@native-systems/utility 1.3.0 → 2.0.1

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/dist/index.d.ts CHANGED
@@ -664,7 +664,7 @@ declare module "@native-systems/utility" {
664
664
  }
665
665
 
666
666
  declare module "@native-systems/utility" {
667
- namespace Native {
667
+ namespace native {
668
668
  type Error = ErrorConstructor & {
669
669
  status: number;
670
670
  message: string;
@@ -675,7 +675,7 @@ declare module "@native-systems/utility" {
675
675
  }
676
676
  export { Error, ErrorResponse };
677
677
  }
678
- export type { Native };
678
+ export type { native };
679
679
  }
680
680
 
681
681
  declare module "@native-systems/utility" {
@@ -722,7 +722,7 @@ declare module "@native-systems/utility" {
722
722
  }
723
723
 
724
724
  declare module "@native-systems/utility" {
725
- import { Native } from "@/types";
725
+ import { native } from "@/types";
726
726
  class HttpHandler {
727
727
  /**
728
728
  * Http request response handler, which checks if the given response is in status range 'ok'.
@@ -731,17 +731,17 @@ declare module "@native-systems/utility" {
731
731
  * This means, that the reason of the error is not a network error for example.
732
732
  * @param response {Response} The raw response data from the server, which could also be a Native.Error.
733
733
  * @returns {<T>} The expected data resource, if the status of the request is 'ok'.
734
- * @throws {Native.ErrorResponse} A modified version of the default Response object, to be able to detect if the error response is of the expected type.
734
+ * @throws {native.ErrorResponse} A modified version of the default Response object, to be able to detect if the error response is of the expected type.
735
735
  */
736
736
  static response<T>(response: Response): Promise<T>;
737
737
  /**
738
738
  * Http request error handler, that always returns the correct error object.
739
739
  * Either fast forwards the already correctly formatted naive error or set up a new native error, based on the provided info.
740
740
  * The generic typing is just used to prevent type errors.
741
- * @param response {Response | Native.ErrorResponse} The Response object that errored. Can either be a default object, or the modified native version.
742
- * @throws {Native.Error} Always throws an error, which is always of this type.
741
+ * @param response {Response | native.ErrorResponse} The Response object that errored. Can either be a default object, or the modified native version.
742
+ * @throws {native.Error} Always throws an error, which is always of this type.
743
743
  */
744
- static error<T>(response: Response | Native.ErrorResponse): Promise<T>;
744
+ static error<T>(response: Response | native.ErrorResponse): Promise<T>;
745
745
  }
746
746
  export { HttpHandler };
747
747
  }
@@ -772,6 +772,50 @@ declare module "@native-systems/utility" {
772
772
  };
773
773
  }
774
774
 
775
+ declare module "@native-systems/utility" {
776
+ export type PatternView = Record<string | number, any>;
777
+ export type CompileFn = (source?: string | null, view?: PatternView) => string;
778
+ export interface IPatternCompiler {
779
+ compile: CompileFn;
780
+ keyToTemplate(key: string): string;
781
+ }
782
+ }
783
+
784
+ declare module "@native-systems/utility" {
785
+ import Handlebars from "handlebars";
786
+ export class PatternCompiler implements IPatternCompiler {
787
+ private defaultView;
788
+ private handlebars;
789
+ constructor(defaultView: PatternView, installPlugins: (handlebars: typeof Handlebars) => void);
790
+ compile(source?: string | null, partialView?: PatternView): string;
791
+ static keyToTemplate(key: string): string;
792
+ keyToTemplate(key: string): string;
793
+ }
794
+ }
795
+
796
+ declare module "@native-systems/utility" {
797
+ export type CompilerPlugin<T = void> = (handlebars: typeof Handlebars, ...args: [
798
+ T
799
+ ] extends [
800
+ void
801
+ ] ? [
802
+ ] : [
803
+ data: T
804
+ ]) => void;
805
+ }
806
+
807
+ declare module "@native-systems/utility" {
808
+ export const eqPlugin: CompilerPlugin;
809
+ }
810
+
811
+ declare module "@native-systems/utility" {
812
+ export const markdownPlugin: CompilerPlugin;
813
+ }
814
+
815
+ declare module "@native-systems/utility" {
816
+ export const stringPlugin: CompilerPlugin;
817
+ }
818
+
775
819
  declare module "@native-systems/utility" {
776
820
  export class DateFormatter {
777
821
  /**
@@ -801,5 +845,33 @@ declare module "@native-systems/utility" {
801
845
  * DateFormatter.formatMini(new Date('2025-08-14T15:30:00'))
802
846
  */
803
847
  static formatMini(date: Date | string): string;
848
+ static getZoneAdjustedWeekday: (dateString: string, options: {
849
+ timezone: string;
850
+ locale: string | undefined;
851
+ }) => string;
852
+ static getZoneAdjustedDate: (dateString: string, options: {
853
+ timezone: string;
854
+ locale: string | undefined;
855
+ }) => string;
856
+ static getZoneAdjustedTime: (dateString: string, options: {
857
+ timezone: string;
858
+ locale: string | undefined;
859
+ }) => string;
804
860
  }
805
861
  }
862
+
863
+ declare module "@native-systems/utility" {
864
+ export type UserTimezone = {
865
+ timezone: string;
866
+ locale: string;
867
+ };
868
+ export const timezonePlugin: CompilerPlugin<UserTimezone>;
869
+ }
870
+
871
+ declare module "@native-systems/utility" {
872
+ export const urlPlugin: CompilerPlugin;
873
+ }
874
+
875
+ declare module "@native-systems/utility" {
876
+ export const userTimezonePlugin: CompilerPlugin<UserTimezone>;
877
+ }