@pax2pay/model-banking 0.1.308 → 0.1.309
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/Log/Message/Configuration.ts +28 -0
- package/Log/Message/Entry.ts +27 -0
- package/Log/Message/index.ts +27 -0
- package/Log/index.ts +49 -17
- package/dist/Log/Message/Configuration.d.ts +13 -0
- package/dist/Log/Message/Configuration.js +21 -0
- package/dist/Log/Message/Configuration.js.map +1 -0
- package/dist/Log/Message/Entry.d.ts +15 -0
- package/dist/Log/Message/Entry.js +22 -0
- package/dist/Log/Message/Entry.js.map +1 -0
- package/dist/Log/Message/index.d.ts +10 -0
- package/dist/Log/Message/index.js +22 -0
- package/dist/Log/Message/index.js.map +1 -0
- package/dist/Log/index.d.ts +17 -6
- package/dist/Log/index.js +43 -18
- package/dist/Log/index.js.map +1 -1
- package/package.json +2 -1
- package/Log/Configuration.ts +0 -15
- package/dist/Log/Configuration.d.ts +0 -10
- package/dist/Log/Configuration.js +0 -11
- package/dist/Log/Configuration.js.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TraceLog } from "@cloudflare/workers-types"
|
|
2
|
+
import { isly } from "isly"
|
|
3
|
+
import { Realm } from "../../Realm"
|
|
4
|
+
import type { Log } from "../index"
|
|
5
|
+
|
|
6
|
+
export interface Configuration {
|
|
7
|
+
realm: Realm
|
|
8
|
+
collection: string
|
|
9
|
+
resource?: string
|
|
10
|
+
}
|
|
11
|
+
export namespace Configuration {
|
|
12
|
+
export const type = isly.object<Configuration>({
|
|
13
|
+
realm: Realm.type,
|
|
14
|
+
collection: isly.string(),
|
|
15
|
+
resource: isly.string().optional(),
|
|
16
|
+
})
|
|
17
|
+
export function fromTraceLog(
|
|
18
|
+
trace: TraceLog | undefined
|
|
19
|
+
): Pick<Log, "realm" | "collection" | "resource"> | undefined {
|
|
20
|
+
return trace && Configuration.type.is(trace.message[0])
|
|
21
|
+
? {
|
|
22
|
+
realm: trace.message[0].realm,
|
|
23
|
+
collection: trace.message[0].collection,
|
|
24
|
+
resource: trace.message[0].resource,
|
|
25
|
+
}
|
|
26
|
+
: undefined
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TraceLog } from "@cloudflare/workers-types"
|
|
2
|
+
import { isly } from "isly"
|
|
3
|
+
import type { Log } from "../index"
|
|
4
|
+
|
|
5
|
+
export interface Entry {
|
|
6
|
+
message: string
|
|
7
|
+
resource?: string
|
|
8
|
+
data?: any
|
|
9
|
+
}
|
|
10
|
+
export namespace Entry {
|
|
11
|
+
export const type = isly.object<Entry>({
|
|
12
|
+
message: isly.string(),
|
|
13
|
+
resource: isly.string().optional(),
|
|
14
|
+
data: isly.any().optional(),
|
|
15
|
+
})
|
|
16
|
+
export function fromEventLogs(trace: TraceLog): { entry: Log.Entry; resource: Log["resource"] } | undefined {
|
|
17
|
+
return Entry.type.is(trace.message[0])
|
|
18
|
+
? {
|
|
19
|
+
entry: {
|
|
20
|
+
message: trace.message[0].message,
|
|
21
|
+
data: trace.message[0].data,
|
|
22
|
+
},
|
|
23
|
+
resource: trace.message[0].resource,
|
|
24
|
+
}
|
|
25
|
+
: undefined
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { TraceLog } from "@cloudflare/workers-types"
|
|
2
|
+
import type { Log } from "../index"
|
|
3
|
+
import { Configuration as MessageConfiguration } from "./Configuration"
|
|
4
|
+
import { Entry as MessageEntry } from "./Entry"
|
|
5
|
+
|
|
6
|
+
export type Message = MessageConfiguration | MessageEntry
|
|
7
|
+
export namespace Message {
|
|
8
|
+
export import Configuration = MessageConfiguration
|
|
9
|
+
export import Entry = MessageEntry
|
|
10
|
+
export function fromEventLogs(
|
|
11
|
+
traces: TraceLog[]
|
|
12
|
+
): Pick<Log, "realm" | "collection" | "resource" | "entries"> | undefined {
|
|
13
|
+
const configuration: Pick<Log, "realm" | "collection" | "resource"> | undefined =
|
|
14
|
+
Message.Configuration.fromTraceLog(traces.find(trace => Message.Configuration.type.is(trace.message[0])))
|
|
15
|
+
const result: Pick<Log, "realm" | "collection" | "resource" | "entries"> | undefined = configuration
|
|
16
|
+
? { ...configuration, entries: [] }
|
|
17
|
+
: undefined
|
|
18
|
+
if (result)
|
|
19
|
+
for (const trace of traces) {
|
|
20
|
+
const logFragment: { entry: Log.Entry; resource: Log["resource"] } | undefined =
|
|
21
|
+
Message.Entry.fromEventLogs(trace)
|
|
22
|
+
logFragment?.resource && (result.resource ??= logFragment.resource)
|
|
23
|
+
logFragment?.entry && result.entries.push(logFragment.entry)
|
|
24
|
+
}
|
|
25
|
+
return result
|
|
26
|
+
}
|
|
27
|
+
}
|
package/Log/index.ts
CHANGED
|
@@ -1,34 +1,66 @@
|
|
|
1
|
+
import { isoly } from "isoly"
|
|
2
|
+
import { TraceItem } from "@cloudflare/workers-types"
|
|
3
|
+
import { isly } from "isly"
|
|
1
4
|
import { Identifier } from "../Identifier"
|
|
2
|
-
import {
|
|
3
|
-
import { Entry } from "./Entry"
|
|
5
|
+
import { Realm } from "../Realm"
|
|
6
|
+
import { Entry as LogEntry } from "./Entry"
|
|
7
|
+
import { Message as LogMessage } from "./Message"
|
|
4
8
|
|
|
5
|
-
export interface Log
|
|
9
|
+
export interface Log {
|
|
6
10
|
id: Identifier
|
|
7
|
-
|
|
11
|
+
realm: Realm
|
|
12
|
+
script?: string
|
|
13
|
+
collection: string
|
|
14
|
+
resource?: string
|
|
15
|
+
entries: Log.Entry[]
|
|
16
|
+
created: isoly.DateTime
|
|
8
17
|
}
|
|
9
18
|
export namespace Log {
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
export import Message = LogMessage
|
|
20
|
+
export import Entry = LogEntry
|
|
21
|
+
export const type = isly.object<Log>({
|
|
22
|
+
id: Identifier.type,
|
|
23
|
+
realm: Realm.type,
|
|
24
|
+
script: isly.string(),
|
|
25
|
+
collection: isly.string(),
|
|
26
|
+
resource: isly.string().optional(),
|
|
27
|
+
entries: Log.Entry.type.array(),
|
|
28
|
+
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
29
|
+
})
|
|
30
|
+
export function fromEvents(events: TraceItem[]): Log[] {
|
|
31
|
+
const result: Log[] = []
|
|
32
|
+
for (const event of events) {
|
|
33
|
+
const created = event.eventTimestamp
|
|
34
|
+
? isoly.DateTime.create(event.eventTimestamp, "milliseconds")
|
|
35
|
+
: isoly.DateTime.now()
|
|
36
|
+
const message = Log.Message.fromEventLogs(event.logs)
|
|
37
|
+
if (message) {
|
|
38
|
+
const log: Log = {
|
|
39
|
+
id: Identifier.generate(),
|
|
40
|
+
realm: message.realm,
|
|
41
|
+
collection: message.collection,
|
|
42
|
+
entries: message.entries,
|
|
43
|
+
created,
|
|
44
|
+
}
|
|
45
|
+
message.resource && (log.resource = message.resource)
|
|
46
|
+
event.scriptName && (log.script = event.scriptName)
|
|
47
|
+
result.push(log)
|
|
48
|
+
}
|
|
18
49
|
}
|
|
50
|
+
return result
|
|
19
51
|
}
|
|
20
52
|
export function configure(collection: string, realm: string | undefined, resource?: string): void {
|
|
21
53
|
const configuration = { collection, realm, resource }
|
|
22
|
-
if (Configuration.type.is(configuration))
|
|
23
|
-
console.log(
|
|
54
|
+
if (Log.Message.Configuration.type.is(configuration))
|
|
55
|
+
console.log(configuration)
|
|
24
56
|
}
|
|
25
57
|
export function log(message: string, data?: any, resource?: string): void {
|
|
26
|
-
console.log(
|
|
58
|
+
console.log(Log.Entry.Message.to(message, data, resource))
|
|
27
59
|
}
|
|
28
60
|
export function warning(message: string, data?: any, resource?: string): void {
|
|
29
|
-
console.warn(
|
|
61
|
+
console.warn(Log.Entry.Message.to(message, data, resource))
|
|
30
62
|
}
|
|
31
63
|
export function exception(message: string, data?: any, resource?: string): void {
|
|
32
|
-
console.error(
|
|
64
|
+
console.error(Log.Entry.Message.to(message, data, resource))
|
|
33
65
|
}
|
|
34
66
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { TraceLog } from "@cloudflare/workers-types";
|
|
2
|
+
import { isly } from "isly";
|
|
3
|
+
import { Realm } from "../../Realm";
|
|
4
|
+
import type { Log } from "../index";
|
|
5
|
+
export interface Configuration {
|
|
6
|
+
realm: Realm;
|
|
7
|
+
collection: string;
|
|
8
|
+
resource?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare namespace Configuration {
|
|
11
|
+
const type: isly.object.ExtendableType<Log.Message.Configuration>;
|
|
12
|
+
function fromTraceLog(trace: TraceLog | undefined): Pick<Log, "realm" | "collection" | "resource"> | undefined;
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
import { Realm } from "../../Realm";
|
|
3
|
+
export var Configuration;
|
|
4
|
+
(function (Configuration) {
|
|
5
|
+
Configuration.type = isly.object({
|
|
6
|
+
realm: Realm.type,
|
|
7
|
+
collection: isly.string(),
|
|
8
|
+
resource: isly.string().optional(),
|
|
9
|
+
});
|
|
10
|
+
function fromTraceLog(trace) {
|
|
11
|
+
return trace && Configuration.type.is(trace.message[0])
|
|
12
|
+
? {
|
|
13
|
+
realm: trace.message[0].realm,
|
|
14
|
+
collection: trace.message[0].collection,
|
|
15
|
+
resource: trace.message[0].resource,
|
|
16
|
+
}
|
|
17
|
+
: undefined;
|
|
18
|
+
}
|
|
19
|
+
Configuration.fromTraceLog = fromTraceLog;
|
|
20
|
+
})(Configuration || (Configuration = {}));
|
|
21
|
+
//# sourceMappingURL=Configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Configuration.js","sourceRoot":"../","sources":["Log/Message/Configuration.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAQnC,MAAM,KAAW,aAAa,CAiB7B;AAjBD,WAAiB,aAAa;IAChB,kBAAI,GAAG,IAAI,CAAC,MAAM,CAAgB;QAC9C,KAAK,EAAE,KAAK,CAAC,IAAI;QACjB,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE;QACzB,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAClC,CAAC,CAAA;IACF,SAAgB,YAAY,CAC3B,KAA2B;QAE3B,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;aAClC;YACH,CAAC,CAAC,SAAS,CAAA;IACb,CAAC;IAVe,0BAAY,eAU3B,CAAA;AACF,CAAC,EAjBgB,aAAa,KAAb,aAAa,QAiB7B"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TraceLog } from "@cloudflare/workers-types";
|
|
2
|
+
import { isly } from "isly";
|
|
3
|
+
import type { Log } from "../index";
|
|
4
|
+
export interface Entry {
|
|
5
|
+
message: string;
|
|
6
|
+
resource?: string;
|
|
7
|
+
data?: any;
|
|
8
|
+
}
|
|
9
|
+
export declare namespace Entry {
|
|
10
|
+
const type: isly.object.ExtendableType<Log.Message.Entry>;
|
|
11
|
+
function fromEventLogs(trace: TraceLog): {
|
|
12
|
+
entry: Log.Entry;
|
|
13
|
+
resource: Log["resource"];
|
|
14
|
+
} | undefined;
|
|
15
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
export var Entry;
|
|
3
|
+
(function (Entry) {
|
|
4
|
+
Entry.type = isly.object({
|
|
5
|
+
message: isly.string(),
|
|
6
|
+
resource: isly.string().optional(),
|
|
7
|
+
data: isly.any().optional(),
|
|
8
|
+
});
|
|
9
|
+
function fromEventLogs(trace) {
|
|
10
|
+
return Entry.type.is(trace.message[0])
|
|
11
|
+
? {
|
|
12
|
+
entry: {
|
|
13
|
+
message: trace.message[0].message,
|
|
14
|
+
data: trace.message[0].data,
|
|
15
|
+
},
|
|
16
|
+
resource: trace.message[0].resource,
|
|
17
|
+
}
|
|
18
|
+
: undefined;
|
|
19
|
+
}
|
|
20
|
+
Entry.fromEventLogs = fromEventLogs;
|
|
21
|
+
})(Entry || (Entry = {}));
|
|
22
|
+
//# sourceMappingURL=Entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Entry.js","sourceRoot":"../","sources":["Log/Message/Entry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAQ3B,MAAM,KAAW,KAAK,CAiBrB;AAjBD,WAAiB,KAAK;IACR,UAAI,GAAG,IAAI,CAAC,MAAM,CAAQ;QACtC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE;QACtB,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAClC,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;KAC3B,CAAC,CAAA;IACF,SAAgB,aAAa,CAAC,KAAe;QAC5C,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YACrC,CAAC,CAAC;gBACA,KAAK,EAAE;oBACN,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO;oBACjC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI;iBAC3B;gBACD,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ;aAClC;YACH,CAAC,CAAC,SAAS,CAAA;IACb,CAAC;IAVe,mBAAa,gBAU5B,CAAA;AACF,CAAC,EAjBgB,KAAK,KAAL,KAAK,QAiBrB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TraceLog } from "@cloudflare/workers-types";
|
|
2
|
+
import type { Log } from "../index";
|
|
3
|
+
import { Configuration as MessageConfiguration } from "./Configuration";
|
|
4
|
+
import { Entry as MessageEntry } from "./Entry";
|
|
5
|
+
export type Message = MessageConfiguration | MessageEntry;
|
|
6
|
+
export declare namespace Message {
|
|
7
|
+
export import Configuration = MessageConfiguration;
|
|
8
|
+
export import Entry = MessageEntry;
|
|
9
|
+
function fromEventLogs(traces: TraceLog[]): Pick<Log, "realm" | "collection" | "resource" | "entries"> | undefined;
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Configuration as MessageConfiguration } from "./Configuration";
|
|
2
|
+
import { Entry as MessageEntry } from "./Entry";
|
|
3
|
+
export var Message;
|
|
4
|
+
(function (Message) {
|
|
5
|
+
Message.Configuration = MessageConfiguration;
|
|
6
|
+
Message.Entry = MessageEntry;
|
|
7
|
+
function fromEventLogs(traces) {
|
|
8
|
+
const configuration = Message.Configuration.fromTraceLog(traces.find(trace => Message.Configuration.type.is(trace.message[0])));
|
|
9
|
+
const result = configuration
|
|
10
|
+
? { ...configuration, entries: [] }
|
|
11
|
+
: undefined;
|
|
12
|
+
if (result)
|
|
13
|
+
for (const trace of traces) {
|
|
14
|
+
const logFragment = Message.Entry.fromEventLogs(trace);
|
|
15
|
+
logFragment?.resource && (result.resource ??= logFragment.resource);
|
|
16
|
+
logFragment?.entry && result.entries.push(logFragment.entry);
|
|
17
|
+
}
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
Message.fromEventLogs = fromEventLogs;
|
|
21
|
+
})(Message || (Message = {}));
|
|
22
|
+
//# sourceMappingURL=index.js.map
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
|
1
|
+
import { isoly } from "isoly";
|
|
2
|
+
import { TraceItem } from "@cloudflare/workers-types";
|
|
3
|
+
import { isly } from "isly";
|
|
1
4
|
import { Identifier } from "../Identifier";
|
|
2
|
-
import {
|
|
3
|
-
import { Entry } from "./Entry";
|
|
4
|
-
|
|
5
|
+
import { Realm } from "../Realm";
|
|
6
|
+
import { Entry as LogEntry } from "./Entry";
|
|
7
|
+
import { Message as LogMessage } from "./Message";
|
|
8
|
+
export interface Log {
|
|
5
9
|
id: Identifier;
|
|
6
|
-
|
|
10
|
+
realm: Realm;
|
|
11
|
+
script?: string;
|
|
12
|
+
collection: string;
|
|
13
|
+
resource?: string;
|
|
14
|
+
entries: Log.Entry[];
|
|
15
|
+
created: isoly.DateTime;
|
|
7
16
|
}
|
|
8
17
|
export declare namespace Log {
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
export import Message = LogMessage;
|
|
19
|
+
export import Entry = LogEntry;
|
|
20
|
+
const type: isly.object.ExtendableType<Log>;
|
|
21
|
+
function fromEvents(events: TraceItem[]): Log[];
|
|
11
22
|
function configure(collection: string, realm: string | undefined, resource?: string): void;
|
|
12
23
|
function log(message: string, data?: any, resource?: string): void;
|
|
13
24
|
function warning(message: string, data?: any, resource?: string): void;
|
package/dist/Log/index.js
CHANGED
|
@@ -1,36 +1,61 @@
|
|
|
1
|
+
import { isoly } from "isoly";
|
|
2
|
+
import { isly } from "isly";
|
|
1
3
|
import { Identifier } from "../Identifier";
|
|
2
|
-
import {
|
|
3
|
-
import { Entry } from "./Entry";
|
|
4
|
+
import { Realm } from "../Realm";
|
|
5
|
+
import { Entry as LogEntry } from "./Entry";
|
|
6
|
+
import { Message as LogMessage } from "./Message";
|
|
4
7
|
export var Log;
|
|
5
8
|
(function (Log) {
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
Log.Message = LogMessage;
|
|
10
|
+
Log.Entry = LogEntry;
|
|
11
|
+
Log.type = isly.object({
|
|
12
|
+
id: Identifier.type,
|
|
13
|
+
realm: Realm.type,
|
|
14
|
+
script: isly.string(),
|
|
15
|
+
collection: isly.string(),
|
|
16
|
+
resource: isly.string().optional(),
|
|
17
|
+
entries: Log.Entry.type.array(),
|
|
18
|
+
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
19
|
+
});
|
|
20
|
+
function fromEvents(events) {
|
|
21
|
+
const result = [];
|
|
22
|
+
for (const event of events) {
|
|
23
|
+
const created = event.eventTimestamp
|
|
24
|
+
? isoly.DateTime.create(event.eventTimestamp, "milliseconds")
|
|
25
|
+
: isoly.DateTime.now();
|
|
26
|
+
const message = Log.Message.fromEventLogs(event.logs);
|
|
27
|
+
if (message) {
|
|
28
|
+
const log = {
|
|
29
|
+
id: Identifier.generate(),
|
|
30
|
+
realm: message.realm,
|
|
31
|
+
collection: message.collection,
|
|
32
|
+
entries: message.entries,
|
|
33
|
+
created,
|
|
34
|
+
};
|
|
35
|
+
message.resource && (log.resource = message.resource);
|
|
36
|
+
event.scriptName && (log.script = event.scriptName);
|
|
37
|
+
result.push(log);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
8
41
|
}
|
|
9
|
-
Log.
|
|
10
|
-
function fromConfiguration(configuration) {
|
|
11
|
-
return {
|
|
12
|
-
id: Identifier.generate(),
|
|
13
|
-
...configuration,
|
|
14
|
-
entries: [],
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
Log.fromConfiguration = fromConfiguration;
|
|
42
|
+
Log.fromEvents = fromEvents;
|
|
18
43
|
function configure(collection, realm, resource) {
|
|
19
44
|
const configuration = { collection, realm, resource };
|
|
20
|
-
if (Configuration.type.is(configuration))
|
|
21
|
-
console.log(
|
|
45
|
+
if (Log.Message.Configuration.type.is(configuration))
|
|
46
|
+
console.log(configuration);
|
|
22
47
|
}
|
|
23
48
|
Log.configure = configure;
|
|
24
49
|
function log(message, data, resource) {
|
|
25
|
-
console.log(
|
|
50
|
+
console.log(Log.Entry.Message.to(message, data, resource));
|
|
26
51
|
}
|
|
27
52
|
Log.log = log;
|
|
28
53
|
function warning(message, data, resource) {
|
|
29
|
-
console.warn(
|
|
54
|
+
console.warn(Log.Entry.Message.to(message, data, resource));
|
|
30
55
|
}
|
|
31
56
|
Log.warning = warning;
|
|
32
57
|
function exception(message, data, resource) {
|
|
33
|
-
console.error(
|
|
58
|
+
console.error(Log.Entry.Message.to(message, data, resource));
|
|
34
59
|
}
|
|
35
60
|
Log.exception = exception;
|
|
36
61
|
})(Log || (Log = {}));
|
package/dist/Log/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Log/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Log/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAE7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,KAAK,IAAI,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC3C,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,WAAW,CAAA;AAWjD,MAAM,KAAW,GAAG,CAgDnB;AAhDD,WAAiB,GAAG;IACL,WAAO,GAAG,UAAU,CAAA;IACpB,SAAK,GAAG,QAAQ,CAAA;IACjB,QAAI,GAAG,IAAI,CAAC,MAAM,CAAM;QACpC,EAAE,EAAE,UAAU,CAAC,IAAI;QACnB,KAAK,EAAE,KAAK,CAAC,IAAI;QACjB,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE;QACrB,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE;QACzB,QAAQ,EAAE,IAAI,CAAC,MAA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,MAAM,aAAa,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;QACrD,IAAI,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC;YACnD,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IAC5B,CAAC;IAJe,aAAS,YAIxB,CAAA;IACD,SAAgB,GAAG,CAAC,OAAe,EAAE,IAAU,EAAE,QAAiB;QACjE,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC3D,CAAC;IAFe,OAAG,MAElB,CAAA;IACD,SAAgB,OAAO,CAAC,OAAe,EAAE,IAAU,EAAE,QAAiB;QACrE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC5D,CAAC;IAFe,WAAO,UAEtB,CAAA;IACD,SAAgB,SAAS,CAAC,OAAe,EAAE,IAAU,EAAE,QAAiB;QACvE,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC7D,CAAC;IAFe,aAAS,YAExB,CAAA;AACF,CAAC,EAhDgB,GAAG,KAAH,GAAG,QAgDnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pax2pay/model-banking",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.309",
|
|
4
4
|
"description": "Library containing data model types and functions for the Pax2Pay Banking API.",
|
|
5
5
|
"author": "Pax2Pay Ltd",
|
|
6
6
|
"license": "MIT",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"semver": "7.5.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
+
"@cloudflare/workers-types": "^4.20240208.0",
|
|
60
61
|
"@types/jest": "^29.5.12",
|
|
61
62
|
"@typescript-eslint/eslint-plugin": "7.13.0",
|
|
62
63
|
"@typescript-eslint/parser": "7.13.0",
|
package/Log/Configuration.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { isly } from "isly"
|
|
2
|
-
import { Realm } from "../Realm"
|
|
3
|
-
|
|
4
|
-
export interface Configuration {
|
|
5
|
-
realm: Realm
|
|
6
|
-
collection: string
|
|
7
|
-
resource?: string
|
|
8
|
-
}
|
|
9
|
-
export namespace Configuration {
|
|
10
|
-
export const type = isly.object<Configuration>({
|
|
11
|
-
realm: Realm.type,
|
|
12
|
-
collection: isly.string(),
|
|
13
|
-
resource: isly.string().optional(),
|
|
14
|
-
})
|
|
15
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { isly } from "isly";
|
|
2
|
-
import { Realm } from "../Realm";
|
|
3
|
-
export interface Configuration {
|
|
4
|
-
realm: Realm;
|
|
5
|
-
collection: string;
|
|
6
|
-
resource?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare namespace Configuration {
|
|
9
|
-
const type: isly.object.ExtendableType<Configuration>;
|
|
10
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { isly } from "isly";
|
|
2
|
-
import { Realm } from "../Realm";
|
|
3
|
-
export var Configuration;
|
|
4
|
-
(function (Configuration) {
|
|
5
|
-
Configuration.type = isly.object({
|
|
6
|
-
realm: Realm.type,
|
|
7
|
-
collection: isly.string(),
|
|
8
|
-
resource: isly.string().optional(),
|
|
9
|
-
});
|
|
10
|
-
})(Configuration || (Configuration = {}));
|
|
11
|
-
//# sourceMappingURL=Configuration.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.js","sourceRoot":"../","sources":["Log/Configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAOhC,MAAM,KAAW,aAAa,CAM7B;AAND,WAAiB,aAAa;IAChB,kBAAI,GAAG,IAAI,CAAC,MAAM,CAAgB;QAC9C,KAAK,EAAE,KAAK,CAAC,IAAI;QACjB,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE;QACzB,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAClC,CAAC,CAAA;AACH,CAAC,EANgB,aAAa,KAAb,aAAa,QAM7B"}
|