@lightsparkdev/core 1.0.18 → 1.0.20

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @lightsparkdev/core
2
2
 
3
+ ## 1.0.20
4
+
5
+ ### Patch Changes
6
+
7
+ - b47bc60: - Add lsidToUUID util
8
+
9
+ ## 1.0.19
10
+
11
+ ### Patch Changes
12
+
13
+ - 330f913: - Ensure tsup properly bundles ESM-only auto-bind and lodash dependencies for CJS support
14
+
3
15
  ## 1.0.18
4
16
 
5
17
  ### Patch Changes
@@ -768,8 +768,83 @@ var deleteLocalStorageItem = (key) => {
768
768
  }
769
769
  };
770
770
 
771
- // src/utils/pollUntil.ts
772
- import { isFunction } from "lodash-es";
771
+ // ../../node_modules/lodash-es/_freeGlobal.js
772
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
773
+ var freeGlobal_default = freeGlobal;
774
+
775
+ // ../../node_modules/lodash-es/_root.js
776
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
777
+ var root = freeGlobal_default || freeSelf || Function("return this")();
778
+ var root_default = root;
779
+
780
+ // ../../node_modules/lodash-es/_Symbol.js
781
+ var Symbol = root_default.Symbol;
782
+ var Symbol_default = Symbol;
783
+
784
+ // ../../node_modules/lodash-es/_getRawTag.js
785
+ var objectProto = Object.prototype;
786
+ var hasOwnProperty = objectProto.hasOwnProperty;
787
+ var nativeObjectToString = objectProto.toString;
788
+ var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
789
+ function getRawTag(value) {
790
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
791
+ try {
792
+ value[symToStringTag] = void 0;
793
+ var unmasked = true;
794
+ } catch (e) {
795
+ }
796
+ var result = nativeObjectToString.call(value);
797
+ if (unmasked) {
798
+ if (isOwn) {
799
+ value[symToStringTag] = tag;
800
+ } else {
801
+ delete value[symToStringTag];
802
+ }
803
+ }
804
+ return result;
805
+ }
806
+ var getRawTag_default = getRawTag;
807
+
808
+ // ../../node_modules/lodash-es/_objectToString.js
809
+ var objectProto2 = Object.prototype;
810
+ var nativeObjectToString2 = objectProto2.toString;
811
+ function objectToString(value) {
812
+ return nativeObjectToString2.call(value);
813
+ }
814
+ var objectToString_default = objectToString;
815
+
816
+ // ../../node_modules/lodash-es/_baseGetTag.js
817
+ var nullTag = "[object Null]";
818
+ var undefinedTag = "[object Undefined]";
819
+ var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
820
+ function baseGetTag(value) {
821
+ if (value == null) {
822
+ return value === void 0 ? undefinedTag : nullTag;
823
+ }
824
+ return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
825
+ }
826
+ var baseGetTag_default = baseGetTag;
827
+
828
+ // ../../node_modules/lodash-es/isObject.js
829
+ function isObject(value) {
830
+ var type = typeof value;
831
+ return value != null && (type == "object" || type == "function");
832
+ }
833
+ var isObject_default = isObject;
834
+
835
+ // ../../node_modules/lodash-es/isFunction.js
836
+ var asyncTag = "[object AsyncFunction]";
837
+ var funcTag = "[object Function]";
838
+ var genTag = "[object GeneratorFunction]";
839
+ var proxyTag = "[object Proxy]";
840
+ function isFunction(value) {
841
+ if (!isObject_default(value)) {
842
+ return false;
843
+ }
844
+ var tag = baseGetTag_default(value);
845
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
846
+ }
847
+ var isFunction_default = isFunction;
773
848
 
774
849
  // src/utils/sleep.ts
775
850
  function sleep(ms) {
@@ -804,7 +879,7 @@ async function pollUntil(asyncFn, getValue, maxPolls = 60, pollIntervalMs = 500,
804
879
  stopPolling = true;
805
880
  }
806
881
  } catch (e) {
807
- if (!ignoreErrors || isFunction(ignoreErrors) && !ignoreErrors(e)) {
882
+ if (!ignoreErrors || isFunction_default(ignoreErrors) && !ignoreErrors(e)) {
808
883
  stopPolling = true;
809
884
  throw e;
810
885
  }
@@ -814,6 +889,16 @@ async function pollUntil(asyncFn, getValue, maxPolls = 60, pollIntervalMs = 500,
814
889
  return result.value;
815
890
  }
816
891
 
892
+ // src/utils/strings.ts
893
+ function lsidToUUID(lsid) {
894
+ return lsid.replace(/^[^:]+:(.*)$/, "$1");
895
+ }
896
+
897
+ // src/utils/typeGuards.ts
898
+ function isUint8Array(variable) {
899
+ return variable instanceof Uint8Array;
900
+ }
901
+
817
902
  // src/utils/types.ts
818
903
  var isType = (typename) => (node) => {
819
904
  return node?.__typename === typename;
@@ -860,5 +945,20 @@ export {
860
945
  deleteLocalStorageItem,
861
946
  sleep,
862
947
  pollUntil,
948
+ lsidToUUID,
949
+ isUint8Array,
863
950
  isType
864
951
  };
952
+ /*! Bundled license information:
953
+
954
+ lodash-es/lodash.js:
955
+ (**
956
+ * @license
957
+ * Lodash (Custom Build) <https://lodash.com/>
958
+ * Build: `lodash modularize exports="es" -o ./`
959
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
960
+ * Released under MIT license <https://lodash.com/license>
961
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
962
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
963
+ *)
964
+ */
@@ -269,4 +269,8 @@ declare function pollUntil<D extends () => Promise<unknown>, T>(asyncFn: D, getV
269
269
 
270
270
  declare function sleep(ms: number): Promise<unknown>;
271
271
 
272
- export { JSONType as $, isErrorMsg as A, errorToJSON as B, ConfigKeys as C, bytesToHex as D, hexToBytes as E, getLocalStorageConfigItem as F, getLocalStorageBoolean as G, setLocalStorageBoolean as H, deleteLocalStorageItem as I, getCurrentLocale as J, countryCodesToCurrencyCodes as K, CurrencyLocales as L, CurrencyCodes as M, localeToCurrencyCode as N, clamp as O, linearInterpolate as P, round as Q, isNumber as R, pollUntil as S, sleep as T, Maybe as U, ExpandRecursively as V, ById as W, OmitTypename as X, isType as Y, DeepPartial as Z, JSONLiteral as _, b64encode as a, JSONObject as a0, NN as a1, b64decode as b, createSha256Hash as c, defaultCurrencyCode as d, CurrencyUnit as e, CurrencyAmountType as f, convertCurrencyAmountValue as g, convertCurrencyAmount as h, CurrencyMap as i, CurrencyAmountObj as j, CurrencyAmountArg as k, isCurrencyAmountObj as l, isCurrencyAmount as m, mapCurrencyAmount as n, isCurrencyMap as o, abbrCurrencyUnit as p, formatCurrencyStr as q, localeToCurrencySymbol as r, separateCurrencyStrParts as s, isBrowser as t, urlsafe_b64decode as u, isNode as v, isTest as w, isError as x, isErrorWithMessage as y, getErrorMsg as z };
272
+ declare function lsidToUUID(lsid: string): string;
273
+
274
+ declare function isUint8Array(variable: unknown): variable is Uint8Array;
275
+
276
+ export { DeepPartial as $, isErrorMsg as A, errorToJSON as B, ConfigKeys as C, bytesToHex as D, hexToBytes as E, getLocalStorageConfigItem as F, getLocalStorageBoolean as G, setLocalStorageBoolean as H, deleteLocalStorageItem as I, getCurrentLocale as J, countryCodesToCurrencyCodes as K, CurrencyLocales as L, CurrencyCodes as M, localeToCurrencyCode as N, clamp as O, linearInterpolate as P, round as Q, isNumber as R, pollUntil as S, sleep as T, lsidToUUID as U, isUint8Array as V, Maybe as W, ExpandRecursively as X, ById as Y, OmitTypename as Z, isType as _, b64encode as a, JSONLiteral as a0, JSONType as a1, JSONObject as a2, NN as a3, b64decode as b, createSha256Hash as c, defaultCurrencyCode as d, CurrencyUnit as e, CurrencyAmountType as f, convertCurrencyAmountValue as g, convertCurrencyAmount as h, CurrencyMap as i, CurrencyAmountObj as j, CurrencyAmountArg as k, isCurrencyAmountObj as l, isCurrencyAmount as m, mapCurrencyAmount as n, isCurrencyMap as o, abbrCurrencyUnit as p, formatCurrencyStr as q, localeToCurrencySymbol as r, separateCurrencyStrParts as s, isBrowser as t, urlsafe_b64decode as u, isNode as v, isTest as w, isError as x, isErrorWithMessage as y, getErrorMsg as z };
package/dist/index.cjs CHANGED
@@ -77,9 +77,11 @@ __export(src_exports, {
77
77
  isNumber: () => isNumber,
78
78
  isTest: () => isTest,
79
79
  isType: () => isType,
80
+ isUint8Array: () => isUint8Array,
80
81
  linearInterpolate: () => linearInterpolate,
81
82
  localeToCurrencyCode: () => localeToCurrencyCode,
82
83
  localeToCurrencySymbol: () => localeToCurrencySymbol,
84
+ lsidToUUID: () => lsidToUUID,
83
85
  mapCurrencyAmount: () => mapCurrencyAmount,
84
86
  pollUntil: () => pollUntil,
85
87
  round: () => round,
@@ -213,8 +215,38 @@ var LightsparkSigningException = class extends LightsparkException_default {
213
215
  };
214
216
  var LightsparkSigningException_default = LightsparkSigningException;
215
217
 
216
- // src/crypto/NodeKeyCache.ts
217
- var import_auto_bind = __toESM(require("auto-bind"), 1);
218
+ // ../../node_modules/auto-bind/index.js
219
+ var getAllProperties = (object) => {
220
+ const properties = /* @__PURE__ */ new Set();
221
+ do {
222
+ for (const key of Reflect.ownKeys(object)) {
223
+ properties.add([object, key]);
224
+ }
225
+ } while ((object = Reflect.getPrototypeOf(object)) && object !== Object.prototype);
226
+ return properties;
227
+ };
228
+ function autoBind(self2, { include, exclude } = {}) {
229
+ const filter = (key) => {
230
+ const match = (pattern) => typeof pattern === "string" ? key === pattern : pattern.test(key);
231
+ if (include) {
232
+ return include.some(match);
233
+ }
234
+ if (exclude) {
235
+ return !exclude.some(match);
236
+ }
237
+ return true;
238
+ };
239
+ for (const [object, key] of getAllProperties(self2.constructor.prototype)) {
240
+ if (key === "constructor" || !filter(key)) {
241
+ continue;
242
+ }
243
+ const descriptor = Reflect.getOwnPropertyDescriptor(object, key);
244
+ if (descriptor && typeof descriptor.value === "function") {
245
+ self2[key] = self2[key].bind(self2);
246
+ }
247
+ }
248
+ return self2;
249
+ }
218
250
 
219
251
  // src/utils/base64.ts
220
252
  var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
@@ -1177,8 +1209,83 @@ var deleteLocalStorageItem = (key) => {
1177
1209
  }
1178
1210
  };
1179
1211
 
1180
- // src/utils/pollUntil.ts
1181
- var import_lodash_es = require("lodash-es");
1212
+ // ../../node_modules/lodash-es/_freeGlobal.js
1213
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
1214
+ var freeGlobal_default = freeGlobal;
1215
+
1216
+ // ../../node_modules/lodash-es/_root.js
1217
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
1218
+ var root = freeGlobal_default || freeSelf || Function("return this")();
1219
+ var root_default = root;
1220
+
1221
+ // ../../node_modules/lodash-es/_Symbol.js
1222
+ var Symbol2 = root_default.Symbol;
1223
+ var Symbol_default = Symbol2;
1224
+
1225
+ // ../../node_modules/lodash-es/_getRawTag.js
1226
+ var objectProto = Object.prototype;
1227
+ var hasOwnProperty = objectProto.hasOwnProperty;
1228
+ var nativeObjectToString = objectProto.toString;
1229
+ var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
1230
+ function getRawTag(value) {
1231
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
1232
+ try {
1233
+ value[symToStringTag] = void 0;
1234
+ var unmasked = true;
1235
+ } catch (e) {
1236
+ }
1237
+ var result = nativeObjectToString.call(value);
1238
+ if (unmasked) {
1239
+ if (isOwn) {
1240
+ value[symToStringTag] = tag;
1241
+ } else {
1242
+ delete value[symToStringTag];
1243
+ }
1244
+ }
1245
+ return result;
1246
+ }
1247
+ var getRawTag_default = getRawTag;
1248
+
1249
+ // ../../node_modules/lodash-es/_objectToString.js
1250
+ var objectProto2 = Object.prototype;
1251
+ var nativeObjectToString2 = objectProto2.toString;
1252
+ function objectToString(value) {
1253
+ return nativeObjectToString2.call(value);
1254
+ }
1255
+ var objectToString_default = objectToString;
1256
+
1257
+ // ../../node_modules/lodash-es/_baseGetTag.js
1258
+ var nullTag = "[object Null]";
1259
+ var undefinedTag = "[object Undefined]";
1260
+ var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
1261
+ function baseGetTag(value) {
1262
+ if (value == null) {
1263
+ return value === void 0 ? undefinedTag : nullTag;
1264
+ }
1265
+ return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
1266
+ }
1267
+ var baseGetTag_default = baseGetTag;
1268
+
1269
+ // ../../node_modules/lodash-es/isObject.js
1270
+ function isObject(value) {
1271
+ var type = typeof value;
1272
+ return value != null && (type == "object" || type == "function");
1273
+ }
1274
+ var isObject_default = isObject;
1275
+
1276
+ // ../../node_modules/lodash-es/isFunction.js
1277
+ var asyncTag = "[object AsyncFunction]";
1278
+ var funcTag = "[object Function]";
1279
+ var genTag = "[object GeneratorFunction]";
1280
+ var proxyTag = "[object Proxy]";
1281
+ function isFunction(value) {
1282
+ if (!isObject_default(value)) {
1283
+ return false;
1284
+ }
1285
+ var tag = baseGetTag_default(value);
1286
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1287
+ }
1288
+ var isFunction_default = isFunction;
1182
1289
 
1183
1290
  // src/utils/sleep.ts
1184
1291
  function sleep(ms) {
@@ -1213,7 +1320,7 @@ async function pollUntil(asyncFn, getValue, maxPolls = 60, pollIntervalMs = 500,
1213
1320
  stopPolling = true;
1214
1321
  }
1215
1322
  } catch (e) {
1216
- if (!ignoreErrors || (0, import_lodash_es.isFunction)(ignoreErrors) && !ignoreErrors(e)) {
1323
+ if (!ignoreErrors || isFunction_default(ignoreErrors) && !ignoreErrors(e)) {
1217
1324
  stopPolling = true;
1218
1325
  throw e;
1219
1326
  }
@@ -1223,6 +1330,16 @@ async function pollUntil(asyncFn, getValue, maxPolls = 60, pollIntervalMs = 500,
1223
1330
  return result.value;
1224
1331
  }
1225
1332
 
1333
+ // src/utils/strings.ts
1334
+ function lsidToUUID(lsid) {
1335
+ return lsid.replace(/^[^:]+:(.*)$/, "$1");
1336
+ }
1337
+
1338
+ // src/utils/typeGuards.ts
1339
+ function isUint8Array(variable) {
1340
+ return variable instanceof Uint8Array;
1341
+ }
1342
+
1226
1343
  // src/utils/types.ts
1227
1344
  var isType = (typename) => (node) => {
1228
1345
  return node?.__typename === typename;
@@ -1274,7 +1391,7 @@ var NodeKeyCache = class {
1274
1391
  constructor(cryptoImpl = DefaultCrypto) {
1275
1392
  this.cryptoImpl = cryptoImpl;
1276
1393
  this.idToKey = /* @__PURE__ */ new Map();
1277
- (0, import_auto_bind.default)(this);
1394
+ autoBind(this);
1278
1395
  }
1279
1396
  idToKey;
1280
1397
  async loadKey(id, keyOrAlias, signingKeyType) {
@@ -1324,7 +1441,6 @@ var NodeKeyCache = class {
1324
1441
  var NodeKeyCache_default = NodeKeyCache;
1325
1442
 
1326
1443
  // src/requester/Requester.ts
1327
- var import_auto_bind2 = __toESM(require("auto-bind"), 1);
1328
1444
  var import_dayjs = __toESM(require("dayjs"), 1);
1329
1445
  var import_utc = __toESM(require("dayjs/plugin/utc.js"), 1);
1330
1446
  var import_graphql_ws = require("graphql-ws");
@@ -1353,7 +1469,7 @@ var Requester = class {
1353
1469
  connectionParams: () => authProvider.addWsConnectionParams({}),
1354
1470
  webSocketImpl: websocketImpl
1355
1471
  });
1356
- (0, import_auto_bind2.default)(this);
1472
+ autoBind(this);
1357
1473
  }
1358
1474
  wsClient;
1359
1475
  async executeQuery(query) {
@@ -1566,9 +1682,11 @@ var Requester_default = Requester;
1566
1682
  isNumber,
1567
1683
  isTest,
1568
1684
  isType,
1685
+ isUint8Array,
1569
1686
  linearInterpolate,
1570
1687
  localeToCurrencyCode,
1571
1688
  localeToCurrencySymbol,
1689
+ lsidToUUID,
1572
1690
  mapCurrencyAmount,
1573
1691
  pollUntil,
1574
1692
  round,
@@ -1577,3 +1695,16 @@ var Requester_default = Requester;
1577
1695
  sleep,
1578
1696
  urlsafe_b64decode
1579
1697
  });
1698
+ /*! Bundled license information:
1699
+
1700
+ lodash-es/lodash.js:
1701
+ (**
1702
+ * @license
1703
+ * Lodash (Custom Build) <https://lodash.com/>
1704
+ * Build: `lodash modularize exports="es" -o ./`
1705
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
1706
+ * Released under MIT license <https://lodash.com/license>
1707
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
1708
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
1709
+ *)
1710
+ */
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { W as ById, C as ConfigKeys, k as CurrencyAmountArg, j as CurrencyAmountObj, f as CurrencyAmountType, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, Z as DeepPartial, V as ExpandRecursively, _ as JSONLiteral, a0 as JSONObject, $ as JSONType, U as Maybe, a1 as NN, X as OmitTypename, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, m as isCurrencyAmount, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, w as isTest, Y as isType, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, n as mapCurrencyAmount, S as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, T as sleep, u as urlsafe_b64decode } from './index-2708d41b.js';
1
+ export { Y as ById, C as ConfigKeys, k as CurrencyAmountArg, j as CurrencyAmountObj, f as CurrencyAmountType, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, $ as DeepPartial, X as ExpandRecursively, a0 as JSONLiteral, a2 as JSONObject, a1 as JSONType, W as Maybe, a3 as NN, Z as OmitTypename, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, m as isCurrencyAmount, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, w as isTest, _ as isType, V as isUint8Array, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, U as lsidToUUID, n as mapCurrencyAmount, S as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, T as sleep, u as urlsafe_b64decode } from './index-324f8ba4.js';
2
2
  import { Observable } from 'zen-observable-ts';
3
3
 
4
4
  declare class LightsparkException extends Error {
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { W as ById, C as ConfigKeys, k as CurrencyAmountArg, j as CurrencyAmountObj, f as CurrencyAmountType, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, Z as DeepPartial, V as ExpandRecursively, _ as JSONLiteral, a0 as JSONObject, $ as JSONType, U as Maybe, a1 as NN, X as OmitTypename, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, m as isCurrencyAmount, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, w as isTest, Y as isType, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, n as mapCurrencyAmount, S as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, T as sleep, u as urlsafe_b64decode } from './index-2708d41b.js';
1
+ export { Y as ById, C as ConfigKeys, k as CurrencyAmountArg, j as CurrencyAmountObj, f as CurrencyAmountType, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, $ as DeepPartial, X as ExpandRecursively, a0 as JSONLiteral, a2 as JSONObject, a1 as JSONType, W as Maybe, a3 as NN, Z as OmitTypename, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, m as isCurrencyAmount, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, w as isTest, _ as isType, V as isUint8Array, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, U as lsidToUUID, n as mapCurrencyAmount, S as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, T as sleep, u as urlsafe_b64decode } from './index-324f8ba4.js';
2
2
  import { Observable } from 'zen-observable-ts';
3
3
 
4
4
  declare class LightsparkException extends Error {
package/dist/index.js CHANGED
@@ -30,9 +30,11 @@ import {
30
30
  isNumber,
31
31
  isTest,
32
32
  isType,
33
+ isUint8Array,
33
34
  linearInterpolate,
34
35
  localeToCurrencyCode,
35
36
  localeToCurrencySymbol,
37
+ lsidToUUID,
36
38
  mapCurrencyAmount,
37
39
  pollUntil,
38
40
  round,
@@ -40,7 +42,7 @@ import {
40
42
  setLocalStorageBoolean,
41
43
  sleep,
42
44
  urlsafe_b64decode
43
- } from "./chunk-XPHRCMJA.js";
45
+ } from "./chunk-ZPGGNCAE.js";
44
46
 
45
47
  // src/Logger.ts
46
48
  var LoggingLevel = /* @__PURE__ */ ((LoggingLevel2) => {
@@ -146,8 +148,38 @@ var LightsparkSigningException = class extends LightsparkException_default {
146
148
  };
147
149
  var LightsparkSigningException_default = LightsparkSigningException;
148
150
 
149
- // src/crypto/NodeKeyCache.ts
150
- import autoBind from "auto-bind";
151
+ // ../../node_modules/auto-bind/index.js
152
+ var getAllProperties = (object) => {
153
+ const properties = /* @__PURE__ */ new Set();
154
+ do {
155
+ for (const key of Reflect.ownKeys(object)) {
156
+ properties.add([object, key]);
157
+ }
158
+ } while ((object = Reflect.getPrototypeOf(object)) && object !== Object.prototype);
159
+ return properties;
160
+ };
161
+ function autoBind(self, { include, exclude } = {}) {
162
+ const filter = (key) => {
163
+ const match = (pattern) => typeof pattern === "string" ? key === pattern : pattern.test(key);
164
+ if (include) {
165
+ return include.some(match);
166
+ }
167
+ if (exclude) {
168
+ return !exclude.some(match);
169
+ }
170
+ return true;
171
+ };
172
+ for (const [object, key] of getAllProperties(self.constructor.prototype)) {
173
+ if (key === "constructor" || !filter(key)) {
174
+ continue;
175
+ }
176
+ const descriptor = Reflect.getOwnPropertyDescriptor(object, key);
177
+ if (descriptor && typeof descriptor.value === "function") {
178
+ self[key] = self[key].bind(self);
179
+ }
180
+ }
181
+ return self;
182
+ }
151
183
 
152
184
  // src/crypto/crypto.ts
153
185
  var getCrypto = () => {
@@ -453,7 +485,6 @@ var NodeKeyCache = class {
453
485
  var NodeKeyCache_default = NodeKeyCache;
454
486
 
455
487
  // src/requester/Requester.ts
456
- import autoBind2 from "auto-bind";
457
488
  import dayjs from "dayjs";
458
489
  import utc from "dayjs/plugin/utc.js";
459
490
  import { createClient } from "graphql-ws";
@@ -482,7 +513,7 @@ var Requester = class {
482
513
  connectionParams: () => authProvider.addWsConnectionParams({}),
483
514
  webSocketImpl: websocketImpl
484
515
  });
485
- autoBind2(this);
516
+ autoBind(this);
486
517
  }
487
518
  wsClient;
488
519
  async executeQuery(query) {
@@ -694,9 +725,11 @@ export {
694
725
  isNumber,
695
726
  isTest,
696
727
  isType,
728
+ isUint8Array,
697
729
  linearInterpolate,
698
730
  localeToCurrencyCode,
699
731
  localeToCurrencySymbol,
732
+ lsidToUUID,
700
733
  mapCurrencyAmount,
701
734
  pollUntil,
702
735
  round,
@@ -60,9 +60,11 @@ __export(utils_exports, {
60
60
  isNumber: () => isNumber,
61
61
  isTest: () => isTest,
62
62
  isType: () => isType,
63
+ isUint8Array: () => isUint8Array,
63
64
  linearInterpolate: () => linearInterpolate,
64
65
  localeToCurrencyCode: () => localeToCurrencyCode,
65
66
  localeToCurrencySymbol: () => localeToCurrencySymbol,
67
+ lsidToUUID: () => lsidToUUID,
66
68
  mapCurrencyAmount: () => mapCurrencyAmount,
67
69
  pollUntil: () => pollUntil,
68
70
  round: () => round,
@@ -843,8 +845,83 @@ var deleteLocalStorageItem = (key) => {
843
845
  }
844
846
  };
845
847
 
846
- // src/utils/pollUntil.ts
847
- var import_lodash_es = require("lodash-es");
848
+ // ../../node_modules/lodash-es/_freeGlobal.js
849
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
850
+ var freeGlobal_default = freeGlobal;
851
+
852
+ // ../../node_modules/lodash-es/_root.js
853
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
854
+ var root = freeGlobal_default || freeSelf || Function("return this")();
855
+ var root_default = root;
856
+
857
+ // ../../node_modules/lodash-es/_Symbol.js
858
+ var Symbol2 = root_default.Symbol;
859
+ var Symbol_default = Symbol2;
860
+
861
+ // ../../node_modules/lodash-es/_getRawTag.js
862
+ var objectProto = Object.prototype;
863
+ var hasOwnProperty = objectProto.hasOwnProperty;
864
+ var nativeObjectToString = objectProto.toString;
865
+ var symToStringTag = Symbol_default ? Symbol_default.toStringTag : void 0;
866
+ function getRawTag(value) {
867
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
868
+ try {
869
+ value[symToStringTag] = void 0;
870
+ var unmasked = true;
871
+ } catch (e) {
872
+ }
873
+ var result = nativeObjectToString.call(value);
874
+ if (unmasked) {
875
+ if (isOwn) {
876
+ value[symToStringTag] = tag;
877
+ } else {
878
+ delete value[symToStringTag];
879
+ }
880
+ }
881
+ return result;
882
+ }
883
+ var getRawTag_default = getRawTag;
884
+
885
+ // ../../node_modules/lodash-es/_objectToString.js
886
+ var objectProto2 = Object.prototype;
887
+ var nativeObjectToString2 = objectProto2.toString;
888
+ function objectToString(value) {
889
+ return nativeObjectToString2.call(value);
890
+ }
891
+ var objectToString_default = objectToString;
892
+
893
+ // ../../node_modules/lodash-es/_baseGetTag.js
894
+ var nullTag = "[object Null]";
895
+ var undefinedTag = "[object Undefined]";
896
+ var symToStringTag2 = Symbol_default ? Symbol_default.toStringTag : void 0;
897
+ function baseGetTag(value) {
898
+ if (value == null) {
899
+ return value === void 0 ? undefinedTag : nullTag;
900
+ }
901
+ return symToStringTag2 && symToStringTag2 in Object(value) ? getRawTag_default(value) : objectToString_default(value);
902
+ }
903
+ var baseGetTag_default = baseGetTag;
904
+
905
+ // ../../node_modules/lodash-es/isObject.js
906
+ function isObject(value) {
907
+ var type = typeof value;
908
+ return value != null && (type == "object" || type == "function");
909
+ }
910
+ var isObject_default = isObject;
911
+
912
+ // ../../node_modules/lodash-es/isFunction.js
913
+ var asyncTag = "[object AsyncFunction]";
914
+ var funcTag = "[object Function]";
915
+ var genTag = "[object GeneratorFunction]";
916
+ var proxyTag = "[object Proxy]";
917
+ function isFunction(value) {
918
+ if (!isObject_default(value)) {
919
+ return false;
920
+ }
921
+ var tag = baseGetTag_default(value);
922
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
923
+ }
924
+ var isFunction_default = isFunction;
848
925
 
849
926
  // src/utils/sleep.ts
850
927
  function sleep(ms) {
@@ -879,7 +956,7 @@ async function pollUntil(asyncFn, getValue, maxPolls = 60, pollIntervalMs = 500,
879
956
  stopPolling = true;
880
957
  }
881
958
  } catch (e) {
882
- if (!ignoreErrors || (0, import_lodash_es.isFunction)(ignoreErrors) && !ignoreErrors(e)) {
959
+ if (!ignoreErrors || isFunction_default(ignoreErrors) && !ignoreErrors(e)) {
883
960
  stopPolling = true;
884
961
  throw e;
885
962
  }
@@ -889,6 +966,16 @@ async function pollUntil(asyncFn, getValue, maxPolls = 60, pollIntervalMs = 500,
889
966
  return result.value;
890
967
  }
891
968
 
969
+ // src/utils/strings.ts
970
+ function lsidToUUID(lsid) {
971
+ return lsid.replace(/^[^:]+:(.*)$/, "$1");
972
+ }
973
+
974
+ // src/utils/typeGuards.ts
975
+ function isUint8Array(variable) {
976
+ return variable instanceof Uint8Array;
977
+ }
978
+
892
979
  // src/utils/types.ts
893
980
  var isType = (typename) => (node) => {
894
981
  return node?.__typename === typename;
@@ -925,9 +1012,11 @@ var isType = (typename) => (node) => {
925
1012
  isNumber,
926
1013
  isTest,
927
1014
  isType,
1015
+ isUint8Array,
928
1016
  linearInterpolate,
929
1017
  localeToCurrencyCode,
930
1018
  localeToCurrencySymbol,
1019
+ lsidToUUID,
931
1020
  mapCurrencyAmount,
932
1021
  pollUntil,
933
1022
  round,
@@ -936,3 +1025,16 @@ var isType = (typename) => (node) => {
936
1025
  sleep,
937
1026
  urlsafe_b64decode
938
1027
  });
1028
+ /*! Bundled license information:
1029
+
1030
+ lodash-es/lodash.js:
1031
+ (**
1032
+ * @license
1033
+ * Lodash (Custom Build) <https://lodash.com/>
1034
+ * Build: `lodash modularize exports="es" -o ./`
1035
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
1036
+ * Released under MIT license <https://lodash.com/license>
1037
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
1038
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
1039
+ *)
1040
+ */
@@ -1 +1 @@
1
- export { W as ById, k as CurrencyAmountArg, j as CurrencyAmountObj, f as CurrencyAmountType, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, Z as DeepPartial, V as ExpandRecursively, _ as JSONLiteral, a0 as JSONObject, $ as JSONType, U as Maybe, a1 as NN, X as OmitTypename, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, m as isCurrencyAmount, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, w as isTest, Y as isType, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, n as mapCurrencyAmount, S as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, T as sleep, u as urlsafe_b64decode } from '../index-2708d41b.js';
1
+ export { Y as ById, k as CurrencyAmountArg, j as CurrencyAmountObj, f as CurrencyAmountType, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, $ as DeepPartial, X as ExpandRecursively, a0 as JSONLiteral, a2 as JSONObject, a1 as JSONType, W as Maybe, a3 as NN, Z as OmitTypename, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, m as isCurrencyAmount, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, w as isTest, _ as isType, V as isUint8Array, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, U as lsidToUUID, n as mapCurrencyAmount, S as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, T as sleep, u as urlsafe_b64decode } from '../index-324f8ba4.js';
@@ -1 +1 @@
1
- export { W as ById, k as CurrencyAmountArg, j as CurrencyAmountObj, f as CurrencyAmountType, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, Z as DeepPartial, V as ExpandRecursively, _ as JSONLiteral, a0 as JSONObject, $ as JSONType, U as Maybe, a1 as NN, X as OmitTypename, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, m as isCurrencyAmount, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, w as isTest, Y as isType, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, n as mapCurrencyAmount, S as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, T as sleep, u as urlsafe_b64decode } from '../index-2708d41b.js';
1
+ export { Y as ById, k as CurrencyAmountArg, j as CurrencyAmountObj, f as CurrencyAmountType, M as CurrencyCodes, L as CurrencyLocales, i as CurrencyMap, e as CurrencyUnit, $ as DeepPartial, X as ExpandRecursively, a0 as JSONLiteral, a2 as JSONObject, a1 as JSONType, W as Maybe, a3 as NN, Z as OmitTypename, p as abbrCurrencyUnit, b as b64decode, a as b64encode, D as bytesToHex, O as clamp, h as convertCurrencyAmount, g as convertCurrencyAmountValue, K as countryCodesToCurrencyCodes, c as createSha256Hash, d as defaultCurrencyCode, I as deleteLocalStorageItem, B as errorToJSON, q as formatCurrencyStr, J as getCurrentLocale, z as getErrorMsg, G as getLocalStorageBoolean, F as getLocalStorageConfigItem, E as hexToBytes, t as isBrowser, m as isCurrencyAmount, l as isCurrencyAmountObj, o as isCurrencyMap, x as isError, A as isErrorMsg, y as isErrorWithMessage, v as isNode, R as isNumber, w as isTest, _ as isType, V as isUint8Array, P as linearInterpolate, N as localeToCurrencyCode, r as localeToCurrencySymbol, U as lsidToUUID, n as mapCurrencyAmount, S as pollUntil, Q as round, s as separateCurrencyStrParts, H as setLocalStorageBoolean, T as sleep, u as urlsafe_b64decode } from '../index-324f8ba4.js';
@@ -29,9 +29,11 @@ import {
29
29
  isNumber,
30
30
  isTest,
31
31
  isType,
32
+ isUint8Array,
32
33
  linearInterpolate,
33
34
  localeToCurrencyCode,
34
35
  localeToCurrencySymbol,
36
+ lsidToUUID,
35
37
  mapCurrencyAmount,
36
38
  pollUntil,
37
39
  round,
@@ -39,7 +41,7 @@ import {
39
41
  setLocalStorageBoolean,
40
42
  sleep,
41
43
  urlsafe_b64decode
42
- } from "../chunk-XPHRCMJA.js";
44
+ } from "../chunk-ZPGGNCAE.js";
43
45
  export {
44
46
  CurrencyUnit,
45
47
  abbrCurrencyUnit,
@@ -71,9 +73,11 @@ export {
71
73
  isNumber,
72
74
  isTest,
73
75
  isType,
76
+ isUint8Array,
74
77
  linearInterpolate,
75
78
  localeToCurrencyCode,
76
79
  localeToCurrencySymbol,
80
+ lsidToUUID,
77
81
  mapCurrencyAmount,
78
82
  pollUntil,
79
83
  round,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightsparkdev/core",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Lightspark JS SDK",
5
5
  "author": "Lightspark Inc.",
6
6
  "keywords": [
@@ -73,12 +73,10 @@
73
73
  },
74
74
  "license": "Apache-2.0",
75
75
  "dependencies": {
76
- "auto-bind": "^5.0.1",
77
76
  "crypto-browserify": "^3.12.0",
78
77
  "dayjs": "^1.11.7",
79
78
  "graphql": "^16.6.0",
80
79
  "graphql-ws": "^5.11.3",
81
- "lodash-es": "^4.17.21",
82
80
  "secp256k1": "^5.0.0",
83
81
  "text-encoding": "^0.7.0",
84
82
  "ws": "^8.12.1",
@@ -93,9 +91,11 @@
93
91
  "@types/secp256k1": "^4.0.3",
94
92
  "@types/text-encoding": "^0.0.36",
95
93
  "@types/ws": "^8.5.4",
94
+ "auto-bind": "^5.0.1",
96
95
  "eslint": "^8.3.0",
97
96
  "eslint-watch": "^8.0.0",
98
97
  "jest": "^29.6.2",
98
+ "lodash-es": "^4.17.21",
99
99
  "prettier": "3.0.3",
100
100
  "prettier-plugin-organize-imports": "^3.2.4",
101
101
  "ts-jest": "^29.1.1",
@@ -12,4 +12,6 @@ export * from "./localeToCurrencyCodes.js";
12
12
  export * from "./numbers.js";
13
13
  export * from "./pollUntil.js";
14
14
  export * from "./sleep.js";
15
+ export * from "./strings.js";
16
+ export * from "./typeGuards.js";
15
17
  export * from "./types.js";
@@ -0,0 +1,3 @@
1
+ export function lsidToUUID(lsid: string) {
2
+ return lsid.replace(/^[^:]+:(.*)$/, "$1");
3
+ }
@@ -0,0 +1,3 @@
1
+ export function isUint8Array(variable: unknown): variable is Uint8Array {
2
+ return variable instanceof Uint8Array;
3
+ }