akeyless-client-commons 1.1.138 → 1.1.139

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.
@@ -1677,7 +1677,11 @@ var SocketService = /*#__PURE__*/ function() {
1677
1677
  if (callback.success) {
1678
1678
  console.log("Successfully subscribed to: ".concat(collectionsNames.join(", ")));
1679
1679
  } else {
1680
- console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
1680
+ console.error("Failed to subscribe to ".concat(collectionsNames.join(", "), ": ").concat(callback.message));
1681
+ config.forEach(function(c) {
1682
+ var _c_onError;
1683
+ return (_c_onError = c.onError) === null || _c_onError === void 0 ? void 0 : _c_onError.call(c, new Error(callback.message || "Subscription failed"), c);
1684
+ });
1681
1685
  }
1682
1686
  };
1683
1687
  config.forEach(function(c) {
@@ -1408,7 +1408,11 @@ var SocketService = /*#__PURE__*/ function() {
1408
1408
  if (callback.success) {
1409
1409
  console.log("Successfully subscribed to: ".concat(collectionsNames.join(", ")));
1410
1410
  } else {
1411
- console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
1411
+ console.error("Failed to subscribe to ".concat(collectionsNames.join(", "), ": ").concat(callback.message));
1412
+ config.forEach(function(c) {
1413
+ var _c_onError;
1414
+ return (_c_onError = c.onError) === null || _c_onError === void 0 ? void 0 : _c_onError.call(c, new Error(callback.message || "Subscription failed"), c);
1415
+ });
1412
1416
  }
1413
1417
  };
1414
1418
  config.forEach(function(c) {
@@ -13,6 +13,7 @@ type AppName = "installer" | "toolbox" | "dashboard";
13
13
  type LoginOption = "google" | "phone";
14
14
 
15
15
  type OnSnapshotCallback = (documents: any[], config: OnSnapshotConfig) => void;
16
+ type OnSnapshotErrorCallback<TConfig> = (error: Error, config: TConfig) => void;
16
17
  interface OnSnapshotParsers {
17
18
  onFirstTime?: OnSnapshotCallback;
18
19
  onAdd?: OnSnapshotCallback;
@@ -34,12 +35,14 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
34
35
  }[];
35
36
  parseAs?: "object" | "array";
36
37
  subscribeTo?: "cache" | "db";
38
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfig>;
37
39
  }
38
40
  interface OnSnapshotConfigDocument extends Omit<OnSnapshotParsers, "onAdd"> {
39
41
  collectionName: string;
40
42
  documentId: string;
41
43
  extraParsers?: Omit<OnSnapshotParsers, "onAdd">[];
42
44
  conditions?: WhereCondition[];
45
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfigDocument>;
43
46
  }
44
47
  interface SnapshotResult {
45
48
  promise: Promise<void>;
@@ -13,6 +13,7 @@ type AppName = "installer" | "toolbox" | "dashboard";
13
13
  type LoginOption = "google" | "phone";
14
14
 
15
15
  type OnSnapshotCallback = (documents: any[], config: OnSnapshotConfig) => void;
16
+ type OnSnapshotErrorCallback<TConfig> = (error: Error, config: TConfig) => void;
16
17
  interface OnSnapshotParsers {
17
18
  onFirstTime?: OnSnapshotCallback;
18
19
  onAdd?: OnSnapshotCallback;
@@ -34,12 +35,14 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
34
35
  }[];
35
36
  parseAs?: "object" | "array";
36
37
  subscribeTo?: "cache" | "db";
38
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfig>;
37
39
  }
38
40
  interface OnSnapshotConfigDocument extends Omit<OnSnapshotParsers, "onAdd"> {
39
41
  collectionName: string;
40
42
  documentId: string;
41
43
  extraParsers?: Omit<OnSnapshotParsers, "onAdd">[];
42
44
  conditions?: WhereCondition[];
45
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfigDocument>;
43
46
  }
44
47
  interface SnapshotResult {
45
48
  promise: Promise<void>;
@@ -1990,8 +1990,10 @@ var snapshot = function(config, snapshotsFirstTime, settings) {
1990
1990
  });
1991
1991
  }
1992
1992
  }, function(error) {
1993
+ var _config_onError;
1993
1994
  console.error("Error listening to collection: ".concat(config.collectionName), error);
1994
1995
  resolvePromise();
1996
+ (_config_onError = config.onError) === null || _config_onError === void 0 ? void 0 : _config_onError.call(config, error, config);
1995
1997
  });
1996
1998
  return {
1997
1999
  promise: promise,
@@ -2059,8 +2061,10 @@ var snapshotDocument = function(config, snapshotsFirstTime) {
2059
2061
  }
2060
2062
  }
2061
2063
  }, function(error) {
2064
+ var _config_onError;
2062
2065
  console.error("Error listening to document in ".concat(config.collectionName, ":"), error);
2063
2066
  resolvePromise();
2067
+ (_config_onError = config.onError) === null || _config_onError === void 0 ? void 0 : _config_onError.call(config, error, config);
2064
2068
  });
2065
2069
  return {
2066
2070
  promise: promise,
@@ -3284,7 +3288,11 @@ var SocketService = /*#__PURE__*/ function() {
3284
3288
  if (callback.success) {
3285
3289
  console.log("Successfully subscribed to: ".concat(collectionsNames.join(", ")));
3286
3290
  } else {
3287
- console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
3291
+ console.error("Failed to subscribe to ".concat(collectionsNames.join(", "), ": ").concat(callback.message));
3292
+ config.forEach(function(c) {
3293
+ var _c_onError;
3294
+ return (_c_onError = c.onError) === null || _c_onError === void 0 ? void 0 : _c_onError.call(c, new Error(callback.message || "Subscription failed"), c);
3295
+ });
3288
3296
  }
3289
3297
  };
3290
3298
  config.forEach(function(c) {
@@ -1566,8 +1566,10 @@ var snapshot = function(config, snapshotsFirstTime, settings) {
1566
1566
  });
1567
1567
  }
1568
1568
  }, function(error) {
1569
+ var _config_onError;
1569
1570
  console.error("Error listening to collection: ".concat(config.collectionName), error);
1570
1571
  resolvePromise();
1572
+ (_config_onError = config.onError) === null || _config_onError === void 0 ? void 0 : _config_onError.call(config, error, config);
1571
1573
  });
1572
1574
  return {
1573
1575
  promise: promise,
@@ -1635,8 +1637,10 @@ var snapshotDocument = function(config, snapshotsFirstTime) {
1635
1637
  }
1636
1638
  }
1637
1639
  }, function(error) {
1640
+ var _config_onError;
1638
1641
  console.error("Error listening to document in ".concat(config.collectionName, ":"), error);
1639
1642
  resolvePromise();
1643
+ (_config_onError = config.onError) === null || _config_onError === void 0 ? void 0 : _config_onError.call(config, error, config);
1640
1644
  });
1641
1645
  return {
1642
1646
  promise: promise,
@@ -2860,7 +2864,11 @@ var SocketService = /*#__PURE__*/ function() {
2860
2864
  if (callback.success) {
2861
2865
  console.log("Successfully subscribed to: ".concat(collectionsNames.join(", ")));
2862
2866
  } else {
2863
- console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
2867
+ console.error("Failed to subscribe to ".concat(collectionsNames.join(", "), ": ").concat(callback.message));
2868
+ config.forEach(function(c) {
2869
+ var _c_onError;
2870
+ return (_c_onError = c.onError) === null || _c_onError === void 0 ? void 0 : _c_onError.call(c, new Error(callback.message || "Subscription failed"), c);
2871
+ });
2864
2872
  }
2865
2873
  };
2866
2874
  config.forEach(function(c) {
@@ -10,6 +10,7 @@ declare const useDeepCompareMemo: <T>(factory: () => T, dependencies: any[]) =>
10
10
  declare function useDeepCompareEffect(effect: EffectCallback, dependencies: any[]): void;
11
11
 
12
12
  type OnSnapshotCallback = (documents: any[], config: OnSnapshotConfig) => void;
13
+ type OnSnapshotErrorCallback<TConfig> = (error: Error, config: TConfig) => void;
13
14
  interface OnSnapshotParsers {
14
15
  onFirstTime?: OnSnapshotCallback;
15
16
  onAdd?: OnSnapshotCallback;
@@ -31,12 +32,14 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
31
32
  }[];
32
33
  parseAs?: "object" | "array";
33
34
  subscribeTo?: "cache" | "db";
35
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfig>;
34
36
  }
35
37
  interface OnSnapshotConfigDocument extends Omit<OnSnapshotParsers, "onAdd"> {
36
38
  collectionName: string;
37
39
  documentId: string;
38
40
  extraParsers?: Omit<OnSnapshotParsers, "onAdd">[];
39
41
  conditions?: WhereCondition[];
42
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfigDocument>;
40
43
  }
41
44
 
42
45
  interface GetDataPayload<T = any> {
@@ -10,6 +10,7 @@ declare const useDeepCompareMemo: <T>(factory: () => T, dependencies: any[]) =>
10
10
  declare function useDeepCompareEffect(effect: EffectCallback, dependencies: any[]): void;
11
11
 
12
12
  type OnSnapshotCallback = (documents: any[], config: OnSnapshotConfig) => void;
13
+ type OnSnapshotErrorCallback<TConfig> = (error: Error, config: TConfig) => void;
13
14
  interface OnSnapshotParsers {
14
15
  onFirstTime?: OnSnapshotCallback;
15
16
  onAdd?: OnSnapshotCallback;
@@ -31,12 +32,14 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
31
32
  }[];
32
33
  parseAs?: "object" | "array";
33
34
  subscribeTo?: "cache" | "db";
35
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfig>;
34
36
  }
35
37
  interface OnSnapshotConfigDocument extends Omit<OnSnapshotParsers, "onAdd"> {
36
38
  collectionName: string;
37
39
  documentId: string;
38
40
  extraParsers?: Omit<OnSnapshotParsers, "onAdd">[];
39
41
  conditions?: WhereCondition[];
42
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfigDocument>;
40
43
  }
41
44
 
42
45
  interface GetDataPayload<T = any> {
@@ -710,8 +710,10 @@ var snapshot = function(config, snapshotsFirstTime, settings) {
710
710
  });
711
711
  }
712
712
  }, function(error) {
713
+ var _config_onError;
713
714
  console.error("Error listening to collection: ".concat(config.collectionName), error);
714
715
  resolvePromise();
716
+ (_config_onError = config.onError) === null || _config_onError === void 0 ? void 0 : _config_onError.call(config, error, config);
715
717
  });
716
718
  return {
717
719
  promise: promise,
@@ -779,8 +781,10 @@ var snapshotDocument = function(config, snapshotsFirstTime) {
779
781
  }
780
782
  }
781
783
  }, function(error) {
784
+ var _config_onError;
782
785
  console.error("Error listening to document in ".concat(config.collectionName, ":"), error);
783
786
  resolvePromise();
787
+ (_config_onError = config.onError) === null || _config_onError === void 0 ? void 0 : _config_onError.call(config, error, config);
784
788
  });
785
789
  return {
786
790
  promise: promise,
@@ -1134,7 +1138,11 @@ var SocketService = /*#__PURE__*/ function() {
1134
1138
  if (callback.success) {
1135
1139
  console.log("Successfully subscribed to: ".concat(collectionsNames.join(", ")));
1136
1140
  } else {
1137
- console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
1141
+ console.error("Failed to subscribe to ".concat(collectionsNames.join(", "), ": ").concat(callback.message));
1142
+ config.forEach(function(c) {
1143
+ var _c_onError;
1144
+ return (_c_onError = c.onError) === null || _c_onError === void 0 ? void 0 : _c_onError.call(c, new Error(callback.message || "Subscription failed"), c);
1145
+ });
1138
1146
  }
1139
1147
  };
1140
1148
  config.forEach(function(c) {
@@ -614,8 +614,10 @@ var snapshot = function(config, snapshotsFirstTime, settings) {
614
614
  });
615
615
  }
616
616
  }, function(error) {
617
+ var _config_onError;
617
618
  console.error("Error listening to collection: ".concat(config.collectionName), error);
618
619
  resolvePromise();
620
+ (_config_onError = config.onError) === null || _config_onError === void 0 ? void 0 : _config_onError.call(config, error, config);
619
621
  });
620
622
  return {
621
623
  promise: promise,
@@ -683,8 +685,10 @@ var snapshotDocument = function(config, snapshotsFirstTime) {
683
685
  }
684
686
  }
685
687
  }, function(error) {
688
+ var _config_onError;
686
689
  console.error("Error listening to document in ".concat(config.collectionName, ":"), error);
687
690
  resolvePromise();
691
+ (_config_onError = config.onError) === null || _config_onError === void 0 ? void 0 : _config_onError.call(config, error, config);
688
692
  });
689
693
  return {
690
694
  promise: promise,
@@ -1038,7 +1042,11 @@ var SocketService = /*#__PURE__*/ function() {
1038
1042
  if (callback.success) {
1039
1043
  console.log("Successfully subscribed to: ".concat(collectionsNames.join(", ")));
1040
1044
  } else {
1041
- console.error("Failed to subscribe to ".concat(config.join(", "), ": ").concat(callback.message));
1045
+ console.error("Failed to subscribe to ".concat(collectionsNames.join(", "), ": ").concat(callback.message));
1046
+ config.forEach(function(c) {
1047
+ var _c_onError;
1048
+ return (_c_onError = c.onError) === null || _c_onError === void 0 ? void 0 : _c_onError.call(c, new Error(callback.message || "Subscription failed"), c);
1049
+ });
1042
1050
  }
1043
1051
  };
1044
1052
  config.forEach(function(c) {
@@ -78,6 +78,7 @@ type AppName = "installer" | "toolbox" | "dashboard";
78
78
  type LoginOption = "google" | "phone";
79
79
 
80
80
  type OnSnapshotCallback = (documents: any[], config: OnSnapshotConfig) => void;
81
+ type OnSnapshotErrorCallback<TConfig> = (error: Error, config: TConfig) => void;
81
82
  interface OnSnapshotParsers {
82
83
  onFirstTime?: OnSnapshotCallback;
83
84
  onAdd?: OnSnapshotCallback;
@@ -99,12 +100,14 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
99
100
  }[];
100
101
  parseAs?: "object" | "array";
101
102
  subscribeTo?: "cache" | "db";
103
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfig>;
102
104
  }
103
105
  interface OnSnapshotConfigDocument extends Omit<OnSnapshotParsers, "onAdd"> {
104
106
  collectionName: string;
105
107
  documentId: string;
106
108
  extraParsers?: Omit<OnSnapshotParsers, "onAdd">[];
107
109
  conditions?: WhereCondition[];
110
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfigDocument>;
108
111
  }
109
112
  interface SnapshotResult {
110
113
  promise: Promise<void>;
@@ -369,4 +372,4 @@ interface DatePickerProps {
369
372
  todayDayClassName?: string;
370
373
  }
371
374
 
372
- export type { AppName, BaseElementProps, CheckboxContainerProps, ConfirmFormProps, CustomElementProps, DateInputContainerProps, DateInputElement, DatePickerProps, Direction, DurationInputOption, DurationInputProps, DurationValues, FormElement, FormSeparatorProps, InputContainerProps, InputElement, InternationalInputProps, LoginOption, ModularFormProps, ModularPopUp, MultiSelectProps, OnSnapshotCallback, OnSnapshotConfig, OnSnapshotConfigDocument, OnSnapshotParsers, SelectContainerProps, SelectElement, SelectWithSearchProps, SetState, Snapshot, SnapshotDocument, SnapshotResult, TextAreaContainerProps, TextAreaElement, WhereCondition };
375
+ export type { AppName, BaseElementProps, CheckboxContainerProps, ConfirmFormProps, CustomElementProps, DateInputContainerProps, DateInputElement, DatePickerProps, Direction, DurationInputOption, DurationInputProps, DurationValues, FormElement, FormSeparatorProps, InputContainerProps, InputElement, InternationalInputProps, LoginOption, ModularFormProps, ModularPopUp, MultiSelectProps, OnSnapshotCallback, OnSnapshotConfig, OnSnapshotConfigDocument, OnSnapshotErrorCallback, OnSnapshotParsers, SelectContainerProps, SelectElement, SelectWithSearchProps, SetState, Snapshot, SnapshotDocument, SnapshotResult, TextAreaContainerProps, TextAreaElement, WhereCondition };
@@ -78,6 +78,7 @@ type AppName = "installer" | "toolbox" | "dashboard";
78
78
  type LoginOption = "google" | "phone";
79
79
 
80
80
  type OnSnapshotCallback = (documents: any[], config: OnSnapshotConfig) => void;
81
+ type OnSnapshotErrorCallback<TConfig> = (error: Error, config: TConfig) => void;
81
82
  interface OnSnapshotParsers {
82
83
  onFirstTime?: OnSnapshotCallback;
83
84
  onAdd?: OnSnapshotCallback;
@@ -99,12 +100,14 @@ interface OnSnapshotConfig extends OnSnapshotParsers {
99
100
  }[];
100
101
  parseAs?: "object" | "array";
101
102
  subscribeTo?: "cache" | "db";
103
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfig>;
102
104
  }
103
105
  interface OnSnapshotConfigDocument extends Omit<OnSnapshotParsers, "onAdd"> {
104
106
  collectionName: string;
105
107
  documentId: string;
106
108
  extraParsers?: Omit<OnSnapshotParsers, "onAdd">[];
107
109
  conditions?: WhereCondition[];
110
+ onError?: OnSnapshotErrorCallback<OnSnapshotConfigDocument>;
108
111
  }
109
112
  interface SnapshotResult {
110
113
  promise: Promise<void>;
@@ -369,4 +372,4 @@ interface DatePickerProps {
369
372
  todayDayClassName?: string;
370
373
  }
371
374
 
372
- export type { AppName, BaseElementProps, CheckboxContainerProps, ConfirmFormProps, CustomElementProps, DateInputContainerProps, DateInputElement, DatePickerProps, Direction, DurationInputOption, DurationInputProps, DurationValues, FormElement, FormSeparatorProps, InputContainerProps, InputElement, InternationalInputProps, LoginOption, ModularFormProps, ModularPopUp, MultiSelectProps, OnSnapshotCallback, OnSnapshotConfig, OnSnapshotConfigDocument, OnSnapshotParsers, SelectContainerProps, SelectElement, SelectWithSearchProps, SetState, Snapshot, SnapshotDocument, SnapshotResult, TextAreaContainerProps, TextAreaElement, WhereCondition };
375
+ export type { AppName, BaseElementProps, CheckboxContainerProps, ConfirmFormProps, CustomElementProps, DateInputContainerProps, DateInputElement, DatePickerProps, Direction, DurationInputOption, DurationInputProps, DurationValues, FormElement, FormSeparatorProps, InputContainerProps, InputElement, InternationalInputProps, LoginOption, ModularFormProps, ModularPopUp, MultiSelectProps, OnSnapshotCallback, OnSnapshotConfig, OnSnapshotConfigDocument, OnSnapshotErrorCallback, OnSnapshotParsers, SelectContainerProps, SelectElement, SelectWithSearchProps, SetState, Snapshot, SnapshotDocument, SnapshotResult, TextAreaContainerProps, TextAreaElement, WhereCondition };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akeyless-client-commons",
3
- "version": "1.1.138",
3
+ "version": "1.1.139",
4
4
  "scripts": {
5
5
  "build": "tsup",
6
6
  "deploy": "npm run build && npm version patch --no-git-tag-version && npm publish",