@ecency/sdk 1.1.8 → 1.1.10

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.
Files changed (2) hide show
  1. package/dist/ecency-sdk.es.js +104 -98
  2. package/package.json +1 -1
@@ -3,8 +3,8 @@ var W = (e, t, n) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writab
3
3
  var K = (e, t, n) => W(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { QueryClient as A, useMutation as d, useQuery as j, useInfiniteQuery as z, queryOptions as p, useQueryClient as U, infiniteQueryOptions as $ } from "@tanstack/react-query";
5
5
  import { Client as R, PrivateKey as v, cryptoUtils as X, RCAPI as Y } from "@hiveio/dhive";
6
- import m from "hivesigner";
7
- import * as C from "remeda";
6
+ import b from "hivesigner";
7
+ import * as m from "remeda";
8
8
  class Z {
9
9
  constructor() {
10
10
  K(this, "length", 0);
@@ -93,7 +93,7 @@ const _ = (e) => {
93
93
  console.error(t);
94
94
  return;
95
95
  }
96
- }, y = (e) => _(e) && _(e).accessToken, P = (e) => _(e) && _(e).postingKey, E = (e) => _(e) && _(e).loginType, he = (e) => _(e) && _(e).refreshToken;
96
+ }, y = (e) => _(e) && _(e).accessToken, P = (e) => _(e) && _(e).postingKey, E = (e) => _(e) && _(e).loginType, fe = (e) => _(e) && _(e).refreshToken;
97
97
  function ee() {
98
98
  return new Promise((e) => {
99
99
  var t;
@@ -102,7 +102,7 @@ function ee() {
102
102
  });
103
103
  });
104
104
  }
105
- const b = (e, t, n, o = null) => new Promise((r, c) => {
105
+ const C = (e, t, n, o = null) => new Promise((r, c) => {
106
106
  var s;
107
107
  (s = window.hive_keychain) == null || s.requestBroadcast(
108
108
  e,
@@ -126,9 +126,9 @@ const b = (e, t, n, o = null) => new Promise((r, c) => {
126
126
  },
127
127
  c
128
128
  );
129
- }), fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
129
+ }), ge = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
130
130
  __proto__: null,
131
- broadcast: b,
131
+ broadcast: C,
132
132
  customJson: te,
133
133
  handshake: ee
134
134
  }, Symbol.toStringTag, { value: "Module" }));
@@ -152,14 +152,14 @@ function ne(e = [], t, n, o = () => {
152
152
  }
153
153
  const s = E(t);
154
154
  if (s && s == "keychain")
155
- return b(
155
+ return C(
156
156
  t,
157
157
  n(r),
158
158
  "Posting"
159
159
  ).then((l) => l.result);
160
160
  let a = y(t);
161
161
  if (a)
162
- return (await new m.Client({
162
+ return (await new b.Client({
163
163
  accessToken: a
164
164
  }).broadcast(n(r))).result;
165
165
  throw new Error(
@@ -188,17 +188,17 @@ async function oe(e, t, n) {
188
188
  }
189
189
  const c = E(e);
190
190
  if (c && c == "keychain")
191
- return b(e, [["custom_json", o]], "Posting").then((a) => a.result);
191
+ return C(e, [["custom_json", o]], "Posting").then((a) => a.result);
192
192
  let s = y(e);
193
193
  if (s)
194
- return (await new m.Client({
194
+ return (await new b.Client({
195
195
  accessToken: s
196
196
  }).customJson([], [e], t, JSON.stringify(n))).result;
197
197
  throw new Error(
198
198
  "[SDK][Broadcast] – cannot broadcast w/o posting key or token"
199
199
  );
200
200
  }
201
- function ge() {
201
+ function _e() {
202
202
  return new A({
203
203
  defaultOptions: {
204
204
  queries: {
@@ -249,7 +249,7 @@ var q;
249
249
  }
250
250
  e.generateClientServerInfiniteQuery = s;
251
251
  })(q || (q = {}));
252
- function _e() {
252
+ function ve() {
253
253
  return p({
254
254
  queryKey: ["core", "dynamic-props"],
255
255
  refetchInterval: 6e4,
@@ -367,7 +367,7 @@ function T(e) {
367
367
  staleTime: 6e4
368
368
  });
369
369
  }
370
- function ve(e, t = 5, n = []) {
370
+ function we(e, t = 5, n = []) {
371
371
  return p({
372
372
  queryKey: ["accounts", "search", e, n],
373
373
  enabled: !!e,
@@ -379,7 +379,7 @@ function ve(e, t = 5, n = []) {
379
379
  )
380
380
  });
381
381
  }
382
- function we(e) {
382
+ function me(e) {
383
383
  return p({
384
384
  queryKey: ["accounts", "check-wallet-pending", e],
385
385
  queryFn: async () => await (await fetch(
@@ -411,7 +411,7 @@ function re(e, t) {
411
411
  )
412
412
  });
413
413
  }
414
- function me(e) {
414
+ function be(e) {
415
415
  return p({
416
416
  queryKey: ["accounts", "subscriptions", e],
417
417
  enabled: !!e,
@@ -424,7 +424,7 @@ function me(e) {
424
424
  ) ?? []
425
425
  });
426
426
  }
427
- function be(e) {
427
+ function Ce(e) {
428
428
  return p({
429
429
  queryKey: ["accounts", "bookmarks", e],
430
430
  enabled: !!e,
@@ -444,7 +444,7 @@ function be(e) {
444
444
  }
445
445
  });
446
446
  }
447
- function Ce(e) {
447
+ function Se(e) {
448
448
  return p({
449
449
  queryKey: ["accounts", "favourites", e],
450
450
  enabled: !!e,
@@ -464,18 +464,24 @@ function Ce(e) {
464
464
  }
465
465
  });
466
466
  }
467
+ function ie(e) {
468
+ return e == null ? void 0 : e.map(({ meta: t, ...n }) => ({
469
+ ...n,
470
+ meta: m.omit(t, ["privateKey"])
471
+ }));
472
+ }
467
473
  function Q({
468
474
  profile: e,
469
475
  tokens: t,
470
476
  data: n
471
477
  }) {
472
- const o = C.pipe(
478
+ const o = m.pipe(
473
479
  JSON.parse((n == null ? void 0 : n.posting_json_metadata) || "{}"),
474
- C.mergeDeep(e ?? {})
480
+ m.mergeDeep(e ?? {})
475
481
  );
476
- return t && t.length > 0 && (o.tokens = t), o;
482
+ return t && t.length > 0 && (o.tokens = t), o.tokens = ie(o.tokens), o;
477
483
  }
478
- function Se(e) {
484
+ function Oe(e) {
479
485
  const t = U(), { data: n } = j(T(e));
480
486
  return ne(
481
487
  ["accounts", "update", n == null ? void 0 : n.name],
@@ -502,13 +508,13 @@ function Se(e) {
502
508
  (c) => {
503
509
  if (!c)
504
510
  return c;
505
- const s = C.clone(c);
511
+ const s = m.clone(c);
506
512
  return s.profile = Q({ ...r, data: c }), s;
507
513
  }
508
514
  )
509
515
  );
510
516
  }
511
- function Oe(e, t, n, o) {
517
+ function Ke(e, t, n, o) {
512
518
  return d({
513
519
  mutationKey: [],
514
520
  mutationFn: async (r) => {
@@ -545,7 +551,7 @@ function Oe(e, t, n, o) {
545
551
  }
546
552
  });
547
553
  }
548
- function Ke(e, t, n) {
554
+ function ke(e, t, n) {
549
555
  return d({
550
556
  mutationKey: ["accounts", "bookmarks", "add", e],
551
557
  mutationFn: async ({ author: o, permlink: r }) => {
@@ -574,7 +580,7 @@ function Ke(e, t, n) {
574
580
  onError: n
575
581
  });
576
582
  }
577
- function ke(e, t, n) {
583
+ function qe(e, t, n) {
578
584
  return d({
579
585
  mutationKey: ["accounts", "bookmarks", "delete", e],
580
586
  mutationFn: async (o) => {
@@ -602,7 +608,7 @@ function ke(e, t, n) {
602
608
  onError: n
603
609
  });
604
610
  }
605
- function qe(e, t, n) {
611
+ function Te(e, t, n) {
606
612
  return d({
607
613
  mutationKey: ["accounts", "favourites", "add", e],
608
614
  mutationFn: async (o) => {
@@ -630,7 +636,7 @@ function qe(e, t, n) {
630
636
  onError: n
631
637
  });
632
638
  }
633
- function Te(e, t, n) {
639
+ function Qe(e, t, n) {
634
640
  return d({
635
641
  mutationKey: ["accounts", "favourites", "add", e],
636
642
  mutationFn: async (o) => {
@@ -658,7 +664,7 @@ function Te(e, t, n) {
658
664
  onError: n
659
665
  });
660
666
  }
661
- function Qe(e) {
667
+ function Ae(e) {
662
668
  return d({
663
669
  mutationKey: ["operations", "sign", e],
664
670
  mutationFn: ({
@@ -675,7 +681,7 @@ function Qe(e) {
675
681
  }
676
682
  });
677
683
  }
678
- function Ae(e, t = "Active") {
684
+ function je(e, t = "Active") {
679
685
  return d({
680
686
  mutationKey: ["operations", "sign-keychain", e],
681
687
  mutationFn: ({ operation: n }) => {
@@ -683,24 +689,24 @@ function Ae(e, t = "Active") {
683
689
  throw new Error(
684
690
  "[SDK][Keychain] – cannot sign operation with anon user"
685
691
  );
686
- return b(e, [n], t);
692
+ return C(e, [n], t);
687
693
  }
688
694
  });
689
695
  }
690
- function je(e = "/") {
696
+ function De(e = "/") {
691
697
  return d({
692
698
  mutationKey: ["operations", "sign-hivesigner", e],
693
- mutationFn: async ({ operation: t }) => m.sendOperation(t, { callback: e }, () => {
699
+ mutationFn: async ({ operation: t }) => b.sendOperation(t, { callback: e }, () => {
694
700
  })
695
701
  });
696
702
  }
697
- function De() {
703
+ function Fe() {
698
704
  return p({
699
705
  queryKey: ["operations", "chain-properties"],
700
706
  queryFn: async () => await i.hiveClient.database.getChainProperties()
701
707
  });
702
708
  }
703
- function Fe(e = 20) {
709
+ function Pe(e = 20) {
704
710
  return $({
705
711
  queryKey: ["posts", "trending-tags"],
706
712
  queryFn: async ({ pageParam: { afterTag: t } }) => i.hiveClient.database.call("get_trending_tags", [t, e]).then(
@@ -732,7 +738,7 @@ function O(e) {
732
738
  enabled: !!e
733
739
  });
734
740
  }
735
- function Pe(e = "feed") {
741
+ function Ee(e = "feed") {
736
742
  return p({
737
743
  queryKey: ["posts", "promoted", e],
738
744
  queryFn: async () => {
@@ -748,7 +754,7 @@ function Pe(e = "feed") {
748
754
  }
749
755
  });
750
756
  }
751
- function Ee(e) {
757
+ function Be(e) {
752
758
  return d({
753
759
  mutationKey: ["posts", "add-fragment", e],
754
760
  mutationFn: async ({ title: t, body: n }) => (await fetch(
@@ -773,7 +779,7 @@ function Ee(e) {
773
779
  }
774
780
  });
775
781
  }
776
- function Be(e, t) {
782
+ function He(e, t) {
777
783
  return d({
778
784
  mutationKey: ["posts", "edit-fragment", e, t],
779
785
  mutationFn: async ({ title: n, body: o }) => (await fetch(
@@ -804,7 +810,7 @@ function Be(e, t) {
804
810
  }
805
811
  });
806
812
  }
807
- function He(e, t) {
813
+ function Ie(e, t) {
808
814
  return d({
809
815
  mutationKey: ["posts", "remove-fragment", e],
810
816
  mutationFn: async () => fetch(i.privateApiHost + "/private-api/fragments-delete", {
@@ -848,27 +854,27 @@ function B(e, t) {
848
854
  }
849
855
  });
850
856
  }
851
- const Ie = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
857
+ const Me = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
852
858
  __proto__: null,
853
859
  useRecordActivity: B
854
860
  }, Symbol.toStringTag, { value: "Module" }));
855
- function ie(e, t) {
861
+ function se(e, t) {
856
862
  return p({
857
863
  queryKey: ["integrations", "hivesigner", "decode-memo", e],
858
864
  queryFn: async () => {
859
865
  const n = y(e);
860
866
  if (n)
861
- return new m.Client({
867
+ return new b.Client({
862
868
  accessToken: n
863
869
  }).decode(t);
864
870
  }
865
871
  });
866
872
  }
867
- const se = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
873
+ const ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
868
874
  __proto__: null,
869
- getDecodeMemoQueryOptions: ie
870
- }, Symbol.toStringTag, { value: "Module" })), ae = {
871
- queries: se
875
+ getDecodeMemoQueryOptions: se
876
+ }, Symbol.toStringTag, { value: "Module" })), ce = {
877
+ queries: ae
872
878
  };
873
879
  function S(e) {
874
880
  return p({
@@ -884,7 +890,7 @@ function S(e) {
884
890
  "Content-Type": "application/json"
885
891
  }
886
892
  }
887
- ), n = ae.queries.getDecodeMemoQueryOptions(
893
+ ), n = ce.queries.getDecodeMemoQueryOptions(
888
894
  e,
889
895
  (await t.json()).memo
890
896
  );
@@ -896,7 +902,7 @@ function S(e) {
896
902
  }
897
903
  });
898
904
  }
899
- function ce(e) {
905
+ function ue(e) {
900
906
  return p({
901
907
  queryKey: ["integrations", "3speak", "videos", e],
902
908
  enabled: !!e,
@@ -919,14 +925,14 @@ function ce(e) {
919
925
  }
920
926
  });
921
927
  }
922
- const ue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
928
+ const pe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
923
929
  __proto__: null,
924
930
  getAccountTokenQueryOptions: S,
925
- getAccountVideosQueryOptions: ce
926
- }, Symbol.toStringTag, { value: "Module" })), Me = {
927
- queries: ue
931
+ getAccountVideosQueryOptions: ue
932
+ }, Symbol.toStringTag, { value: "Module" })), Je = {
933
+ queries: pe
928
934
  };
929
- function Je(e) {
935
+ function Ne(e) {
930
936
  return p({
931
937
  queryKey: ["integrations", "hiveposh", "links", e],
932
938
  queryFn: async () => {
@@ -951,7 +957,7 @@ function Je(e) {
951
957
  }
952
958
  });
953
959
  }
954
- function Ne() {
960
+ function xe() {
955
961
  return p({
956
962
  queryKey: ["resource-credits", "stats"],
957
963
  queryFn: async () => (await i.hiveClient.call(
@@ -961,14 +967,14 @@ function Ne() {
961
967
  )).rc_stats
962
968
  });
963
969
  }
964
- function xe(e) {
970
+ function Ge(e) {
965
971
  return p({
966
972
  queryKey: ["resource-credits", "account", e],
967
973
  queryFn: async () => new Y(i.hiveClient).findRCAccounts([e]),
968
974
  enabled: !!e
969
975
  });
970
976
  }
971
- function Ge(e, t) {
977
+ function Ve(e, t) {
972
978
  return p({
973
979
  queryKey: ["games", "status-check", t, e],
974
980
  enabled: !!e,
@@ -991,7 +997,7 @@ function Ge(e, t) {
991
997
  }
992
998
  });
993
999
  }
994
- function Ve(e, t, n) {
1000
+ function We(e, t, n) {
995
1001
  const { mutateAsync: o } = B(
996
1002
  e,
997
1003
  "spin-rolled"
@@ -1021,7 +1027,7 @@ function Ve(e, t, n) {
1021
1027
  }
1022
1028
  });
1023
1029
  }
1024
- function We(e, t, n = 100, o = void 0, r = !0) {
1030
+ function ze(e, t, n = 100, o = void 0, r = !0) {
1025
1031
  return p({
1026
1032
  queryKey: ["communities", "list", e, t, n],
1027
1033
  enabled: r,
@@ -1041,7 +1047,7 @@ function We(e, t, n = 100, o = void 0, r = !0) {
1041
1047
  }
1042
1048
  });
1043
1049
  }
1044
- function ze(e, t) {
1050
+ function Ue(e, t) {
1045
1051
  return p({
1046
1052
  queryKey: ["community", "context", e, t],
1047
1053
  enabled: !!e && !!t,
@@ -1062,7 +1068,7 @@ function ze(e, t) {
1062
1068
  });
1063
1069
  }
1064
1070
  var h = /* @__PURE__ */ ((e) => (e.OWNER = "owner", e.ADMIN = "admin", e.MOD = "mod", e.MEMBER = "member", e.GUEST = "guest", e.MUTED = "muted", e))(h || {});
1065
- const Ue = {
1071
+ const $e = {
1066
1072
  owner: [
1067
1073
  "admin",
1068
1074
  "mod",
@@ -1085,10 +1091,10 @@ const Ue = {
1085
1091
  /* MUTED */
1086
1092
  ]
1087
1093
  };
1088
- function $e(e, t) {
1094
+ function Re(e, t) {
1089
1095
  return e.startsWith("hive-3") || t === 3 ? "Council" : e.startsWith("hive-2") || t === 2 ? "Journal" : "Topic";
1090
1096
  }
1091
- function Re({
1097
+ function Xe({
1092
1098
  communityType: e,
1093
1099
  userRole: t,
1094
1100
  subscribed: n
@@ -1115,53 +1121,53 @@ function Re({
1115
1121
  export {
1116
1122
  i as CONFIG,
1117
1123
  k as ConfigManager,
1118
- Ie as EcencyAnalytics,
1124
+ Me as EcencyAnalytics,
1119
1125
  q as EcencyQueriesManager,
1120
- ae as HiveSignerIntegration,
1121
- fe as Keychain,
1126
+ ce as HiveSignerIntegration,
1127
+ ge as Keychain,
1122
1128
  h as ROLES,
1123
- Me as ThreeSpeakIntegration,
1129
+ Je as ThreeSpeakIntegration,
1124
1130
  oe as broadcastJson,
1125
- we as checkUsernameWalletsPendingQueryOptions,
1131
+ me as checkUsernameWalletsPendingQueryOptions,
1126
1132
  y as getAccessToken,
1127
1133
  T as getAccountFullQueryOptions,
1128
- xe as getAccountRcQueryOptions,
1129
- me as getAccountSubscriptionsQueryOptions,
1130
- be as getActiveAccountBookmarksQueryOptions,
1131
- Ce as getActiveAccountFavouritesQueryOptions,
1132
- De as getChainPropertiesQueryOptions,
1133
- We as getCommunitiesQueryOptions,
1134
- ze as getCommunityContextQueryOptions,
1135
- Re as getCommunityPermissions,
1136
- $e as getCommunityType,
1137
- _e as getDynamicPropsQueryOptions,
1134
+ Ge as getAccountRcQueryOptions,
1135
+ be as getAccountSubscriptionsQueryOptions,
1136
+ Ce as getActiveAccountBookmarksQueryOptions,
1137
+ Se as getActiveAccountFavouritesQueryOptions,
1138
+ Fe as getChainPropertiesQueryOptions,
1139
+ ze as getCommunitiesQueryOptions,
1140
+ Ue as getCommunityContextQueryOptions,
1141
+ Xe as getCommunityPermissions,
1142
+ Re as getCommunityType,
1143
+ ve as getDynamicPropsQueryOptions,
1138
1144
  O as getFragmentsQueryOptions,
1139
- Ge as getGameStatusCheckQueryOptions,
1140
- Je as getHivePoshLinksQueryOptions,
1145
+ Ve as getGameStatusCheckQueryOptions,
1146
+ Ne as getHivePoshLinksQueryOptions,
1141
1147
  E as getLoginType,
1142
1148
  P as getPostingKey,
1143
- Pe as getPromotedPostsQuery,
1149
+ Ee as getPromotedPostsQuery,
1144
1150
  u as getQueryClient,
1145
- Ne as getRcStatsQueryOptions,
1146
- he as getRefreshToken,
1151
+ xe as getRcStatsQueryOptions,
1152
+ fe as getRefreshToken,
1147
1153
  re as getRelationshipBetweenAccountsQueryOptions,
1148
- ve as getSearchAccountsByUsernameQueryOptions,
1149
- Fe as getTrendingTagsQueryOptions,
1154
+ we as getSearchAccountsByUsernameQueryOptions,
1155
+ Pe as getTrendingTagsQueryOptions,
1150
1156
  _ as getUser,
1151
- ge as makeQueryClient,
1152
- Ue as roleMap,
1153
- qe as useAccountFavouriteAdd,
1154
- Te as useAccountFavouriteDelete,
1155
- Oe as useAccountRelationsUpdate,
1156
- Se as useAccountUpdate,
1157
- Ee as useAddFragment,
1158
- Ke as useBookmarkAdd,
1159
- ke as useBookmarkDelete,
1157
+ _e as makeQueryClient,
1158
+ $e as roleMap,
1159
+ Te as useAccountFavouriteAdd,
1160
+ Qe as useAccountFavouriteDelete,
1161
+ Ke as useAccountRelationsUpdate,
1162
+ Oe as useAccountUpdate,
1163
+ Be as useAddFragment,
1164
+ ke as useBookmarkAdd,
1165
+ qe as useBookmarkDelete,
1160
1166
  ne as useBroadcastMutation,
1161
- Be as useEditFragment,
1162
- Ve as useGameClaim,
1163
- He as useRemoveFragment,
1164
- je as useSignOperationByHivesigner,
1165
- Qe as useSignOperationByKey,
1166
- Ae as useSignOperationByKeychain
1167
+ He as useEditFragment,
1168
+ We as useGameClaim,
1169
+ Ie as useRemoveFragment,
1170
+ De as useSignOperationByHivesigner,
1171
+ Ae as useSignOperationByKey,
1172
+ je as useSignOperationByKeychain
1167
1173
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ecency/sdk",
3
3
  "private": false,
4
- "version": "1.1.8",
4
+ "version": "1.1.10",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "main": "./dist/ecency-sdk.umd.js",