update dist
This commit is contained in:
parent
a7f2b07c00
commit
2a61704a0d
25
dist/utils/date.util.cjs
vendored
25
dist/utils/date.util.cjs
vendored
@ -22,6 +22,9 @@ __export(date_util_exports, {
|
||||
ONE_DAY: () => ONE_DAY,
|
||||
daysBetween: () => daysBetween,
|
||||
formatDate: () => formatDate,
|
||||
getDayBegin: () => getDayBegin,
|
||||
getMonthBegin: () => getMonthBegin,
|
||||
getNDayAgo: () => getNDayAgo,
|
||||
nextday: () => nextday,
|
||||
yesterday: () => yesterday
|
||||
});
|
||||
@ -48,11 +51,33 @@ function daysBetween(date1, date2) {
|
||||
const diffInDays = Math.round(diffInMs / ONE_DAY);
|
||||
return diffInDays;
|
||||
}
|
||||
var getDayBegin = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth();
|
||||
const day = date.getDate();
|
||||
return new Date(year, month, day);
|
||||
};
|
||||
var getNDayAgo = (n, begin) => {
|
||||
const date = new Date(Date.now() - n * 24 * 60 * 60 * 1e3);
|
||||
if (begin) {
|
||||
return getDayBegin(date);
|
||||
} else {
|
||||
return date;
|
||||
}
|
||||
};
|
||||
var getMonthBegin = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth();
|
||||
return new Date(year, month, 1);
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
ONE_DAY,
|
||||
daysBetween,
|
||||
formatDate,
|
||||
getDayBegin,
|
||||
getMonthBegin,
|
||||
getNDayAgo,
|
||||
nextday,
|
||||
yesterday
|
||||
});
|
||||
|
2
dist/utils/date.util.cjs.map
vendored
2
dist/utils/date.util.cjs.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"sources":["../../src/utils/date.util.ts"],"sourcesContent":["export const ONE_DAY = 24 * 60 * 60 * 1000\n\n// format the date to the format we want\nexport const formatDate = (date: Date): string => {\n const year = date.getFullYear()\n const month = (date.getMonth() + 1 + '').padStart(2, '0')\n const day = (date.getDate() + '').padStart(2, '0')\n return `${year}${month}${day}`\n}\n\n// get formated datestring of yesterday\nexport const yesterday = (date?: Date) => {\n date = date || new Date()\n date.setDate(date.getDate() - 1)\n return date\n}\n\nexport const nextday = (date?: Date) => {\n date = date || new Date()\n date.setDate(date.getDate() + 1)\n return date\n}\n\n// calc days between two Date\nexport function daysBetween(date1: Date, date2: Date) {\n // hours*minutes*seconds*milliseconds\n const diffInMs = Math.abs(date1.getTime() - date2.getTime())\n const diffInDays = Math.round(diffInMs / ONE_DAY)\n return diffInDays\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,UAAU,KAAK,KAAK,KAAK;AAG/B,IAAM,aAAa,CAAC,SAAuB;AAChD,QAAM,OAAO,KAAK,YAAY;AAC9B,QAAM,SAAS,KAAK,SAAS,IAAI,IAAI,IAAI,SAAS,GAAG,GAAG;AACxD,QAAM,OAAO,KAAK,QAAQ,IAAI,IAAI,SAAS,GAAG,GAAG;AACjD,SAAO,GAAG,IAAI,GAAG,KAAK,GAAG,GAAG;AAC9B;AAGO,IAAM,YAAY,CAAC,SAAgB;AACxC,SAAO,QAAQ,oBAAI,KAAK;AACxB,OAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAC/B,SAAO;AACT;AAEO,IAAM,UAAU,CAAC,SAAgB;AACtC,SAAO,QAAQ,oBAAI,KAAK;AACxB,OAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAC/B,SAAO;AACT;AAGO,SAAS,YAAY,OAAa,OAAa;AAEpD,QAAM,WAAW,KAAK,IAAI,MAAM,QAAQ,IAAI,MAAM,QAAQ,CAAC;AAC3D,QAAM,aAAa,KAAK,MAAM,WAAW,OAAO;AAChD,SAAO;AACT;","names":[]}
|
||||
{"version":3,"sources":["../../src/utils/date.util.ts"],"sourcesContent":["export const ONE_DAY = 24 * 60 * 60 * 1000\n\n// format the date to the format we want\nexport const formatDate = (date: Date): string => {\n const year = date.getFullYear()\n const month = (date.getMonth() + 1 + '').padStart(2, '0')\n const day = (date.getDate() + '').padStart(2, '0')\n return `${year}${month}${day}`\n}\n\n// get formated datestring of yesterday\nexport const yesterday = (date?: Date) => {\n date = date || new Date()\n date.setDate(date.getDate() - 1)\n return date\n}\n\nexport const nextday = (date?: Date) => {\n date = date || new Date()\n date.setDate(date.getDate() + 1)\n return date\n}\n\n// calc days between two Date\nexport function daysBetween(date1: Date, date2: Date) {\n // hours*minutes*seconds*milliseconds\n const diffInMs = Math.abs(date1.getTime() - date2.getTime())\n const diffInDays = Math.round(diffInMs / ONE_DAY)\n return diffInDays\n}\n\n// get begin of one day\nexport const getDayBegin = (date: Date): Date => {\n const year = date.getFullYear()\n const month = date.getMonth()\n const day = date.getDate()\n return new Date(year, month, day)\n}\n\n// get begin of n day ago\nexport const getNDayAgo = (n: number, begin: boolean): Date => {\n const date = new Date(Date.now() - n * 24 * 60 * 60 * 1000)\n if (begin) {\n return getDayBegin(date)\n } else {\n return date\n }\n}\n\n// get begin of this month\nexport const getMonthBegin = (date: Date): Date => {\n const year = date.getFullYear()\n const month = date.getMonth()\n return new Date(year, month, 1)\n}"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,UAAU,KAAK,KAAK,KAAK;AAG/B,IAAM,aAAa,CAAC,SAAuB;AAChD,QAAM,OAAO,KAAK,YAAY;AAC9B,QAAM,SAAS,KAAK,SAAS,IAAI,IAAI,IAAI,SAAS,GAAG,GAAG;AACxD,QAAM,OAAO,KAAK,QAAQ,IAAI,IAAI,SAAS,GAAG,GAAG;AACjD,SAAO,GAAG,IAAI,GAAG,KAAK,GAAG,GAAG;AAC9B;AAGO,IAAM,YAAY,CAAC,SAAgB;AACxC,SAAO,QAAQ,oBAAI,KAAK;AACxB,OAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAC/B,SAAO;AACT;AAEO,IAAM,UAAU,CAAC,SAAgB;AACtC,SAAO,QAAQ,oBAAI,KAAK;AACxB,OAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAC/B,SAAO;AACT;AAGO,SAAS,YAAY,OAAa,OAAa;AAEpD,QAAM,WAAW,KAAK,IAAI,MAAM,QAAQ,IAAI,MAAM,QAAQ,CAAC;AAC3D,QAAM,aAAa,KAAK,MAAM,WAAW,OAAO;AAChD,SAAO;AACT;AAGO,IAAM,cAAc,CAAC,SAAqB;AAC/C,QAAM,OAAO,KAAK,YAAY;AAC9B,QAAM,QAAQ,KAAK,SAAS;AAC5B,QAAM,MAAM,KAAK,QAAQ;AACzB,SAAO,IAAI,KAAK,MAAM,OAAO,GAAG;AAClC;AAGO,IAAM,aAAa,CAAC,GAAW,UAAyB;AAC7D,QAAM,OAAO,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,KAAK,GAAI;AAC1D,MAAI,OAAO;AACT,WAAO,YAAY,IAAI;AAAA,EACzB,OAAO;AACL,WAAO;AAAA,EACT;AACF;AAGO,IAAM,gBAAgB,CAAC,SAAqB;AACjD,QAAM,OAAO,KAAK,YAAY;AAC9B,QAAM,QAAQ,KAAK,SAAS;AAC5B,SAAO,IAAI,KAAK,MAAM,OAAO,CAAC;AAChC;","names":[]}
|
5
dist/utils/date.util.d.cts
vendored
5
dist/utils/date.util.d.cts
vendored
@ -3,5 +3,8 @@ declare const formatDate: (date: Date) => string;
|
||||
declare const yesterday: (date?: Date) => Date;
|
||||
declare const nextday: (date?: Date) => Date;
|
||||
declare function daysBetween(date1: Date, date2: Date): number;
|
||||
declare const getDayBegin: (date: Date) => Date;
|
||||
declare const getNDayAgo: (n: number, begin: boolean) => Date;
|
||||
declare const getMonthBegin: (date: Date) => Date;
|
||||
|
||||
export { ONE_DAY, daysBetween, formatDate, nextday, yesterday };
|
||||
export { ONE_DAY, daysBetween, formatDate, getDayBegin, getMonthBegin, getNDayAgo, nextday, yesterday };
|
||||
|
5
dist/utils/date.util.d.ts
vendored
5
dist/utils/date.util.d.ts
vendored
@ -3,5 +3,8 @@ declare const formatDate: (date: Date) => string;
|
||||
declare const yesterday: (date?: Date) => Date;
|
||||
declare const nextday: (date?: Date) => Date;
|
||||
declare function daysBetween(date1: Date, date2: Date): number;
|
||||
declare const getDayBegin: (date: Date) => Date;
|
||||
declare const getNDayAgo: (n: number, begin: boolean) => Date;
|
||||
declare const getMonthBegin: (date: Date) => Date;
|
||||
|
||||
export { ONE_DAY, daysBetween, formatDate, nextday, yesterday };
|
||||
export { ONE_DAY, daysBetween, formatDate, getDayBegin, getMonthBegin, getNDayAgo, nextday, yesterday };
|
||||
|
22
dist/utils/date.util.js
vendored
22
dist/utils/date.util.js
vendored
@ -21,10 +21,32 @@ function daysBetween(date1, date2) {
|
||||
const diffInDays = Math.round(diffInMs / ONE_DAY);
|
||||
return diffInDays;
|
||||
}
|
||||
var getDayBegin = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth();
|
||||
const day = date.getDate();
|
||||
return new Date(year, month, day);
|
||||
};
|
||||
var getNDayAgo = (n, begin) => {
|
||||
const date = new Date(Date.now() - n * 24 * 60 * 60 * 1e3);
|
||||
if (begin) {
|
||||
return getDayBegin(date);
|
||||
} else {
|
||||
return date;
|
||||
}
|
||||
};
|
||||
var getMonthBegin = (date) => {
|
||||
const year = date.getFullYear();
|
||||
const month = date.getMonth();
|
||||
return new Date(year, month, 1);
|
||||
};
|
||||
export {
|
||||
ONE_DAY,
|
||||
daysBetween,
|
||||
formatDate,
|
||||
getDayBegin,
|
||||
getMonthBegin,
|
||||
getNDayAgo,
|
||||
nextday,
|
||||
yesterday
|
||||
};
|
||||
|
2
dist/utils/date.util.js.map
vendored
2
dist/utils/date.util.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"sources":["../../src/utils/date.util.ts"],"sourcesContent":["export const ONE_DAY = 24 * 60 * 60 * 1000\n\n// format the date to the format we want\nexport const formatDate = (date: Date): string => {\n const year = date.getFullYear()\n const month = (date.getMonth() + 1 + '').padStart(2, '0')\n const day = (date.getDate() + '').padStart(2, '0')\n return `${year}${month}${day}`\n}\n\n// get formated datestring of yesterday\nexport const yesterday = (date?: Date) => {\n date = date || new Date()\n date.setDate(date.getDate() - 1)\n return date\n}\n\nexport const nextday = (date?: Date) => {\n date = date || new Date()\n date.setDate(date.getDate() + 1)\n return date\n}\n\n// calc days between two Date\nexport function daysBetween(date1: Date, date2: Date) {\n // hours*minutes*seconds*milliseconds\n const diffInMs = Math.abs(date1.getTime() - date2.getTime())\n const diffInDays = Math.round(diffInMs / ONE_DAY)\n return diffInDays\n}\n"],"mappings":";AAAO,IAAM,UAAU,KAAK,KAAK,KAAK;AAG/B,IAAM,aAAa,CAAC,SAAuB;AAChD,QAAM,OAAO,KAAK,YAAY;AAC9B,QAAM,SAAS,KAAK,SAAS,IAAI,IAAI,IAAI,SAAS,GAAG,GAAG;AACxD,QAAM,OAAO,KAAK,QAAQ,IAAI,IAAI,SAAS,GAAG,GAAG;AACjD,SAAO,GAAG,IAAI,GAAG,KAAK,GAAG,GAAG;AAC9B;AAGO,IAAM,YAAY,CAAC,SAAgB;AACxC,SAAO,QAAQ,oBAAI,KAAK;AACxB,OAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAC/B,SAAO;AACT;AAEO,IAAM,UAAU,CAAC,SAAgB;AACtC,SAAO,QAAQ,oBAAI,KAAK;AACxB,OAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAC/B,SAAO;AACT;AAGO,SAAS,YAAY,OAAa,OAAa;AAEpD,QAAM,WAAW,KAAK,IAAI,MAAM,QAAQ,IAAI,MAAM,QAAQ,CAAC;AAC3D,QAAM,aAAa,KAAK,MAAM,WAAW,OAAO;AAChD,SAAO;AACT;","names":[]}
|
||||
{"version":3,"sources":["../../src/utils/date.util.ts"],"sourcesContent":["export const ONE_DAY = 24 * 60 * 60 * 1000\n\n// format the date to the format we want\nexport const formatDate = (date: Date): string => {\n const year = date.getFullYear()\n const month = (date.getMonth() + 1 + '').padStart(2, '0')\n const day = (date.getDate() + '').padStart(2, '0')\n return `${year}${month}${day}`\n}\n\n// get formated datestring of yesterday\nexport const yesterday = (date?: Date) => {\n date = date || new Date()\n date.setDate(date.getDate() - 1)\n return date\n}\n\nexport const nextday = (date?: Date) => {\n date = date || new Date()\n date.setDate(date.getDate() + 1)\n return date\n}\n\n// calc days between two Date\nexport function daysBetween(date1: Date, date2: Date) {\n // hours*minutes*seconds*milliseconds\n const diffInMs = Math.abs(date1.getTime() - date2.getTime())\n const diffInDays = Math.round(diffInMs / ONE_DAY)\n return diffInDays\n}\n\n// get begin of one day\nexport const getDayBegin = (date: Date): Date => {\n const year = date.getFullYear()\n const month = date.getMonth()\n const day = date.getDate()\n return new Date(year, month, day)\n}\n\n// get begin of n day ago\nexport const getNDayAgo = (n: number, begin: boolean): Date => {\n const date = new Date(Date.now() - n * 24 * 60 * 60 * 1000)\n if (begin) {\n return getDayBegin(date)\n } else {\n return date\n }\n}\n\n// get begin of this month\nexport const getMonthBegin = (date: Date): Date => {\n const year = date.getFullYear()\n const month = date.getMonth()\n return new Date(year, month, 1)\n}"],"mappings":";AAAO,IAAM,UAAU,KAAK,KAAK,KAAK;AAG/B,IAAM,aAAa,CAAC,SAAuB;AAChD,QAAM,OAAO,KAAK,YAAY;AAC9B,QAAM,SAAS,KAAK,SAAS,IAAI,IAAI,IAAI,SAAS,GAAG,GAAG;AACxD,QAAM,OAAO,KAAK,QAAQ,IAAI,IAAI,SAAS,GAAG,GAAG;AACjD,SAAO,GAAG,IAAI,GAAG,KAAK,GAAG,GAAG;AAC9B;AAGO,IAAM,YAAY,CAAC,SAAgB;AACxC,SAAO,QAAQ,oBAAI,KAAK;AACxB,OAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAC/B,SAAO;AACT;AAEO,IAAM,UAAU,CAAC,SAAgB;AACtC,SAAO,QAAQ,oBAAI,KAAK;AACxB,OAAK,QAAQ,KAAK,QAAQ,IAAI,CAAC;AAC/B,SAAO;AACT;AAGO,SAAS,YAAY,OAAa,OAAa;AAEpD,QAAM,WAAW,KAAK,IAAI,MAAM,QAAQ,IAAI,MAAM,QAAQ,CAAC;AAC3D,QAAM,aAAa,KAAK,MAAM,WAAW,OAAO;AAChD,SAAO;AACT;AAGO,IAAM,cAAc,CAAC,SAAqB;AAC/C,QAAM,OAAO,KAAK,YAAY;AAC9B,QAAM,QAAQ,KAAK,SAAS;AAC5B,QAAM,MAAM,KAAK,QAAQ;AACzB,SAAO,IAAI,KAAK,MAAM,OAAO,GAAG;AAClC;AAGO,IAAM,aAAa,CAAC,GAAW,UAAyB;AAC7D,QAAM,OAAO,IAAI,KAAK,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,KAAK,GAAI;AAC1D,MAAI,OAAO;AACT,WAAO,YAAY,IAAI;AAAA,EACzB,OAAO;AACL,WAAO;AAAA,EACT;AACF;AAGO,IAAM,gBAAgB,CAAC,SAAqB;AACjD,QAAM,OAAO,KAAK,YAAY;AAC9B,QAAM,QAAQ,KAAK,SAAS;AAC5B,SAAO,IAAI,KAAK,MAAM,OAAO,CAAC;AAChC;","names":[]}
|
13
dist/utils/net.util.cjs
vendored
13
dist/utils/net.util.cjs
vendored
@ -1,6 +1,8 @@
|
||||
var __create = Object.create;
|
||||
var __defProp = Object.defineProperty;
|
||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||
var __getProtoOf = Object.getPrototypeOf;
|
||||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||||
var __export = (target, all) => {
|
||||
for (var name in all)
|
||||
@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
||||
}
|
||||
return to;
|
||||
};
|
||||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||||
// If the importer is in node compatibility mode or this is not an ESM
|
||||
// file that has been converted to a CommonJS file using a Babel-
|
||||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||||
mod
|
||||
));
|
||||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
||||
|
||||
// src/utils/net.util.ts
|
||||
@ -39,9 +49,10 @@ var ZError = class {
|
||||
};
|
||||
|
||||
// src/utils/net.util.ts
|
||||
var import_node_fetch = __toESM(require("node-fetch"), 1);
|
||||
var TIMEOUT_ERROR = new Error("timeout");
|
||||
async function successfulFetch(request, options) {
|
||||
const response = await fetch(request, options);
|
||||
const response = await (0, import_node_fetch.default)(request, options);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Fetch failed with status '${response.status}' for request '${request}'`);
|
||||
}
|
||||
|
2
dist/utils/net.util.cjs.map
vendored
2
dist/utils/net.util.cjs.map
vendored
File diff suppressed because one or more lines are too long
4
dist/utils/net.util.d.cts
vendored
4
dist/utils/net.util.d.cts
vendored
@ -1,3 +1,5 @@
|
||||
import fetch, { RequestInit, Response } from 'node-fetch';
|
||||
|
||||
/**
|
||||
* Execute fetch and verify that the response was successful.
|
||||
*
|
||||
@ -5,7 +7,7 @@
|
||||
* @param options - Fetch options.
|
||||
* @returns The fetch response.
|
||||
*/
|
||||
declare function successfulFetch(request: string, options?: RequestInit): Promise<Response>;
|
||||
declare function successfulFetch(request: string, options?: RequestInit): Promise<fetch.Response>;
|
||||
/**
|
||||
* Execute fetch and return object response.
|
||||
*
|
||||
|
4
dist/utils/net.util.d.ts
vendored
4
dist/utils/net.util.d.ts
vendored
@ -1,3 +1,5 @@
|
||||
import fetch, { RequestInit, Response } from 'node-fetch';
|
||||
|
||||
/**
|
||||
* Execute fetch and verify that the response was successful.
|
||||
*
|
||||
@ -5,7 +7,7 @@
|
||||
* @param options - Fetch options.
|
||||
* @returns The fetch response.
|
||||
*/
|
||||
declare function successfulFetch(request: string, options?: RequestInit): Promise<Response>;
|
||||
declare function successfulFetch(request: string, options?: RequestInit): Promise<fetch.Response>;
|
||||
/**
|
||||
* Execute fetch and return object response.
|
||||
*
|
||||
|
1
dist/utils/net.util.js
vendored
1
dist/utils/net.util.js
vendored
@ -7,6 +7,7 @@ var ZError = class {
|
||||
};
|
||||
|
||||
// src/utils/net.util.ts
|
||||
import fetch from "node-fetch";
|
||||
var TIMEOUT_ERROR = new Error("timeout");
|
||||
async function successfulFetch(request, options) {
|
||||
const response = await fetch(request, options);
|
||||
|
2
dist/utils/net.util.js.map
vendored
2
dist/utils/net.util.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user