@pax2pay/model-banking 0.1.314 → 0.1.316
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/Analytics/Configuration/Mapping/Field.ts +16 -0
- package/Analytics/Configuration/Mapping/Transform.ts +8 -0
- package/Analytics/Configuration/Mapping/index.ts +9 -0
- package/Analytics/Configuration/Schema/Field.ts +16 -0
- package/Analytics/Configuration/Schema/Mode.ts +8 -0
- package/Analytics/Configuration/Schema/Type.ts +23 -0
- package/Analytics/Configuration/Schema/index.ts +7 -0
- package/Analytics/Configuration/index.ts +72 -0
- package/Analytics/Event/Base.ts +10 -0
- package/Analytics/Event/Operation.ts +20 -0
- package/Analytics/Event/Transaction.ts +22 -0
- package/Analytics/Event/index.ts +10 -0
- package/Analytics/index.ts +22 -0
- package/Card/Expiry.ts +8 -0
- package/Rule/State/Authorization.ts +16 -0
- package/Rule/State/Card.ts +23 -0
- package/dist/Analytics/Configuration/Mapping/Field.d.ts +12 -0
- package/dist/Analytics/Configuration/Mapping/Field.js +11 -0
- package/dist/Analytics/Configuration/Mapping/Field.js.map +1 -0
- package/dist/Analytics/Configuration/Mapping/Transform.d.ts +6 -0
- package/dist/Analytics/Configuration/Mapping/Transform.js +7 -0
- package/dist/Analytics/Configuration/Mapping/Transform.js.map +1 -0
- package/dist/Analytics/Configuration/Mapping/index.d.ts +7 -0
- package/dist/Analytics/Configuration/Mapping/index.js +8 -0
- package/dist/Analytics/Configuration/Mapping/index.js.map +1 -0
- package/dist/Analytics/Configuration/Schema/Field.d.ts +14 -0
- package/dist/Analytics/Configuration/Schema/Field.js +15 -0
- package/dist/Analytics/Configuration/Schema/Field.js.map +1 -0
- package/dist/Analytics/Configuration/Schema/Mode.d.ts +6 -0
- package/dist/Analytics/Configuration/Schema/Mode.js +7 -0
- package/dist/Analytics/Configuration/Schema/Mode.js.map +1 -0
- package/dist/Analytics/Configuration/Schema/Type.d.ts +6 -0
- package/dist/Analytics/Configuration/Schema/Type.js +22 -0
- package/dist/Analytics/Configuration/Schema/Type.js.map +1 -0
- package/dist/Analytics/Configuration/Schema/index.d.ts +6 -0
- package/dist/Analytics/Configuration/Schema/index.js +7 -0
- package/dist/Analytics/Configuration/Schema/index.js.map +1 -0
- package/dist/Analytics/Configuration/index.d.ts +76 -0
- package/dist/Analytics/Configuration/index.js +62 -0
- package/dist/Analytics/Configuration/index.js.map +1 -0
- package/dist/Analytics/Event/Base.d.ts +12 -0
- package/dist/Analytics/Event/Base.js +2 -0
- package/dist/Analytics/Event/Base.js.map +1 -0
- package/dist/Analytics/Event/Operation.d.ts +13 -0
- package/dist/Analytics/Event/Operation.js +15 -0
- package/dist/Analytics/Event/Operation.js.map +1 -0
- package/dist/Analytics/Event/Transaction.d.ts +14 -0
- package/dist/Analytics/Event/Transaction.js +16 -0
- package/dist/Analytics/Event/Transaction.js.map +1 -0
- package/dist/Analytics/Event/index.d.ts +11 -0
- package/dist/Analytics/Event/index.js +8 -0
- package/dist/Analytics/Event/index.js.map +1 -0
- package/dist/Analytics/index.d.ts +6 -0
- package/dist/Analytics/index.js +8 -0
- package/dist/Analytics/index.js.map +1 -0
- package/dist/Card/Expiry.d.ts +1 -0
- package/dist/Card/Expiry.js +7 -0
- package/dist/Card/Expiry.js.map +1 -1
- package/dist/Identity.d.ts +2 -2
- package/dist/Rule/State/Authorization.d.ts +5 -0
- package/dist/Rule/State/Authorization.js +13 -0
- package/dist/Rule/State/Authorization.js.map +1 -1
- package/dist/Rule/State/Card.d.ts +4 -0
- package/dist/Rule/State/Card.js +23 -0
- package/dist/Rule/State/Card.js.map +1 -1
- package/dist/pax2pay.d.ts +1 -1
- package/dist/pax2pay.js +1 -1
- package/dist/pax2pay.js.map +1 -1
- package/package.json +7 -7
- package/pax2pay.ts +1 -1
- package/Event/index.ts +0 -97
- package/dist/Event/index.d.ts +0 -40
- package/dist/Event/index.js +0 -101
- package/dist/Event/index.js.map +0 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isly } from "isly"
|
|
2
|
+
import { Transform as FieldTransform } from "./Transform"
|
|
3
|
+
|
|
4
|
+
type Transformer = { selector: string; transform: Field.Transform }
|
|
5
|
+
export type Field = string | Transformer
|
|
6
|
+
|
|
7
|
+
export namespace Field {
|
|
8
|
+
export import Transform = FieldTransform
|
|
9
|
+
export const type = isly.union<string | Transformer, string, Transformer>(
|
|
10
|
+
isly.string(),
|
|
11
|
+
isly.object<Transformer>({
|
|
12
|
+
selector: isly.string(),
|
|
13
|
+
transform: Transform.type,
|
|
14
|
+
})
|
|
15
|
+
)
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { isly } from "isly"
|
|
2
|
+
|
|
3
|
+
export type Transform = typeof Transform.values[number]
|
|
4
|
+
|
|
5
|
+
export namespace Transform {
|
|
6
|
+
export const values = ["string", "stringify", "boolean", "float", "integer", "number", "point"] as const
|
|
7
|
+
export const type = isly.string<Transform>(values)
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isly } from "isly"
|
|
2
|
+
import { Field as FieldMapping } from "./Field"
|
|
3
|
+
|
|
4
|
+
export type Mapping<T extends string = string> = Record<T, Mapping.Field>
|
|
5
|
+
|
|
6
|
+
export namespace Mapping {
|
|
7
|
+
export import Field = FieldMapping
|
|
8
|
+
export const type = isly.record<Mapping>(isly.string(), Field.type)
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { isly } from "isly"
|
|
2
|
+
import { Mode as FieldMode } from "./Mode"
|
|
3
|
+
import { Type as FieldType } from "./Type"
|
|
4
|
+
|
|
5
|
+
export type Field<T extends string = string> = { name: T; type: Field.Type; mode?: Field.Mode; fields?: Field[] }
|
|
6
|
+
|
|
7
|
+
export namespace Field {
|
|
8
|
+
export import Type = FieldType
|
|
9
|
+
export import Mode = FieldMode
|
|
10
|
+
export const type = isly.object<Field>({
|
|
11
|
+
name: isly.string(),
|
|
12
|
+
type: Type.type,
|
|
13
|
+
mode: Mode.type.optional(),
|
|
14
|
+
fields: isly.lazy((): isly.Type<Field<string>[] | undefined> => type.array().optional(), "fields"),
|
|
15
|
+
})
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { isly } from "isly"
|
|
2
|
+
|
|
3
|
+
export type Type = typeof Type.values[number]
|
|
4
|
+
|
|
5
|
+
export namespace Type {
|
|
6
|
+
export const values = [
|
|
7
|
+
"STRING",
|
|
8
|
+
"BYTES",
|
|
9
|
+
"INTEGER",
|
|
10
|
+
"FLOAT",
|
|
11
|
+
"NUMERIC",
|
|
12
|
+
"BIGNUMERIC",
|
|
13
|
+
"BOOLEAN",
|
|
14
|
+
"TIMESTAMP",
|
|
15
|
+
"DATE",
|
|
16
|
+
"TIME",
|
|
17
|
+
"DATETIME",
|
|
18
|
+
"INTERVAL",
|
|
19
|
+
"RECORD",
|
|
20
|
+
"GEOGRAPHY",
|
|
21
|
+
] as const
|
|
22
|
+
export const type = isly.string<Type>(values)
|
|
23
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Mapping } from "./Mapping"
|
|
2
|
+
import { Schema } from "./Schema"
|
|
3
|
+
|
|
4
|
+
export namespace Configuration {
|
|
5
|
+
export const baseFields = [
|
|
6
|
+
"realm",
|
|
7
|
+
"entity",
|
|
8
|
+
"entityId",
|
|
9
|
+
"action",
|
|
10
|
+
"created",
|
|
11
|
+
"isError",
|
|
12
|
+
"version",
|
|
13
|
+
"source",
|
|
14
|
+
] as const
|
|
15
|
+
export type BaseFields = typeof baseFields[number]
|
|
16
|
+
export const baseMapping: Mapping<BaseFields> = {
|
|
17
|
+
realm: "realm",
|
|
18
|
+
entity: "entity.type",
|
|
19
|
+
entityId: "entity.id",
|
|
20
|
+
action: "action",
|
|
21
|
+
created: "created",
|
|
22
|
+
isError: { selector: "isError", transform: "boolean" },
|
|
23
|
+
version: "version",
|
|
24
|
+
source: "source",
|
|
25
|
+
}
|
|
26
|
+
export const baseTableSchema: Schema<BaseFields> = [
|
|
27
|
+
{ name: "realm", type: "STRING" },
|
|
28
|
+
{ name: "entity", type: "STRING" },
|
|
29
|
+
{ name: "entityId", type: "STRING" },
|
|
30
|
+
{ name: "action", type: "STRING" },
|
|
31
|
+
{ name: "created", type: "TIMESTAMP" },
|
|
32
|
+
{ name: "isError", type: "BOOLEAN" },
|
|
33
|
+
{ name: "source", type: "STRING" },
|
|
34
|
+
{ name: "version", type: "STRING" },
|
|
35
|
+
]
|
|
36
|
+
export function create(
|
|
37
|
+
mapping: Mapping,
|
|
38
|
+
schema: Schema,
|
|
39
|
+
config: { projectName?: "paxpay-prod" | "paxpay-nonprod"; datasetName?: string; tableName: string },
|
|
40
|
+
filter?: string
|
|
41
|
+
) {
|
|
42
|
+
return {
|
|
43
|
+
name: "ledger-events",
|
|
44
|
+
type: "bigquery",
|
|
45
|
+
filter: [
|
|
46
|
+
{
|
|
47
|
+
type: "selectively",
|
|
48
|
+
expression: filter ?? "source:pax2pay-worker-banking-ledger",
|
|
49
|
+
},
|
|
50
|
+
{ type: "useragent" },
|
|
51
|
+
{
|
|
52
|
+
type: "mapping",
|
|
53
|
+
mapping: {
|
|
54
|
+
...baseMapping,
|
|
55
|
+
...mapping,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
batchSize: 10,
|
|
60
|
+
batchInterval: 3,
|
|
61
|
+
projectName: "paxpay-nonprod",
|
|
62
|
+
datasetName: "banking_ledger",
|
|
63
|
+
...config,
|
|
64
|
+
tableSchema: [...baseTableSchema, ...schema],
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export const backup = create(
|
|
68
|
+
{ value: { selector: "value", transform: "stringify" } },
|
|
69
|
+
[{ name: "value", type: "STRING" }],
|
|
70
|
+
{ tableName: "backup_test" }
|
|
71
|
+
)
|
|
72
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isoly } from "isoly"
|
|
2
|
+
import { Operation as modelOperation } from "../../Operation"
|
|
3
|
+
import { Realm } from "../../Realm"
|
|
4
|
+
import { Base } from "./Base"
|
|
5
|
+
|
|
6
|
+
export type Operation = Base<modelOperation> & {
|
|
7
|
+
entity: { type: "operation"; id: string }
|
|
8
|
+
action: "created"
|
|
9
|
+
}
|
|
10
|
+
export namespace Operation {
|
|
11
|
+
export function create(value: modelOperation, realm: Realm, action: Operation["action"]): Operation {
|
|
12
|
+
return {
|
|
13
|
+
realm,
|
|
14
|
+
entity: { type: "operation", id: value.signature ?? "" },
|
|
15
|
+
action,
|
|
16
|
+
created: isoly.DateTime.now(),
|
|
17
|
+
value,
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isoly } from "isoly"
|
|
2
|
+
import { Realm } from "../../Realm"
|
|
3
|
+
import { Transaction as modelTransaction } from "../../Transaction"
|
|
4
|
+
import { Base } from "./Base"
|
|
5
|
+
|
|
6
|
+
export type Transaction = Base<modelTransaction> & {
|
|
7
|
+
entity: { type: "transaction"; id: string }
|
|
8
|
+
action: "created" | "finalized" | "cancelled" | "failed"
|
|
9
|
+
isError?: true
|
|
10
|
+
}
|
|
11
|
+
export namespace Transaction {
|
|
12
|
+
export function create(value: modelTransaction, realm: Realm, action: Transaction["action"]): Transaction {
|
|
13
|
+
return {
|
|
14
|
+
realm,
|
|
15
|
+
entity: { type: "transaction", id: value.id },
|
|
16
|
+
action,
|
|
17
|
+
...(action == "failed" ? { isError: true } : {}),
|
|
18
|
+
created: isoly.DateTime.now(),
|
|
19
|
+
value,
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Base as EventBase } from "./Base"
|
|
2
|
+
import { Operation as OperationEvent } from "./Operation"
|
|
3
|
+
import { Transaction as TransactionEvent } from "./Transaction"
|
|
4
|
+
|
|
5
|
+
export type Event = (Event.Transaction | Event.Operation) & { version: string }
|
|
6
|
+
export namespace Event {
|
|
7
|
+
export type Base<T> = EventBase<T>
|
|
8
|
+
export import Transaction = TransactionEvent
|
|
9
|
+
export import Operation = OperationEvent
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Configuration as AnalyticsConfiguration } from "./Configuration"
|
|
2
|
+
import { Event as AnalyticsEvent } from "./Event"
|
|
3
|
+
|
|
4
|
+
export namespace Analytics {
|
|
5
|
+
export import Event = AnalyticsEvent
|
|
6
|
+
export import Configuration = AnalyticsConfiguration
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
// /**
|
|
10
|
+
// * It is possible to set default values for analytics:
|
|
11
|
+
// *
|
|
12
|
+
// * Both properties in Event and in AnalyticsExtra can be used.
|
|
13
|
+
// * This needs to satisfies Partial<Event & AnalyticsExtra>, but not be declared as that.
|
|
14
|
+
// * Do not use `as` or declare the const as Partial<Event & AnalyticsExtra>.
|
|
15
|
+
// * If satisfies isn't possible to use (eg old typescript version or es-lint parsing error etc)
|
|
16
|
+
// * remove type-declaration.
|
|
17
|
+
// *
|
|
18
|
+
// * This is because the actual type of this object will effect the type of
|
|
19
|
+
// * the event-parameter for `Analytics.send(event)`
|
|
20
|
+
// */
|
|
21
|
+
// //eslint-disable-next-line
|
|
22
|
+
// export const analyticsDefault = { version: data.version, source: "pax2pay-worker-banking-ledger", } satisfies Partial<types.Event & AnalyticsExtra>;
|
package/Card/Expiry.ts
CHANGED
|
@@ -16,4 +16,12 @@ export namespace Expiry {
|
|
|
16
16
|
"20" + expiry[0].toString() + "-" + expiry[1].toString().padStart(2, "0") + "-01T00:00:01.000Z"
|
|
17
17
|
)
|
|
18
18
|
}
|
|
19
|
+
export function isExpired(expiry: Expiry): boolean {
|
|
20
|
+
const now = isoly.DateTime.now()
|
|
21
|
+
const expiryYear = 2000 + expiry[0]
|
|
22
|
+
return (
|
|
23
|
+
expiryYear < isoly.DateTime.getYear(now) ||
|
|
24
|
+
(expiryYear == isoly.DateTime.getYear(now) && expiry[1] < isoly.DateTime.getMonth(now))
|
|
25
|
+
)
|
|
26
|
+
}
|
|
19
27
|
}
|
|
@@ -2,6 +2,8 @@ import { isoly } from "isoly"
|
|
|
2
2
|
import { isly } from "isly"
|
|
3
3
|
import { Creatable as AuthorizationCreatable } from "../../Authorization/Creatable"
|
|
4
4
|
import { Merchant } from "../../Merchant"
|
|
5
|
+
import type { Rail } from "../../Rail"
|
|
6
|
+
import type { Transaction } from "../../Transaction"
|
|
5
7
|
|
|
6
8
|
export interface Authorization extends Omit<AuthorizationCreatable, "amount"> {
|
|
7
9
|
time: string
|
|
@@ -21,6 +23,20 @@ export namespace Authorization {
|
|
|
21
23
|
merchant: { ...authorization.merchant, reference: `${authorization.acquirer.id}-${authorization.merchant.id}` },
|
|
22
24
|
}
|
|
23
25
|
}
|
|
26
|
+
export function toTransaction(authorization: Authorization): Transaction.Creatable & {
|
|
27
|
+
counterpart: Rail.Address.Card.Counterpart
|
|
28
|
+
} {
|
|
29
|
+
return {
|
|
30
|
+
amount: authorization.amount,
|
|
31
|
+
currency: authorization.currency,
|
|
32
|
+
description: authorization.description,
|
|
33
|
+
counterpart: {
|
|
34
|
+
type: "card",
|
|
35
|
+
merchant: authorization.merchant,
|
|
36
|
+
acquirer: authorization.acquirer,
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
}
|
|
24
40
|
export const type = AuthorizationCreatable.type.omit(["amount"]).extend<Authorization>({
|
|
25
41
|
time: isly.string(),
|
|
26
42
|
hour: isly.number(),
|
package/Rule/State/Card.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { isoly } from "isoly"
|
|
2
2
|
import { isly } from "isly"
|
|
3
3
|
import { Card as ModelCard } from "../../Card"
|
|
4
|
+
import type { Rail } from "../../Rail"
|
|
5
|
+
import type { Status as TransactionStatus } from "../../Transaction/Status"
|
|
4
6
|
|
|
5
7
|
export interface Card extends Omit<ModelCard, "limit">, Card.Statistics {
|
|
6
8
|
age: { days: number; minutes: number }
|
|
@@ -30,6 +32,27 @@ export namespace Card {
|
|
|
30
32
|
original: { currency: card.limit[0], limit: card.limit[1] },
|
|
31
33
|
}
|
|
32
34
|
}
|
|
35
|
+
export function check(card: Card, amount: number): TransactionStatus {
|
|
36
|
+
let result: TransactionStatus
|
|
37
|
+
if (ModelCard.Expiry.isExpired(card.details.expiry))
|
|
38
|
+
result = ["rejected", "card expired"]
|
|
39
|
+
else if (amount + card.spent[1] > card.limit)
|
|
40
|
+
result = ["rejected", "exceeds limit"]
|
|
41
|
+
else
|
|
42
|
+
result = "processing"
|
|
43
|
+
return result
|
|
44
|
+
}
|
|
45
|
+
export function toAddress(card: Card): Rail.Address.Card {
|
|
46
|
+
return {
|
|
47
|
+
type: "card",
|
|
48
|
+
id: card.id,
|
|
49
|
+
expiry: card.details.expiry,
|
|
50
|
+
holder: card.details.holder,
|
|
51
|
+
iin: card.details.iin,
|
|
52
|
+
last4: card.details.last4,
|
|
53
|
+
scheme: card.scheme,
|
|
54
|
+
}
|
|
55
|
+
}
|
|
33
56
|
export const type = ModelCard.type.omit(["limit"]).extend<Card>({
|
|
34
57
|
age: isly.object<Card["age"]>({ days: isly.number(), minutes: isly.number() }),
|
|
35
58
|
limit: isly.number(),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
import { Transform as FieldTransform } from "./Transform";
|
|
3
|
+
type Transformer = {
|
|
4
|
+
selector: string;
|
|
5
|
+
transform: Field.Transform;
|
|
6
|
+
};
|
|
7
|
+
export type Field = string | Transformer;
|
|
8
|
+
export declare namespace Field {
|
|
9
|
+
export import Transform = FieldTransform;
|
|
10
|
+
const type: isly.Type<string | Transformer>;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
import { Transform as FieldTransform } from "./Transform";
|
|
3
|
+
export var Field;
|
|
4
|
+
(function (Field) {
|
|
5
|
+
Field.Transform = FieldTransform;
|
|
6
|
+
Field.type = isly.union(isly.string(), isly.object({
|
|
7
|
+
selector: isly.string(),
|
|
8
|
+
transform: Field.Transform.type,
|
|
9
|
+
}));
|
|
10
|
+
})(Field || (Field = {}));
|
|
11
|
+
//# sourceMappingURL=Field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"../","sources":["Analytics/Configuration/Mapping/Field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,MAAM,aAAa,CAAA;AAKzD,MAAM,KAAW,KAAK,CASrB;AATD,WAAiB,KAAK;IACP,eAAS,GAAG,cAAc,CAAA;IAC3B,UAAI,GAAG,IAAI,CAAC,KAAK,CAC7B,IAAI,CAAC,MAAM,EAAE,EACb,IAAI,CAAC,MAAM,CAAc;QACxB,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE;QACvB,SAAS,EAAE,MAAA,SAAS,CAAC,IAAI;KACzB,CAAC,CACF,CAAA;AACF,CAAC,EATgB,KAAK,KAAL,KAAK,QASrB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
export type Transform = typeof Transform.values[number];
|
|
3
|
+
export declare namespace Transform {
|
|
4
|
+
const values: readonly ["string", "stringify", "boolean", "float", "integer", "number", "point"];
|
|
5
|
+
const type: isly.Type<"string" | "number" | "boolean" | "integer" | "stringify" | "float" | "point">;
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
export var Transform;
|
|
3
|
+
(function (Transform) {
|
|
4
|
+
Transform.values = ["string", "stringify", "boolean", "float", "integer", "number", "point"];
|
|
5
|
+
Transform.type = isly.string(Transform.values);
|
|
6
|
+
})(Transform || (Transform = {}));
|
|
7
|
+
//# sourceMappingURL=Transform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Transform.js","sourceRoot":"../","sources":["Analytics/Configuration/Mapping/Transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAI3B,MAAM,KAAW,SAAS,CAGzB;AAHD,WAAiB,SAAS;IACZ,gBAAM,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAA;IAC3F,cAAI,GAAG,IAAI,CAAC,MAAM,CAAY,UAAA,MAAM,CAAC,CAAA;AACnD,CAAC,EAHgB,SAAS,KAAT,SAAS,QAGzB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
import { Field as FieldMapping } from "./Field";
|
|
3
|
+
export type Mapping<T extends string = string> = Record<T, Mapping.Field>;
|
|
4
|
+
export declare namespace Mapping {
|
|
5
|
+
export import Field = FieldMapping;
|
|
6
|
+
const type: isly.Type<Mapping<string>>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
import { Field as FieldMapping } from "./Field";
|
|
3
|
+
export var Mapping;
|
|
4
|
+
(function (Mapping) {
|
|
5
|
+
Mapping.Field = FieldMapping;
|
|
6
|
+
Mapping.type = isly.record(isly.string(), Mapping.Field.type);
|
|
7
|
+
})(Mapping || (Mapping = {}));
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Analytics/Configuration/Mapping/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,SAAS,CAAA;AAI/C,MAAM,KAAW,OAAO,CAGvB;AAHD,WAAiB,OAAO;IACT,aAAK,GAAG,YAAY,CAAA;IACrB,YAAI,GAAG,IAAI,CAAC,MAAM,CAAU,IAAI,CAAC,MAAM,EAAE,EAAE,QAAA,KAAK,CAAC,IAAI,CAAC,CAAA;AACpE,CAAC,EAHgB,OAAO,KAAP,OAAO,QAGvB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
import { Mode as FieldMode } from "./Mode";
|
|
3
|
+
import { Type as FieldType } from "./Type";
|
|
4
|
+
export type Field<T extends string = string> = {
|
|
5
|
+
name: T;
|
|
6
|
+
type: Field.Type;
|
|
7
|
+
mode?: Field.Mode;
|
|
8
|
+
fields?: Field[];
|
|
9
|
+
};
|
|
10
|
+
export declare namespace Field {
|
|
11
|
+
export import Type = FieldType;
|
|
12
|
+
export import Mode = FieldMode;
|
|
13
|
+
const type: isly.object.ExtendableType<Field<string>>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
import { Mode as FieldMode } from "./Mode";
|
|
3
|
+
import { Type as FieldType } from "./Type";
|
|
4
|
+
export var Field;
|
|
5
|
+
(function (Field) {
|
|
6
|
+
Field.Type = FieldType;
|
|
7
|
+
Field.Mode = FieldMode;
|
|
8
|
+
Field.type = isly.object({
|
|
9
|
+
name: isly.string(),
|
|
10
|
+
type: Field.Type.type,
|
|
11
|
+
mode: Field.Mode.type.optional(),
|
|
12
|
+
fields: isly.lazy(() => Field.type.array().optional(), "fields"),
|
|
13
|
+
});
|
|
14
|
+
})(Field || (Field = {}));
|
|
15
|
+
//# sourceMappingURL=Field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"../","sources":["Analytics/Configuration/Schema/Field.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAA;AAC1C,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,QAAQ,CAAA;AAI1C,MAAM,KAAW,KAAK,CASrB;AATD,WAAiB,KAAK;IACP,UAAI,GAAG,SAAS,CAAA;IAChB,UAAI,GAAG,SAAS,CAAA;IACjB,UAAI,GAAG,IAAI,CAAC,MAAM,CAAQ;QACtC,IAAI,EAAE,IAAI,CAAC,MAAM,EAAE;QACnB,IAAI,EAAE,MAAA,IAAI,CAAC,IAAI;QACf,IAAI,EAAE,MAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;QAC1B,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAA2C,EAAE,CAAC,MAAA,IAAI,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC;KAClG,CAAC,CAAA;AACH,CAAC,EATgB,KAAK,KAAL,KAAK,QASrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Mode.js","sourceRoot":"../","sources":["Analytics/Configuration/Schema/Mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAI3B,MAAM,KAAW,IAAI,CAGpB;AAHD,WAAiB,IAAI;IACP,WAAM,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,UAAU,CAAU,CAAA;IACtD,SAAI,GAAG,IAAI,CAAC,MAAM,CAAO,KAAA,MAAM,CAAC,CAAA;AAC9C,CAAC,EAHgB,IAAI,KAAJ,IAAI,QAGpB"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
export type Type = typeof Type.values[number];
|
|
3
|
+
export declare namespace Type {
|
|
4
|
+
const values: readonly ["STRING", "BYTES", "INTEGER", "FLOAT", "NUMERIC", "BIGNUMERIC", "BOOLEAN", "TIMESTAMP", "DATE", "TIME", "DATETIME", "INTERVAL", "RECORD", "GEOGRAPHY"];
|
|
5
|
+
const type: isly.Type<"STRING" | "BYTES" | "INTEGER" | "FLOAT" | "NUMERIC" | "BIGNUMERIC" | "BOOLEAN" | "TIMESTAMP" | "DATE" | "TIME" | "DATETIME" | "INTERVAL" | "RECORD" | "GEOGRAPHY">;
|
|
6
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isly } from "isly";
|
|
2
|
+
export var Type;
|
|
3
|
+
(function (Type) {
|
|
4
|
+
Type.values = [
|
|
5
|
+
"STRING",
|
|
6
|
+
"BYTES",
|
|
7
|
+
"INTEGER",
|
|
8
|
+
"FLOAT",
|
|
9
|
+
"NUMERIC",
|
|
10
|
+
"BIGNUMERIC",
|
|
11
|
+
"BOOLEAN",
|
|
12
|
+
"TIMESTAMP",
|
|
13
|
+
"DATE",
|
|
14
|
+
"TIME",
|
|
15
|
+
"DATETIME",
|
|
16
|
+
"INTERVAL",
|
|
17
|
+
"RECORD",
|
|
18
|
+
"GEOGRAPHY",
|
|
19
|
+
];
|
|
20
|
+
Type.type = isly.string(Type.values);
|
|
21
|
+
})(Type || (Type = {}));
|
|
22
|
+
//# sourceMappingURL=Type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Type.js","sourceRoot":"../","sources":["Analytics/Configuration/Schema/Type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAI3B,MAAM,KAAW,IAAI,CAkBpB;AAlBD,WAAiB,IAAI;IACP,WAAM,GAAG;QACrB,QAAQ;QACR,OAAO;QACP,SAAS;QACT,OAAO;QACP,SAAS;QACT,YAAY;QACZ,SAAS;QACT,WAAW;QACX,MAAM;QACN,MAAM;QACN,UAAU;QACV,UAAU;QACV,QAAQ;QACR,WAAW;KACF,CAAA;IACG,SAAI,GAAG,IAAI,CAAC,MAAM,CAAO,KAAA,MAAM,CAAC,CAAA;AAC9C,CAAC,EAlBgB,IAAI,KAAJ,IAAI,QAkBpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Analytics/Configuration/Schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,SAAS,CAAA;AAG9C,MAAM,KAAW,MAAM,CAGtB;AAHD,WAAiB,MAAM;IACR,YAAK,GAAG,WAAW,CAAA;IACpB,WAAI,GAAG,OAAA,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;AACvC,CAAC,EAHgB,MAAM,KAAN,MAAM,QAGtB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Mapping } from "./Mapping";
|
|
2
|
+
import { Schema } from "./Schema";
|
|
3
|
+
export declare namespace Configuration {
|
|
4
|
+
const baseFields: readonly ["realm", "entity", "entityId", "action", "created", "isError", "version", "source"];
|
|
5
|
+
type BaseFields = typeof baseFields[number];
|
|
6
|
+
const baseMapping: Mapping<BaseFields>;
|
|
7
|
+
const baseTableSchema: Schema<BaseFields>;
|
|
8
|
+
function create(mapping: Mapping, schema: Schema, config: {
|
|
9
|
+
projectName?: "paxpay-prod" | "paxpay-nonprod";
|
|
10
|
+
datasetName?: string;
|
|
11
|
+
tableName: string;
|
|
12
|
+
}, filter?: string): {
|
|
13
|
+
tableSchema: Schema.Field<string>[];
|
|
14
|
+
projectName: string;
|
|
15
|
+
datasetName: string;
|
|
16
|
+
tableName: string;
|
|
17
|
+
name: string;
|
|
18
|
+
type: string;
|
|
19
|
+
filter: ({
|
|
20
|
+
type: string;
|
|
21
|
+
expression: string;
|
|
22
|
+
mapping?: undefined;
|
|
23
|
+
} | {
|
|
24
|
+
type: string;
|
|
25
|
+
expression?: undefined;
|
|
26
|
+
mapping?: undefined;
|
|
27
|
+
} | {
|
|
28
|
+
type: string;
|
|
29
|
+
mapping: {
|
|
30
|
+
source: Mapping.Field;
|
|
31
|
+
action: Mapping.Field;
|
|
32
|
+
realm: Mapping.Field;
|
|
33
|
+
created: Mapping.Field;
|
|
34
|
+
entity: Mapping.Field;
|
|
35
|
+
entityId: Mapping.Field;
|
|
36
|
+
isError: Mapping.Field;
|
|
37
|
+
version: Mapping.Field;
|
|
38
|
+
};
|
|
39
|
+
expression?: undefined;
|
|
40
|
+
})[];
|
|
41
|
+
batchSize: number;
|
|
42
|
+
batchInterval: number;
|
|
43
|
+
};
|
|
44
|
+
const backup: {
|
|
45
|
+
tableSchema: Schema.Field<string>[];
|
|
46
|
+
projectName: string;
|
|
47
|
+
datasetName: string;
|
|
48
|
+
tableName: string;
|
|
49
|
+
name: string;
|
|
50
|
+
type: string;
|
|
51
|
+
filter: ({
|
|
52
|
+
type: string;
|
|
53
|
+
expression: string;
|
|
54
|
+
mapping?: undefined;
|
|
55
|
+
} | {
|
|
56
|
+
type: string;
|
|
57
|
+
expression?: undefined;
|
|
58
|
+
mapping?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
type: string;
|
|
61
|
+
mapping: {
|
|
62
|
+
source: Mapping.Field;
|
|
63
|
+
action: Mapping.Field;
|
|
64
|
+
realm: Mapping.Field;
|
|
65
|
+
created: Mapping.Field;
|
|
66
|
+
entity: Mapping.Field;
|
|
67
|
+
entityId: Mapping.Field;
|
|
68
|
+
isError: Mapping.Field;
|
|
69
|
+
version: Mapping.Field;
|
|
70
|
+
};
|
|
71
|
+
expression?: undefined;
|
|
72
|
+
})[];
|
|
73
|
+
batchSize: number;
|
|
74
|
+
batchInterval: number;
|
|
75
|
+
};
|
|
76
|
+
}
|