@pax2pay/model-banking 0.1.579 → 0.1.581

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 (62) hide show
  1. package/Identifier.ts +2 -0
  2. package/Log/Entry.ts +7 -10
  3. package/Log/Locations.ts +8 -13
  4. package/Log/Message/Configuration.ts +8 -13
  5. package/Log/Message/Entry.ts +7 -11
  6. package/Log/Message/index.ts +1 -1
  7. package/Log/index.ts +11 -19
  8. package/Realm.ts +2 -0
  9. package/Supplier/index.ts +16 -7
  10. package/dist/cjs/Identifier.d.ts +2 -0
  11. package/dist/cjs/Identifier.js +35 -0
  12. package/dist/cjs/Identifier.js.map +1 -1
  13. package/dist/cjs/Log/Entry.d.ts +12 -9
  14. package/dist/cjs/Log/Entry.js +38 -5
  15. package/dist/cjs/Log/Entry.js.map +1 -1
  16. package/dist/cjs/Log/Locations.d.ts +8 -7
  17. package/dist/cjs/Log/Locations.js +40 -7
  18. package/dist/cjs/Log/Locations.js.map +1 -1
  19. package/dist/cjs/Log/Message/Configuration.d.ts +13 -8
  20. package/dist/cjs/Log/Message/Configuration.js +40 -7
  21. package/dist/cjs/Log/Message/Configuration.js.map +1 -1
  22. package/dist/cjs/Log/Message/Entry.d.ts +7 -6
  23. package/dist/cjs/Log/Message/Entry.js +39 -6
  24. package/dist/cjs/Log/Message/Entry.js.map +1 -1
  25. package/dist/cjs/Log/Message/index.js +1 -1
  26. package/dist/cjs/Log/Message/index.js.map +1 -1
  27. package/dist/cjs/Log/index.d.ts +19 -13
  28. package/dist/cjs/Log/index.js +43 -10
  29. package/dist/cjs/Log/index.js.map +1 -1
  30. package/dist/cjs/Realm.d.ts +7 -0
  31. package/dist/cjs/Realm.js +35 -0
  32. package/dist/cjs/Realm.js.map +1 -1
  33. package/dist/cjs/Supplier/index.d.ts +11 -2
  34. package/dist/cjs/Supplier/index.js +12 -4
  35. package/dist/cjs/Supplier/index.js.map +1 -1
  36. package/dist/mjs/Identifier.d.ts +2 -0
  37. package/dist/mjs/Identifier.js +2 -0
  38. package/dist/mjs/Identifier.js.map +1 -1
  39. package/dist/mjs/Log/Entry.d.ts +12 -9
  40. package/dist/mjs/Log/Entry.js +5 -5
  41. package/dist/mjs/Log/Entry.js.map +1 -1
  42. package/dist/mjs/Log/Locations.d.ts +8 -7
  43. package/dist/mjs/Log/Locations.js +7 -7
  44. package/dist/mjs/Log/Locations.js.map +1 -1
  45. package/dist/mjs/Log/Message/Configuration.d.ts +13 -8
  46. package/dist/mjs/Log/Message/Configuration.js +7 -7
  47. package/dist/mjs/Log/Message/Configuration.js.map +1 -1
  48. package/dist/mjs/Log/Message/Entry.d.ts +7 -6
  49. package/dist/mjs/Log/Message/Entry.js +6 -6
  50. package/dist/mjs/Log/Message/Entry.js.map +1 -1
  51. package/dist/mjs/Log/Message/index.js +1 -1
  52. package/dist/mjs/Log/Message/index.js.map +1 -1
  53. package/dist/mjs/Log/index.d.ts +19 -13
  54. package/dist/mjs/Log/index.js +10 -10
  55. package/dist/mjs/Log/index.js.map +1 -1
  56. package/dist/mjs/Realm.d.ts +7 -0
  57. package/dist/mjs/Realm.js +2 -0
  58. package/dist/mjs/Realm.js.map +1 -1
  59. package/dist/mjs/Supplier/index.d.ts +11 -2
  60. package/dist/mjs/Supplier/index.js +12 -4
  61. package/dist/mjs/Supplier/index.js.map +1 -1
  62. package/package.json +3 -2
package/Identifier.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { cryptly } from "cryptly"
2
2
  import { isoly } from "isoly"
3
3
  import { isly } from "isly"
4
+ import * as z from "zod"
4
5
 
5
6
  export type Identifier = cryptly.Identifier
6
7
  export namespace Identifier {
@@ -19,4 +20,5 @@ export namespace Identifier {
19
20
  return isoly.DateTime.create(Number(new BigUint64Array(decoded.slice(decoded.length - 8).buffer)), "milliseconds")
20
21
  }
21
22
  export const type = isly.fromIs("Identifier", cryptly.Identifier.is)
23
+ export const zodType = z.string().refine(cryptly.Identifier.is)
22
24
  }
package/Log/Entry.ts CHANGED
@@ -1,17 +1,12 @@
1
- import { isly } from "isly"
1
+ import * as z from "zod"
2
2
 
3
- export interface Entry {
4
- message: string
5
- data?: any
6
- }
7
3
  export namespace Entry {
8
- export type Message = Entry & { resource?: string }
9
- export const type = isly.object<Entry>({
10
- message: isly.string(),
11
- data: isly.any().optional(),
4
+ export const type = z.object({
5
+ message: z.string(),
6
+ data: z.any().optional(),
12
7
  })
13
8
  export namespace Message {
14
- export const type = Entry.type.extend<Message>({ resource: isly.string().optional() })
9
+ export const type = z.object({ ...Entry.type.shape, resource: z.string().optional() })
15
10
  export function to(message: string, data: any | undefined, resource: string | undefined): Entry.Message {
16
11
  const result: Entry.Message = { message }
17
12
  resource && (result.resource = resource)
@@ -19,4 +14,6 @@ export namespace Entry {
19
14
  return result
20
15
  }
21
16
  }
17
+ export type Message = z.infer<typeof Message.type>
22
18
  }
19
+ export type Entry = z.infer<typeof Entry.type>
package/Log/Locations.ts CHANGED
@@ -1,17 +1,11 @@
1
- import { isly } from "isly"
1
+ import * as z from "zod"
2
2
 
3
- export interface Locations {
4
- cfConnectionIp?: string
5
- cfIpCountry?: string
6
- datacenter?: string
7
- country?: string
8
- }
9
3
  export namespace Locations {
10
- export const type = isly.object<Locations>({
11
- cfConnectionIp: isly.string().optional(),
12
- cfIpCountry: isly.string().optional(),
13
- datacenter: isly.string().optional(),
14
- country: isly.string().optional(),
4
+ export const type = z.object({
5
+ cfConnectionIp: z.string().optional(),
6
+ cfIpCountry: z.string().optional(),
7
+ datacenter: z.string().optional(),
8
+ country: z.string().optional(),
15
9
  })
16
10
  export function getLocations(request: any): Locations | undefined {
17
11
  const locations = {
@@ -20,6 +14,7 @@ export namespace Locations {
20
14
  datacenter: request.cf?.colo,
21
15
  country: request.cf?.country,
22
16
  }
23
- return type.is(locations) ? locations : undefined
17
+ return type.safeParse(locations).success ? locations : undefined
24
18
  }
25
19
  }
20
+ export type Locations = z.infer<typeof Locations.type>
@@ -1,22 +1,16 @@
1
1
  import { TraceLog } from "@cloudflare/workers-types"
2
- import { isly } from "isly"
2
+ import * as z from "zod"
3
3
  import { Realm } from "../../Realm"
4
4
 
5
- export interface Configuration {
6
- realm: Realm
7
- collection: string
8
- resource?: string
9
- requireEntries?: boolean
10
- }
11
5
  export namespace Configuration {
12
- export const type = isly.object<Configuration>({
13
- realm: Realm.type,
14
- collection: isly.string(),
15
- resource: isly.string().optional(),
16
- requireEntries: isly.boolean().optional(),
6
+ export const type = z.object({
7
+ realm: Realm.zodType,
8
+ collection: z.string(),
9
+ resource: z.string().optional(),
10
+ requireEntries: z.boolean().optional(),
17
11
  })
18
12
  export function fromTraceLog(trace: TraceLog | undefined): Configuration | undefined {
19
- return trace && Configuration.type.is(trace.message[0])
13
+ return trace && Configuration.type.safeParse(trace.message[0]).success
20
14
  ? {
21
15
  realm: trace.message[0].realm,
22
16
  collection: trace.message[0].collection,
@@ -26,3 +20,4 @@ export namespace Configuration {
26
20
  : undefined
27
21
  }
28
22
  }
23
+ export type Configuration = z.infer<typeof Configuration.type>
@@ -1,20 +1,15 @@
1
1
  import { TraceLog } from "@cloudflare/workers-types"
2
- import { isly } from "isly"
2
+ import * as z from "zod"
3
3
  import type { Log } from "../index"
4
4
 
5
- export interface Entry {
6
- message: string
7
- resource?: string
8
- data?: any
9
- }
10
5
  export namespace Entry {
11
- export const type = isly.object<Entry>({
12
- message: isly.string(),
13
- resource: isly.string().optional(),
14
- data: isly.any().optional(),
6
+ export const type = z.object({
7
+ message: z.string(),
8
+ resource: z.string().optional(),
9
+ data: z.any().optional(),
15
10
  })
16
11
  export function fromEventLogs(trace: TraceLog): { entry: Log.Entry; resource: Log["resource"] } | undefined {
17
- return Entry.type.is(trace.message[0])
12
+ return Entry.type.safeParse(trace.message[0]).success
18
13
  ? {
19
14
  entry: {
20
15
  message: trace.message[0].message,
@@ -25,3 +20,4 @@ export namespace Entry {
25
20
  : undefined
26
21
  }
27
22
  }
23
+ export type Entry = z.infer<typeof Entry.type>
@@ -11,7 +11,7 @@ export namespace Message {
11
11
  traces: TraceLog[]
12
12
  ): Pick<Log, "realm" | "collection" | "resource" | "entries"> | undefined {
13
13
  const configuration: Configuration | undefined = Message.Configuration.fromTraceLog(
14
- traces.find(trace => Message.Configuration.type.is(trace.message[0]))
14
+ traces.find(trace => Message.Configuration.type.safeParse(trace.message[0]).success)
15
15
  )
16
16
  const result: Pick<Log, "realm" | "collection" | "resource" | "entries"> | undefined = configuration
17
17
  ? {
package/Log/index.ts CHANGED
@@ -1,33 +1,24 @@
1
1
  import { isoly } from "isoly"
2
2
  import { TraceItem } from "@cloudflare/workers-types"
3
- import { isly } from "isly"
3
+ import * as z from "zod"
4
4
  import { Identifier } from "../Identifier"
5
5
  import { Realm } from "../Realm"
6
6
  import { Entry as LogEntry } from "./Entry"
7
7
  import { Locations as LogLocations } from "./Locations"
8
8
  import { Message as LogMessage } from "./Message"
9
9
 
10
- export interface Log {
11
- id: Identifier
12
- realm: Realm
13
- script?: string
14
- collection: string
15
- resource?: string
16
- entries: Log.Entry[]
17
- created: isoly.DateTime
18
- }
19
10
  export namespace Log {
20
11
  export import Message = LogMessage
21
12
  export import Entry = LogEntry
22
13
  export import Locations = LogLocations
23
- export const type = isly.object<Log>({
24
- id: Identifier.type,
25
- realm: Realm.type,
26
- script: isly.string(),
27
- collection: isly.string(),
28
- resource: isly.string().optional(),
14
+ export const type = z.object({
15
+ id: Identifier.zodType,
16
+ realm: Realm.zodType,
17
+ script: z.string().optional(),
18
+ collection: z.string(),
19
+ resource: z.string().optional(),
29
20
  entries: Log.Entry.type.array(),
30
- created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
21
+ created: z.iso.datetime({ offset: true }),
31
22
  })
32
23
  export function fromEvents(events: TraceItem[]): Log[] {
33
24
  const result: Log[] = []
@@ -59,9 +50,9 @@ export namespace Log {
59
50
  locations?: LogLocations
60
51
  ): void {
61
52
  const configuration = { collection, realm, resource, requireEntries }
62
- if (Log.Message.Configuration.type.is(configuration))
53
+ if (Log.Message.Configuration.type.safeParse(configuration).success)
63
54
  console.log(configuration)
64
- if (Log.Locations.type.is(locations))
55
+ if (Log.Locations.type.safeParse(locations).success)
65
56
  console.log(Log.Entry.Message.to("Locations", locations, resource))
66
57
  }
67
58
  export function log(message: string, data?: any, resource?: string): void {
@@ -74,3 +65,4 @@ export namespace Log {
74
65
  console.error(Log.Entry.Message.to(message, data, resource))
75
66
  }
76
67
  }
68
+ export type Log = z.infer<typeof Log.type>
package/Realm.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { isoly } from "isoly"
2
2
  import { isly } from "isly"
3
3
  import { isly as isly2 } from "isly2"
4
+ import * as z from "zod"
4
5
  import { Supplier as modelSupplier } from "./Supplier"
5
6
 
6
7
  export type Realm = typeof Realm.realms[number]
@@ -8,6 +9,7 @@ export type Realm = typeof Realm.realms[number]
8
9
  export namespace Realm {
9
10
  export const realms = ["test", "uk", "uguk", "eea"] as const
10
11
  export const type = isly.string<Realm>(realms)
12
+ export const zodType = z.enum(realms)
11
13
  export const type2 = isly2
12
14
  .string<Realm>("value", ...realms)
13
15
  .rename("Realm")
package/Supplier/index.ts CHANGED
@@ -6,16 +6,25 @@ export type Supplier = typeof Supplier.names[number]
6
6
  export namespace Supplier {
7
7
  export const names = ["paxgiro", "clearbank", "bankingcircle", "paxgiroCredit"] as const
8
8
  export const type = isly.string<Supplier>(names)
9
- export const currencies: Record<Supplier, isoly.Currency[]> = {
10
- clearbank: ["GBP"],
11
- bankingcircle: ["EUR", "GBP", "USD", "DKK", "CHF", "PLN", "SEK", "HUF"],
12
- paxgiro: ["GBP", "SEK", "USD", "EUR"],
13
- paxgiroCredit: ["GBP", "SEK", "USD", "EUR"],
9
+ export const currencies: { [R in Realm]: { [S in typeof realm[R][number]]: isoly.Currency[] } } = {
10
+ eea: {},
11
+ uk: {
12
+ clearbank: ["GBP"],
13
+ bankingcircle: ["EUR", "GBP", "USD", "DKK", "CHF", "PLN", "SEK", "HUF"],
14
+ },
15
+ uguk: {
16
+ bankingcircle: ["EUR", "GBP", "USD", "DKK", "CHF", "PLN", "SEK", "NOK"],
17
+ },
18
+ test: {
19
+ paxgiro: ["GBP", "SEK", "USD", "EUR"],
20
+ bankingcircle: ["EUR", "GBP", "USD", "DKK", "CHF", "PLN", "SEK", "HUF"],
21
+ },
14
22
  }
15
- export const realm: Record<Realm, Supplier[]> = {
23
+ export const realm = {
16
24
  eea: [],
17
25
  test: ["paxgiro", "bankingcircle"],
18
26
  uk: ["clearbank", "bankingcircle"],
19
27
  uguk: ["bankingcircle"],
20
- }
28
+ // eslint-disable-next-line prettierx/options
29
+ } as const satisfies Record<Realm, Supplier[]>
21
30
  }
@@ -1,9 +1,11 @@
1
1
  import { cryptly } from "cryptly";
2
2
  import { isoly } from "isoly";
3
3
  import { isly } from "isly";
4
+ import * as z from "zod";
4
5
  export type Identifier = cryptly.Identifier;
5
6
  export declare namespace Identifier {
6
7
  function generate(date?: isoly.DateTime, length?: cryptly.Identifier.Length, ordering?: "ordered" | "reversed"): string;
7
8
  function timeOf(identifier: cryptly.Identifier, ordering?: "ordered" | "reversed"): isoly.DateTime;
8
9
  const type: isly.Type<string>;
10
+ const zodType: z.ZodString;
9
11
  }
@@ -1,9 +1,43 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.Identifier = void 0;
4
37
  const cryptly_1 = require("cryptly");
5
38
  const isoly_1 = require("isoly");
6
39
  const isly_1 = require("isly");
40
+ const z = __importStar(require("zod"));
7
41
  var Identifier;
8
42
  (function (Identifier) {
9
43
  function generate(date = isoly_1.isoly.DateTime.now(), length = 16, ordering = "reversed") {
@@ -16,5 +50,6 @@ var Identifier;
16
50
  }
17
51
  Identifier.timeOf = timeOf;
18
52
  Identifier.type = isly_1.isly.fromIs("Identifier", cryptly_1.cryptly.Identifier.is);
53
+ Identifier.zodType = z.string().refine(cryptly_1.cryptly.Identifier.is);
19
54
  })(Identifier || (exports.Identifier = Identifier = {}));
20
55
  //# sourceMappingURL=Identifier.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Identifier.js","sourceRoot":"","sources":["../../Identifier.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,iCAA6B;AAC7B,+BAA2B;AAG3B,IAAiB,UAAU,CAgB1B;AAhBD,WAAiB,UAAU;IAC1B,SAAgB,QAAQ,CACvB,OAAuB,aAAK,CAAC,QAAQ,CAAC,GAAG,EAAE,EAC3C,SAAoC,EAAE,EACtC,WAAmC,UAAU;QAE7C,OAAO,iBAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,EAAE,aAAK,CAAC,QAAQ,CAA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AM,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAA;QAC3D,OAAO,aAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,cAAc,CAAC,CAAA;IACnH,CAAC;IANe,iBAAM,SAMrB,CAAA;IACY,eAAI,GAAG,WAAI,CAAC,MAAM,CAAC,YAAY,EAAE,iBAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IACvD,kBAAO,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,iBAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;AAChE,CAAC,EAjBgB,UAAU,0BAAV,UAAU,QAiB1B"}
@@ -1,14 +1,17 @@
1
- export interface Entry {
2
- message: string;
3
- data?: any;
4
- }
1
+ import * as z from "zod";
5
2
  export declare namespace Entry {
6
- type Message = Entry & {
7
- resource?: string;
8
- };
9
- const type: import("isly/dist/cjs/object").IslyObject<Entry, object>;
3
+ const type: z.ZodObject<{
4
+ message: z.ZodString;
5
+ data: z.ZodOptional<z.ZodAny>;
6
+ }, z.core.$strip>;
10
7
  namespace Message {
11
- const type: import("isly/dist/cjs/object").IslyObject<Message, Entry>;
8
+ const type: z.ZodObject<{
9
+ resource: z.ZodOptional<z.ZodString>;
10
+ message: z.ZodString;
11
+ data: z.ZodOptional<z.ZodAny>;
12
+ }, z.core.$strip>;
12
13
  function to(message: string, data: any | undefined, resource: string | undefined): Entry.Message;
13
14
  }
15
+ type Message = z.infer<typeof Message.type>;
14
16
  }
17
+ export type Entry = z.infer<typeof Entry.type>;
@@ -1,16 +1,49 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.Entry = void 0;
4
- const isly_1 = require("isly");
37
+ const z = __importStar(require("zod"));
5
38
  var Entry;
6
39
  (function (Entry) {
7
- Entry.type = isly_1.isly.object({
8
- message: isly_1.isly.string(),
9
- data: isly_1.isly.any().optional(),
40
+ Entry.type = z.object({
41
+ message: z.string(),
42
+ data: z.any().optional(),
10
43
  });
11
44
  let Message;
12
45
  (function (Message) {
13
- Message.type = Entry.type.extend({ resource: isly_1.isly.string().optional() });
46
+ Message.type = z.object({ ...Entry.type.shape, resource: z.string().optional() });
14
47
  function to(message, data, resource) {
15
48
  const result = { message };
16
49
  resource && (result.resource = resource);
@@ -1 +1 @@
1
- {"version":3,"file":"Entry.js","sourceRoot":"","sources":["../../../Log/Entry.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAM3B,IA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AC,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA;QACtF,SAAgB,EAAE,CAAC,OAAe,EAAE,IAAqB,EAAE,QAA4B;YACtF,MAAM,MAAM,GAAkB,EAAE,OAAO,EAAE,CAAA;YACzC,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAA;YACxC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,CAAA;YAC5B,OAAO,MAAM,CAAA;QACd,CAAC;QALe,UAAE,KAKjB,CAAA;IACF,CAAC,EARgB,OAAO,GAAP,aAAO,KAAP,aAAO,QAQvB;AAEF,CAAC,EAfgB,KAAK,qBAAL,KAAK,QAerB"}
@@ -1,10 +1,11 @@
1
- export interface Locations {
2
- cfConnectionIp?: string;
3
- cfIpCountry?: string;
4
- datacenter?: string;
5
- country?: string;
6
- }
1
+ import * as z from "zod";
7
2
  export declare namespace Locations {
8
- const type: import("isly/dist/cjs/object").IslyObject<Locations, object>;
3
+ const type: z.ZodObject<{
4
+ cfConnectionIp: z.ZodOptional<z.ZodString>;
5
+ cfIpCountry: z.ZodOptional<z.ZodString>;
6
+ datacenter: z.ZodOptional<z.ZodString>;
7
+ country: z.ZodOptional<z.ZodString>;
8
+ }, z.core.$strip>;
9
9
  function getLocations(request: any): Locations | undefined;
10
10
  }
11
+ export type Locations = z.infer<typeof Locations.type>;
@@ -1,14 +1,47 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.Locations = void 0;
4
- const isly_1 = require("isly");
37
+ const z = __importStar(require("zod"));
5
38
  var Locations;
6
39
  (function (Locations) {
7
- Locations.type = isly_1.isly.object({
8
- cfConnectionIp: isly_1.isly.string().optional(),
9
- cfIpCountry: isly_1.isly.string().optional(),
10
- datacenter: isly_1.isly.string().optional(),
11
- country: isly_1.isly.string().optional(),
40
+ Locations.type = z.object({
41
+ cfConnectionIp: z.string().optional(),
42
+ cfIpCountry: z.string().optional(),
43
+ datacenter: z.string().optional(),
44
+ country: z.string().optional(),
12
45
  });
13
46
  function getLocations(request) {
14
47
  const locations = {
@@ -17,7 +50,7 @@ var Locations;
17
50
  datacenter: request.cf?.colo,
18
51
  country: request.cf?.country,
19
52
  };
20
- return Locations.type.is(locations) ? locations : undefined;
53
+ return Locations.type.safeParse(locations).success ? locations : undefined;
21
54
  }
22
55
  Locations.getLocations = getLocations;
23
56
  })(Locations || (exports.Locations = Locations = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"Locations.js","sourceRoot":"","sources":["../../../Log/Locations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QAClC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACjC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC9B,CAAC,CAAA;IACF,SAAgB,YAAY,CAAC,OAAY;QACxC,MAAM,SAAS,GAAG;YACjB,kBAAkB,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;YAC3D,cAAc,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;YACnD,UAAU,EAAE,OAAO,CAAC,EAAE,EAAE,IAAI;YAC5B,OAAO,EAAE,OAAO,CAAC,EAAE,EAAE,OAAO;SAC5B,CAAA;QACD,OAAO,UAAA,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAA;IACjE,CAAC;IARe,sBAAY,eAQ3B,CAAA;AACF,CAAC,EAhBgB,SAAS,yBAAT,SAAS,QAgBzB"}
@@ -1,12 +1,17 @@
1
1
  import { TraceLog } from "@cloudflare/workers-types";
2
- import { Realm } from "../../Realm";
3
- export interface Configuration {
4
- realm: Realm;
5
- collection: string;
6
- resource?: string;
7
- requireEntries?: boolean;
8
- }
2
+ import * as z from "zod";
9
3
  export declare namespace Configuration {
10
- const type: import("isly/dist/cjs/object").IslyObject<Configuration, object>;
4
+ const type: z.ZodObject<{
5
+ realm: z.ZodEnum<{
6
+ test: "test";
7
+ uk: "uk";
8
+ uguk: "uguk";
9
+ eea: "eea";
10
+ }>;
11
+ collection: z.ZodString;
12
+ resource: z.ZodOptional<z.ZodString>;
13
+ requireEntries: z.ZodOptional<z.ZodBoolean>;
14
+ }, z.core.$strip>;
11
15
  function fromTraceLog(trace: TraceLog | undefined): Configuration | undefined;
12
16
  }
17
+ export type Configuration = z.infer<typeof Configuration.type>;
@@ -1,18 +1,51 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
2
35
  Object.defineProperty(exports, "__esModule", { value: true });
3
36
  exports.Configuration = void 0;
4
- const isly_1 = require("isly");
37
+ const z = __importStar(require("zod"));
5
38
  const Realm_1 = require("../../Realm");
6
39
  var Configuration;
7
40
  (function (Configuration) {
8
- Configuration.type = isly_1.isly.object({
9
- realm: Realm_1.Realm.type,
10
- collection: isly_1.isly.string(),
11
- resource: isly_1.isly.string().optional(),
12
- requireEntries: isly_1.isly.boolean().optional(),
41
+ Configuration.type = z.object({
42
+ realm: Realm_1.Realm.zodType,
43
+ collection: z.string(),
44
+ resource: z.string().optional(),
45
+ requireEntries: z.boolean().optional(),
13
46
  });
14
47
  function fromTraceLog(trace) {
15
- return trace && Configuration.type.is(trace.message[0])
48
+ return trace && Configuration.type.safeParse(trace.message[0]).success
16
49
  ? {
17
50
  realm: trace.message[0].realm,
18
51
  collection: trace.message[0].collection,
@@ -1 +1 @@
1
- {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../Log/Message/Configuration.ts"],"names":[],"mappings":";;;AACA,+BAA2B;AAC3B,uCAAmC;AAQnC,IAAiB,aAAa,CAiB7B;AAjBD,WAAiB,aAAa;IAChB,kBAAI,GAAG,WAAI,CAAC,MAAM,CAAgB;QAC9C,KAAK,EAAE,aAAK,CAAC,IAAI;QACjB,UAAU,EAAE,WAAI,CAAC,MAAM,EAAE;QACzB,QAAQ,EAAE,WAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAClC,cAAc,EAAE,WAAI,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;KACzC,CAAC,CAAA;IACF,SAAgB,YAAY,CAAC,KAA2B;QACvD,OAAO,KAAK,IAAI,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACtD,CAAC,CAAC;gBACA,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK;gBAC7B,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU;gBACvC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ;gBACnC,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc;aAC9C;YACH,CAAC,CAAC,SAAS,CAAA;IACb,CAAC;IATe,0BAAY,eAS3B,CAAA;AACF,CAAC,EAjBgB,aAAa,6BAAb,aAAa,QAiB7B"}
1
+ {"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../../../Log/Message/Configuration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAAwB;AACxB,uCAAmC;AAEnC,IAAiB,aAAa,CAiB7B;AAjBD,WAAiB,aAAa;IAChB,kBAAI,GAAG,CAAC,CAAC,MAAM,CAAC;QAC5B,KAAK,EAAE,aAAK,CAAC,OAAO;QACpB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;QACtB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC/B,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;KACtC,CAAC,CAAA;IACF,SAAgB,YAAY,CAAC,KAA2B;QACvD,OAAO,KAAK,IAAI,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO;YACrE,CAAC,CAAC;gBACA,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK;gBAC7B,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,UAAU;gBACvC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ;gBACnC,cAAc,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,cAAc;aAC9C;YACH,CAAC,CAAC,SAAS,CAAA;IACb,CAAC;IATe,0BAAY,eAS3B,CAAA;AACF,CAAC,EAjBgB,aAAa,6BAAb,aAAa,QAiB7B"}
@@ -1,14 +1,15 @@
1
1
  import { TraceLog } from "@cloudflare/workers-types";
2
+ import * as z from "zod";
2
3
  import type { Log } from "../index";
3
- export interface Entry {
4
- message: string;
5
- resource?: string;
6
- data?: any;
7
- }
8
4
  export declare namespace Entry {
9
- const type: import("isly/dist/cjs/object").IslyObject<Log.Message.Entry, object>;
5
+ const type: z.ZodObject<{
6
+ message: z.ZodString;
7
+ resource: z.ZodOptional<z.ZodString>;
8
+ data: z.ZodOptional<z.ZodAny>;
9
+ }, z.core.$strip>;
10
10
  function fromEventLogs(trace: TraceLog): {
11
11
  entry: Log.Entry;
12
12
  resource: Log["resource"];
13
13
  } | undefined;
14
14
  }
15
+ export type Entry = z.infer<typeof Entry.type>;