@fintekkers/ledger-models 0.4.56 → 0.4.58
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/catalog/measures.json +3 -2
- package/node/fintekkers/requests/price/query_price_response_pb.d.ts +6 -0
- package/node/fintekkers/requests/price/query_price_response_pb.js +61 -1
- package/node/wrappers/requests/query-price-truncation.test.d.ts +1 -0
- package/node/wrappers/requests/query-price-truncation.test.js +36 -0
- package/node/wrappers/requests/query-price-truncation.test.js.map +1 -0
- package/node/wrappers/requests/query-price-truncation.test.ts +40 -0
- package/package.json +1 -1
package/catalog/measures.json
CHANGED
|
@@ -259,7 +259,7 @@
|
|
|
259
259
|
"name": "REFERENCE_CPI",
|
|
260
260
|
"enum_value": 28,
|
|
261
261
|
"display_name": "Reference CPI",
|
|
262
|
-
"description": "The reference CPI of a TIPS for the settlement date (ValuationRequestProto.asof_datetime), the numerator of the index ratio.",
|
|
262
|
+
"description": "The reference CPI of a TIPS for the settlement date (UTC date of ValuationRequestProto.asof_datetime), the numerator of the index ratio.",
|
|
263
263
|
"formula": "reference_cpi as given, or RefCPI = CPI(m-3) + (d - 1) / days_in_month * (CPI(m-2) - CPI(m-3)) from monthly readings",
|
|
264
264
|
"units": "Index points (e.g. 310.326)",
|
|
265
265
|
"category": "valuation",
|
|
@@ -267,7 +267,8 @@
|
|
|
267
267
|
"model_assumptions": [
|
|
268
268
|
"Reference CPI from TipsInput.cpi",
|
|
269
269
|
"Unrounded (Treasury publishes 5 decimals)",
|
|
270
|
-
"
|
|
270
|
+
"Request rejected unless readings are exactly months m-3 and m-2 (UTC settlement month)",
|
|
271
|
+
"Absent when no CPI is given"
|
|
271
272
|
],
|
|
272
273
|
"implemented": false
|
|
273
274
|
},
|
|
@@ -35,6 +35,10 @@ export class QueryPriceResponseProto extends jspb.Message {
|
|
|
35
35
|
setErrorsOrWarnings(value?: fintekkers_requests_util_errors_summary_pb.SummaryProto): QueryPriceResponseProto;
|
|
36
36
|
getNextPageToken(): string;
|
|
37
37
|
setNextPageToken(value: string): QueryPriceResponseProto;
|
|
38
|
+
getTruncated(): boolean;
|
|
39
|
+
setTruncated(value: boolean): QueryPriceResponseProto;
|
|
40
|
+
getRowCap(): number;
|
|
41
|
+
setRowCap(value: number): QueryPriceResponseProto;
|
|
38
42
|
|
|
39
43
|
serializeBinary(): Uint8Array;
|
|
40
44
|
toObject(includeInstance?: boolean): QueryPriceResponseProto.AsObject;
|
|
@@ -54,5 +58,7 @@ export namespace QueryPriceResponseProto {
|
|
|
54
58
|
priceResponseList: Array<fintekkers_models_price_price_pb.PriceProto.AsObject>,
|
|
55
59
|
errorsOrWarnings?: fintekkers_requests_util_errors_summary_pb.SummaryProto.AsObject,
|
|
56
60
|
nextPageToken: string,
|
|
61
|
+
truncated: boolean,
|
|
62
|
+
rowCap: number,
|
|
57
63
|
}
|
|
58
64
|
}
|
|
@@ -98,7 +98,9 @@ proto.fintekkers.requests.price.QueryPriceResponseProto.toObject = function(incl
|
|
|
98
98
|
priceResponseList: jspb.Message.toObjectList(msg.getPriceResponseList(),
|
|
99
99
|
fintekkers_models_price_price_pb.PriceProto.toObject, includeInstance),
|
|
100
100
|
errorsOrWarnings: (f = msg.getErrorsOrWarnings()) && fintekkers_requests_util_errors_summary_pb.SummaryProto.toObject(includeInstance, f),
|
|
101
|
-
nextPageToken: jspb.Message.getFieldWithDefault(msg, 50, "")
|
|
101
|
+
nextPageToken: jspb.Message.getFieldWithDefault(msg, 50, ""),
|
|
102
|
+
truncated: jspb.Message.getBooleanFieldWithDefault(msg, 60, false),
|
|
103
|
+
rowCap: jspb.Message.getFieldWithDefault(msg, 61, 0)
|
|
102
104
|
};
|
|
103
105
|
|
|
104
106
|
if (includeInstance) {
|
|
@@ -163,6 +165,14 @@ proto.fintekkers.requests.price.QueryPriceResponseProto.deserializeBinaryFromRea
|
|
|
163
165
|
var value = /** @type {string} */ (reader.readString());
|
|
164
166
|
msg.setNextPageToken(value);
|
|
165
167
|
break;
|
|
168
|
+
case 60:
|
|
169
|
+
var value = /** @type {boolean} */ (reader.readBool());
|
|
170
|
+
msg.setTruncated(value);
|
|
171
|
+
break;
|
|
172
|
+
case 61:
|
|
173
|
+
var value = /** @type {number} */ (reader.readInt32());
|
|
174
|
+
msg.setRowCap(value);
|
|
175
|
+
break;
|
|
166
176
|
default:
|
|
167
177
|
reader.skipField();
|
|
168
178
|
break;
|
|
@@ -238,6 +248,20 @@ proto.fintekkers.requests.price.QueryPriceResponseProto.serializeBinaryToWriter
|
|
|
238
248
|
f
|
|
239
249
|
);
|
|
240
250
|
}
|
|
251
|
+
f = message.getTruncated();
|
|
252
|
+
if (f) {
|
|
253
|
+
writer.writeBool(
|
|
254
|
+
60,
|
|
255
|
+
f
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
f = message.getRowCap();
|
|
259
|
+
if (f !== 0) {
|
|
260
|
+
writer.writeInt32(
|
|
261
|
+
61,
|
|
262
|
+
f
|
|
263
|
+
);
|
|
264
|
+
}
|
|
241
265
|
};
|
|
242
266
|
|
|
243
267
|
|
|
@@ -426,4 +450,40 @@ proto.fintekkers.requests.price.QueryPriceResponseProto.prototype.setNextPageTok
|
|
|
426
450
|
};
|
|
427
451
|
|
|
428
452
|
|
|
453
|
+
/**
|
|
454
|
+
* optional bool truncated = 60;
|
|
455
|
+
* @return {boolean}
|
|
456
|
+
*/
|
|
457
|
+
proto.fintekkers.requests.price.QueryPriceResponseProto.prototype.getTruncated = function() {
|
|
458
|
+
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 60, false));
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* @param {boolean} value
|
|
464
|
+
* @return {!proto.fintekkers.requests.price.QueryPriceResponseProto} returns this
|
|
465
|
+
*/
|
|
466
|
+
proto.fintekkers.requests.price.QueryPriceResponseProto.prototype.setTruncated = function(value) {
|
|
467
|
+
return jspb.Message.setProto3BooleanField(this, 60, value);
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* optional int32 row_cap = 61;
|
|
473
|
+
* @return {number}
|
|
474
|
+
*/
|
|
475
|
+
proto.fintekkers.requests.price.QueryPriceResponseProto.prototype.getRowCap = function() {
|
|
476
|
+
return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 61, 0));
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* @param {number} value
|
|
482
|
+
* @return {!proto.fintekkers.requests.price.QueryPriceResponseProto} returns this
|
|
483
|
+
*/
|
|
484
|
+
proto.fintekkers.requests.price.QueryPriceResponseProto.prototype.setRowCap = function(value) {
|
|
485
|
+
return jspb.Message.setProto3IntField(this, 61, value);
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
|
|
429
489
|
goog.object.extend(exports, proto.fintekkers.requests.price);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// Wire tests for QueryPriceResponseProto.truncated / row_cap.
|
|
4
|
+
// See docs/adr/query_price_truncation.md.
|
|
5
|
+
const price_pb_1 = require("../../fintekkers/models/price/price_pb");
|
|
6
|
+
const query_price_response_pb_1 = require("../../fintekkers/requests/price/query_price_response_pb");
|
|
7
|
+
function pagedResponse() {
|
|
8
|
+
const response = new query_price_response_pb_1.QueryPriceResponseProto();
|
|
9
|
+
response.addPriceResponse(new price_pb_1.PriceProto().setIsLink(true));
|
|
10
|
+
response.setNextPageToken('opaque-def');
|
|
11
|
+
return response;
|
|
12
|
+
}
|
|
13
|
+
describe('QueryPriceResponseProto truncation fields', () => {
|
|
14
|
+
test('truncated and row_cap round-trip with existing fields', () => {
|
|
15
|
+
const response = pagedResponse();
|
|
16
|
+
response.setTruncated(true);
|
|
17
|
+
response.setRowCap(1000);
|
|
18
|
+
const parsed = query_price_response_pb_1.QueryPriceResponseProto.deserializeBinary(response.serializeBinary());
|
|
19
|
+
expect(parsed.getTruncated()).toBe(true);
|
|
20
|
+
expect(parsed.getRowCap()).toBe(1000);
|
|
21
|
+
expect(parsed.getNextPageToken()).toBe('opaque-def');
|
|
22
|
+
expect(parsed.getPriceResponseList()).toHaveLength(1);
|
|
23
|
+
expect(parsed.getPriceResponseList()[0].getIsLink()).toBe(true);
|
|
24
|
+
});
|
|
25
|
+
test('response without the new fields reads false / 0', () => {
|
|
26
|
+
const old = pagedResponse();
|
|
27
|
+
const explicit = pagedResponse();
|
|
28
|
+
explicit.setTruncated(false);
|
|
29
|
+
explicit.setRowCap(0);
|
|
30
|
+
const parsed = query_price_response_pb_1.QueryPriceResponseProto.deserializeBinary(old.serializeBinary());
|
|
31
|
+
expect(parsed.getTruncated()).toBe(false);
|
|
32
|
+
expect(parsed.getRowCap()).toBe(0);
|
|
33
|
+
expect(Array.from(explicit.serializeBinary())).toEqual(Array.from(old.serializeBinary()));
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=query-price-truncation.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-price-truncation.test.js","sourceRoot":"","sources":["query-price-truncation.test.ts"],"names":[],"mappings":";;AAAA,8DAA8D;AAC9D,0CAA0C;AAC1C,qEAAoE;AACpE,qGAAkG;AAElG,SAAS,aAAa;IACpB,MAAM,QAAQ,GAAG,IAAI,iDAAuB,EAAE,CAAC;IAC/C,QAAQ,CAAC,gBAAgB,CAAC,IAAI,qBAAU,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,QAAQ,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACxC,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,QAAQ,CAAC,2CAA2C,EAAE,GAAG,EAAE;IACzD,IAAI,CAAC,uDAAuD,EAAE,GAAG,EAAE;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C,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC;IAC5F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Wire tests for QueryPriceResponseProto.truncated / row_cap.
|
|
2
|
+
// See docs/adr/query_price_truncation.md.
|
|
3
|
+
import { PriceProto } from '../../fintekkers/models/price/price_pb';
|
|
4
|
+
import { QueryPriceResponseProto } from '../../fintekkers/requests/price/query_price_response_pb';
|
|
5
|
+
|
|
6
|
+
function pagedResponse(): QueryPriceResponseProto {
|
|
7
|
+
const response = new QueryPriceResponseProto();
|
|
8
|
+
response.addPriceResponse(new PriceProto().setIsLink(true));
|
|
9
|
+
response.setNextPageToken('opaque-def');
|
|
10
|
+
return response;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
describe('QueryPriceResponseProto truncation fields', () => {
|
|
14
|
+
test('truncated and row_cap round-trip with existing fields', () => {
|
|
15
|
+
const response = pagedResponse();
|
|
16
|
+
response.setTruncated(true);
|
|
17
|
+
response.setRowCap(1000);
|
|
18
|
+
|
|
19
|
+
const parsed = QueryPriceResponseProto.deserializeBinary(response.serializeBinary());
|
|
20
|
+
|
|
21
|
+
expect(parsed.getTruncated()).toBe(true);
|
|
22
|
+
expect(parsed.getRowCap()).toBe(1000);
|
|
23
|
+
expect(parsed.getNextPageToken()).toBe('opaque-def');
|
|
24
|
+
expect(parsed.getPriceResponseList()).toHaveLength(1);
|
|
25
|
+
expect(parsed.getPriceResponseList()[0].getIsLink()).toBe(true);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test('response without the new fields reads false / 0', () => {
|
|
29
|
+
const old = pagedResponse();
|
|
30
|
+
const explicit = pagedResponse();
|
|
31
|
+
explicit.setTruncated(false);
|
|
32
|
+
explicit.setRowCap(0);
|
|
33
|
+
|
|
34
|
+
const parsed = QueryPriceResponseProto.deserializeBinary(old.serializeBinary());
|
|
35
|
+
|
|
36
|
+
expect(parsed.getTruncated()).toBe(false);
|
|
37
|
+
expect(parsed.getRowCap()).toBe(0);
|
|
38
|
+
expect(Array.from(explicit.serializeBinary())).toEqual(Array.from(old.serializeBinary()));
|
|
39
|
+
});
|
|
40
|
+
});
|