@punks/backend-core 0.0.77 → 0.0.79

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.
@@ -0,0 +1,61 @@
1
+ type QuoteCharacter = '"' | "'";
2
+ export interface StateMachineOptions {
3
+ readonly allowedTags?: Set<string>;
4
+ readonly disallowedTags?: Set<string>;
5
+ readonly tagReplacementText: string;
6
+ readonly encodePlaintextTagDelimiters: boolean;
7
+ }
8
+ export type StateTransitionFunction = (next: State) => void;
9
+ export interface State {
10
+ consume(character: string, transition: StateTransitionFunction): string;
11
+ }
12
+ type InPlaintextStateTransitionFunction = (next: InTagNameState) => void;
13
+ export declare class InPlaintextState implements State {
14
+ private readonly options;
15
+ constructor(options: StateMachineOptions);
16
+ consume(character: string, transition: InPlaintextStateTransitionFunction): string;
17
+ }
18
+ export declare const enum TagMode {
19
+ Allowed = 0,
20
+ Disallowed = 1
21
+ }
22
+ type InTagNameStateTransitionFunction = (next: InPlaintextState | InTagState<TagMode.Allowed> | InTagState<TagMode.Disallowed> | InCommentState) => void;
23
+ export declare class InTagNameState implements State {
24
+ private readonly options;
25
+ private nameBuffer;
26
+ private isClosingTag;
27
+ constructor(options: StateMachineOptions);
28
+ consume(character: string, transition: InTagNameStateTransitionFunction): string;
29
+ private isNameBufferAnAllowedTag;
30
+ }
31
+ type InTagStateTransitionFunction<T extends TagMode> = (next: InPlaintextState | InQuotedStringInTagState<T>) => void;
32
+ export declare class InTagState<T extends TagMode> implements State {
33
+ readonly mode: T;
34
+ private readonly options;
35
+ constructor(mode: T, options: StateMachineOptions);
36
+ consume(character: string, transition: InTagStateTransitionFunction<T>): string;
37
+ }
38
+ type InQuotedStringInTagStateTransitionFunction<T extends TagMode> = (next: InTagState<T>) => void;
39
+ export declare class InQuotedStringInTagState<T extends TagMode> implements State {
40
+ readonly mode: T;
41
+ readonly quoteCharacter: QuoteCharacter;
42
+ private readonly options;
43
+ constructor(mode: T, quoteCharacter: QuoteCharacter, options: StateMachineOptions);
44
+ consume(character: string, transition: InQuotedStringInTagStateTransitionFunction<T>): string;
45
+ }
46
+ type InCommentStateTransitionFunction = (next: InPlaintextState) => void;
47
+ export declare class InCommentState implements State {
48
+ private readonly options;
49
+ private consecutiveHyphens;
50
+ constructor(options: StateMachineOptions);
51
+ consume(character: string, transition: InCommentStateTransitionFunction): string;
52
+ }
53
+ export declare const DefaultStateMachineOptions: StateMachineOptions;
54
+ export declare class StateMachine {
55
+ private state;
56
+ private transitionFunction;
57
+ constructor(partialOptions?: Partial<StateMachineOptions>);
58
+ consume(text: string): string;
59
+ }
60
+ export declare function stripTags(text: string, options?: Partial<StateMachineOptions>): string;
61
+ export {};
@@ -7,11 +7,12 @@ export { joinPath, splitPath, ensureDirectory, getDirectoryPath, createDayPath,
7
7
  export * from "./strings";
8
8
  export * from "./objects";
9
9
  export * from "./encoding";
10
+ export { stripTags } from "./html";
10
11
  export { maskVariable } from "./variables";
11
12
  export * from "./text";
12
13
  export * from "./threading";
13
14
  export { buildTree, TreeNodeBuilder } from "./trees";
14
15
  export * from "./mappings";
15
- export * from "./uid";
16
+ export { newUuid, generateHash } from "./uid";
16
17
  export { serializeQueryString, buildUrl, deserializeQueryString, getQueryParameter, updateQueryParameters, joinUrl, } from "./urls";
17
18
  export { ExcelSheetDefinition, ExcelKeyTransform, ExcelColumnDefinition, ExcelParseOptions, excelBuild, excelParse, } from "./xls";
package/dist/index.d.ts CHANGED
@@ -256,6 +256,14 @@ declare const decodeUtf8: (value: string) => Buffer;
256
256
  declare const encodeBase64: (value: Uint8Array) => string;
257
257
  declare const decodeBase64: (value: string) => Buffer;
258
258
 
259
+ interface StateMachineOptions {
260
+ readonly allowedTags?: Set<string>;
261
+ readonly disallowedTags?: Set<string>;
262
+ readonly tagReplacementText: string;
263
+ readonly encodePlaintextTagDelimiters: boolean;
264
+ }
265
+ declare function stripTags(text: string, options?: Partial<StateMachineOptions>): string;
266
+
259
267
  declare const maskVariable: (value: string | undefined, unmaskedLength?: number) => string;
260
268
 
261
269
  declare const pluralize: (word: string) => string;
@@ -321,4 +329,4 @@ type ExcelParseOptions = {
321
329
  };
322
330
  declare const excelParse: (file: string | ArrayBuffer, options?: ExcelParseOptions) => any;
323
331
 
324
- 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, subArrays, subtractTime, testInternetConnection, toArrayDict, toCamelCase, toDict, toItemsDict, toItemsMap, toMap, toTitleCase, trim, trimEnd, trimStart, updateQueryParameters };
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@punks/backend-core",
3
- "version": "0.0.77",
3
+ "version": "0.0.79",
4
4
  "description": "WebPunks Backend Core",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",