@basecraft/types 2.0.0 → 3.0.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.
Files changed (39) hide show
  1. package/dist/service/crypto-service.type.d.ts +9 -0
  2. package/dist/service/crypto-service.type.d.ts.map +1 -0
  3. package/dist/service/date-service.type.d.ts +21 -14
  4. package/dist/service/date-service.type.d.ts.map +1 -1
  5. package/dist/service/date-time-service.type.d.ts +21 -0
  6. package/dist/service/date-time-service.type.d.ts.map +1 -0
  7. package/dist/service/index.d.ts +12 -0
  8. package/dist/service/index.d.ts.map +1 -1
  9. package/dist/service/instant-service.type.d.ts +19 -0
  10. package/dist/service/instant-service.type.d.ts.map +1 -0
  11. package/dist/service/locale.type.d.ts +2 -0
  12. package/dist/service/locale.type.d.ts.map +1 -0
  13. package/dist/service/time-service.type.d.ts +26 -0
  14. package/dist/service/time-service.type.d.ts.map +1 -0
  15. package/dist/service/time-zone.type.d.ts +2 -0
  16. package/dist/service/time-zone.type.d.ts.map +1 -0
  17. package/dist/service/token-decoding-service.type.d.ts +4 -0
  18. package/dist/service/token-decoding-service.type.d.ts.map +1 -0
  19. package/dist/service/token-decryption-service.type.d.ts +5 -0
  20. package/dist/service/token-decryption-service.type.d.ts.map +1 -0
  21. package/dist/service/token-encryption-service.type.d.ts +5 -0
  22. package/dist/service/token-encryption-service.type.d.ts.map +1 -0
  23. package/dist/service/token-generation-service.type.d.ts +7 -0
  24. package/dist/service/token-generation-service.type.d.ts.map +1 -0
  25. package/dist/service/token-signing-service.type.d.ts +9 -0
  26. package/dist/service/token-signing-service.type.d.ts.map +1 -0
  27. package/dist/service/token-validation-service.type.d.ts +4 -0
  28. package/dist/service/token-validation-service.type.d.ts.map +1 -0
  29. package/dist/service/token-verification-service.type.d.ts +8 -0
  30. package/dist/service/token-verification-service.type.d.ts.map +1 -0
  31. package/dist/service/zoned-date-time-service.type.d.ts +22 -0
  32. package/dist/service/zoned-date-time-service.type.d.ts.map +1 -0
  33. package/dist/util/index.d.ts +0 -2
  34. package/dist/util/index.d.ts.map +1 -1
  35. package/package.json +1 -1
  36. package/dist/util/date-format.type.d.ts +0 -2
  37. package/dist/util/date-format.type.d.ts.map +0 -1
  38. package/dist/util/date-unit.type.d.ts +0 -2
  39. package/dist/util/date-unit.type.d.ts.map +0 -1
@@ -0,0 +1,9 @@
1
+ export interface CryptoService {
2
+ hashSecret(secret: string): Promise<string>;
3
+ compareSecret(secret: string, hashedSecret: string): Promise<boolean>;
4
+ hash(value: string): Promise<string>;
5
+ encrypt(value: string): Promise<string>;
6
+ decrypt(encryptedValue: string): Promise<string>;
7
+ randomBytes(length: number): Promise<Uint8Array>;
8
+ }
9
+ //# sourceMappingURL=crypto-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-service.type.d.ts","sourceRoot":"","sources":["../../src/service/crypto-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5C,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtE,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAErC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExC,OAAO,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjD,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAClD"}
@@ -1,16 +1,23 @@
1
- import { DateFormat } from "../util/date-format.type.js";
2
- import { DateUnit } from "../util/date-unit.type.js";
3
- export interface DateService<CustomDate> {
4
- now(): CustomDate;
5
- add(date: CustomDate, amount: number, unit: DateUnit): CustomDate;
6
- subtract(date: CustomDate, amount: number, unit: DateUnit): CustomDate;
7
- equal(firstDate: CustomDate, secondDate: CustomDate, unit?: DateUnit): boolean;
8
- gt(firstDate: CustomDate, secondDate: CustomDate, unit?: DateUnit): boolean;
9
- lt(firstDate: CustomDate, secondDate: CustomDate, unit?: DateUnit): boolean;
10
- gte(firstDate: CustomDate, secondDate: CustomDate, unit?: DateUnit): boolean;
11
- lte(firstDate: CustomDate, secondDate: CustomDate, unit?: DateUnit): boolean;
12
- between(date: CustomDate, startDate: CustomDate, endDate: CustomDate, unit?: DateUnit): boolean;
13
- diff(firstDate: CustomDate, secondDate: CustomDate, unit: DateUnit): number;
14
- format(date: CustomDate, format: DateFormat): string;
1
+ import { Locale } from "./locale.type.js";
2
+ import { TimeZone } from "./time-zone.type.js";
3
+ export type DateUnit = "day" | "week" | "month" | "year";
4
+ export type DateFormatOptions = {
5
+ locale?: Locale;
6
+ year?: "numeric" | "2-digit";
7
+ month?: "numeric" | "2-digit" | "long" | "short" | "narrow";
8
+ day?: "numeric" | "2-digit";
9
+ weekday?: "long" | "short" | "narrow";
10
+ };
11
+ export interface DateService<Date> {
12
+ now(timeZone?: TimeZone): Date;
13
+ add(date: Date, amount: number, unit: DateUnit): Date;
14
+ subtract(date: Date, amount: number, unit: DateUnit): Date;
15
+ diff(firstDate: Date, secondDate: Date, unit: DateUnit): number;
16
+ equal(firstDate: Date, secondDate: Date): boolean;
17
+ gt(firstDate: Date, secondDate: Date): boolean;
18
+ lt(firstDate: Date, secondDate: Date): boolean;
19
+ gte(firstDate: Date, secondDate: Date): boolean;
20
+ lte(firstDate: Date, secondDate: Date): boolean;
21
+ format(date: Date, options: DateFormatOptions): string;
15
22
  }
16
23
  //# sourceMappingURL=date-service.type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"date-service.type.d.ts","sourceRoot":"","sources":["../../src/service/date-service.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,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AI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAEhD,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAEhD,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;CACxD"}
@@ -0,0 +1,21 @@
1
+ import { DateFormatOptions, DateUnit } from "./date-service.type.js";
2
+ import { TimeFormatOptions, TimeUnit } from "./time-service.type.js";
3
+ import { TimeZone } from "./time-zone.type.js";
4
+ export type DateTimeUnit = DateUnit | TimeUnit;
5
+ export type DateTimeFormatOptions = DateFormatOptions & TimeFormatOptions & {
6
+ dateStyle?: "full" | "long" | "medium" | "short";
7
+ timeStyle?: "full" | "long" | "medium" | "short";
8
+ };
9
+ export interface DateTimeService<DateTime> {
10
+ now(timeZone?: TimeZone): DateTime;
11
+ add(dateTime: DateTime, amount: number, unit: DateTimeUnit): DateTime;
12
+ subtract(dateTime: DateTime, amount: number, unit: DateTimeUnit): DateTime;
13
+ diff(firstDateTime: DateTime, secondDateTime: DateTime, unit: DateTimeUnit): number;
14
+ equal(firstDateTime: DateTime, secondDateTime: DateTime): boolean;
15
+ gt(firstDateTime: DateTime, secondDateTime: DateTime): boolean;
16
+ lt(firstDateTime: DateTime, secondDateTime: DateTime): boolean;
17
+ gte(firstDateTime: DateTime, secondDateTime: DateTime): boolean;
18
+ lte(firstDateTime: DateTime, secondDateTime: DateTime): boolean;
19
+ format(dateTime: DateTime, options: DateTimeFormatOptions): string;
20
+ }
21
+ //# sourceMappingURL=date-time-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-time-service.type.d.ts","sourceRoot":"","sources":["../../src/service/date-time-service.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,wBAAw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B,GAAG,MAAM,CAAC;CACpE"}
@@ -1,2 +1,14 @@
1
+ export * from "./instant-service.type.js";
1
2
  export * from "./date-service.type.js";
3
+ export * from "./time-service.type.js";
4
+ export * from "./date-time-service.type.js";
5
+ export * from "./zoned-date-time-service.type.js";
6
+ export * from "./crypto-service.type.js";
7
+ export * from "./token-generation-service.type.js";
8
+ export * from "./token-signing-service.type.js";
9
+ export * from "./token-verification-service.type.js";
10
+ export * from "./token-decoding-service.type.js";
11
+ export * from "./token-encryption-service.type.js";
12
+ export * from "./token-decryption-service.type.js";
13
+ export * from "./token-validation-service.type.js";
2
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC;AACzC,cAAc,oCAAoC,CAAC;AACnD,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,cAAc,kCAAkC,CAAC;AACjD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { DateTimeFormatOptions } from "./date-time-service.type.js";
2
+ import { TimeZone } from "./time-zone.type.js";
3
+ export type InstantUnit = "millisecond" | "second" | "minute" | "hour";
4
+ export type InstantFormatOptions = DateTimeFormatOptions & {
5
+ timeZone?: TimeZone;
6
+ };
7
+ export interface InstantService<Instant> {
8
+ now(): Instant;
9
+ add(instant: Instant, amount: number, unit: InstantUnit): Instant;
10
+ subtract(instant: Instant, amount: number, unit: InstantUnit): Instant;
11
+ diff(firstInstant: Instant, secondInstant: Instant, unit: InstantUnit): number;
12
+ equal(firstInstant: Instant, secondInstant: Instant): boolean;
13
+ gt(firstInstant: Instant, secondInstant: Instant): boolean;
14
+ lt(firstInstant: Instant, secondInstant: Instant): boolean;
15
+ gte(firstInstant: Instant, secondInstant: Instant): boolean;
16
+ lte(firstInstant: Instant, secondInstant: Instant): boolean;
17
+ format(instant: Instant, options: InstantFormatOptions): string;
18
+ }
19
+ //# sourceMappingURL=instant-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instant-service.type.d.ts","sourceRoot":"","sources":["../../src/service/instant-service.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAEvE,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,GAAG;IACzD,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF,MAAM,WAAW,cAAc,CAAC,OAAO;IACrC,GAAG,IAAI,OAAO,CAAC;IAEf,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC;IAElE,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC;IAEvE,IAAI,CACF,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,OAAO,EACtB,IAAI,EAAE,WAAW,GAChB,MAAM,CAAC;IAEV,KAAK,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAE9D,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAE3D,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAE3D,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAE5D,GAAG,CAAC,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAE5D,MAAM,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,oBAAoB,GAAG,MAAM,CAAC;CACjE"}
@@ -0,0 +1,2 @@
1
+ export type Locale = string;
2
+ //# sourceMappingURL=locale.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.type.d.ts","sourceRoot":"","sources":["../../src/service/locale.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { InstantUnit } from "./instant-service.type.js";
2
+ import { Locale } from "./locale.type.js";
3
+ import { TimeZone } from "./time-zone.type.js";
4
+ export type TimeUnit = InstantUnit;
5
+ export type TimeFormatOptions = {
6
+ locale?: Locale;
7
+ hour?: "numeric" | "2-digit";
8
+ minute?: "numeric" | "2-digit";
9
+ second?: "numeric" | "2-digit";
10
+ fractionalSecondDigits?: 1 | 2 | 3;
11
+ hour12?: boolean;
12
+ hourCycle?: "h11" | "h12" | "h23" | "h24";
13
+ };
14
+ export interface TimeService<Time> {
15
+ now(timeZone?: TimeZone): Time;
16
+ add(time: Time, amount: number, unit: TimeUnit): Time;
17
+ subtract(time: Time, amount: number, unit: TimeUnit): Time;
18
+ diff(firstTime: Time, secondTime: Time, unit: TimeUnit): number;
19
+ equal(firstTime: Time, secondTime: Time): boolean;
20
+ gt(firstTime: Time, secondTime: Time): boolean;
21
+ lt(firstTime: Time, secondTime: Time): boolean;
22
+ gte(firstTime: Time, secondTime: Time): boolean;
23
+ lte(firstTime: Time, secondTime: Time): boolean;
24
+ format(time: Time, options: TimeFormatOptions): string;
25
+ }
26
+ //# sourceMappingURL=time-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-service.type.d.ts","sourceRoot":"","sources":["../../src/service/time-service.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC;AAEnC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC7B,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,MAAM,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAC/B,sBAAsB,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;CAC3C,CAAC;AAEF,MAAM,WAAW,WAAW,CAAC,IAAI;IAC/B,GAAG,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE/B,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAEtD,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IAE3D,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IAEhE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAElD,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAE/C,EAAE,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAE/C,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAEhD,GAAG,CAAC,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,GAAG,OAAO,CAAC;IAEhD,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;CACxD"}
@@ -0,0 +1,2 @@
1
+ export type TimeZone = string;
2
+ //# sourceMappingURL=time-zone.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-zone.type.d.ts","sourceRoot":"","sources":["../../src/service/time-zone.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC"}
@@ -0,0 +1,4 @@
1
+ export interface TokenDecodingService<TokenPayload extends object, Token = string> {
2
+ decode(token: Token): Promise<TokenPayload | null>;
3
+ }
4
+ //# sourceMappingURL=token-decoding-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-decoding-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-decoding-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB,CACnC,YAAY,SAAS,MAAM,EAC3B,KAAK,GAAG,MAAM;IAEd,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;CACpD"}
@@ -0,0 +1,5 @@
1
+ export type DecryptOptions = Record<string, unknown>;
2
+ export interface TokenDecryptionService<TokenPayload extends object, Token = string, CustomDecryptOptions extends DecryptOptions = DecryptOptions> {
3
+ decrypt(token: Token, options?: CustomDecryptOptions): Promise<TokenPayload>;
4
+ }
5
+ //# sourceMappingURL=token-decryption-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-decryption-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-decryption-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,WAAW,sBAAsB,CACrC,YAAY,SAAS,MAAM,EAC3B,KAAK,GAAG,MAAM,EACd,oBAAoB,SAAS,cAAc,GAAG,cAAc;IAE5D,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC9E"}
@@ -0,0 +1,5 @@
1
+ export type EncryptOptions = Record<string, unknown>;
2
+ export interface TokenEncryptionService<TokenPayload extends object, Token = string, CustomEncryptOptions extends EncryptOptions = EncryptOptions> {
3
+ encrypt(payload: TokenPayload, options?: CustomEncryptOptions): Promise<Token>;
4
+ }
5
+ //# sourceMappingURL=token-encryption-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-encryption-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-encryption-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,WAAW,sBAAsB,CACrC,YAAY,SAAS,MAAM,EAC3B,KAAK,GAAG,MAAM,EACd,oBAAoB,SAAS,cAAc,GAAG,cAAc;IAE5D,OAAO,CACL,OAAO,EAAE,YAAY,EACrB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,OAAO,CAAC,KAAK,CAAC,CAAC;CACnB"}
@@ -0,0 +1,7 @@
1
+ export type GenerateOptions = {
2
+ length?: number;
3
+ };
4
+ export interface TokenGenerationService<Token = string, CustomGenerateOptions extends GenerateOptions = GenerateOptions> {
5
+ generate(options?: CustomGenerateOptions): Promise<Token>;
6
+ }
7
+ //# sourceMappingURL=token-generation-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-generation-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-generation-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,sBAAsB,CACrC,KAAK,GAAG,MAAM,EACd,qBAAqB,SAAS,eAAe,GAAG,eAAe;IAE/D,QAAQ,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CAC3D"}
@@ -0,0 +1,9 @@
1
+ export type SignOptions = {
2
+ expiresIn?: number | string;
3
+ issuer?: string;
4
+ audience?: string;
5
+ };
6
+ export interface TokenSigningService<TokenPayload extends object, Token = string, CustomSignOptions extends SignOptions = SignOptions> {
7
+ sign(payload: TokenPayload, options?: CustomSignOptions): Promise<Token>;
8
+ }
9
+ //# sourceMappingURL=token-signing-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-signing-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-signing-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,mBAAmB,CAClC,YAAY,SAAS,MAAM,EAC3B,KAAK,GAAG,MAAM,EACd,iBAAiB,SAAS,WAAW,GAAG,WAAW;IAEnD,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;CAC1E"}
@@ -0,0 +1,4 @@
1
+ export interface TokenValidationService<Token = string> {
2
+ validate(token: Token): Promise<boolean>;
3
+ }
4
+ //# sourceMappingURL=token-validation-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-validation-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-validation-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB,CAAC,KAAK,GAAG,MAAM;IACpD,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1C"}
@@ -0,0 +1,8 @@
1
+ export type VerifyOptions = {
2
+ issuer?: string;
3
+ audience?: string;
4
+ };
5
+ export interface TokenVerificationService<TokenPayload extends object, Token = string, CustomVerifyOptions extends VerifyOptions = VerifyOptions> {
6
+ verify(token: Token, options?: CustomVerifyOptions): Promise<TokenPayload>;
7
+ }
8
+ //# sourceMappingURL=token-verification-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-verification-service.type.d.ts","sourceRoot":"","sources":["../../src/service/token-verification-service.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,wBAAwB,CACvC,YAAY,SAAS,MAAM,EAC3B,KAAK,GAAG,MAAM,EACd,mBAAmB,SAAS,aAAa,GAAG,aAAa;IAEzD,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAC5E"}
@@ -0,0 +1,22 @@
1
+ import { DateTimeFormatOptions } from "./date-time-service.type.js";
2
+ import { DateUnit } from "./date-service.type.js";
3
+ import { TimeUnit } from "./time-service.type.js";
4
+ import { TimeZone } from "./time-zone.type.js";
5
+ export type ZonedDateTimeUnit = DateUnit | TimeUnit;
6
+ export type ZonedDateTimeFormatOptions = DateTimeFormatOptions & {
7
+ timeZone?: TimeZone;
8
+ timeZoneName?: "long" | "short" | "longOffset" | "shortOffset";
9
+ };
10
+ export interface ZonedDateTimeService<ZonedDateTime> {
11
+ now(timeZone?: TimeZone): ZonedDateTime;
12
+ add(zonedDateTime: ZonedDateTime, amount: number, unit: ZonedDateTimeUnit): ZonedDateTime;
13
+ subtract(zonedDateTime: ZonedDateTime, amount: number, unit: ZonedDateTimeUnit): ZonedDateTime;
14
+ diff(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime, unit: ZonedDateTimeUnit): number;
15
+ equal(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime): boolean;
16
+ gt(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime): boolean;
17
+ lt(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime): boolean;
18
+ gte(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime): boolean;
19
+ lte(firstZonedDateTime: ZonedDateTime, secondZonedDateTime: ZonedDateTime): boolean;
20
+ format(zonedDateTime: ZonedDateTime, options: ZonedDateTimeFormatOptions): string;
21
+ }
22
+ //# sourceMappingURL=zoned-date-time-service.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zoned-date-time-service.type.d.ts","sourceRoot":"","sources":["../../src/service/zoned-date-time-service.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEpD,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,GAAG;IAC/D,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,YAAY,GAAG,aAAa,CAAC;CAChE,CAAC;AAEF,MAAM,WAAW,oBAAoB,CAAC,aAAa;IACjD,GAAG,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,aAAa,CAAC;IAExC,GAAG,CACD,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,iBAAiB,GACtB,aAAa,CAAC;IAEjB,QAAQ,CACN,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,iBAAiB,GACtB,aAAa,CAAC;IAEjB,IAAI,CACF,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,EAClC,IAAI,EAAE,iBAAiB,GACtB,MAAM,CAAC;IAEV,KAAK,CACH,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,GACjC,OAAO,CAAC;IAEX,EAAE,CACA,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,GACjC,OAAO,CAAC;IAEX,EAAE,CACA,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,GACjC,OAAO,CAAC;IAEX,GAAG,CACD,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,GACjC,OAAO,CAAC;IAEX,GAAG,CACD,kBAAkB,EAAE,aAAa,EACjC,mBAAmB,EAAE,aAAa,GACjC,OAAO,CAAC;IAEX,MAAM,CACJ,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,0BAA0B,GAClC,MAAM,CAAC;CACX"}
@@ -1,4 +1,2 @@
1
1
  export * from "./require-at-least-one.type.js";
2
- export * from "./date-unit.type.js";
3
- export * from "./date-format.type.js";
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/util/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@basecraft/types",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "files": [
@@ -1,2 +0,0 @@
1
- export type DateFormat = "dd/MM/yyyy" | "dd-MM-yyyy" | "dd/MM/yy" | "dd-MM-yy" | "dd/MM/yyyy HH:mm:ss" | "dd-MM-yyyy HH:mm:ss" | "dd/MM/yy HH:mm:ss" | "dd-MM-yy HH:mm:ss";
2
- //# sourceMappingURL=date-format.type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-format.type.d.ts","sourceRoot":"","sources":["../../src/util/date-format.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAClB,YAAY,GACZ,YAAY,GACZ,UAAU,GACV,UAAU,GACV,qBAAqB,GACrB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,CAAC"}
@@ -1,2 +0,0 @@
1
- export type DateUnit = "millisecond" | "second" | "minute" | "hour" | "day" | "week" | "month" | "year";
2
- //# sourceMappingURL=date-unit.type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-unit.type.d.ts","sourceRoot":"","sources":["../../src/util/date-unit.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAChB,aAAa,GACb,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,KAAK,GACL,MAAM,GACN,OAAO,GACP,MAAM,CAAC"}