@pax2pay/model-banking 0.1.307 → 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.
Files changed (51) hide show
  1. package/{Log.ts → Audit.ts} +2 -2
  2. package/Client/Logs.ts +4 -4
  3. package/Client/index.ts +2 -2
  4. package/Log/Entry.ts +22 -0
  5. package/Log/Message/Configuration.ts +28 -0
  6. package/Log/Message/Entry.ts +27 -0
  7. package/Log/Message/index.ts +27 -0
  8. package/Log/index.ts +66 -0
  9. package/dist/{Log.d.ts → Audit.d.ts} +2 -2
  10. package/dist/Audit.js +2 -0
  11. package/dist/Audit.js.map +1 -0
  12. package/dist/Client/Logs.d.ts +3 -3
  13. package/dist/Client/Logs.js +1 -1
  14. package/dist/Client/Logs.js.map +1 -1
  15. package/dist/Client/index.d.ts +2 -2
  16. package/dist/Client/index.js +2 -2
  17. package/dist/Client/index.js.map +1 -1
  18. package/dist/Log/Entry.d.ts +15 -0
  19. package/dist/Log/Entry.js +20 -0
  20. package/dist/Log/Entry.js.map +1 -0
  21. package/dist/Log/Message/Configuration.d.ts +13 -0
  22. package/dist/Log/Message/Configuration.js +21 -0
  23. package/dist/Log/Message/Configuration.js.map +1 -0
  24. package/dist/Log/Message/Entry.d.ts +15 -0
  25. package/dist/Log/Message/Entry.js +22 -0
  26. package/dist/Log/Message/Entry.js.map +1 -0
  27. package/dist/Log/Message/index.d.ts +10 -0
  28. package/dist/Log/Message/index.js +22 -0
  29. package/dist/Log/Message/index.js.map +1 -0
  30. package/dist/Log/index.d.ts +26 -0
  31. package/dist/Log/index.js +62 -0
  32. package/dist/Log/index.js.map +1 -0
  33. package/dist/pax2pay.d.ts +1 -1
  34. package/dist/pax2pay.js +1 -1
  35. package/dist/pax2pay.js.map +1 -1
  36. package/package.json +2 -1
  37. package/pax2pay.ts +1 -1
  38. package/Logger/Log.ts +0 -32
  39. package/Logger/LogHandler.ts +0 -19
  40. package/Logger/index.ts +0 -26
  41. package/dist/Log.js +0 -2
  42. package/dist/Log.js.map +0 -1
  43. package/dist/Logger/Log.d.ts +0 -23
  44. package/dist/Logger/Log.js +0 -25
  45. package/dist/Logger/Log.js.map +0 -1
  46. package/dist/Logger/LogHandler.d.ts +0 -10
  47. package/dist/Logger/LogHandler.js +0 -17
  48. package/dist/Logger/LogHandler.js.map +0 -1
  49. package/dist/Logger/index.d.ts +0 -10
  50. package/dist/Logger/index.js +0 -31
  51. package/dist/Logger/index.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { storage } from "cloudly-storage"
2
2
 
3
- export type Log = storage.AuditLogger.Entry<Log.Type>
4
- export namespace Log {
3
+ export type Audit = storage.AuditLogger.Entry<Audit.Type>
4
+ export namespace Audit {
5
5
  export type Type = { rule: "change" | "add" }
6
6
  export type Resource = Extract<keyof Type, string>
7
7
  }
package/Client/Logs.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { gracely } from "gracely"
2
2
  import { http } from "cloudly-http"
3
- import { Log } from "../Log"
3
+ import { Audit as AuditLog } from "../Audit"
4
4
 
5
- export class Logs {
5
+ export class Audit {
6
6
  constructor(private readonly client: http.Client) {}
7
- async list(resource?: Log.Resource): Promise<Log[] | gracely.Error> {
8
- return this.client.get<Log[]>(`/audit/${resource}`)
7
+ async list(resource?: AuditLog.Resource): Promise<AuditLog[] | gracely.Error> {
8
+ return this.client.get<AuditLog[]>(`/audit/${resource}`)
9
9
  }
10
10
  }
package/Client/index.ts CHANGED
@@ -6,7 +6,7 @@ import { Accounts } from "./Accounts"
6
6
  import { Cards } from "./Cards"
7
7
  import { Exchanges } from "./Exchanges"
8
8
  import { Labels } from "./Labels"
9
- import { Logs } from "./Logs"
9
+ import { Audit } from "./Logs"
10
10
  import { Operations } from "./Operations"
11
11
  import { Organizations } from "./Organizations"
12
12
  import { Reports } from "./Reports"
@@ -25,7 +25,7 @@ export class Client extends rest.Client<gracely.Error> {
25
25
  readonly exchanges = new Exchanges(this.client)
26
26
  readonly organizations = new Organizations(this.client)
27
27
  readonly reports = new Reports(this.client)
28
- readonly logs = new Logs(this.client)
28
+ readonly logs = new Audit(this.client)
29
29
  readonly rules = new Rules(this.client)
30
30
  readonly settlements = new Settlements(this.client)
31
31
  readonly transactions = new Transactions(this.client)
package/Log/Entry.ts ADDED
@@ -0,0 +1,22 @@
1
+ import { isly } from "isly"
2
+
3
+ export interface Entry {
4
+ message: string
5
+ data?: any
6
+ }
7
+ 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(),
12
+ })
13
+ export namespace Message {
14
+ export const type = Entry.type.extend<Message>({ resource: isly.string().optional() })
15
+ export function to(message: string, data: any | undefined, resource: string | undefined): Entry.Message {
16
+ const result: Entry.Message = { message }
17
+ resource && (result.resource = resource)
18
+ data && (result.data = data)
19
+ return result
20
+ }
21
+ }
22
+ }
@@ -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 ADDED
@@ -0,0 +1,66 @@
1
+ import { isoly } from "isoly"
2
+ import { TraceItem } from "@cloudflare/workers-types"
3
+ import { isly } from "isly"
4
+ import { Identifier } from "../Identifier"
5
+ import { Realm } from "../Realm"
6
+ import { Entry as LogEntry } from "./Entry"
7
+ import { Message as LogMessage } from "./Message"
8
+
9
+ export interface Log {
10
+ id: Identifier
11
+ realm: Realm
12
+ script?: string
13
+ collection: string
14
+ resource?: string
15
+ entries: Log.Entry[]
16
+ created: isoly.DateTime
17
+ }
18
+ export namespace Log {
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
+ }
49
+ }
50
+ return result
51
+ }
52
+ export function configure(collection: string, realm: string | undefined, resource?: string): void {
53
+ const configuration = { collection, realm, resource }
54
+ if (Log.Message.Configuration.type.is(configuration))
55
+ console.log(configuration)
56
+ }
57
+ export function log(message: string, data?: any, resource?: string): void {
58
+ console.log(Log.Entry.Message.to(message, data, resource))
59
+ }
60
+ export function warning(message: string, data?: any, resource?: string): void {
61
+ console.warn(Log.Entry.Message.to(message, data, resource))
62
+ }
63
+ export function exception(message: string, data?: any, resource?: string): void {
64
+ console.error(Log.Entry.Message.to(message, data, resource))
65
+ }
66
+ }
@@ -1,6 +1,6 @@
1
1
  import { storage } from "cloudly-storage";
2
- export type Log = storage.AuditLogger.Entry<Log.Type>;
3
- export declare namespace Log {
2
+ export type Audit = storage.AuditLogger.Entry<Audit.Type>;
3
+ export declare namespace Audit {
4
4
  type Type = {
5
5
  rule: "change" | "add";
6
6
  };
package/dist/Audit.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Audit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Audit.js","sourceRoot":"../","sources":["Audit.ts"],"names":[],"mappings":""}
@@ -1,8 +1,8 @@
1
1
  import { gracely } from "gracely";
2
2
  import { http } from "cloudly-http";
3
- import { Log } from "../Log";
4
- export declare class Logs {
3
+ import { Audit as AuditLog } from "../Audit";
4
+ export declare class Audit {
5
5
  private readonly client;
6
6
  constructor(client: http.Client);
7
- list(resource?: Log.Resource): Promise<Log[] | gracely.Error>;
7
+ list(resource?: AuditLog.Resource): Promise<AuditLog[] | gracely.Error>;
8
8
  }
@@ -1,4 +1,4 @@
1
- export class Logs {
1
+ export class Audit {
2
2
  constructor(client) {
3
3
  this.client = client;
4
4
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Logs.js","sourceRoot":"../","sources":["Client/Logs.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,IAAI;IAChB,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IACpD,KAAK,CAAC,IAAI,CAAC,QAAuB;QACjC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAQ,UAAU,QAAQ,EAAE,CAAC,CAAA;IACpD,CAAC;CACD"}
1
+ {"version":3,"file":"Logs.js","sourceRoot":"../","sources":["Client/Logs.ts"],"names":[],"mappings":"AAIA,MAAM,OAAO,KAAK;IACjB,YAA6B,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAG,CAAC;IACpD,KAAK,CAAC,IAAI,CAAC,QAA4B;QACtC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAa,UAAU,QAAQ,EAAE,CAAC,CAAA;IACzD,CAAC;CACD"}
@@ -6,7 +6,7 @@ import { Accounts } from "./Accounts";
6
6
  import { Cards } from "./Cards";
7
7
  import { Exchanges } from "./Exchanges";
8
8
  import { Labels } from "./Labels";
9
- import { Logs } from "./Logs";
9
+ import { Audit } from "./Logs";
10
10
  import { Operations } from "./Operations";
11
11
  import { Organizations } from "./Organizations";
12
12
  import { Reports } from "./Reports";
@@ -24,7 +24,7 @@ export declare class Client extends rest.Client<gracely.Error> {
24
24
  readonly exchanges: Exchanges;
25
25
  readonly organizations: Organizations;
26
26
  readonly reports: Reports;
27
- readonly logs: Logs;
27
+ readonly logs: Audit;
28
28
  readonly rules: Rules;
29
29
  readonly settlements: Settlements;
30
30
  readonly transactions: Transactions;
@@ -5,7 +5,7 @@ import { Accounts } from "./Accounts";
5
5
  import { Cards } from "./Cards";
6
6
  import { Exchanges } from "./Exchanges";
7
7
  import { Labels } from "./Labels";
8
- import { Logs } from "./Logs";
8
+ import { Audit } from "./Logs";
9
9
  import { Operations } from "./Operations";
10
10
  import { Organizations } from "./Organizations";
11
11
  import { Reports } from "./Reports";
@@ -23,7 +23,7 @@ export class Client extends rest.Client {
23
23
  this.exchanges = new Exchanges(this.client);
24
24
  this.organizations = new Organizations(this.client);
25
25
  this.reports = new Reports(this.client);
26
- this.logs = new Logs(this.client);
26
+ this.logs = new Audit(this.client);
27
27
  this.rules = new Rules(this.client);
28
28
  this.settlements = new Settlements(this.client);
29
29
  this.transactions = new Transactions(this.client);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Client/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE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C,CAAC,UAAU,GAAG,IAAI,IAAI,CAAC,MAAM,CAAgB,MAAM,EAAE,GAAG,EAAE;YACzD,YAAY,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;gBACzB,GAAG,OAAO,CAAC,MAAM;gBACjB,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,YAAY;aAChE,CAAC;YACF,WAAW,EAAE,KAAK,EAAC,QAAQ,EAAC,EAAE;gBAC7B,IAAI,MAAM,GAAG,QAAQ,CAAA;gBACrB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAA;gBAChC,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;oBACzB,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,CAC5B,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE;wBACrC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;qBACtE,CAAC,CACF,CAAA;gBACF,CAAC;gBACD,OAAO,MAAM,CAAA;YACd,CAAC;SACD,CAAC,CAAC,CACH,CAAA;QACD,IAAI,IAAI;YACP,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA;QACxC,OAAO,MAAoB,CAAA;IAC5B,CAAC;CACD"}
@@ -0,0 +1,15 @@
1
+ import { isly } from "isly";
2
+ export interface Entry {
3
+ message: string;
4
+ data?: any;
5
+ }
6
+ export declare namespace Entry {
7
+ type Message = Entry & {
8
+ resource?: string;
9
+ };
10
+ const type: isly.object.ExtendableType<Entry>;
11
+ namespace Message {
12
+ const type: isly.object.ExtendableType<Message>;
13
+ function to(message: string, data: any | undefined, resource: string | undefined): Entry.Message;
14
+ }
15
+ }
@@ -0,0 +1,20 @@
1
+ import { isly } from "isly";
2
+ export var Entry;
3
+ (function (Entry) {
4
+ Entry.type = isly.object({
5
+ message: isly.string(),
6
+ data: isly.any().optional(),
7
+ });
8
+ let Message;
9
+ (function (Message) {
10
+ Message.type = Entry.type.extend({ resource: isly.string().optional() });
11
+ function to(message, data, resource) {
12
+ const result = { message };
13
+ resource && (result.resource = resource);
14
+ data && (result.data = data);
15
+ return result;
16
+ }
17
+ Message.to = to;
18
+ })(Message = Entry.Message || (Entry.Message = {}));
19
+ })(Entry || (Entry = {}));
20
+ //# sourceMappingURL=Entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Entry.js","sourceRoot":"../","sources":["Log/Entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAM3B,MAAM,KAAW,KAAK,CAerB;AAfD,WAAiB,KAAK;IAER,UAAI,GAAG,IAAI,CAAC,MAAM,CAAQ;QACtC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE;QACtB,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;KAC3B,CAAC,CAAA;IACF,IAAiB,OAAO,CAQvB;IARD,WAAiB,OAAO;QACV,YAAI,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAU,EAAE,QAAQ,EAAE,IAAI,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;AACF,CAAC,EAfgB,KAAK,KAAL,KAAK,QAerB"}
@@ -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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../","sources":["Log/Message/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,IAAI,oBAAoB,EAAE,MAAM,iBAAiB,CAAA;AACvE,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,SAAS,CAAA;AAG/C,MAAM,KAAW,OAAO,CAoBvB;AApBD,WAAiB,OAAO;IACT,qBAAa,GAAG,oBAAoB,CAAA;IACpC,aAAK,GAAG,YAAY,CAAA;IAClC,SAAgB,aAAa,CAC5B,MAAkB;QAElB,MAAM,aAAa,GAClB,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC1G,MAAM,MAAM,GAA2E,aAAa;YACnG,CAAC,CAAC,EAAE,GAAG,aAAa,EAAE,OAAO,EAAE,EAAE,EAAE;YACnC,CAAC,CAAC,SAAS,CAAA;QACZ,IAAI,MAAM;YACT,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;gBAC5B,MAAM,WAAW,GAChB,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;gBACnC,WAAW,EAAE,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC,QAAQ,CAAC,CAAA;gBACnE,WAAW,EAAE,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;YAC7D,CAAC;QACF,OAAO,MAAM,CAAA;IACd,CAAC;IAhBe,qBAAa,gBAgB5B,CAAA;AACF,CAAC,EApBgB,OAAO,KAAP,OAAO,QAoBvB"}
@@ -0,0 +1,26 @@
1
+ import { isoly } from "isoly";
2
+ import { TraceItem } from "@cloudflare/workers-types";
3
+ import { isly } from "isly";
4
+ import { Identifier } from "../Identifier";
5
+ import { Realm } from "../Realm";
6
+ import { Entry as LogEntry } from "./Entry";
7
+ import { Message as LogMessage } from "./Message";
8
+ export interface Log {
9
+ id: Identifier;
10
+ realm: Realm;
11
+ script?: string;
12
+ collection: string;
13
+ resource?: string;
14
+ entries: Log.Entry[];
15
+ created: isoly.DateTime;
16
+ }
17
+ export declare namespace Log {
18
+ export import Message = LogMessage;
19
+ export import Entry = LogEntry;
20
+ const type: isly.object.ExtendableType<Log>;
21
+ function fromEvents(events: TraceItem[]): Log[];
22
+ function configure(collection: string, realm: string | undefined, resource?: string): void;
23
+ function log(message: string, data?: any, resource?: string): void;
24
+ function warning(message: string, data?: any, resource?: string): void;
25
+ function exception(message: string, data?: any, resource?: string): void;
26
+ }
@@ -0,0 +1,62 @@
1
+ import { isoly } from "isoly";
2
+ import { isly } from "isly";
3
+ import { Identifier } from "../Identifier";
4
+ import { Realm } from "../Realm";
5
+ import { Entry as LogEntry } from "./Entry";
6
+ import { Message as LogMessage } from "./Message";
7
+ export var Log;
8
+ (function (Log) {
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;
41
+ }
42
+ Log.fromEvents = fromEvents;
43
+ function configure(collection, realm, resource) {
44
+ const configuration = { collection, realm, resource };
45
+ if (Log.Message.Configuration.type.is(configuration))
46
+ console.log(configuration);
47
+ }
48
+ Log.configure = configure;
49
+ function log(message, data, resource) {
50
+ console.log(Log.Entry.Message.to(message, data, resource));
51
+ }
52
+ Log.log = log;
53
+ function warning(message, data, resource) {
54
+ console.warn(Log.Entry.Message.to(message, data, resource));
55
+ }
56
+ Log.warning = warning;
57
+ function exception(message, data, resource) {
58
+ console.error(Log.Entry.Message.to(message, data, resource));
59
+ }
60
+ Log.exception = exception;
61
+ })(Log || (Log = {}));
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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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AAO,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAA;IAC7D,CAAC;IAFe,aAAS,YAExB,CAAA;AACF,CAAC,EAhDgB,GAAG,KAAH,GAAG,QAgDnB"}
package/dist/pax2pay.d.ts CHANGED
@@ -28,4 +28,4 @@ export { Identity } from "./Identity";
28
28
  export { Key } from "./Key";
29
29
  export { Exchange } from "./Exchange";
30
30
  export { Log } from "./Log";
31
- export { Logger } from "./Logger";
31
+ export { Audit } from "./Audit";
package/dist/pax2pay.js CHANGED
@@ -26,5 +26,5 @@ export { Label } from "./Label";
26
26
  export { Identity } from "./Identity";
27
27
  export { Key } from "./Key";
28
28
  export { Exchange } from "./Exchange";
29
- export { Logger } from "./Logger";
29
+ export { Log } from "./Log";
30
30
  //# sourceMappingURL=pax2pay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pax2pay.js","sourceRoot":"../","sources":["pax2pay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAA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BAAgB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAC3B,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pax2pay/model-banking",
3
- "version": "0.1.307",
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/pax2pay.ts CHANGED
@@ -28,4 +28,4 @@ export { Identity } from "./Identity"
28
28
  export { Key } from "./Key"
29
29
  export { Exchange } from "./Exchange"
30
30
  export { Log } from "./Log"
31
- export { Logger } from "./Logger"
31
+ export { Audit } from "./Audit"
package/Logger/Log.ts DELETED
@@ -1,32 +0,0 @@
1
- import { isly } from "isly"
2
-
3
- export namespace Log {
4
- export interface Configuration {
5
- realm?: string
6
- collection: string
7
- resource?: string
8
- }
9
- export namespace Configuration {
10
- export const type = isly.object<Configuration>({
11
- realm: isly.string().optional(),
12
- collection: isly.string(),
13
- resource: isly.string().optional(),
14
- })
15
- export const is = type.is
16
- export const get = type.get
17
- }
18
- export interface Creatable {
19
- message: string
20
- data?: any
21
- resource?: string
22
- }
23
- export namespace Creatable {
24
- export const type = isly.object<Creatable>({
25
- message: isly.string(),
26
- data: isly.any().optional(),
27
- resource: isly.string().optional(),
28
- })
29
- export const is = type.is
30
- export const get = type.get
31
- }
32
- }
@@ -1,19 +0,0 @@
1
- import { Identifier } from "../Identifier"
2
- import { Log } from "./Log"
3
-
4
- export namespace LogHandler {
5
- export interface Logs extends Log.Configuration {
6
- id: Identifier
7
- entries: Log.Creatable[]
8
- }
9
- export function fromConfiguration(configuration: Log.Configuration): Logs {
10
- return {
11
- id: Identifier.generate(),
12
- ...configuration,
13
- entries: [],
14
- }
15
- }
16
- export function addEntry(logs: Logs, entry: Log.Creatable): Logs {
17
- return logs.entries.concat(entry), logs
18
- }
19
- }
package/Logger/index.ts DELETED
@@ -1,26 +0,0 @@
1
- import { Log as LoggerLog } from "./Log"
2
- import { LogHandler } from "./LogHandler"
3
-
4
- export namespace Logger {
5
- export import Handler = LogHandler
6
- export import Log = LoggerLog
7
- export function configure(collection: string, realm: string | undefined, resource?: string) {
8
- console.log({ collection, realm, resource })
9
- }
10
- export function log(message: string, data?: any, resource?: any) {
11
- console.log(toMessage(message, resource, data))
12
- }
13
- export function warning(message: string, data?: any, resource?: any) {
14
- console.warn(toMessage(message, resource, data))
15
- }
16
- export function exception(message: string, data?: any, resource?: any) {
17
- console.error(toMessage(message, resource, data))
18
- }
19
- function toMessage(message: string, resource: any, data: any) {
20
- return {
21
- message,
22
- ...(resource ? { resource } : {}),
23
- ...(data ? { data } : {}),
24
- }
25
- }
26
- }
package/dist/Log.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=Log.js.map
package/dist/Log.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"Log.js","sourceRoot":"../","sources":["Log.ts"],"names":[],"mappings":""}
@@ -1,23 +0,0 @@
1
- import { isly } from "isly";
2
- export declare namespace Log {
3
- interface Configuration {
4
- realm?: string;
5
- collection: string;
6
- resource?: string;
7
- }
8
- namespace Configuration {
9
- const type: isly.object.ExtendableType<Configuration>;
10
- const is: isly.Type.IsFunction<Configuration>;
11
- const get: isly.Type.GetFunction<Configuration>;
12
- }
13
- interface Creatable {
14
- message: string;
15
- data?: any;
16
- resource?: string;
17
- }
18
- namespace Creatable {
19
- const type: isly.object.ExtendableType<Creatable>;
20
- const is: isly.Type.IsFunction<Creatable>;
21
- const get: isly.Type.GetFunction<Creatable>;
22
- }
23
- }
@@ -1,25 +0,0 @@
1
- import { isly } from "isly";
2
- export var Log;
3
- (function (Log) {
4
- let Configuration;
5
- (function (Configuration) {
6
- Configuration.type = isly.object({
7
- realm: isly.string().optional(),
8
- collection: isly.string(),
9
- resource: isly.string().optional(),
10
- });
11
- Configuration.is = Configuration.type.is;
12
- Configuration.get = Configuration.type.get;
13
- })(Configuration = Log.Configuration || (Log.Configuration = {}));
14
- let Creatable;
15
- (function (Creatable) {
16
- Creatable.type = isly.object({
17
- message: isly.string(),
18
- data: isly.any().optional(),
19
- resource: isly.string().optional(),
20
- });
21
- Creatable.is = Creatable.type.is;
22
- Creatable.get = Creatable.type.get;
23
- })(Creatable = Log.Creatable || (Log.Creatable = {}));
24
- })(Log || (Log = {}));
25
- //# sourceMappingURL=Log.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Log.js","sourceRoot":"../","sources":["Logger/Log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAE3B,MAAM,KAAW,GAAG,CA6BnB;AA7BD,WAAiB,GAAG;IAMnB,IAAiB,aAAa,CAQ7B;IARD,WAAiB,aAAa;QAChB,kBAAI,GAAG,IAAI,CAAC,MAAM,CAAgB;YAC9C,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;YAC/B,UAAU,EAAE,IAAI,CAAC,MAAM,EAAE;YACzB,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAClC,CAAC,CAAA;QACW,gBAAE,GAAG,cAAA,IAAI,CAAC,EAAE,CAAA;QACZ,iBAAG,GAAG,cAAA,IAAI,CAAC,GAAG,CAAA;IAC5B,CAAC,EARgB,aAAa,GAAb,iBAAa,KAAb,iBAAa,QAQ7B;IAMD,IAAiB,SAAS,CAQzB;IARD,WAAiB,SAAS;QACZ,cAAI,GAAG,IAAI,CAAC,MAAM,CAAY;YAC1C,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE;YACtB,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;YAC3B,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAClC,CAAC,CAAA;QACW,YAAE,GAAG,UAAA,IAAI,CAAC,EAAE,CAAA;QACZ,aAAG,GAAG,UAAA,IAAI,CAAC,GAAG,CAAA;IAC5B,CAAC,EARgB,SAAS,GAAT,aAAS,KAAT,aAAS,QAQzB;AACF,CAAC,EA7BgB,GAAG,KAAH,GAAG,QA6BnB"}
@@ -1,10 +0,0 @@
1
- import { Identifier } from "../Identifier";
2
- import { Log } from "./Log";
3
- export declare namespace LogHandler {
4
- interface Logs extends Log.Configuration {
5
- id: Identifier;
6
- entries: Log.Creatable[];
7
- }
8
- function fromConfiguration(configuration: Log.Configuration): Logs;
9
- function addEntry(logs: Logs, entry: Log.Creatable): Logs;
10
- }
@@ -1,17 +0,0 @@
1
- import { Identifier } from "../Identifier";
2
- export var LogHandler;
3
- (function (LogHandler) {
4
- function fromConfiguration(configuration) {
5
- return {
6
- id: Identifier.generate(),
7
- ...configuration,
8
- entries: [],
9
- };
10
- }
11
- LogHandler.fromConfiguration = fromConfiguration;
12
- function addEntry(logs, entry) {
13
- return logs.entries.concat(entry), logs;
14
- }
15
- LogHandler.addEntry = addEntry;
16
- })(LogHandler || (LogHandler = {}));
17
- //# sourceMappingURL=LogHandler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LogHandler.js","sourceRoot":"../","sources":["Logger/LogHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAG1C,MAAM,KAAW,UAAU,CAe1B;AAfD,WAAiB,UAAU;IAK1B,SAAgB,iBAAiB,CAAC,aAAgC;QACjE,OAAO;YACN,EAAE,EAAE,UAAU,CAAC,QAAQ,EAAE;YACzB,GAAG,aAAa;YAChB,OAAO,EAAE,EAAE;SACX,CAAA;IACF,CAAC;IANe,4BAAiB,oBAMhC,CAAA;IACD,SAAgB,QAAQ,CAAC,IAAU,EAAE,KAAoB;QACxD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAA;IACxC,CAAC;IAFe,mBAAQ,WAEvB,CAAA;AACF,CAAC,EAfgB,UAAU,KAAV,UAAU,QAe1B"}
@@ -1,10 +0,0 @@
1
- import { Log as LoggerLog } from "./Log";
2
- import { LogHandler } from "./LogHandler";
3
- export declare namespace Logger {
4
- export import Handler = LogHandler;
5
- export import Log = LoggerLog;
6
- function configure(collection: string, realm: string | undefined, resource?: string): void;
7
- function log(message: string, data?: any, resource?: any): void;
8
- function warning(message: string, data?: any, resource?: any): void;
9
- function exception(message: string, data?: any, resource?: any): void;
10
- }
@@ -1,31 +0,0 @@
1
- import { Log as LoggerLog } from "./Log";
2
- import { LogHandler } from "./LogHandler";
3
- export var Logger;
4
- (function (Logger) {
5
- Logger.Handler = LogHandler;
6
- Logger.Log = LoggerLog;
7
- function configure(collection, realm, resource) {
8
- console.log({ collection, realm, resource });
9
- }
10
- Logger.configure = configure;
11
- function log(message, data, resource) {
12
- console.log(toMessage(message, resource, data));
13
- }
14
- Logger.log = log;
15
- function warning(message, data, resource) {
16
- console.warn(toMessage(message, resource, data));
17
- }
18
- Logger.warning = warning;
19
- function exception(message, data, resource) {
20
- console.error(toMessage(message, resource, data));
21
- }
22
- Logger.exception = exception;
23
- function toMessage(message, resource, data) {
24
- return {
25
- message,
26
- ...(resource ? { resource } : {}),
27
- ...(data ? { data } : {}),
28
- };
29
- }
30
- })(Logger || (Logger = {}));
31
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"../","sources":["Logger/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,IAAI,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,MAAM,KAAW,MAAM,CAsBtB;AAtBD,WAAiB,MAAM;IACR,cAAO,GAAG,UAAU,CAAA;IACpB,UAAG,GAAG,SAAS,CAAA;IAC7B,SAAgB,SAAS,CAAC,UAAkB,EAAE,KAAyB,EAAE,QAAiB;QACzF,OAAO,CAAC,GAAG,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAA;IAC7C,CAAC;IAFe,gBAAS,YAExB,CAAA;IACD,SAAgB,GAAG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