@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.
- package/Identifier.ts +2 -0
- package/Log/Entry.ts +7 -10
- package/Log/Locations.ts +8 -13
- package/Log/Message/Configuration.ts +8 -13
- package/Log/Message/Entry.ts +7 -11
- package/Log/Message/index.ts +1 -1
- package/Log/index.ts +11 -19
- package/Realm.ts +2 -0
- package/Supplier/index.ts +16 -7
- package/dist/cjs/Identifier.d.ts +2 -0
- package/dist/cjs/Identifier.js +35 -0
- package/dist/cjs/Identifier.js.map +1 -1
- package/dist/cjs/Log/Entry.d.ts +12 -9
- package/dist/cjs/Log/Entry.js +38 -5
- package/dist/cjs/Log/Entry.js.map +1 -1
- package/dist/cjs/Log/Locations.d.ts +8 -7
- package/dist/cjs/Log/Locations.js +40 -7
- package/dist/cjs/Log/Locations.js.map +1 -1
- package/dist/cjs/Log/Message/Configuration.d.ts +13 -8
- package/dist/cjs/Log/Message/Configuration.js +40 -7
- package/dist/cjs/Log/Message/Configuration.js.map +1 -1
- package/dist/cjs/Log/Message/Entry.d.ts +7 -6
- package/dist/cjs/Log/Message/Entry.js +39 -6
- package/dist/cjs/Log/Message/Entry.js.map +1 -1
- package/dist/cjs/Log/Message/index.js +1 -1
- package/dist/cjs/Log/Message/index.js.map +1 -1
- package/dist/cjs/Log/index.d.ts +19 -13
- package/dist/cjs/Log/index.js +43 -10
- package/dist/cjs/Log/index.js.map +1 -1
- package/dist/cjs/Realm.d.ts +7 -0
- package/dist/cjs/Realm.js +35 -0
- package/dist/cjs/Realm.js.map +1 -1
- package/dist/cjs/Supplier/index.d.ts +11 -2
- package/dist/cjs/Supplier/index.js +12 -4
- package/dist/cjs/Supplier/index.js.map +1 -1
- package/dist/mjs/Identifier.d.ts +2 -0
- package/dist/mjs/Identifier.js +2 -0
- package/dist/mjs/Identifier.js.map +1 -1
- package/dist/mjs/Log/Entry.d.ts +12 -9
- package/dist/mjs/Log/Entry.js +5 -5
- package/dist/mjs/Log/Entry.js.map +1 -1
- package/dist/mjs/Log/Locations.d.ts +8 -7
- package/dist/mjs/Log/Locations.js +7 -7
- package/dist/mjs/Log/Locations.js.map +1 -1
- package/dist/mjs/Log/Message/Configuration.d.ts +13 -8
- package/dist/mjs/Log/Message/Configuration.js +7 -7
- package/dist/mjs/Log/Message/Configuration.js.map +1 -1
- package/dist/mjs/Log/Message/Entry.d.ts +7 -6
- package/dist/mjs/Log/Message/Entry.js +6 -6
- package/dist/mjs/Log/Message/Entry.js.map +1 -1
- package/dist/mjs/Log/Message/index.js +1 -1
- package/dist/mjs/Log/Message/index.js.map +1 -1
- package/dist/mjs/Log/index.d.ts +19 -13
- package/dist/mjs/Log/index.js +10 -10
- package/dist/mjs/Log/index.js.map +1 -1
- package/dist/mjs/Realm.d.ts +7 -0
- package/dist/mjs/Realm.js +2 -0
- package/dist/mjs/Realm.js.map +1 -1
- package/dist/mjs/Supplier/index.d.ts +11 -2
- package/dist/mjs/Supplier/index.js +12 -4
- package/dist/mjs/Supplier/index.js.map +1 -1
- 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
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
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.
|
|
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
|
|
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 =
|
|
11
|
-
cfConnectionIp:
|
|
12
|
-
cfIpCountry:
|
|
13
|
-
datacenter:
|
|
14
|
-
country:
|
|
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.
|
|
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
|
|
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 =
|
|
13
|
-
realm: Realm.
|
|
14
|
-
collection:
|
|
15
|
-
resource:
|
|
16
|
-
requireEntries:
|
|
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.
|
|
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>
|
package/Log/Message/Entry.ts
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import { TraceLog } from "@cloudflare/workers-types"
|
|
2
|
-
import
|
|
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 =
|
|
12
|
-
message:
|
|
13
|
-
resource:
|
|
14
|
-
data:
|
|
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.
|
|
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>
|
package/Log/Message/index.ts
CHANGED
|
@@ -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.
|
|
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
|
|
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 =
|
|
24
|
-
id: Identifier.
|
|
25
|
-
realm: Realm.
|
|
26
|
-
script:
|
|
27
|
-
collection:
|
|
28
|
-
resource:
|
|
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:
|
|
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.
|
|
53
|
+
if (Log.Message.Configuration.type.safeParse(configuration).success)
|
|
63
54
|
console.log(configuration)
|
|
64
|
-
if (Log.Locations.type.
|
|
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:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
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
|
}
|
package/dist/cjs/Identifier.d.ts
CHANGED
|
@@ -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
|
}
|
package/dist/cjs/Identifier.js
CHANGED
|
@@ -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":"
|
|
1
|
+
{"version":3,"file":"Identifier.js","sourceRoot":"","sources":["../../Identifier.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAiC;AACjC,iCAA6B;AAC7B,+BAA2B;AAC3B,uCAAwB;AAGxB,IAAiB,UAAU,CAiB1B;AAjBD,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,CAAC,KAAK,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAA;IACjG,CAAC;IANe,mBAAQ,WAMvB,CAAA;IACD,SAAgB,MAAM,CACrB,UAA8B,EAC9B,WAAmC,UAAU;QAE7C,MAAM,OAAO,GAAG,iBAAO,CAAC,MAAM,CAAC,MAAM,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"}
|
package/dist/cjs/Log/Entry.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
message: string;
|
|
3
|
-
data?: any;
|
|
4
|
-
}
|
|
1
|
+
import * as z from "zod";
|
|
5
2
|
export declare namespace Entry {
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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:
|
|
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>;
|
package/dist/cjs/Log/Entry.js
CHANGED
|
@@ -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
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
var Entry;
|
|
6
39
|
(function (Entry) {
|
|
7
|
-
Entry.type =
|
|
8
|
-
message:
|
|
9
|
-
data:
|
|
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.
|
|
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":"
|
|
1
|
+
{"version":3,"file":"Entry.js","sourceRoot":"","sources":["../../../Log/Entry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AAExB,IAAiB,KAAK,CAerB;AAfD,WAAiB,KAAK;IACR,UAAI,GAAG,CAAC,CAAC,MAAM,CAAC;QAC5B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;KACxB,CAAC,CAAA;IACF,IAAiB,OAAO,CAQvB;IARD,WAAiB,OAAO;QACV,YAAI,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,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
|
-
|
|
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:
|
|
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
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
var Locations;
|
|
6
39
|
(function (Locations) {
|
|
7
|
-
Locations.type =
|
|
8
|
-
cfConnectionIp:
|
|
9
|
-
cfIpCountry:
|
|
10
|
-
datacenter:
|
|
11
|
-
country:
|
|
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.
|
|
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.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Locations.js","sourceRoot":"","sources":["../../../Log/Locations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAwB;AAExB,IAAiB,SAAS,CAgBzB;AAhBD,WAAiB,SAAS;IACZ,cAAI,GAAG,CAAC,CAAC,MAAM,CAAC;QAC5B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACrC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;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
|
|
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:
|
|
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
|
|
37
|
+
const z = __importStar(require("zod"));
|
|
5
38
|
const Realm_1 = require("../../Realm");
|
|
6
39
|
var Configuration;
|
|
7
40
|
(function (Configuration) {
|
|
8
|
-
Configuration.type =
|
|
9
|
-
realm: Realm_1.Realm.
|
|
10
|
-
collection:
|
|
11
|
-
resource:
|
|
12
|
-
requireEntries:
|
|
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.
|
|
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":"
|
|
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:
|
|
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>;
|