@finsys/core 4.7.0 → 4.9.0
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/dist/data/adapter-categories.json +25 -1
- package/dist/index.cjs +82 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +125 -2
- package/dist/index.d.ts +125 -2
- package/dist/index.js +80 -3
- package/dist/index.js.map +1 -1
- package/dist/schema/adapter-manifest.schema.json +24 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"schemaVersion": "1.
|
|
2
|
+
"schemaVersion": "1.2.0",
|
|
3
3
|
"categories": [
|
|
4
4
|
{
|
|
5
5
|
"id": "telco-carrier",
|
|
@@ -51,6 +51,30 @@
|
|
|
51
51
|
"unit": "MYR",
|
|
52
52
|
"range": [0, 10000],
|
|
53
53
|
"description": "Average Revenue Per User (monthly) in Malaysian Ringgit. Coarse spending-capacity proxy."
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "telcoPaymentReliabilityTier",
|
|
57
|
+
"type": "string",
|
|
58
|
+
"kind": "enum",
|
|
59
|
+
"description": "Coarse bill-payment reliability bucket, for partners that return a tier label instead of a continuous ratio. Parallel signal to telcoOnTimePaymentRatio24m. Labels are vendor-declared (see the adapter manifest's enumValues); ordering and scoring live in the consumer's per-value mapping."
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "telcoTenureTier",
|
|
63
|
+
"type": "string",
|
|
64
|
+
"kind": "enum",
|
|
65
|
+
"description": "Coarse account-age bucket, for partners that return a tenure tier label instead of a continuous month count. Parallel signal to telcoTenureMonths. Labels are vendor-declared (see the adapter manifest's enumValues)."
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "telcoDistressTier",
|
|
69
|
+
"type": "string",
|
|
70
|
+
"kind": "enum",
|
|
71
|
+
"description": "Coarse account-distress bucket, for partners that return a distress tier label instead of discrete counts. Parallel signal to telcoSuspensionsCount24m / telcoLateDays24m. Labels are vendor-declared (see the adapter manifest's enumValues)."
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "telcoHandsetRiskTier",
|
|
75
|
+
"type": "string",
|
|
76
|
+
"kind": "enum",
|
|
77
|
+
"description": "Coarse handset-financing risk bucket, for partners that return a tier label instead of the discrete handset flags. Parallel signal to telcoHandsetFinancingActive / telcoHandsetFinancingDelinquent. Labels are vendor-declared (see the adapter manifest's enumValues)."
|
|
54
78
|
}
|
|
55
79
|
]
|
|
56
80
|
},
|
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
ADAPTER_CATEGORY_IDS: () => ADAPTER_CATEGORY_IDS,
|
|
34
34
|
ALL_AGGREGATION_OPS: () => ALL_AGGREGATION_OPS,
|
|
35
35
|
AdapterError: () => AdapterError,
|
|
36
|
+
AdapterExecutionMode: () => AdapterExecutionMode,
|
|
36
37
|
BASE_FIELD_SPECS: () => BASE_FIELD_SPECS,
|
|
37
38
|
BasicFormField: () => BasicFormField,
|
|
38
39
|
DEFAULT_VALIDATOR_DEFINITIONS: () => DEFAULT_VALIDATOR_DEFINITIONS,
|
|
@@ -66,6 +67,7 @@ __export(index_exports, {
|
|
|
66
67
|
categoryForField: () => categoryForField,
|
|
67
68
|
categorySchemaOf: () => categorySchemaOf,
|
|
68
69
|
evaluateExpression: () => evaluateExpression,
|
|
70
|
+
executionModeOf: () => executionModeOf,
|
|
69
71
|
extractTimePeriods: () => extractTimePeriods,
|
|
70
72
|
factOf: () => factOf,
|
|
71
73
|
formatDocumentSize: () => formatDocumentSize,
|
|
@@ -10323,7 +10325,7 @@ function applyAggregation(op, instances) {
|
|
|
10323
10325
|
|
|
10324
10326
|
// src/data/adapter-categories.json
|
|
10325
10327
|
var adapter_categories_default = {
|
|
10326
|
-
schemaVersion: "1.
|
|
10328
|
+
schemaVersion: "1.2.0",
|
|
10327
10329
|
categories: [
|
|
10328
10330
|
{
|
|
10329
10331
|
id: "telco-carrier",
|
|
@@ -10375,6 +10377,30 @@ var adapter_categories_default = {
|
|
|
10375
10377
|
unit: "MYR",
|
|
10376
10378
|
range: [0, 1e4],
|
|
10377
10379
|
description: "Average Revenue Per User (monthly) in Malaysian Ringgit. Coarse spending-capacity proxy."
|
|
10380
|
+
},
|
|
10381
|
+
{
|
|
10382
|
+
name: "telcoPaymentReliabilityTier",
|
|
10383
|
+
type: "string",
|
|
10384
|
+
kind: "enum",
|
|
10385
|
+
description: "Coarse bill-payment reliability bucket, for partners that return a tier label instead of a continuous ratio. Parallel signal to telcoOnTimePaymentRatio24m. Labels are vendor-declared (see the adapter manifest's enumValues); ordering and scoring live in the consumer's per-value mapping."
|
|
10386
|
+
},
|
|
10387
|
+
{
|
|
10388
|
+
name: "telcoTenureTier",
|
|
10389
|
+
type: "string",
|
|
10390
|
+
kind: "enum",
|
|
10391
|
+
description: "Coarse account-age bucket, for partners that return a tenure tier label instead of a continuous month count. Parallel signal to telcoTenureMonths. Labels are vendor-declared (see the adapter manifest's enumValues)."
|
|
10392
|
+
},
|
|
10393
|
+
{
|
|
10394
|
+
name: "telcoDistressTier",
|
|
10395
|
+
type: "string",
|
|
10396
|
+
kind: "enum",
|
|
10397
|
+
description: "Coarse account-distress bucket, for partners that return a distress tier label instead of discrete counts. Parallel signal to telcoSuspensionsCount24m / telcoLateDays24m. Labels are vendor-declared (see the adapter manifest's enumValues)."
|
|
10398
|
+
},
|
|
10399
|
+
{
|
|
10400
|
+
name: "telcoHandsetRiskTier",
|
|
10401
|
+
type: "string",
|
|
10402
|
+
kind: "enum",
|
|
10403
|
+
description: "Coarse handset-financing risk bucket, for partners that return a tier label instead of the discrete handset flags. Parallel signal to telcoHandsetFinancingActive / telcoHandsetFinancingDelinquent. Labels are vendor-declared (see the adapter manifest's enumValues)."
|
|
10378
10404
|
}
|
|
10379
10405
|
]
|
|
10380
10406
|
},
|
|
@@ -11822,6 +11848,7 @@ var VALID_FIELD_TYPES = [
|
|
|
11822
11848
|
"boolean",
|
|
11823
11849
|
"string"
|
|
11824
11850
|
];
|
|
11851
|
+
var VALID_FIELD_KINDS = ["enum"];
|
|
11825
11852
|
function buildCategoryRegistry(raw) {
|
|
11826
11853
|
if (!raw || typeof raw !== "object") {
|
|
11827
11854
|
throw new Error("adapter category data: expected an object");
|
|
@@ -11889,6 +11916,12 @@ function buildCategoryRegistry(raw) {
|
|
|
11889
11916
|
`adapter category data: canonical field "${f.name}" declared by more than one category (${prior.categories.join(" + ")} with ${describeFact(prior.fact)} + ${cat.id} with ${describeFact(f.fact)}) \u2014 field names must be globally unique unless every declaring category attests the same fact`
|
|
11890
11917
|
);
|
|
11891
11918
|
}
|
|
11919
|
+
if (prior.kind !== f.kind) {
|
|
11920
|
+
const describeKind = (kind) => kind === void 0 ? "no kind" : `kind "${kind}"`;
|
|
11921
|
+
throw new Error(
|
|
11922
|
+
`adapter category data: canonical field "${f.name}" declared with ${describeKind(prior.kind)} by ${prior.categories.join(" + ")} but ${describeKind(f.kind)} by ${cat.id} \u2014 shared-fact attestations must agree on kind`
|
|
11923
|
+
);
|
|
11924
|
+
}
|
|
11892
11925
|
}
|
|
11893
11926
|
if (f.fact !== void 0) {
|
|
11894
11927
|
for (const [otherName, otherFact] of fieldToFact) {
|
|
@@ -11904,6 +11937,23 @@ function buildCategoryRegistry(raw) {
|
|
|
11904
11937
|
`adapter category data: field "${f.name}" (${where}) has invalid type "${f.type}"`
|
|
11905
11938
|
);
|
|
11906
11939
|
}
|
|
11940
|
+
if (f.kind !== void 0) {
|
|
11941
|
+
if (!VALID_FIELD_KINDS.includes(f.kind)) {
|
|
11942
|
+
throw new Error(
|
|
11943
|
+
`adapter category data: field "${f.name}" (${where}) has invalid kind "${String(f.kind)}"`
|
|
11944
|
+
);
|
|
11945
|
+
}
|
|
11946
|
+
if (f.type !== "string") {
|
|
11947
|
+
throw new Error(
|
|
11948
|
+
`adapter category data: field "${f.name}" (${where}) is kind "enum" but type "${f.type}" \u2014 enum labels are string-normalized, so an enum field must be type "string"`
|
|
11949
|
+
);
|
|
11950
|
+
}
|
|
11951
|
+
if (f.range !== void 0) {
|
|
11952
|
+
throw new Error(
|
|
11953
|
+
`adapter category data: field "${f.name}" (${where}) is kind "enum" but declares a range \u2014 enum labels are unordered; ordering belongs to the consumer, never the data contract`
|
|
11954
|
+
);
|
|
11955
|
+
}
|
|
11956
|
+
}
|
|
11907
11957
|
if (typeof f.description !== "string" || f.description.length === 0) {
|
|
11908
11958
|
throw new Error(
|
|
11909
11959
|
`adapter category data: field "${f.name}" (${where}) needs a non-empty description`
|
|
@@ -11922,14 +11972,15 @@ function buildCategoryRegistry(raw) {
|
|
|
11922
11972
|
...f.unit !== void 0 ? { unit: f.unit } : {},
|
|
11923
11973
|
...f.range !== void 0 ? { range: Object.freeze([f.range[0], f.range[1]]) } : {},
|
|
11924
11974
|
description: f.description,
|
|
11925
|
-
...f.fact !== void 0 ? { fact: f.fact } : {}
|
|
11975
|
+
...f.fact !== void 0 ? { fact: f.fact } : {},
|
|
11976
|
+
...f.kind !== void 0 ? { kind: f.kind } : {}
|
|
11926
11977
|
});
|
|
11927
11978
|
fields.push(spec);
|
|
11928
11979
|
if (prior) {
|
|
11929
11980
|
prior.categories.push(cat.id);
|
|
11930
11981
|
fieldToCategory.delete(f.name);
|
|
11931
11982
|
} else {
|
|
11932
|
-
declarations.set(f.name, { fact: f.fact, categories: [cat.id] });
|
|
11983
|
+
declarations.set(f.name, { fact: f.fact, kind: f.kind, categories: [cat.id] });
|
|
11933
11984
|
fieldToCategory.set(f.name, cat.id);
|
|
11934
11985
|
}
|
|
11935
11986
|
if (f.fact !== void 0) {
|
|
@@ -12004,11 +12055,38 @@ function assertAdapterCategory(id) {
|
|
|
12004
12055
|
}
|
|
12005
12056
|
return id;
|
|
12006
12057
|
}
|
|
12058
|
+
|
|
12059
|
+
// src/adapter-manifest.ts
|
|
12060
|
+
var AdapterExecutionMode = /* @__PURE__ */ ((AdapterExecutionMode2) => {
|
|
12061
|
+
AdapterExecutionMode2["Runnable"] = "runnable";
|
|
12062
|
+
AdapterExecutionMode2["DeclarationOnly"] = "declaration-only";
|
|
12063
|
+
AdapterExecutionMode2["ExternallyAsserted"] = "externally-asserted";
|
|
12064
|
+
return AdapterExecutionMode2;
|
|
12065
|
+
})(AdapterExecutionMode || {});
|
|
12066
|
+
function executionModeOf(manifest) {
|
|
12067
|
+
const implementationType = manifest.implementation.type;
|
|
12068
|
+
switch (implementationType) {
|
|
12069
|
+
case "declarative":
|
|
12070
|
+
case "typescript":
|
|
12071
|
+
return "runnable" /* Runnable */;
|
|
12072
|
+
case "form-intake":
|
|
12073
|
+
case "manual-override":
|
|
12074
|
+
case "extraction-pipeline":
|
|
12075
|
+
return "declaration-only" /* DeclarationOnly */;
|
|
12076
|
+
case "external-assertion":
|
|
12077
|
+
return "externally-asserted" /* ExternallyAsserted */;
|
|
12078
|
+
default: {
|
|
12079
|
+
const unhandled = implementationType;
|
|
12080
|
+
throw new Error(`unknown adapter implementation type: ${String(unhandled)}`);
|
|
12081
|
+
}
|
|
12082
|
+
}
|
|
12083
|
+
}
|
|
12007
12084
|
// Annotate the CommonJS export names for ESM import in node:
|
|
12008
12085
|
0 && (module.exports = {
|
|
12009
12086
|
ADAPTER_CATEGORY_IDS,
|
|
12010
12087
|
ALL_AGGREGATION_OPS,
|
|
12011
12088
|
AdapterError,
|
|
12089
|
+
AdapterExecutionMode,
|
|
12012
12090
|
BASE_FIELD_SPECS,
|
|
12013
12091
|
BasicFormField,
|
|
12014
12092
|
DEFAULT_VALIDATOR_DEFINITIONS,
|
|
@@ -12042,6 +12120,7 @@ function assertAdapterCategory(id) {
|
|
|
12042
12120
|
categoryForField,
|
|
12043
12121
|
categorySchemaOf,
|
|
12044
12122
|
evaluateExpression,
|
|
12123
|
+
executionModeOf,
|
|
12045
12124
|
extractTimePeriods,
|
|
12046
12125
|
factOf,
|
|
12047
12126
|
formatDocumentSize,
|