@pax2pay/model-banking 0.1.161 → 0.1.162
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/Operation/index.ts
CHANGED
|
@@ -7,29 +7,36 @@ export interface Operation extends OperationCreatable {
|
|
|
7
7
|
transaction: string
|
|
8
8
|
counter: number
|
|
9
9
|
created: isoly.DateTime
|
|
10
|
-
|
|
10
|
+
signature?: string
|
|
11
11
|
}
|
|
12
12
|
export namespace Operation {
|
|
13
|
+
export type Creatable = OperationCreatable
|
|
14
|
+
export const Creatable = OperationCreatable
|
|
15
|
+
export type Changes = OperationChanges
|
|
16
|
+
export const Changes = OperationChanges
|
|
17
|
+
export namespace Changes {
|
|
18
|
+
export type Entry = OperationChanges.Entry
|
|
19
|
+
}
|
|
13
20
|
export const type = OperationCreatable.type.extend<Operation>({
|
|
14
21
|
transaction: isly.string(),
|
|
15
22
|
counter: isly.number(),
|
|
16
23
|
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
24
|
+
signature: isly.string().optional(),
|
|
17
25
|
})
|
|
18
26
|
export const is = type.is
|
|
19
27
|
export const flaw = type.flaw
|
|
20
|
-
|
|
28
|
+
//TODO: actual signing function
|
|
29
|
+
function sign(precursor: string): string | undefined {
|
|
30
|
+
const signature = Number.parseInt(precursor)
|
|
31
|
+
return Number.isNaN(signature) ? undefined : (signature + 1).toString()
|
|
32
|
+
}
|
|
33
|
+
export function fromCreatable(transaction: string, creatable: Creatable, oldSignature?: string): Operation {
|
|
21
34
|
return {
|
|
22
35
|
...creatable,
|
|
23
36
|
transaction,
|
|
24
37
|
counter: 0,
|
|
25
38
|
created: isoly.DateTime.now(),
|
|
39
|
+
signature: oldSignature && sign(oldSignature),
|
|
26
40
|
}
|
|
27
41
|
}
|
|
28
|
-
export type Creatable = OperationCreatable
|
|
29
|
-
export const Creatable = OperationCreatable
|
|
30
|
-
export type Changes = OperationChanges
|
|
31
|
-
export const Changes = OperationChanges
|
|
32
|
-
export namespace Changes {
|
|
33
|
-
export type Entry = OperationChanges.Entry
|
|
34
|
-
}
|
|
35
42
|
}
|
|
@@ -6,12 +6,9 @@ export interface Operation extends OperationCreatable {
|
|
|
6
6
|
transaction: string;
|
|
7
7
|
counter: number;
|
|
8
8
|
created: isoly.DateTime;
|
|
9
|
+
signature?: string;
|
|
9
10
|
}
|
|
10
11
|
export declare namespace Operation {
|
|
11
|
-
const type: isly.object.ExtendableType<Operation>;
|
|
12
|
-
const is: isly.Type.IsFunction<Operation>;
|
|
13
|
-
const flaw: isly.Type.FlawFunction;
|
|
14
|
-
function fromCreatable(transaction: string, creatable: Creatable): Operation;
|
|
15
12
|
type Creatable = OperationCreatable;
|
|
16
13
|
const Creatable: typeof OperationCreatable;
|
|
17
14
|
type Changes = OperationChanges;
|
|
@@ -19,4 +16,8 @@ export declare namespace Operation {
|
|
|
19
16
|
namespace Changes {
|
|
20
17
|
type Entry = OperationChanges.Entry;
|
|
21
18
|
}
|
|
19
|
+
const type: isly.object.ExtendableType<Operation>;
|
|
20
|
+
const is: isly.Type.IsFunction<Operation>;
|
|
21
|
+
const flaw: isly.Type.FlawFunction;
|
|
22
|
+
function fromCreatable(transaction: string, creatable: Creatable, oldSignature?: string): Operation;
|
|
22
23
|
}
|
package/dist/Operation/index.js
CHANGED
|
@@ -4,23 +4,29 @@ import { Changes as OperationChanges } from "./Changes";
|
|
|
4
4
|
import { Creatable as OperationCreatable } from "./Creatable";
|
|
5
5
|
export var Operation;
|
|
6
6
|
(function (Operation) {
|
|
7
|
+
Operation.Creatable = OperationCreatable;
|
|
8
|
+
Operation.Changes = OperationChanges;
|
|
7
9
|
Operation.type = OperationCreatable.type.extend({
|
|
8
10
|
transaction: isly.string(),
|
|
9
11
|
counter: isly.number(),
|
|
10
12
|
created: isly.fromIs("isoly.DateTime", isoly.DateTime.is),
|
|
13
|
+
signature: isly.string().optional(),
|
|
11
14
|
});
|
|
12
15
|
Operation.is = Operation.type.is;
|
|
13
16
|
Operation.flaw = Operation.type.flaw;
|
|
14
|
-
function
|
|
17
|
+
function sign(precursor) {
|
|
18
|
+
const signature = Number.parseInt(precursor);
|
|
19
|
+
return Number.isNaN(signature) ? undefined : (signature + 1).toString();
|
|
20
|
+
}
|
|
21
|
+
function fromCreatable(transaction, creatable, oldSignature) {
|
|
15
22
|
return {
|
|
16
23
|
...creatable,
|
|
17
24
|
transaction,
|
|
18
25
|
counter: 0,
|
|
19
26
|
created: isoly.DateTime.now(),
|
|
27
|
+
signature: oldSignature && sign(oldSignature),
|
|
20
28
|
};
|
|
21
29
|
}
|
|
22
30
|
Operation.fromCreatable = fromCreatable;
|
|
23
|
-
Operation.Creatable = OperationCreatable;
|
|
24
|
-
Operation.Changes = OperationChanges;
|
|
25
31
|
})(Operation || (Operation = {}));
|
|
26
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAQ7D,MAAM,KAAW,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../","sources":["Operation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAA;AACvD,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAQ7D,MAAM,KAAW,SAAS,CA8BzB;AA9BD,WAAiB,SAAS;IAEZ,mBAA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