@8ms/helpers 2.0.1 → 2.0.3
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/package.json +58 -58
- package/url/index.d.ts +12 -1
- package/url/index.js +9 -7
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@8ms/helpers",
|
|
3
3
|
"license": "UNLICENSED",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.3",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
|
|
@@ -16,38 +16,38 @@
|
|
|
16
16
|
"node": "22"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"axios": "1.9.0",
|
|
20
|
-
"lodash": "4.17.21",
|
|
21
|
-
"luxon": "3.6.1",
|
|
22
|
-
"zod": "3.25.63"
|
|
19
|
+
"axios": "^1.9.0",
|
|
20
|
+
"lodash": "^4.17.21",
|
|
21
|
+
"luxon": "^3.6.1",
|
|
22
|
+
"zod": "^3.25.63"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@1password/sdk": "0.
|
|
26
|
-
"@aws-sdk/client-ec2": "3.
|
|
27
|
-
"@aws-sdk/client-ecs": "3.
|
|
28
|
-
"@aws-sdk/client-glue": "3.
|
|
29
|
-
"@aws-sdk/client-lambda": "3.
|
|
30
|
-
"@aws-sdk/client-s3": "3.
|
|
31
|
-
"@aws-sdk/client-ses": "3.
|
|
32
|
-
"@aws-sdk/client-sqs": "3.
|
|
33
|
-
"@aws-sdk/client-ssm": "3.
|
|
34
|
-
"@aws-sdk/lib-storage": "3.
|
|
35
|
-
"@aws-sdk/s3-request-presigner": "3.
|
|
36
|
-
"@google-cloud/bigquery": "
|
|
37
|
-
"@google-cloud/storage": "7.
|
|
38
|
-
"@googleapis/sheets": "10.0.
|
|
39
|
-
"@planetscale/database": "1.
|
|
40
|
-
"@prisma/adapter-planetscale": "
|
|
41
|
-
"@prisma/client": "
|
|
42
|
-
"athena-express": "7.
|
|
43
|
-
"aws-sdk": "2.
|
|
44
|
-
"crypto-js": "4.
|
|
45
|
-
"fs-extra": "11.
|
|
46
|
-
"google-ads-api": "20.0.
|
|
47
|
-
"react": "19.
|
|
48
|
-
"stream-chain": "3.
|
|
49
|
-
"stream-json": "1.
|
|
50
|
-
"swr": "2.
|
|
25
|
+
"@1password/sdk": "^0.0.1",
|
|
26
|
+
"@aws-sdk/client-ec2": "^3.0.0",
|
|
27
|
+
"@aws-sdk/client-ecs": "^3.0.0",
|
|
28
|
+
"@aws-sdk/client-glue": "^3.0.0",
|
|
29
|
+
"@aws-sdk/client-lambda": "^3.0.0",
|
|
30
|
+
"@aws-sdk/client-s3": "^3.0.0",
|
|
31
|
+
"@aws-sdk/client-ses": "^3.0.0",
|
|
32
|
+
"@aws-sdk/client-sqs": "^3.0.0",
|
|
33
|
+
"@aws-sdk/client-ssm": "^3.0.0",
|
|
34
|
+
"@aws-sdk/lib-storage": "^3.0.0",
|
|
35
|
+
"@aws-sdk/s3-request-presigner": "^3.0.0",
|
|
36
|
+
"@google-cloud/bigquery": "^8.0.0",
|
|
37
|
+
"@google-cloud/storage": "^7.0.0",
|
|
38
|
+
"@googleapis/sheets": "^10.0.0",
|
|
39
|
+
"@planetscale/database": "^1.0.0",
|
|
40
|
+
"@prisma/adapter-planetscale": "^6.0.0",
|
|
41
|
+
"@prisma/client": "^6.0.0",
|
|
42
|
+
"athena-express": "^7.0.0",
|
|
43
|
+
"aws-sdk": "^2.0.0",
|
|
44
|
+
"crypto-js": "^4.0.0",
|
|
45
|
+
"fs-extra": "^11.0.0",
|
|
46
|
+
"google-ads-api": "^20.0.0",
|
|
47
|
+
"react": "^19.0.0",
|
|
48
|
+
"stream-chain": "^3.0.0",
|
|
49
|
+
"stream-json": "^1.0.0",
|
|
50
|
+
"swr": "^2.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependenciesMeta": {
|
|
53
53
|
"@1password/sdk": {
|
|
@@ -134,50 +134,50 @@
|
|
|
134
134
|
},
|
|
135
135
|
"devDependencies": {
|
|
136
136
|
"@1password/sdk": "0.3.1",
|
|
137
|
-
"@aws-sdk/client-ec2": "3.
|
|
138
|
-
"@aws-sdk/client-ecs": "3.
|
|
139
|
-
"@aws-sdk/client-glue": "3.
|
|
140
|
-
"@aws-sdk/client-lambda": "3.
|
|
141
|
-
"@aws-sdk/client-s3": "3.
|
|
142
|
-
"@aws-sdk/client-ses": "3.
|
|
143
|
-
"@aws-sdk/client-sqs": "3.
|
|
144
|
-
"@aws-sdk/client-ssm": "3.
|
|
145
|
-
"@aws-sdk/lib-storage": "3.
|
|
146
|
-
"@aws-sdk/s3-request-presigner": "3.
|
|
137
|
+
"@aws-sdk/client-ec2": "^3.0.0",
|
|
138
|
+
"@aws-sdk/client-ecs": "^3.0.0",
|
|
139
|
+
"@aws-sdk/client-glue": "^3.0.0",
|
|
140
|
+
"@aws-sdk/client-lambda": "^3.0.0",
|
|
141
|
+
"@aws-sdk/client-s3": "^3.0.0",
|
|
142
|
+
"@aws-sdk/client-ses": "^3.0.0",
|
|
143
|
+
"@aws-sdk/client-sqs": "^3.0.0",
|
|
144
|
+
"@aws-sdk/client-ssm": "^3.0.0",
|
|
145
|
+
"@aws-sdk/lib-storage": "^3.0.0",
|
|
146
|
+
"@aws-sdk/s3-request-presigner": "^3.0.0",
|
|
147
147
|
"@babel/core": "7.27.4",
|
|
148
148
|
"@babel/preset-env": "7.27.2",
|
|
149
149
|
"@babel/preset-flow": "7.27.1",
|
|
150
150
|
"@babel/preset-typescript": "7.27.1",
|
|
151
|
-
"@google-cloud/bigquery": "8.
|
|
152
|
-
"@google-cloud/storage": "7.
|
|
153
|
-
"@googleapis/sheets": "10.0.
|
|
154
|
-
"@planetscale/database": "1.
|
|
155
|
-
"@prisma/adapter-planetscale": "6.
|
|
156
|
-
"@prisma/client": "6.
|
|
151
|
+
"@google-cloud/bigquery": "^8.0.0",
|
|
152
|
+
"@google-cloud/storage": "^7.0.0",
|
|
153
|
+
"@googleapis/sheets": "^10.0.0",
|
|
154
|
+
"@planetscale/database": "^1.0.0",
|
|
155
|
+
"@prisma/adapter-planetscale": "^6.0.0",
|
|
156
|
+
"@prisma/client": "^6.0.0",
|
|
157
157
|
"@types/babel__core": "7",
|
|
158
|
-
"@types/crypto-js": "4.
|
|
158
|
+
"@types/crypto-js": "^4.0.0",
|
|
159
159
|
"@types/fs-extra": "11.0.4",
|
|
160
160
|
"@types/jest": "29.5.14",
|
|
161
161
|
"@types/lodash": "4.17.17",
|
|
162
162
|
"@types/luxon": "3.6.2",
|
|
163
163
|
"@types/node": "22.15.32",
|
|
164
164
|
"@types/react": "19",
|
|
165
|
-
"athena-express": "7.
|
|
166
|
-
"aws-sdk": "2.
|
|
165
|
+
"athena-express": "^7.0.0",
|
|
166
|
+
"aws-sdk": "^2.0.0",
|
|
167
167
|
"babel-jest": "30.0.0",
|
|
168
|
-
"crypto-js": "4.
|
|
169
|
-
"dotenv": "16.
|
|
168
|
+
"crypto-js": "^4.0.0",
|
|
169
|
+
"dotenv": "^16.0.0",
|
|
170
170
|
"fs-extra": "11.3.0",
|
|
171
|
-
"google-ads-api": "20.0.
|
|
171
|
+
"google-ads-api": "^20.0.0",
|
|
172
172
|
"jest": "30.0.0",
|
|
173
173
|
"node-fetch": "3.3.2",
|
|
174
|
-
"react": "19.
|
|
175
|
-
"stream-chain": "3.
|
|
176
|
-
"stream-json": "1.9.
|
|
177
|
-
"swr": "2.
|
|
174
|
+
"react": "^19.0.0",
|
|
175
|
+
"stream-chain": "^3.0.0",
|
|
176
|
+
"stream-json": "^1.9.0",
|
|
177
|
+
"swr": "^2.0.0",
|
|
178
178
|
"ts-node": "10.9.2",
|
|
179
179
|
"tslib": "2.8.1",
|
|
180
|
-
"typescript": "5.8.3"
|
|
180
|
+
"typescript": "^5.8.3"
|
|
181
181
|
},
|
|
182
182
|
"packageManager": "yarn@4.9.2"
|
|
183
183
|
}
|
package/url/index.d.ts
CHANGED
|
@@ -12,8 +12,19 @@ export declare const isAbsolute: (input: string) => boolean;
|
|
|
12
12
|
* Does the URL begin with a slash.
|
|
13
13
|
*/
|
|
14
14
|
export declare const isRelative: (input: string) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Take an object and return the parameter for a given URL irrespective of path.
|
|
17
|
+
*/
|
|
18
|
+
export declare const buildParameters: (existing?: object, updated?: object) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Create a new relative URL based on the current path.
|
|
21
|
+
*/
|
|
22
|
+
export declare const buildRelative: ({ router, updated }: {
|
|
23
|
+
router: any;
|
|
24
|
+
updated: object;
|
|
25
|
+
}) => string;
|
|
15
26
|
/**
|
|
16
27
|
* Get the current base url.
|
|
17
28
|
*/
|
|
18
|
-
export declare const
|
|
29
|
+
export declare const buildEnvironmentUrl: (path: string, url: EnvironmentUrl) => string;
|
|
19
30
|
export { writeUrlContents } from "./writeUrlContents";
|
package/url/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.writeUrlContents = exports.
|
|
6
|
+
exports.writeUrlContents = exports.buildEnvironmentUrl = exports.buildRelative = exports.buildParameters = exports.isRelative = exports.isAbsolute = void 0;
|
|
7
7
|
const environment_1 = require("../environment");
|
|
8
8
|
const merge_1 = __importDefault(require("lodash/merge"));
|
|
9
9
|
/**
|
|
@@ -28,28 +28,30 @@ exports.isRelative = isRelative;
|
|
|
28
28
|
/**
|
|
29
29
|
* Take an object and return the parameter for a given URL irrespective of path.
|
|
30
30
|
*/
|
|
31
|
-
const buildParameters = ({
|
|
31
|
+
const buildParameters = (existing = {}, updated = {}) => {
|
|
32
32
|
const merged = (0, merge_1.default)(existing, updated);
|
|
33
|
-
let response =
|
|
33
|
+
let response = "";
|
|
34
34
|
if (Object.values(merged).length) {
|
|
35
35
|
for (const key in merged) {
|
|
36
36
|
const value = undefined === updated[key] ? existing[key] : updated[key];
|
|
37
|
-
response +=
|
|
37
|
+
response += "" === response ? "?" : "&";
|
|
38
38
|
response += `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
return response;
|
|
42
42
|
};
|
|
43
|
+
exports.buildParameters = buildParameters;
|
|
43
44
|
/**
|
|
44
45
|
* Create a new relative URL based on the current path.
|
|
45
46
|
*/
|
|
46
47
|
const buildRelative = ({ router, updated }) => {
|
|
47
|
-
return `${router.pathname}${buildParameters({ existing: router.query, updated: updated || {} })}`;
|
|
48
|
+
return `${router.pathname}${(0, exports.buildParameters)({ existing: router.query, updated: updated || {} })}`;
|
|
48
49
|
};
|
|
50
|
+
exports.buildRelative = buildRelative;
|
|
49
51
|
/**
|
|
50
52
|
* Get the current base url.
|
|
51
53
|
*/
|
|
52
|
-
const
|
|
54
|
+
const buildEnvironmentUrl = (path, url) => {
|
|
53
55
|
let response;
|
|
54
56
|
if ((0, environment_1.isDevelopment)() && (0, environment_1.isLocalhost)()) {
|
|
55
57
|
response = url.localhost;
|
|
@@ -65,6 +67,6 @@ const buildUrl = (path, url) => {
|
|
|
65
67
|
}
|
|
66
68
|
return response + path || "";
|
|
67
69
|
};
|
|
68
|
-
exports.
|
|
70
|
+
exports.buildEnvironmentUrl = buildEnvironmentUrl;
|
|
69
71
|
var writeUrlContents_1 = require("./writeUrlContents");
|
|
70
72
|
Object.defineProperty(exports, "writeUrlContents", { enumerable: true, get: function () { return writeUrlContents_1.writeUrlContents; } });
|