@8ms/helpers 2.0.3 → 2.0.4
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/.yarn/install-state.gz +0 -0
- package/nextJs/index.d.ts +12 -2
- package/nextJs/index.js +16 -4
- package/package.json +1 -1
- package/upTimeRobot/index.d.ts +2 -2
- package/upTimeRobot/index.js +2 -2
- package/url/index.d.ts +4 -1
- package/url/index.js +44 -2
- package/nextJs/getIp.d.ts +0 -6
- package/nextJs/getIp.js +0 -14
- package/nextJs/getUserAgent.d.ts +0 -6
- package/nextJs/getUserAgent.js +0 -8
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/nextJs/index.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Get the user's remote IP Address
|
|
3
|
+
*/
|
|
4
|
+
export declare const getIp: ({ req }: {
|
|
5
|
+
req: any;
|
|
6
|
+
}) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Get the user's User Agent
|
|
9
|
+
*/
|
|
10
|
+
export declare const getUserAgent: ({ req }: {
|
|
11
|
+
req: any;
|
|
12
|
+
}) => string;
|
package/nextJs/index.js
CHANGED
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getUserAgent = exports.getIp = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Get the user's remote IP Address
|
|
6
|
+
*/
|
|
7
|
+
const getIp = ({ req }) => {
|
|
8
|
+
let response = 'unset';
|
|
9
|
+
if (undefined !== req.headers['x-real-ip']) {
|
|
10
|
+
response = String(req.headers['x-real-ip']);
|
|
11
|
+
}
|
|
12
|
+
return response;
|
|
13
|
+
};
|
|
14
|
+
exports.getIp = getIp;
|
|
15
|
+
/**
|
|
16
|
+
* Get the user's User Agent
|
|
17
|
+
*/
|
|
18
|
+
const getUserAgent = ({ req }) => req.headers['user-agent'] || 'unset';
|
|
19
|
+
exports.getUserAgent = getUserAgent;
|
package/package.json
CHANGED
package/upTimeRobot/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UpTimeRobotNamespace } from "./UpTimeRobotNamespace";
|
|
2
2
|
export type UpTimeRobotConfig = {
|
|
3
3
|
apiKey: string;
|
|
4
4
|
};
|
|
5
|
-
export declare const upTimeRobotClient: (key?: string, config?: UpTimeRobotConfig, vaultId?: string, itemId?: string) => Promise<
|
|
5
|
+
export declare const upTimeRobotClient: (key?: string, config?: UpTimeRobotConfig, vaultId?: string, itemId?: string) => Promise<UpTimeRobotNamespace>;
|
|
6
6
|
export declare const logTypes: {
|
|
7
7
|
DOWN: number;
|
|
8
8
|
UP: number;
|
package/upTimeRobot/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.requestStatuses = exports.monitorTypes = exports.monitorSubTypes = exports.monitorStatuses = exports.logTypes = exports.upTimeRobotClient = void 0;
|
|
4
|
-
const
|
|
4
|
+
const UpTimeRobotNamespace_1 = require("./UpTimeRobotNamespace");
|
|
5
5
|
const onePassword_1 = require("../onePassword");
|
|
6
6
|
const upTimeRobotNamespaces = new Map();
|
|
7
7
|
const upTimeRobotClient = async (key = "default", config, vaultId, itemId) => {
|
|
@@ -23,7 +23,7 @@ const upTimeRobotClient = async (key = "default", config, vaultId, itemId) => {
|
|
|
23
23
|
else {
|
|
24
24
|
throw new Error(`Config required for namespace '${key}'`);
|
|
25
25
|
}
|
|
26
|
-
const namespace = new
|
|
26
|
+
const namespace = new UpTimeRobotNamespace_1.UpTimeRobotNamespace(key, instanceConfig);
|
|
27
27
|
upTimeRobotNamespaces.set(key, namespace);
|
|
28
28
|
return namespace;
|
|
29
29
|
};
|
package/url/index.d.ts
CHANGED
|
@@ -27,4 +27,7 @@ export declare const buildRelative: ({ router, updated }: {
|
|
|
27
27
|
* Get the current base url.
|
|
28
28
|
*/
|
|
29
29
|
export declare const buildEnvironmentUrl: (path: string, url: EnvironmentUrl) => string;
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Server-side only function - dynamically imported to avoid client bundling
|
|
32
|
+
*/
|
|
33
|
+
export declare const writeUrlContents: (...args: Parameters<typeof import("./writeUrlContents").writeUrlContents>) => Promise<void>;
|
package/url/index.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
@@ -68,5 +101,14 @@ const buildEnvironmentUrl = (path, url) => {
|
|
|
68
101
|
return response + path || "";
|
|
69
102
|
};
|
|
70
103
|
exports.buildEnvironmentUrl = buildEnvironmentUrl;
|
|
71
|
-
|
|
72
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Server-side only function - dynamically imported to avoid client bundling
|
|
106
|
+
*/
|
|
107
|
+
const writeUrlContents = async (...args) => {
|
|
108
|
+
if ("undefined" !== typeof window) {
|
|
109
|
+
throw new Error("writeUrlContents is not available on the client side");
|
|
110
|
+
}
|
|
111
|
+
const { writeUrlContents: serverWriteUrlContents } = await Promise.resolve().then(() => __importStar(require("./writeUrlContents")));
|
|
112
|
+
return serverWriteUrlContents(...args);
|
|
113
|
+
};
|
|
114
|
+
exports.writeUrlContents = writeUrlContents;
|
package/nextJs/getIp.d.ts
DELETED
package/nextJs/getIp.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getIp = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Get the user's remote IP Address
|
|
6
|
-
*/
|
|
7
|
-
const getIp = ({ req }) => {
|
|
8
|
-
let response = 'unset';
|
|
9
|
-
if (undefined !== req.headers['x-real-ip']) {
|
|
10
|
-
response = String(req.headers['x-real-ip']);
|
|
11
|
-
}
|
|
12
|
-
return response;
|
|
13
|
-
};
|
|
14
|
-
exports.getIp = getIp;
|
package/nextJs/getUserAgent.d.ts
DELETED
package/nextJs/getUserAgent.js
DELETED