dce-reactkit 3.8.6 → 3.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Send a server-to-server request from this sever to another server that uses
3
+ * dce-reactkit [for server only]
4
+ * @author Gabe Abrams
5
+ * @param opts object containing all arguments
6
+ * @param opts.path - the path of the other server's endpoint
7
+ * @param [opts.method=GET] - the method of the endpoint
8
+ * @param [opts.params] - query/body parameters to include
9
+ * @param [opts.headers] - headers to include
10
+ * @returns response from server
11
+ */
12
+ declare const visitEndpointOnAnotherServer: (opts: {
13
+ path: string;
14
+ method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
15
+ params?: {
16
+ [x: string]: any;
17
+ } | undefined;
18
+ headers?: {
19
+ [x: string]: any;
20
+ } | undefined;
21
+ }) => Promise<any>;
22
+ export default visitEndpointOnAnotherServer;
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Sends and retries an http request
3
+ * @author Gabriel Abrams
4
+ * @param opts object containing all arguments
5
+ * @param opts.path path to send request to
6
+ * @param [opts.host] host to send request to
7
+ * @param [opts.method=GET] http method to use
8
+ * @param [opts.params] body/data to include in the request
9
+ * @param [opts.headers] headers to include in the request
10
+ * @param [opts.sendCrossDomainCredentials=true if in development mode] if true,
11
+ * send cross-domain credentials even if not in dev mode
12
+ * @param [opts.responseType=JSON] expected response type
13
+ * @returns { body, status, headers } on success
14
+ */
15
+ declare const sendServerToServerRequest: (opts: {
16
+ path: string;
17
+ host?: string | undefined;
18
+ method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
19
+ params?: {
20
+ [x: string]: any;
21
+ } | undefined;
22
+ headers?: {
23
+ [x: string]: any;
24
+ } | undefined;
25
+ responseType?: "Text" | "JSON" | undefined;
26
+ }) => Promise<{
27
+ body: any;
28
+ status: number;
29
+ headers: {
30
+ [x: string]: any;
31
+ };
32
+ }>;
33
+ export default sendServerToServerRequest;
@@ -15,6 +15,9 @@ declare enum ReactKitErrorCode {
15
15
  NotAdmin = "DRK10",
16
16
  NotAllowedToReviewLogs = "DRK11",
17
17
  ThemeCheckedBeforeReactKitReady = "DRK12",
18
- SessionExpiredMessageGottenBeforeReactKitReady = "DRK13"
18
+ SessionExpiredMessageGottenBeforeReactKitReady = "DRK13",
19
+ NotConnected = "DRK14",
20
+ SelfSigned = "DRK15",
21
+ ResponseParseError = "DRK16"
19
22
  }
20
23
  export default ReactKitErrorCode;
package/dist/esm/index.js CHANGED
@@ -30,7 +30,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
30
30
  });
31
31
  }
32
32
 
33
- // Highest error code = DRK13
33
+ // Highest error code = DRK16
34
34
  /**
35
35
  * List of error codes built into the react kit
36
36
  * @author Gabe Abrams
@@ -50,6 +50,10 @@ var ReactKitErrorCode;
50
50
  ReactKitErrorCode["NotAllowedToReviewLogs"] = "DRK11";
51
51
  ReactKitErrorCode["ThemeCheckedBeforeReactKitReady"] = "DRK12";
52
52
  ReactKitErrorCode["SessionExpiredMessageGottenBeforeReactKitReady"] = "DRK13";
53
+ // Server-to-server requests
54
+ ReactKitErrorCode["NotConnected"] = "DRK14";
55
+ ReactKitErrorCode["SelfSigned"] = "DRK15";
56
+ ReactKitErrorCode["ResponseParseError"] = "DRK16";
53
57
  })(ReactKitErrorCode || (ReactKitErrorCode = {}));
54
58
  var ReactKitErrorCode$1 = ReactKitErrorCode;
55
59