@stackone/utils 0.10.1 → 0.11.0

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.
@@ -1,17 +1,17 @@
1
1
  import { randomUUID } from "crypto";
2
2
  import { ZodType, z } from "zod/v4";
3
3
 
4
- //#region src/base64.d.ts
4
+ //#region src/shared/base64.d.ts
5
5
  declare function encodeToBase64(data: string): string;
6
6
  declare function decodeFromBase64(encodedData: string): string;
7
7
  //#endregion
8
- //#region src/countries/types.d.ts
8
+ //#region src/shared/countries/types.d.ts
9
9
 
10
10
  type ISO31662SubDivisionCodeNamePairs = {
11
11
  [subDivisionCode: string]: string;
12
12
  };
13
13
  //#endregion
14
- //#region src/countries/countriesGetters.d.ts
14
+ //#region src/shared/countries/countriesGetters.d.ts
15
15
  declare const getCountryAlpha2CodeByAlpha2Code: (alpha2Code: string) => string | undefined;
16
16
  declare const getCountryAlpha3CodeByAlpha3Code: (alpha3Code: string) => string | undefined;
17
17
  declare const getCountryCodeByCountryCode: (countryCode: string) => string | undefined;
@@ -34,7 +34,7 @@ declare const getCountrySubDivisionNameBySubDivisionCode: (subDivisionCode: stri
34
34
  declare const getCountrySubDivisionCodeBySubDivisionName: (subDivisionName: string) => string | undefined;
35
35
  declare const getCountryAlpha2CodeByCitizenship: (citizenship: string) => string | undefined;
36
36
  //#endregion
37
- //#region src/dataStructures/normalizedKeyMap.d.ts
37
+ //#region src/shared/dataStructures/normalizedKeyMap.d.ts
38
38
  declare class NormalizedKeyMap<V> extends Map<string, any> {
39
39
  #private;
40
40
  set(key: string, value: V): this;
@@ -43,7 +43,7 @@ declare class NormalizedKeyMap<V> extends Map<string, any> {
43
43
  delete(key: string): boolean;
44
44
  }
45
45
  //#endregion
46
- //#region src/dates.d.ts
46
+ //#region src/shared/dates.d.ts
47
47
  type InputDate = Date | string | null;
48
48
  declare const calculateNextAnniversary: ({
49
49
  initialDate,
@@ -71,23 +71,20 @@ declare const dateHasPassed: ({
71
71
  format?: string;
72
72
  }) => boolean;
73
73
  //#endregion
74
- //#region src/deepCopy.d.ts
74
+ //#region src/shared/deepCopy.d.ts
75
75
  declare const deepCopy: <T>(obj: T, visited?: WeakMap<object, any>) => T;
76
76
  //#endregion
77
- //#region src/exponentialBackoff.d.ts
77
+ //#region src/shared/exponentialBackoff.d.ts
78
78
  declare const exponentialBackoffInMS: (retryCount: number, baseRetryDelayInMS?: number, jitterFactor?: number) => number;
79
79
  //#endregion
80
- //#region src/hashContent.d.ts
81
- declare const getContentHash: (content: unknown) => string;
82
- //#endregion
83
- //#region src/ipAddr.d.ts
80
+ //#region src/shared/ipAddr.d.ts
84
81
  declare const isValidIp: (ip: string) => boolean;
85
82
  declare const isValidIpRange: (pattern: string) => boolean;
86
83
  declare const isValidIpRanges: (patterns: string[]) => boolean;
87
84
  declare const isIpInRanges: (ip: string, patterns: string[]) => boolean;
88
85
  declare const isIpInRange: (ip: string, pattern: string) => boolean;
89
86
  //#endregion
90
- //#region src/parsers.d.ts
87
+ //#region src/shared/parsers.d.ts
91
88
  declare const safeParseToString: ({
92
89
  value
93
90
  }: {
@@ -118,10 +115,10 @@ declare const safeParseToDateTimeString: ({
118
115
  format?: string;
119
116
  }) => string | null;
120
117
  //#endregion
121
- //#region src/timeouts.d.ts
118
+ //#region src/shared/timeouts.d.ts
122
119
  declare const delay: (ms: number) => Promise<unknown>;
123
120
  //#endregion
124
- //#region src/typeguards.d.ts
121
+ //#region src/shared/typeguards.d.ts
125
122
  declare const notMissing: <T>(value: T | null | undefined) => value is T;
126
123
  declare const isMissing: <T>(value: T | null | undefined) => value is null | undefined;
127
124
  declare const isString: (value: unknown) => value is string;
@@ -132,11 +129,14 @@ declare const isObject: (value: unknown) => value is Record<string, unknown>;
132
129
  declare const isFunction: (value: unknown) => value is (...args: unknown[]) => unknown;
133
130
  declare const isFutureUnixTimestamp: (value: unknown) => boolean;
134
131
  //#endregion
135
- //#region src/uuids.d.ts
132
+ //#region src/shared/zod.d.ts
133
+ declare const zStrictObject: <T extends z.ZodRawShape>(shape: T) => z.ZodObject<{ -readonly [P in keyof T]: T[P] }, z.core.$strict>;
134
+ //#endregion
135
+ //#region src/node/hashContent.d.ts
136
+ declare const getContentHash: (content: unknown) => string;
137
+ //#endregion
138
+ //#region src/node/uuids.d.ts
136
139
  declare const isValidUUID: (uuid: string) => boolean;
137
140
  declare const generateRequestId: (randomUUIDGenerator?: typeof randomUUID) => string;
138
141
  //#endregion
139
- //#region src/zod.d.ts
140
- declare const zStrictObject: <T extends z.ZodRawShape>(shape: T) => z.ZodObject<{ -readonly [P in keyof T]: T[P] }, z.core.$strict>;
141
- //#endregion
142
- export { NormalizedKeyMap, type ZodType, calculateNextAnniversary, calculateYearsElapsed, dateHasPassed, decodeFromBase64, deepCopy, delay, encodeToBase64, exponentialBackoffInMS, generateRequestId, getContentHash, getCountryAlpha2CodeByAlpha2Code, getCountryAlpha2CodeByAlpha3Code, getCountryAlpha2CodeByCitizenship, getCountryAlpha2CodeByCountryCode, getCountryAlpha2CodeByCountryName, getCountryAlpha3CodeByAlpha2Code, getCountryAlpha3CodeByAlpha3Code, getCountryAlpha3CodeByCountryCode, getCountryAlpha3CodeByCountryName, getCountryCodeByAlpha2Code, getCountryCodeByAlpha3Code, getCountryCodeByCountryCode, getCountryCodeByCountryName, getCountryNameByAlpha2Code, getCountryNameByAlpha3Code, getCountryNameByCountryCode, getCountryNameByCountryName, getCountrySubDivisionByAlpha2CodeAndName, getCountrySubDivisionCodeBySubDivisionName, getCountrySubDivisionNameBySubDivisionCode, getCountrySubDivisionsByAlpha2Code, isBoolean, isDate, isFunction, isFutureUnixTimestamp, isIpInRange, isIpInRanges, isMissing, isNumber, isObject, isString, isValidIp, isValidIpRange, isValidIpRanges, isValidUUID, notMissing, safeParseToBoolean, safeParseToDateTime, safeParseToDateTimeString, safeParseToNumber, safeParseToString, z, zStrictObject };
142
+ export { NormalizedKeyMap, ZodType, calculateNextAnniversary, calculateYearsElapsed, dateHasPassed, decodeFromBase64, deepCopy, delay, encodeToBase64, exponentialBackoffInMS, generateRequestId, getContentHash, getCountryAlpha2CodeByAlpha2Code, getCountryAlpha2CodeByAlpha3Code, getCountryAlpha2CodeByCitizenship, getCountryAlpha2CodeByCountryCode, getCountryAlpha2CodeByCountryName, getCountryAlpha3CodeByAlpha2Code, getCountryAlpha3CodeByAlpha3Code, getCountryAlpha3CodeByCountryCode, getCountryAlpha3CodeByCountryName, getCountryCodeByAlpha2Code, getCountryCodeByAlpha3Code, getCountryCodeByCountryCode, getCountryCodeByCountryName, getCountryNameByAlpha2Code, getCountryNameByAlpha3Code, getCountryNameByCountryCode, getCountryNameByCountryName, getCountrySubDivisionByAlpha2CodeAndName, getCountrySubDivisionCodeBySubDivisionName, getCountrySubDivisionNameBySubDivisionCode, getCountrySubDivisionsByAlpha2Code, isBoolean, isDate, isFunction, isFutureUnixTimestamp, isIpInRange, isIpInRanges, isMissing, isNumber, isObject, isString, isValidIp, isValidIpRange, isValidIpRanges, isValidUUID, notMissing, safeParseToBoolean, safeParseToDateTime, safeParseToDateTimeString, safeParseToNumber, safeParseToString, z, zStrictObject };
@@ -1,17 +1,17 @@
1
- import { randomUUID } from "crypto";
2
1
  import { ZodType, z } from "zod/v4";
2
+ import { randomUUID } from "crypto";
3
3
 
4
- //#region src/base64.d.ts
4
+ //#region src/shared/base64.d.ts
5
5
  declare function encodeToBase64(data: string): string;
6
6
  declare function decodeFromBase64(encodedData: string): string;
7
7
  //#endregion
8
- //#region src/countries/types.d.ts
8
+ //#region src/shared/countries/types.d.ts
9
9
 
10
10
  type ISO31662SubDivisionCodeNamePairs = {
11
11
  [subDivisionCode: string]: string;
12
12
  };
13
13
  //#endregion
14
- //#region src/countries/countriesGetters.d.ts
14
+ //#region src/shared/countries/countriesGetters.d.ts
15
15
  declare const getCountryAlpha2CodeByAlpha2Code: (alpha2Code: string) => string | undefined;
16
16
  declare const getCountryAlpha3CodeByAlpha3Code: (alpha3Code: string) => string | undefined;
17
17
  declare const getCountryCodeByCountryCode: (countryCode: string) => string | undefined;
@@ -34,7 +34,7 @@ declare const getCountrySubDivisionNameBySubDivisionCode: (subDivisionCode: stri
34
34
  declare const getCountrySubDivisionCodeBySubDivisionName: (subDivisionName: string) => string | undefined;
35
35
  declare const getCountryAlpha2CodeByCitizenship: (citizenship: string) => string | undefined;
36
36
  //#endregion
37
- //#region src/dataStructures/normalizedKeyMap.d.ts
37
+ //#region src/shared/dataStructures/normalizedKeyMap.d.ts
38
38
  declare class NormalizedKeyMap<V> extends Map<string, any> {
39
39
  #private;
40
40
  set(key: string, value: V): this;
@@ -43,7 +43,7 @@ declare class NormalizedKeyMap<V> extends Map<string, any> {
43
43
  delete(key: string): boolean;
44
44
  }
45
45
  //#endregion
46
- //#region src/dates.d.ts
46
+ //#region src/shared/dates.d.ts
47
47
  type InputDate = Date | string | null;
48
48
  declare const calculateNextAnniversary: ({
49
49
  initialDate,
@@ -71,23 +71,20 @@ declare const dateHasPassed: ({
71
71
  format?: string;
72
72
  }) => boolean;
73
73
  //#endregion
74
- //#region src/deepCopy.d.ts
74
+ //#region src/shared/deepCopy.d.ts
75
75
  declare const deepCopy: <T>(obj: T, visited?: WeakMap<object, any>) => T;
76
76
  //#endregion
77
- //#region src/exponentialBackoff.d.ts
77
+ //#region src/shared/exponentialBackoff.d.ts
78
78
  declare const exponentialBackoffInMS: (retryCount: number, baseRetryDelayInMS?: number, jitterFactor?: number) => number;
79
79
  //#endregion
80
- //#region src/hashContent.d.ts
81
- declare const getContentHash: (content: unknown) => string;
82
- //#endregion
83
- //#region src/ipAddr.d.ts
80
+ //#region src/shared/ipAddr.d.ts
84
81
  declare const isValidIp: (ip: string) => boolean;
85
82
  declare const isValidIpRange: (pattern: string) => boolean;
86
83
  declare const isValidIpRanges: (patterns: string[]) => boolean;
87
84
  declare const isIpInRanges: (ip: string, patterns: string[]) => boolean;
88
85
  declare const isIpInRange: (ip: string, pattern: string) => boolean;
89
86
  //#endregion
90
- //#region src/parsers.d.ts
87
+ //#region src/shared/parsers.d.ts
91
88
  declare const safeParseToString: ({
92
89
  value
93
90
  }: {
@@ -118,10 +115,10 @@ declare const safeParseToDateTimeString: ({
118
115
  format?: string;
119
116
  }) => string | null;
120
117
  //#endregion
121
- //#region src/timeouts.d.ts
118
+ //#region src/shared/timeouts.d.ts
122
119
  declare const delay: (ms: number) => Promise<unknown>;
123
120
  //#endregion
124
- //#region src/typeguards.d.ts
121
+ //#region src/shared/typeguards.d.ts
125
122
  declare const notMissing: <T>(value: T | null | undefined) => value is T;
126
123
  declare const isMissing: <T>(value: T | null | undefined) => value is null | undefined;
127
124
  declare const isString: (value: unknown) => value is string;
@@ -132,11 +129,14 @@ declare const isObject: (value: unknown) => value is Record<string, unknown>;
132
129
  declare const isFunction: (value: unknown) => value is (...args: unknown[]) => unknown;
133
130
  declare const isFutureUnixTimestamp: (value: unknown) => boolean;
134
131
  //#endregion
135
- //#region src/uuids.d.ts
132
+ //#region src/shared/zod.d.ts
133
+ declare const zStrictObject: <T extends z.ZodRawShape>(shape: T) => z.ZodObject<{ -readonly [P in keyof T]: T[P] }, z.core.$strict>;
134
+ //#endregion
135
+ //#region src/node/hashContent.d.ts
136
+ declare const getContentHash: (content: unknown) => string;
137
+ //#endregion
138
+ //#region src/node/uuids.d.ts
136
139
  declare const isValidUUID: (uuid: string) => boolean;
137
140
  declare const generateRequestId: (randomUUIDGenerator?: typeof randomUUID) => string;
138
141
  //#endregion
139
- //#region src/zod.d.ts
140
- declare const zStrictObject: <T extends z.ZodRawShape>(shape: T) => z.ZodObject<{ -readonly [P in keyof T]: T[P] }, z.core.$strict>;
141
- //#endregion
142
- export { NormalizedKeyMap, type ZodType, calculateNextAnniversary, calculateYearsElapsed, dateHasPassed, decodeFromBase64, deepCopy, delay, encodeToBase64, exponentialBackoffInMS, generateRequestId, getContentHash, getCountryAlpha2CodeByAlpha2Code, getCountryAlpha2CodeByAlpha3Code, getCountryAlpha2CodeByCitizenship, getCountryAlpha2CodeByCountryCode, getCountryAlpha2CodeByCountryName, getCountryAlpha3CodeByAlpha2Code, getCountryAlpha3CodeByAlpha3Code, getCountryAlpha3CodeByCountryCode, getCountryAlpha3CodeByCountryName, getCountryCodeByAlpha2Code, getCountryCodeByAlpha3Code, getCountryCodeByCountryCode, getCountryCodeByCountryName, getCountryNameByAlpha2Code, getCountryNameByAlpha3Code, getCountryNameByCountryCode, getCountryNameByCountryName, getCountrySubDivisionByAlpha2CodeAndName, getCountrySubDivisionCodeBySubDivisionName, getCountrySubDivisionNameBySubDivisionCode, getCountrySubDivisionsByAlpha2Code, isBoolean, isDate, isFunction, isFutureUnixTimestamp, isIpInRange, isIpInRanges, isMissing, isNumber, isObject, isString, isValidIp, isValidIpRange, isValidIpRanges, isValidUUID, notMissing, safeParseToBoolean, safeParseToDateTime, safeParseToDateTimeString, safeParseToNumber, safeParseToString, z, zStrictObject };
142
+ export { NormalizedKeyMap, ZodType, calculateNextAnniversary, calculateYearsElapsed, dateHasPassed, decodeFromBase64, deepCopy, delay, encodeToBase64, exponentialBackoffInMS, generateRequestId, getContentHash, getCountryAlpha2CodeByAlpha2Code, getCountryAlpha2CodeByAlpha3Code, getCountryAlpha2CodeByCitizenship, getCountryAlpha2CodeByCountryCode, getCountryAlpha2CodeByCountryName, getCountryAlpha3CodeByAlpha2Code, getCountryAlpha3CodeByAlpha3Code, getCountryAlpha3CodeByCountryCode, getCountryAlpha3CodeByCountryName, getCountryCodeByAlpha2Code, getCountryCodeByAlpha3Code, getCountryCodeByCountryCode, getCountryCodeByCountryName, getCountryNameByAlpha2Code, getCountryNameByAlpha3Code, getCountryNameByCountryCode, getCountryNameByCountryName, getCountrySubDivisionByAlpha2CodeAndName, getCountrySubDivisionCodeBySubDivisionName, getCountrySubDivisionNameBySubDivisionCode, getCountrySubDivisionsByAlpha2Code, isBoolean, isDate, isFunction, isFutureUnixTimestamp, isIpInRange, isIpInRanges, isMissing, isNumber, isObject, isString, isValidIp, isValidIpRange, isValidIpRanges, isValidUUID, notMissing, safeParseToBoolean, safeParseToDateTime, safeParseToDateTimeString, safeParseToNumber, safeParseToString, z, zStrictObject };