@punks/backend-core 0.0.78 → 0.0.80

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.
@@ -5,7 +5,7 @@ export { CsvColumnDefinition, CsvBuildOptions, csvBuild, csvParse } from "./csv"
5
5
  export { getDirectoryFilePaths } from "./files";
6
6
  export { joinPath, splitPath, ensureDirectory, getDirectoryPath, createDayPath, } from "./paths";
7
7
  export * from "./strings";
8
- export * from "./objects";
8
+ export { buildObject, isNullOrUndefined, jsonSerialize, mergeDeep, removeUndefinedProps, replaceUndefinedWithNull, } from "./objects";
9
9
  export * from "./encoding";
10
10
  export { stripTags } from "./html";
11
11
  export { maskVariable } from "./variables";
@@ -13,6 +13,6 @@ export * from "./text";
13
13
  export * from "./threading";
14
14
  export { buildTree, TreeNodeBuilder } from "./trees";
15
15
  export * from "./mappings";
16
- export * from "./uid";
16
+ export { newUuid, generateHash } from "./uid";
17
17
  export { serializeQueryString, buildUrl, deserializeQueryString, getQueryParameter, updateQueryParameters, joinUrl, } from "./urls";
18
18
  export { ExcelSheetDefinition, ExcelKeyTransform, ExcelColumnDefinition, ExcelParseOptions, excelBuild, excelParse, } from "./xls";
@@ -1,3 +1,4 @@
1
+ import { ReplaceUndefinedWithNull } from "./types";
1
2
  export declare const removeUndefinedProps: <T extends Record<string, any>>(obj: T, options?: {
2
3
  recursive?: boolean;
3
4
  }) => T;
@@ -14,3 +15,4 @@ export declare const jsonSerialize: (obj: any, options?: {
14
15
  maxStringsLength?: number;
15
16
  prettify?: boolean;
16
17
  }) => string;
18
+ export declare function replaceUndefinedWithNull<T>(obj: T): ReplaceUndefinedWithNull<T>;
@@ -0,0 +1,3 @@
1
+ export type ReplaceUndefinedWithNull<T> = T extends undefined ? null : T extends (infer U)[] ? ReplaceUndefinedWithNull<U>[] : T extends object ? {
2
+ [K in keyof T]: ReplaceUndefinedWithNull<T[K]>;
3
+ } : T;
package/dist/index.d.ts CHANGED
@@ -234,6 +234,10 @@ declare const ensureTailingSlash: (value: string) => string;
234
234
  declare const ensureStartSlash: (value: string) => string;
235
235
  declare const multipleSplit: (str: string, separators: string[]) => string[];
236
236
 
237
+ type ReplaceUndefinedWithNull<T> = T extends undefined ? null : T extends (infer U)[] ? ReplaceUndefinedWithNull<U>[] : T extends object ? {
238
+ [K in keyof T]: ReplaceUndefinedWithNull<T[K]>;
239
+ } : T;
240
+
237
241
  declare const removeUndefinedProps: <T extends Record<string, any>>(obj: T, options?: {
238
242
  recursive?: boolean;
239
243
  }) => T;
@@ -250,6 +254,7 @@ declare const jsonSerialize: (obj: any, options?: {
250
254
  maxStringsLength?: number;
251
255
  prettify?: boolean;
252
256
  }) => string;
257
+ declare function replaceUndefinedWithNull<T>(obj: T): ReplaceUndefinedWithNull<T>;
253
258
 
254
259
  declare const encodeUtf8: (value: Uint8Array) => string;
255
260
  declare const decodeUtf8: (value: string) => Buffer;
@@ -329,4 +334,4 @@ type ExcelParseOptions = {
329
334
  };
330
335
  declare const excelParse: (file: string | ArrayBuffer, options?: ExcelParseOptions) => any;
331
336
 
332
- export { AppServiceReference, ConsoleLogger, CsvBuildOptions, CsvColumnDefinition, DatadogLogger, Dict, ExcelColumnDefinition, ExcelKeyTransform, ExcelParseOptions, ExcelSheetDefinition, FileLogger, ILogger, ILoggerProvider, IResolveServiceOptions, IServiceLocator, ITree, ITreeNode, LocalizedField, Log, LogLevel, MetaSerializationType, Optional, RichText, TimeUnit, TreeNodeBuilder, addTime, buildObject, buildTree, buildUrl, byField, byFieldDesc, camelToKebabCase, camelToSnakeCase, createDayPath, csvBuild, csvParse, decodeBase64, decodeUtf8, deserializeQueryString, distinct, distinctElements, encodeBase64, encodeUtf8, ensureDirectory, ensureStartSlash, ensureTailingSlash, excelBuild, excelParse, first, flatten, floorDateToSecond, generateHash, getDirectoryFilePaths, getDirectoryPath, getQueryParameter, groupBy, indexes, isNullOrUndefined, iterate, joinPath, joinUrl, jsonDistinct, jsonSerialize, last, logMemoryUsage, mapAsync, mapOrThrow, maskVariable, mergeDeep, multipleSplit, newUuid, notNull, notUndefined, pluralize, processArrayDifferences, processArrayItemMove, range, removeUndefinedProps, selectMany, serializeQueryString, sleep, sort, splitPath, stripTags, subArrays, subtractTime, testInternetConnection, toArrayDict, toCamelCase, toDict, toItemsDict, toItemsMap, toMap, toTitleCase, trim, trimEnd, trimStart, updateQueryParameters };
337
+ export { AppServiceReference, ConsoleLogger, CsvBuildOptions, CsvColumnDefinition, DatadogLogger, Dict, ExcelColumnDefinition, ExcelKeyTransform, ExcelParseOptions, ExcelSheetDefinition, FileLogger, ILogger, ILoggerProvider, IResolveServiceOptions, IServiceLocator, ITree, ITreeNode, LocalizedField, Log, LogLevel, MetaSerializationType, Optional, RichText, TimeUnit, TreeNodeBuilder, addTime, buildObject, buildTree, buildUrl, byField, byFieldDesc, camelToKebabCase, camelToSnakeCase, createDayPath, csvBuild, csvParse, decodeBase64, decodeUtf8, deserializeQueryString, distinct, distinctElements, encodeBase64, encodeUtf8, ensureDirectory, ensureStartSlash, ensureTailingSlash, excelBuild, excelParse, first, flatten, floorDateToSecond, generateHash, getDirectoryFilePaths, getDirectoryPath, getQueryParameter, groupBy, indexes, isNullOrUndefined, iterate, joinPath, joinUrl, jsonDistinct, jsonSerialize, last, logMemoryUsage, mapAsync, mapOrThrow, maskVariable, mergeDeep, multipleSplit, newUuid, notNull, notUndefined, pluralize, processArrayDifferences, processArrayItemMove, range, removeUndefinedProps, replaceUndefinedWithNull, selectMany, serializeQueryString, sleep, sort, splitPath, stripTags, subArrays, subtractTime, testInternetConnection, toArrayDict, toCamelCase, toDict, toItemsDict, toItemsMap, toMap, toTitleCase, trim, trimEnd, trimStart, updateQueryParameters };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punks/backend-core",
3
- "version": "0.0.78",
3
+ "version": "0.0.80",
4
4
  "description": "WebPunks Backend Core",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",