@8ms/helpers 2.2.26 → 2.3.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/_class/index.d.ts +2 -2
- package/_class/index.js +2 -2
- package/adverity/adverity.d.ts +112 -0
- package/adverity/adverity.js +58 -0
- package/adverity/index.d.ts +1 -112
- package/adverity/index.js +1 -58
- package/adverity/server/index.d.ts +1 -1
- package/adverity/server/index.js +1 -1
- package/api/ApiResponseClass.d.ts +1 -1
- package/api/ApiResponseClass.js +12 -12
- package/api/{types.d.ts → api.d.ts} +2 -2
- package/api/{types.js → api.js} +2 -2
- package/api/functions.d.ts +1 -1
- package/api/functions.js +7 -7
- package/api/index.d.ts +1 -1
- package/api/index.js +1 -1
- package/array/array.d.ts +8 -0
- package/array/array.js +9 -0
- package/array/index.d.ts +1 -8
- package/array/index.js +1 -9
- package/atInternet/atInternet.d.ts +16 -0
- package/atInternet/atInternet.js +15 -0
- package/atInternet/index.d.ts +1 -16
- package/atInternet/index.js +1 -15
- package/aws/ec2/server/awsEc2.d.ts +3 -0
- package/aws/ec2/server/awsEc2.js +12 -0
- package/aws/ec2/server/index.d.ts +2 -3
- package/aws/ec2/server/index.js +2 -12
- package/aws/ecs/server/awsEcs.d.ts +3 -0
- package/aws/ecs/server/awsEcs.js +12 -0
- package/aws/ecs/server/index.d.ts +2 -3
- package/aws/ecs/server/index.js +2 -12
- package/aws/glue/server/awsGlue.d.ts +3 -0
- package/aws/glue/server/awsGlue.js +12 -0
- package/aws/glue/server/index.d.ts +2 -3
- package/aws/glue/server/index.js +2 -12
- package/aws/lambda/server/awsLambda.d.ts +4 -0
- package/aws/lambda/server/awsLambda.js +16 -0
- package/aws/lambda/server/index.d.ts +2 -4
- package/aws/lambda/server/index.js +2 -16
- package/aws/s3/server/awsS3.d.ts +13 -0
- package/aws/s3/server/awsS3.js +20 -0
- package/aws/s3/server/index.d.ts +3 -13
- package/aws/s3/server/index.js +3 -20
- package/aws/server/aws.d.ts +9 -0
- package/aws/server/aws.js +29 -0
- package/aws/server/index.d.ts +2 -9
- package/aws/server/index.js +2 -29
- package/aws/ses/server/awsSes.d.ts +4 -0
- package/aws/ses/server/awsSes.js +13 -0
- package/aws/ses/server/index.d.ts +3 -4
- package/aws/ses/server/index.js +3 -13
- package/aws/sqs/server/awsSqs.d.ts +3 -0
- package/aws/sqs/server/awsSqs.js +12 -0
- package/aws/sqs/server/index.d.ts +2 -3
- package/aws/sqs/server/index.js +2 -12
- package/aws/ssm/server/awsSsm.d.ts +3 -0
- package/aws/ssm/server/awsSsm.js +12 -0
- package/aws/ssm/server/index.d.ts +2 -3
- package/aws/ssm/server/index.js +2 -12
- package/axios/index.d.ts +3 -3
- package/axios/index.js +3 -3
- package/boolean/boolean.d.ts +4 -0
- package/boolean/boolean.js +16 -0
- package/boolean/index.d.ts +1 -4
- package/boolean/index.js +1 -16
- package/brightData/serpApi/server/brightDataSerpApi.d.ts +10 -0
- package/brightData/serpApi/server/brightDataSerpApi.js +9 -0
- package/brightData/serpApi/server/getAsyncRequestId.js +2 -2
- package/brightData/serpApi/server/index.d.ts +6 -15
- package/brightData/serpApi/server/index.js +6 -14
- package/brightData/server/brightData.d.ts +15 -0
- package/brightData/server/brightData.js +15 -0
- package/brightData/server/index.d.ts +1 -15
- package/brightData/server/index.js +1 -15
- package/brightData/webScraperIde/server/getRealtime.js +5 -5
- package/brightData/webScraperIde/server/index.d.ts +2 -2
- package/brightData/webScraperIde/server/index.js +2 -2
- package/cache/server/cache.d.ts +7 -0
- package/cache/server/cache.js +43 -0
- package/cache/server/index.d.ts +1 -7
- package/cache/server/index.js +1 -43
- package/crud/crud.d.ts +7 -0
- package/crud/crud.js +6 -0
- package/crud/index.d.ts +1 -7
- package/crud/index.js +1 -6
- package/crypto/index.d.ts +4 -4
- package/crypto/index.js +4 -4
- package/date/calculation.d.ts +4 -1
- package/date/calculation.js +3 -0
- package/date/{type.d.ts → date.d.ts} +2 -2
- package/date/{type.js → date.js} +1 -1
- package/date/financialYear.d.ts +2 -2
- package/date/financialYear.js +1 -1
- package/date/format.d.ts +1 -1
- package/date/index.d.ts +1 -1
- package/date/index.js +1 -1
- package/environment/environment.d.ts +34 -0
- package/environment/environment.js +79 -0
- package/environment/index.d.ts +1 -34
- package/environment/index.js +1 -79
- package/eskimi/eskimi.d.ts +49 -0
- package/eskimi/eskimi.js +93 -0
- package/eskimi/index.d.ts +1 -49
- package/eskimi/index.js +1 -93
- package/file/getFileKey.js +2 -2
- package/googleAds/keywordPlanner/server/googleAdsKeywordPlanner.d.ts +41 -0
- package/googleAds/keywordPlanner/server/googleAdsKeywordPlanner.js +55 -0
- package/googleAds/keywordPlanner/server/index.d.ts +1 -41
- package/googleAds/keywordPlanner/server/index.js +1 -55
- package/googleAds/server/GoogleAdsNamespace.js +1 -2
- package/googleAds/server/googleAds.d.ts +11 -0
- package/googleAds/server/googleAds.js +26 -0
- package/googleAds/server/index.d.ts +2 -11
- package/googleAds/server/index.js +2 -26
- package/{google/bigquery/server/GoogleBigqueryNamespace.d.ts → googleCloud/bigquery/server/GoogleCloudBigqueryNamespace.d.ts} +1 -1
- package/{google/bigquery/server/GoogleBigqueryNamespace.js → googleCloud/bigquery/server/GoogleCloudBigqueryNamespace.js} +1 -1
- package/googleCloud/bigquery/server/googleCloudBigquery.d.ts +5 -0
- package/{google/bigquery/server/index.js → googleCloud/bigquery/server/googleCloudBigquery.js} +7 -8
- package/googleCloud/bigquery/server/index.d.ts +3 -0
- package/googleCloud/bigquery/server/index.js +3 -0
- package/{google → googleCloud}/bigquery/server/loadData.d.ts +3 -3
- package/{google → googleCloud}/bigquery/server/loadData.js +3 -3
- package/googleCloud/server/index.d.ts +1 -0
- package/googleCloud/server/index.js +1 -0
- package/{google/sheets/server/GoogleSheetsNamespace.d.ts → googleCloud/sheets/server/GoogleCloudSheetsNamespace.d.ts} +1 -1
- package/{google/sheets/server/GoogleSheetsNamespace.js → googleCloud/sheets/server/GoogleCloudSheetsNamespace.js} +1 -1
- package/googleCloud/sheets/server/index.d.ts +1 -0
- package/googleCloud/sheets/server/index.js +1 -0
- package/googleCloud/storage/server/index.d.ts +2 -0
- package/googleCloud/storage/server/index.js +2 -0
- package/googlePageSpeed/server/GooglePageSpeedNamespace.d.ts +1 -1
- package/googlePageSpeed/server/GooglePageSpeedNamespace.js +3 -3
- package/googlePageSpeed/server/googlePageSpeed.d.ts +19 -0
- package/googlePageSpeed/server/googlePageSpeed.js +38 -0
- package/googlePageSpeed/server/index.d.ts +2 -19
- package/googlePageSpeed/server/index.js +2 -38
- package/googleSearchIncidents/server/googleSearchIncidents.d.ts +69 -0
- package/googleSearchIncidents/server/googleSearchIncidents.js +42 -0
- package/googleSearchIncidents/server/index.d.ts +1 -69
- package/googleSearchIncidents/server/index.js +1 -42
- package/greenDomain/server/greenDomain.d.ts +21 -0
- package/greenDomain/server/greenDomain.js +37 -0
- package/greenDomain/server/index.d.ts +1 -21
- package/greenDomain/server/index.js +1 -37
- package/inngest/index.d.ts +1 -7
- package/inngest/index.js +1 -6
- package/inngest/inngest.d.ts +7 -0
- package/inngest/inngest.js +6 -0
- package/littleWarden/server/index.d.ts +2 -30
- package/littleWarden/server/index.js +2 -65
- package/littleWarden/server/littleWarden.d.ts +30 -0
- package/littleWarden/server/littleWarden.js +65 -0
- package/lumar/api/server/buildRequest.d.ts +3 -3
- package/lumar/api/server/buildRequest.js +15 -15
- package/lumar/api/server/index.d.ts +1 -33
- package/lumar/api/server/index.js +1 -24
- package/lumar/api/server/lumarApi.d.ts +36 -0
- package/lumar/api/server/lumarApi.js +24 -0
- package/lumar/graphql/server/columns.d.ts +28 -27
- package/lumar/graphql/server/columns.js +1 -1
- package/lumar/graphql/server/getData.js +1 -2
- package/lumar/graphql/server/index.d.ts +11 -29
- package/lumar/graphql/server/index.js +11 -31
- package/lumar/graphql/server/lumarGraphql.d.ts +27 -0
- package/lumar/graphql/server/lumarGraphql.js +27 -0
- package/lumar/graphql/server/queries/getReportDifferences.d.ts +1 -1
- package/lumar/graphql/server/queries/getReportDifferences.js +2 -2
- package/lumar/graphql/server/reportTemplates.d.ts +67 -66
- package/lumar/graphql/server/reportTemplates.js +1 -1
- package/myTarget/server/index.d.ts +1 -5
- package/myTarget/server/index.js +1 -13
- package/myTarget/server/myTarget.d.ts +5 -0
- package/myTarget/server/myTarget.js +13 -0
- package/nextAuth/index.d.ts +2 -7
- package/nextAuth/index.js +2 -6
- package/nextAuth/nextAuth.d.ts +7 -0
- package/nextAuth/nextAuth.js +6 -0
- package/nextJs/index.d.ts +1 -12
- package/nextJs/index.js +1 -14
- package/nextJs/nextJs.d.ts +12 -0
- package/nextJs/nextJs.js +8 -0
- package/onePassword/server/index.d.ts +2 -7
- package/onePassword/server/index.js +2 -21
- package/onePassword/server/onePassword.d.ts +8 -0
- package/onePassword/server/onePassword.js +21 -0
- package/openAi/server/index.d.ts +2 -5
- package/openAi/server/index.js +2 -26
- package/openAi/server/openAi.d.ts +6 -0
- package/openAi/server/openAi.js +26 -0
- package/package.json +65 -65
- package/prisma/server/index.d.ts +2 -20
- package/prisma/server/index.js +2 -26
- package/prisma/server/prisma.d.ts +20 -0
- package/prisma/server/prisma.js +26 -0
- package/snapchat/server/index.d.ts +2 -7
- package/snapchat/server/index.js +2 -26
- package/snapchat/server/snapchat.d.ts +7 -0
- package/snapchat/server/snapchat.js +26 -0
- package/sorting/index.d.ts +1 -4
- package/sorting/index.js +1 -4
- package/sorting/sorting.d.ts +4 -0
- package/sorting/sorting.js +4 -0
- package/stream/server/index.d.ts +1 -1
- package/stream/server/index.js +1 -1
- package/string/index.d.ts +13 -12
- package/string/index.js +13 -12
- package/swr/client/index.d.ts +1 -42
- package/swr/client/index.js +1 -50
- package/swr/client/swr.d.ts +42 -0
- package/swr/client/swr.js +50 -0
- package/upTimeRobot/server/index.d.ts +2 -38
- package/upTimeRobot/server/index.js +2 -59
- package/upTimeRobot/server/upTimeRobot.d.ts +38 -0
- package/upTimeRobot/server/upTimeRobot.js +59 -0
- package/url/index.d.ts +1 -26
- package/url/index.js +1 -59
- package/url/server/index.d.ts +1 -1
- package/url/server/index.js +1 -1
- package/url/url.d.ts +26 -0
- package/url/url.js +59 -0
- package/util/index.d.ts +7 -7
- package/util/index.js +7 -7
- package/util/isUndefined.js +2 -2
- package/util/server/index.d.ts +4 -4
- package/util/server/index.js +4 -4
- package/webWorker/index.d.ts +1 -8
- package/webWorker/index.js +1 -7
- package/webWorker/webWorker.d.ts +8 -0
- package/webWorker/webWorker.js +7 -0
- package/google/bigquery/server/index.d.ts +0 -6
- package/google/sheets/server/index.d.ts +0 -8
- package/google/sheets/server/index.js +0 -42
- /package/{google/server/index.d.ts → googleCloud/server/googleCloud.d.ts} +0 -0
- /package/{google/server/index.js → googleCloud/server/googleCloud.js} +0 -0
- /package/{google → googleCloud}/sheets/server/getAssociatedData.d.ts +0 -0
- /package/{google → googleCloud}/sheets/server/getAssociatedData.js +0 -0
- /package/{google → googleCloud}/storage/server/GoogleCloudStorageNamespace.d.ts +0 -0
- /package/{google → googleCloud}/storage/server/GoogleCloudStorageNamespace.js +0 -0
- /package/{google/storage/server/index.d.ts → googleCloud/storage/server/googleCloudStorage.d.ts} +0 -0
- /package/{google/storage/server/index.js → googleCloud/storage/server/googleCloudStorage.js} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the Zone based on the username.
|
|
3
|
+
*/
|
|
4
|
+
export const getZone = (auth) => {
|
|
5
|
+
const segments = auth.username.split("-");
|
|
6
|
+
return segments[segments.length - 1];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Return the customer Id based on the username.
|
|
10
|
+
*/
|
|
11
|
+
export const getCustomerId = (auth, prefix) => {
|
|
12
|
+
const segments = auth.username.split("-")[2];
|
|
13
|
+
const customerId = segments[2].replace("hl_", "");
|
|
14
|
+
return (prefix || "") + customerId;
|
|
15
|
+
};
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
apiKey: string;
|
|
3
|
-
host: string;
|
|
4
|
-
port: string;
|
|
5
|
-
username: string;
|
|
6
|
-
password: string;
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Return the Zone based on the username.
|
|
10
|
-
*/
|
|
11
|
-
export declare const getZone: (auth: Auth) => string;
|
|
12
|
-
/**
|
|
13
|
-
* Return the customer Id based on the username.
|
|
14
|
-
*/
|
|
15
|
-
export declare const getCustomerId: (auth: Auth, prefix?: string) => string;
|
|
1
|
+
export * from "./brightData";
|
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Return the Zone based on the username.
|
|
3
|
-
*/
|
|
4
|
-
export const getZone = (auth) => {
|
|
5
|
-
const segments = auth.username.split("-");
|
|
6
|
-
return segments[segments.length - 1];
|
|
7
|
-
};
|
|
8
|
-
/**
|
|
9
|
-
* Return the customer Id based on the username.
|
|
10
|
-
*/
|
|
11
|
-
export const getCustomerId = (auth, prefix) => {
|
|
12
|
-
const segments = auth.username.split("-")[2];
|
|
13
|
-
const customerId = segments[2].replace("hl_", "");
|
|
14
|
-
return (prefix || "") + customerId;
|
|
15
|
-
};
|
|
1
|
+
export * from "./brightData";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { get, post } from "../../../axios";
|
|
2
|
-
import {
|
|
2
|
+
import { apiState } from "../../../api";
|
|
3
3
|
import { sleep } from "../../../util";
|
|
4
4
|
/**
|
|
5
5
|
* Depends on the Scraper setup!
|
|
@@ -17,8 +17,8 @@ export const getRealtime = async (auth, scraperId, data = {}) => {
|
|
|
17
17
|
if (requestResponse.isSuccess()) {
|
|
18
18
|
const responseId = requestResponse.getBodyDefaultTo(["response_id"], "");
|
|
19
19
|
if ("" !== responseId) {
|
|
20
|
-
let state =
|
|
21
|
-
while (
|
|
20
|
+
let state = apiState.PENDING;
|
|
21
|
+
while (apiState.PENDING === state) {
|
|
22
22
|
const resultUrl = `https://api.brightdata.com/dca/get_result?response_id=${responseId}`;
|
|
23
23
|
// Use fetch with the agent option to make an HTTP request through the proxy
|
|
24
24
|
// Replace <target_url> with the URL you want to request
|
|
@@ -30,10 +30,10 @@ export const getRealtime = async (auth, scraperId, data = {}) => {
|
|
|
30
30
|
if (resultResponse.isSuccess()) {
|
|
31
31
|
if (undefined !== resultResponse.body.pending &&
|
|
32
32
|
true === resultResponse.body.pending) {
|
|
33
|
-
state =
|
|
33
|
+
state = apiState.PENDING;
|
|
34
34
|
}
|
|
35
35
|
else {
|
|
36
|
-
state =
|
|
36
|
+
state = apiState.SUCCESS;
|
|
37
37
|
response = resultResponse.getBody();
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from "./getBatch";
|
|
2
|
+
export * from "./getRealtime";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from "./getBatch";
|
|
2
|
+
export * from "./getRealtime";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const cache = new Map();
|
|
2
|
+
export const getCache = (key) => {
|
|
3
|
+
let response = null;
|
|
4
|
+
if (cache.has(key)) {
|
|
5
|
+
const cacheItem = cache.get(key);
|
|
6
|
+
// Timed expiry
|
|
7
|
+
if (cacheItem.expires > 0) {
|
|
8
|
+
// https://ui.dev/get-current-timestamp-javascript
|
|
9
|
+
const expiresAt = Math.floor(cacheItem.insertedAt / 1000) + cacheItem.expires;
|
|
10
|
+
const now = Math.floor(Date.now() / 1000);
|
|
11
|
+
// If we are now beyond the expiry date, update the data
|
|
12
|
+
if (now < expiresAt) {
|
|
13
|
+
response = cacheItem;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
// 0 - Never expires
|
|
17
|
+
else {
|
|
18
|
+
response = cacheItem;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return response;
|
|
22
|
+
};
|
|
23
|
+
export const setCache = (key, data, expires = 0, force = false) => {
|
|
24
|
+
const now = Math.floor(Date.now() / 1000);
|
|
25
|
+
if (cache.has(key) && !force) {
|
|
26
|
+
const cacheItem = cache.get(key);
|
|
27
|
+
// 0 - Never expires
|
|
28
|
+
if (cacheItem.expires > 0) {
|
|
29
|
+
// https://ui.dev/get-current-timestamp-javascript
|
|
30
|
+
const expiresAt = Math.floor(cacheItem.insertedAt / 1000) + cacheItem.expires;
|
|
31
|
+
// If we are now beyond the expiry date, update the data
|
|
32
|
+
if (now < expiresAt) {
|
|
33
|
+
return cacheItem;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
cache.set(key, {
|
|
38
|
+
data,
|
|
39
|
+
expires,
|
|
40
|
+
insertedAt: now,
|
|
41
|
+
});
|
|
42
|
+
return data;
|
|
43
|
+
};
|
package/cache/server/index.d.ts
CHANGED
|
@@ -1,7 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
data: any;
|
|
3
|
-
expires: number;
|
|
4
|
-
insertedAt: number;
|
|
5
|
-
};
|
|
6
|
-
export declare const getCache: (key: string) => any;
|
|
7
|
-
export declare const setCache: (key: string, data: any, expires?: number, force?: boolean) => any;
|
|
1
|
+
export * from "./cache";
|
package/cache/server/index.js
CHANGED
|
@@ -1,43 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const getCache = (key) => {
|
|
3
|
-
let response = null;
|
|
4
|
-
if (cache.has(key)) {
|
|
5
|
-
const cacheItem = cache.get(key);
|
|
6
|
-
// Timed expiry
|
|
7
|
-
if (cacheItem.expires > 0) {
|
|
8
|
-
// https://ui.dev/get-current-timestamp-javascript
|
|
9
|
-
const expiresAt = Math.floor(cacheItem.insertedAt / 1000) + cacheItem.expires;
|
|
10
|
-
const now = Math.floor(Date.now() / 1000);
|
|
11
|
-
// If we are now beyond the expiry date, update the data
|
|
12
|
-
if (now < expiresAt) {
|
|
13
|
-
response = cacheItem;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
// 0 - Never expires
|
|
17
|
-
else {
|
|
18
|
-
response = cacheItem;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return response;
|
|
22
|
-
};
|
|
23
|
-
export const setCache = (key, data, expires = 0, force = false) => {
|
|
24
|
-
const now = Math.floor(Date.now() / 1000);
|
|
25
|
-
if (cache.has(key) && !force) {
|
|
26
|
-
const cacheItem = cache.get(key);
|
|
27
|
-
// 0 - Never expires
|
|
28
|
-
if (cacheItem.expires > 0) {
|
|
29
|
-
// https://ui.dev/get-current-timestamp-javascript
|
|
30
|
-
const expiresAt = Math.floor(cacheItem.insertedAt / 1000) + cacheItem.expires;
|
|
31
|
-
// If we are now beyond the expiry date, update the data
|
|
32
|
-
if (now < expiresAt) {
|
|
33
|
-
return cacheItem;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
cache.set(key, {
|
|
38
|
-
data,
|
|
39
|
-
expires,
|
|
40
|
-
insertedAt: now,
|
|
41
|
-
});
|
|
42
|
-
return data;
|
|
43
|
-
};
|
|
1
|
+
export * from "./cache";
|
package/crud/crud.d.ts
ADDED
package/crud/crud.js
ADDED
package/crud/index.d.ts
CHANGED
package/crud/index.js
CHANGED
package/crypto/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export * from "./getDecrypt";
|
|
2
|
+
export * from "./getEncrypt";
|
|
3
|
+
export * from "./getRandom";
|
|
4
|
+
export * from "./getSha256";
|
package/crypto/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export * from "./getDecrypt";
|
|
2
|
+
export * from "./getEncrypt";
|
|
3
|
+
export * from "./getRandom";
|
|
4
|
+
export * from "./getSha256";
|
package/date/calculation.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { DateTime } from "luxon";
|
|
2
|
-
import { InputDate, Timeframe } from "./
|
|
2
|
+
import { InputDate, Timeframe } from "./date";
|
|
3
|
+
/**
|
|
4
|
+
* Return unix timestamp in seconds.
|
|
5
|
+
*/
|
|
3
6
|
export declare const getUnix: (input?: InputDate) => number;
|
|
4
7
|
/**
|
|
5
8
|
* Assume the input is always UTC.
|
package/date/calculation.js
CHANGED
|
@@ -19,7 +19,7 @@ export declare const defaultDateTime: "1901-01-01 00:00:00";
|
|
|
19
19
|
/**
|
|
20
20
|
* Used by Google Ads API.
|
|
21
21
|
*/
|
|
22
|
-
export declare const
|
|
22
|
+
export declare const month: {
|
|
23
23
|
readonly JANUARY: "JANUARY";
|
|
24
24
|
readonly FEBRUARY: "FEBRUARY";
|
|
25
25
|
readonly MARCH: "MARCH";
|
|
@@ -33,4 +33,4 @@ export declare const Month: {
|
|
|
33
33
|
readonly NOVEMBER: "NOVEMBER";
|
|
34
34
|
readonly DECEMBER: "DECEMBER";
|
|
35
35
|
};
|
|
36
|
-
export type Month = typeof
|
|
36
|
+
export type Month = typeof month[keyof typeof month];
|
package/date/{type.js → date.js}
RENAMED
package/date/financialYear.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Timeframe } from "./
|
|
1
|
+
import { Timeframe } from "./date";
|
|
2
2
|
import { Interval } from "luxon";
|
|
3
3
|
/**
|
|
4
|
-
* Get the
|
|
4
|
+
* Get the financial year based on an optional year.
|
|
5
5
|
*/
|
|
6
6
|
export declare const getFinancialYear: (year?: number) => Timeframe;
|
|
7
7
|
/**
|
package/date/financialYear.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getLuxonDate, getToday, getYesterday } from "./calculation";
|
|
2
2
|
import { Interval } from "luxon";
|
|
3
3
|
/**
|
|
4
|
-
* Get the
|
|
4
|
+
* Get the financial year based on an optional year.
|
|
5
5
|
*/
|
|
6
6
|
export const getFinancialYear = (year) => {
|
|
7
7
|
// Either use the current year or a specified year
|
package/date/format.d.ts
CHANGED
package/date/index.d.ts
CHANGED
package/date/index.js
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export declare const environment: {
|
|
2
|
+
readonly DEVELOPMENT: "development";
|
|
3
|
+
readonly STAGING: "staging";
|
|
4
|
+
readonly PRODUCTION: "production";
|
|
5
|
+
};
|
|
6
|
+
export type Environment = typeof environment[keyof typeof environment];
|
|
7
|
+
export declare const platform: {
|
|
8
|
+
readonly AWS: "AWS";
|
|
9
|
+
readonly VERCEL: "VERCEL";
|
|
10
|
+
};
|
|
11
|
+
export type Platform = typeof platform[keyof typeof platform];
|
|
12
|
+
/**
|
|
13
|
+
* Determine the environment we're using.
|
|
14
|
+
*/
|
|
15
|
+
export declare const getEnvironment: () => Environment;
|
|
16
|
+
/**
|
|
17
|
+
* Check to see if we are working on AWS Lambda.
|
|
18
|
+
*/
|
|
19
|
+
export declare const isAws: () => boolean;
|
|
20
|
+
export declare const isVercel: () => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Some code should only run on the server side to protect the data.
|
|
23
|
+
*/
|
|
24
|
+
export declare const isServer: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Check the environment currently running.
|
|
27
|
+
*/
|
|
28
|
+
export declare const isDevelopment: () => boolean;
|
|
29
|
+
export declare const isStaging: () => boolean;
|
|
30
|
+
export declare const isProduction: () => boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Check to see if we are developing locally or on the hosted platform.
|
|
33
|
+
*/
|
|
34
|
+
export declare const isLocalhost: () => boolean;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export const environment = {
|
|
2
|
+
DEVELOPMENT: "development",
|
|
3
|
+
STAGING: "staging",
|
|
4
|
+
PRODUCTION: "production",
|
|
5
|
+
};
|
|
6
|
+
export const platform = {
|
|
7
|
+
AWS: "AWS",
|
|
8
|
+
VERCEL: "VERCEL",
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Determine the environment we're using.
|
|
12
|
+
*/
|
|
13
|
+
export const getEnvironment = () => {
|
|
14
|
+
let platformEnvironment = process.env.ENVIRONMENT;
|
|
15
|
+
let response;
|
|
16
|
+
// Custom - Backend/AWS
|
|
17
|
+
if (process.env.EMS_ENVIRONMENT) {
|
|
18
|
+
platformEnvironment = process.env.EMS_ENVIRONMENT;
|
|
19
|
+
}
|
|
20
|
+
// Custom - Frontend
|
|
21
|
+
else if (process.env.NEXT_PUBLIC_EMS_ENVIRONMENT) {
|
|
22
|
+
platformEnvironment = process.env.NEXT_PUBLIC_EMS_ENVIRONMENT;
|
|
23
|
+
}
|
|
24
|
+
// Vercel - Frontend
|
|
25
|
+
else if (process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF) {
|
|
26
|
+
platformEnvironment = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF;
|
|
27
|
+
}
|
|
28
|
+
// Vercel - Backend
|
|
29
|
+
else if (process.env.VERCEL_GIT_COMMIT_REF) {
|
|
30
|
+
platformEnvironment = process.env.VERCEL_GIT_COMMIT_REF;
|
|
31
|
+
}
|
|
32
|
+
const platformEnvironmentClean = platformEnvironment
|
|
33
|
+
.toLowerCase()
|
|
34
|
+
.trim();
|
|
35
|
+
switch (platformEnvironmentClean) {
|
|
36
|
+
case "production":
|
|
37
|
+
response = environment.PRODUCTION;
|
|
38
|
+
break;
|
|
39
|
+
case "demo":
|
|
40
|
+
case "preview":
|
|
41
|
+
case "staging":
|
|
42
|
+
response = environment.STAGING;
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
response = environment.DEVELOPMENT;
|
|
46
|
+
}
|
|
47
|
+
return response;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Check to see if we are working on AWS Lambda.
|
|
51
|
+
*/
|
|
52
|
+
export const isAws = () => platform.AWS === process.env["EMS_PLATFORM"];
|
|
53
|
+
export const isVercel = () => undefined !== process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF;
|
|
54
|
+
/**
|
|
55
|
+
* Some code should only run on the server side to protect the data.
|
|
56
|
+
*/
|
|
57
|
+
export const isServer = typeof window === "undefined";
|
|
58
|
+
/**
|
|
59
|
+
* Check the environment currently running.
|
|
60
|
+
*/
|
|
61
|
+
export const isDevelopment = () => environment.DEVELOPMENT === getEnvironment();
|
|
62
|
+
export const isStaging = () => environment.STAGING === getEnvironment();
|
|
63
|
+
export const isProduction = () => environment.PRODUCTION === getEnvironment();
|
|
64
|
+
/**
|
|
65
|
+
* Check to see if we are developing locally or on the hosted platform.
|
|
66
|
+
*/
|
|
67
|
+
export const isLocalhost = () => {
|
|
68
|
+
if ("true" === process.env["IS_LOCAL"]) {
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
if (isAws()) {
|
|
72
|
+
return "true" === process.env["AWS_SAM_LOCAL"];
|
|
73
|
+
}
|
|
74
|
+
// This value needs to only be included in Vercel but undefined in locally
|
|
75
|
+
if (isVercel()) {
|
|
76
|
+
return undefined === process.env["NEXT_PUBLIC_VERCEL_GIT_REPO_ID"];
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
};
|
package/environment/index.d.ts
CHANGED
|
@@ -1,34 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
readonly DEVELOPMENT: "development";
|
|
3
|
-
readonly STAGING: "staging";
|
|
4
|
-
readonly PRODUCTION: "production";
|
|
5
|
-
};
|
|
6
|
-
export type Environment = typeof Environment[keyof typeof Environment];
|
|
7
|
-
export declare const Platform: {
|
|
8
|
-
readonly AWS: "AWS";
|
|
9
|
-
readonly VERCEL: "VERCEL";
|
|
10
|
-
};
|
|
11
|
-
export type Platform = typeof Platform[keyof typeof Platform];
|
|
12
|
-
/**
|
|
13
|
-
* Determine the environment we're using.
|
|
14
|
-
*/
|
|
15
|
-
export declare const getEnvironment: () => Environment;
|
|
16
|
-
/**
|
|
17
|
-
* Check to see if we are working on AWS Lambda.
|
|
18
|
-
*/
|
|
19
|
-
export declare const isAws: () => boolean;
|
|
20
|
-
export declare const isVercel: () => boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Some code should only run on the server side to protect the data.
|
|
23
|
-
*/
|
|
24
|
-
export declare const isServer: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Check the environment currently running.
|
|
27
|
-
*/
|
|
28
|
-
export declare const isDevelopment: () => boolean;
|
|
29
|
-
export declare const isStaging: () => boolean;
|
|
30
|
-
export declare const isProduction: () => boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Check to see if we are developing locally or on the hosted platform.
|
|
33
|
-
*/
|
|
34
|
-
export declare const isLocalhost: () => boolean;
|
|
1
|
+
export * from "./environment";
|
package/environment/index.js
CHANGED
|
@@ -1,79 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
DEVELOPMENT: "development",
|
|
3
|
-
STAGING: "staging",
|
|
4
|
-
PRODUCTION: "production",
|
|
5
|
-
};
|
|
6
|
-
export const Platform = {
|
|
7
|
-
AWS: "AWS",
|
|
8
|
-
VERCEL: "VERCEL",
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Determine the environment we're using.
|
|
12
|
-
*/
|
|
13
|
-
export const getEnvironment = () => {
|
|
14
|
-
let platformEnvironment = process.env.ENVIRONMENT;
|
|
15
|
-
let response;
|
|
16
|
-
// Custom - Backend/AWS
|
|
17
|
-
if (process.env.EMS_ENVIRONMENT) {
|
|
18
|
-
platformEnvironment = process.env.EMS_ENVIRONMENT;
|
|
19
|
-
}
|
|
20
|
-
// Custom - Frontend
|
|
21
|
-
else if (process.env.NEXT_PUBLIC_EMS_ENVIRONMENT) {
|
|
22
|
-
platformEnvironment = process.env.NEXT_PUBLIC_EMS_ENVIRONMENT;
|
|
23
|
-
}
|
|
24
|
-
// Vercel - Frontend
|
|
25
|
-
else if (process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF) {
|
|
26
|
-
platformEnvironment = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF;
|
|
27
|
-
}
|
|
28
|
-
// Vercel - Backend
|
|
29
|
-
else if (process.env.VERCEL_GIT_COMMIT_REF) {
|
|
30
|
-
platformEnvironment = process.env.VERCEL_GIT_COMMIT_REF;
|
|
31
|
-
}
|
|
32
|
-
const platformEnvironmentClean = platformEnvironment
|
|
33
|
-
.toLowerCase()
|
|
34
|
-
.trim();
|
|
35
|
-
switch (platformEnvironmentClean) {
|
|
36
|
-
case "production":
|
|
37
|
-
response = Environment.PRODUCTION;
|
|
38
|
-
break;
|
|
39
|
-
case "demo":
|
|
40
|
-
case "preview":
|
|
41
|
-
case "staging":
|
|
42
|
-
response = Environment.STAGING;
|
|
43
|
-
break;
|
|
44
|
-
default:
|
|
45
|
-
response = Environment.DEVELOPMENT;
|
|
46
|
-
}
|
|
47
|
-
return response;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Check to see if we are working on AWS Lambda.
|
|
51
|
-
*/
|
|
52
|
-
export const isAws = () => Platform.AWS === process.env["EMS_PLATFORM"];
|
|
53
|
-
export const isVercel = () => undefined !== process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF;
|
|
54
|
-
/**
|
|
55
|
-
* Some code should only run on the server side to protect the data.
|
|
56
|
-
*/
|
|
57
|
-
export const isServer = typeof window === "undefined";
|
|
58
|
-
/**
|
|
59
|
-
* Check the environment currently running.
|
|
60
|
-
*/
|
|
61
|
-
export const isDevelopment = () => Environment.DEVELOPMENT === getEnvironment();
|
|
62
|
-
export const isStaging = () => Environment.STAGING === getEnvironment();
|
|
63
|
-
export const isProduction = () => Environment.PRODUCTION === getEnvironment();
|
|
64
|
-
/**
|
|
65
|
-
* Check to see if we are developing locally or on the hosted platform.
|
|
66
|
-
*/
|
|
67
|
-
export const isLocalhost = () => {
|
|
68
|
-
if ("true" === process.env["IS_LOCAL"]) {
|
|
69
|
-
return true;
|
|
70
|
-
}
|
|
71
|
-
if (isAws()) {
|
|
72
|
-
return "true" === process.env["AWS_SAM_LOCAL"];
|
|
73
|
-
}
|
|
74
|
-
// This value needs to only be included in Vercel but undefined in locally
|
|
75
|
-
if (isVercel()) {
|
|
76
|
-
return undefined === process.env["NEXT_PUBLIC_VERCEL_GIT_REPO_ID"];
|
|
77
|
-
}
|
|
78
|
-
return false;
|
|
79
|
-
};
|
|
1
|
+
export * from "./environment";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { z } from "zod/v4";
|
|
2
|
+
/**
|
|
3
|
+
* https://dsp-api.eskimi.com/docs/api/v1/#api-Report-GetCampaignReportByAgeGroups
|
|
4
|
+
*/
|
|
5
|
+
export declare const endpoints: {
|
|
6
|
+
campaign: {
|
|
7
|
+
age: string;
|
|
8
|
+
gender: string;
|
|
9
|
+
list: string;
|
|
10
|
+
performance: string;
|
|
11
|
+
video: string;
|
|
12
|
+
};
|
|
13
|
+
site: {
|
|
14
|
+
list: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
declare const campaignSchema: z.ZodObject<{
|
|
18
|
+
id: z.ZodNumber;
|
|
19
|
+
name: z.ZodString;
|
|
20
|
+
type: z.ZodNumber;
|
|
21
|
+
user_id: z.ZodNumber;
|
|
22
|
+
ad_domain: z.ZodString;
|
|
23
|
+
click_url: z.ZodString;
|
|
24
|
+
bid: z.ZodString;
|
|
25
|
+
budget: z.ZodAny;
|
|
26
|
+
dates: z.ZodAny;
|
|
27
|
+
creative_set_ids: z.ZodAny;
|
|
28
|
+
audience_ids: z.ZodAny;
|
|
29
|
+
ad_placement_type_ids: z.ZodAny;
|
|
30
|
+
ad_placement_position_ids: z.ZodAny;
|
|
31
|
+
operator_ids: z.ZodAny;
|
|
32
|
+
devices: z.ZodAny;
|
|
33
|
+
auto_start: z.ZodNumber;
|
|
34
|
+
created_at: z.ZodString;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type CampaignSchemaType = z.infer<typeof campaignSchema>;
|
|
37
|
+
export declare const ageGroups: {
|
|
38
|
+
id: number;
|
|
39
|
+
name: string;
|
|
40
|
+
}[];
|
|
41
|
+
export declare const devices: {
|
|
42
|
+
id: number;
|
|
43
|
+
name: string;
|
|
44
|
+
}[];
|
|
45
|
+
export declare const genders: {
|
|
46
|
+
id: number;
|
|
47
|
+
name: string;
|
|
48
|
+
}[];
|
|
49
|
+
export {};
|