@finsys/core 4.2.0 → 4.3.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/index.d.cts CHANGED
@@ -1470,6 +1470,30 @@ interface AdapterManifest {
1470
1470
  * present — declaring them is harmless but unnecessary.
1471
1471
  */
1472
1472
  readonly requiredIdentityFields?: ReadonlyArray<string>;
1473
+ /**
1474
+ * SYS-2503: declarative per-field authorization gating. Keyed by
1475
+ * canonical field name (every key MUST also appear in `produces` —
1476
+ * host validates at registration, same as `singletonFields`).
1477
+ *
1478
+ * Semantics, enforced by the HOST at read time (the manifest only
1479
+ * declares):
1480
+ *
1481
+ * - No entry for a field → visible to every reader (gating is
1482
+ * strictly opt-in; pre-existing manifests are unaffected).
1483
+ * - An entry restricts: the reader must satisfy EVERY dimension
1484
+ * the entry declares (AND across dimensions), matching ANY value
1485
+ * within a dimension's list (OR within a list).
1486
+ * - `lenderRoles` — reader's lender-role identifier must be listed.
1487
+ * - `programIds` — the application's program must be listed.
1488
+ *
1489
+ * Both dimensions are host-interpreted opaque strings: core neither
1490
+ * knows nor validates what a "role" or "program id" is, keeping the
1491
+ * contract deployment-agnostic. An entry must declare at least one
1492
+ * dimension, and a declared dimension must be non-empty — an empty
1493
+ * list would read as deny-all, which is better expressed by simply
1494
+ * not producing the field.
1495
+ */
1496
+ readonly fieldAuthorizations?: Readonly<Partial<Record<CanonicalFieldName, FieldAuthorization>>>;
1473
1497
  /**
1474
1498
  * Optional free-form notes — useful for partner-side documentation
1475
1499
  * (where to find the adapter's source, who owns it, what version of
@@ -1477,6 +1501,22 @@ interface AdapterManifest {
1477
1501
  */
1478
1502
  readonly notes?: string;
1479
1503
  }
1504
+ /**
1505
+ * SYS-2503: one field's authorization gate. See
1506
+ * {@link AdapterManifest.fieldAuthorizations} for semantics.
1507
+ *
1508
+ * A union rather than an all-optional interface so a no-op gate (`{}`)
1509
+ * is unrepresentable at COMPILE time too, not just rejected by the JSON
1510
+ * schema's `minProperties: 1` at runtime — the TS type and the schema
1511
+ * enforce the same invariant at their respective layers.
1512
+ */
1513
+ type FieldAuthorization = {
1514
+ readonly lenderRoles: ReadonlyArray<string>;
1515
+ readonly programIds?: ReadonlyArray<string>;
1516
+ } | {
1517
+ readonly lenderRoles?: ReadonlyArray<string>;
1518
+ readonly programIds: ReadonlyArray<string>;
1519
+ };
1480
1520
  interface DeclarativeImplementation {
1481
1521
  readonly type: "declarative";
1482
1522
  /**
@@ -1561,4 +1601,4 @@ interface FieldMapEntry {
1561
1601
  readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
1562
1602
  }
1563
1603
 
1564
- export { ADAPTER_CATEGORY_IDS, ALL_AGGREGATION_OPS, type AdapterCategory, AdapterError, type AdapterErrorReason, type AdapterExtraction, type AdapterManifest, type AggregationOp, type ApplicantIdentity, BASE_FIELD_SPECS, BasicFormField, type CanonicalFieldName, type CanonicalFieldSpec, type CanonicalFieldValue, type CanonicalFieldValues, type Category, type CategorySchema, type CategorySpec, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DeclarativeImplementation, type DocExtractionResult, DocExtractionStatus, type DocumentFileMetadata, type DocumentRow, type DocumentRowCapabilities, type DocumentTypeGroup, type DropdownOption, type EditorValidator, type ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldData, type FieldGroup, type FieldMapEntry, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, type FormIntakeFieldMapEntry, type FormIntakeImplementation, FormSpec, type FormValidatorDefinitions, IHS_FAILURE_STATUSES, IHS_FIELD_ORIGINS, IHS_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldOrigin, type IhsFieldProvenance, IhsStatus, IhsValueFormat, type InstanceRow, type InstanceValue, type ManualOverrideImplementation, type PageConfig, type RHFSchemaOutput, type RHFStep, type RawPayload, type ResolvedField, Role, type SourceAdapter, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type TaggedFieldData, type TimePeriodUnit, type TypescriptImplementation, type UnifiedFormConfig, type Validator, type WireFormat, allCategories, applyAggregation, applyDynamicTitles, assertAdapterCategory, assertDocumentType, buildDocumentRows, buildFileFieldTables, buildFileFieldTablesFromInstances, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, formatDocumentSize, formatDocumentType, formatDocumentUploaded, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getDocDisplayNames, getDocumentTypeGroups, getExtractableDocTypes, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getReuploadableDocTypes, getStepDefaultValues, getStepSchema, groupColumnsByInstance, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isDocumentType, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsFieldOrigin, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
1604
+ export { ADAPTER_CATEGORY_IDS, ALL_AGGREGATION_OPS, type AdapterCategory, AdapterError, type AdapterErrorReason, type AdapterExtraction, type AdapterManifest, type AggregationOp, type ApplicantIdentity, BASE_FIELD_SPECS, BasicFormField, type CanonicalFieldName, type CanonicalFieldSpec, type CanonicalFieldValue, type CanonicalFieldValues, type Category, type CategorySchema, type CategorySpec, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DeclarativeImplementation, type DocExtractionResult, DocExtractionStatus, type DocumentFileMetadata, type DocumentRow, type DocumentRowCapabilities, type DocumentTypeGroup, type DropdownOption, type EditorValidator, type ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldAuthorization, type FieldData, type FieldGroup, type FieldMapEntry, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, type FormIntakeFieldMapEntry, type FormIntakeImplementation, FormSpec, type FormValidatorDefinitions, IHS_FAILURE_STATUSES, IHS_FIELD_ORIGINS, IHS_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldOrigin, type IhsFieldProvenance, IhsStatus, IhsValueFormat, type InstanceRow, type InstanceValue, type ManualOverrideImplementation, type PageConfig, type RHFSchemaOutput, type RHFStep, type RawPayload, type ResolvedField, Role, type SourceAdapter, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type TaggedFieldData, type TimePeriodUnit, type TypescriptImplementation, type UnifiedFormConfig, type Validator, type WireFormat, allCategories, applyAggregation, applyDynamicTitles, assertAdapterCategory, assertDocumentType, buildDocumentRows, buildFileFieldTables, buildFileFieldTablesFromInstances, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, formatDocumentSize, formatDocumentType, formatDocumentUploaded, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getDocDisplayNames, getDocumentTypeGroups, getExtractableDocTypes, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getReuploadableDocTypes, getStepDefaultValues, getStepSchema, groupColumnsByInstance, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isDocumentType, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsFieldOrigin, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
package/dist/index.d.ts CHANGED
@@ -1470,6 +1470,30 @@ interface AdapterManifest {
1470
1470
  * present — declaring them is harmless but unnecessary.
1471
1471
  */
1472
1472
  readonly requiredIdentityFields?: ReadonlyArray<string>;
1473
+ /**
1474
+ * SYS-2503: declarative per-field authorization gating. Keyed by
1475
+ * canonical field name (every key MUST also appear in `produces` —
1476
+ * host validates at registration, same as `singletonFields`).
1477
+ *
1478
+ * Semantics, enforced by the HOST at read time (the manifest only
1479
+ * declares):
1480
+ *
1481
+ * - No entry for a field → visible to every reader (gating is
1482
+ * strictly opt-in; pre-existing manifests are unaffected).
1483
+ * - An entry restricts: the reader must satisfy EVERY dimension
1484
+ * the entry declares (AND across dimensions), matching ANY value
1485
+ * within a dimension's list (OR within a list).
1486
+ * - `lenderRoles` — reader's lender-role identifier must be listed.
1487
+ * - `programIds` — the application's program must be listed.
1488
+ *
1489
+ * Both dimensions are host-interpreted opaque strings: core neither
1490
+ * knows nor validates what a "role" or "program id" is, keeping the
1491
+ * contract deployment-agnostic. An entry must declare at least one
1492
+ * dimension, and a declared dimension must be non-empty — an empty
1493
+ * list would read as deny-all, which is better expressed by simply
1494
+ * not producing the field.
1495
+ */
1496
+ readonly fieldAuthorizations?: Readonly<Partial<Record<CanonicalFieldName, FieldAuthorization>>>;
1473
1497
  /**
1474
1498
  * Optional free-form notes — useful for partner-side documentation
1475
1499
  * (where to find the adapter's source, who owns it, what version of
@@ -1477,6 +1501,22 @@ interface AdapterManifest {
1477
1501
  */
1478
1502
  readonly notes?: string;
1479
1503
  }
1504
+ /**
1505
+ * SYS-2503: one field's authorization gate. See
1506
+ * {@link AdapterManifest.fieldAuthorizations} for semantics.
1507
+ *
1508
+ * A union rather than an all-optional interface so a no-op gate (`{}`)
1509
+ * is unrepresentable at COMPILE time too, not just rejected by the JSON
1510
+ * schema's `minProperties: 1` at runtime — the TS type and the schema
1511
+ * enforce the same invariant at their respective layers.
1512
+ */
1513
+ type FieldAuthorization = {
1514
+ readonly lenderRoles: ReadonlyArray<string>;
1515
+ readonly programIds?: ReadonlyArray<string>;
1516
+ } | {
1517
+ readonly lenderRoles?: ReadonlyArray<string>;
1518
+ readonly programIds: ReadonlyArray<string>;
1519
+ };
1480
1520
  interface DeclarativeImplementation {
1481
1521
  readonly type: "declarative";
1482
1522
  /**
@@ -1561,4 +1601,4 @@ interface FieldMapEntry {
1561
1601
  readonly transform?: "identity" | "pct_to_ratio01" | "to_boolean" | "to_integer";
1562
1602
  }
1563
1603
 
1564
- export { ADAPTER_CATEGORY_IDS, ALL_AGGREGATION_OPS, type AdapterCategory, AdapterError, type AdapterErrorReason, type AdapterExtraction, type AdapterManifest, type AggregationOp, type ApplicantIdentity, BASE_FIELD_SPECS, BasicFormField, type CanonicalFieldName, type CanonicalFieldSpec, type CanonicalFieldValue, type CanonicalFieldValues, type Category, type CategorySchema, type CategorySpec, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DeclarativeImplementation, type DocExtractionResult, DocExtractionStatus, type DocumentFileMetadata, type DocumentRow, type DocumentRowCapabilities, type DocumentTypeGroup, type DropdownOption, type EditorValidator, type ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldData, type FieldGroup, type FieldMapEntry, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, type FormIntakeFieldMapEntry, type FormIntakeImplementation, FormSpec, type FormValidatorDefinitions, IHS_FAILURE_STATUSES, IHS_FIELD_ORIGINS, IHS_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldOrigin, type IhsFieldProvenance, IhsStatus, IhsValueFormat, type InstanceRow, type InstanceValue, type ManualOverrideImplementation, type PageConfig, type RHFSchemaOutput, type RHFStep, type RawPayload, type ResolvedField, Role, type SourceAdapter, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type TaggedFieldData, type TimePeriodUnit, type TypescriptImplementation, type UnifiedFormConfig, type Validator, type WireFormat, allCategories, applyAggregation, applyDynamicTitles, assertAdapterCategory, assertDocumentType, buildDocumentRows, buildFileFieldTables, buildFileFieldTablesFromInstances, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, formatDocumentSize, formatDocumentType, formatDocumentUploaded, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getDocDisplayNames, getDocumentTypeGroups, getExtractableDocTypes, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getReuploadableDocTypes, getStepDefaultValues, getStepSchema, groupColumnsByInstance, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isDocumentType, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsFieldOrigin, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
1604
+ export { ADAPTER_CATEGORY_IDS, ALL_AGGREGATION_OPS, type AdapterCategory, AdapterError, type AdapterErrorReason, type AdapterExtraction, type AdapterManifest, type AggregationOp, type ApplicantIdentity, BASE_FIELD_SPECS, BasicFormField, type CanonicalFieldName, type CanonicalFieldSpec, type CanonicalFieldValue, type CanonicalFieldValues, type Category, type CategorySchema, type CategorySpec, type Choice, DEFAULT_VALIDATOR_DEFINITIONS, type DeclarativeImplementation, type DocExtractionResult, DocExtractionStatus, type DocumentFileMetadata, type DocumentRow, type DocumentRowCapabilities, type DocumentTypeGroup, type DropdownOption, type EditorValidator, type ExtractionFileType, type ExtractionJobRecord, ExtractionJobStatus, type ExtractionStatusResult, FIELD_TYPE_DEFINITIONS, type FieldAuthorization, type FieldData, type FieldGroup, type FieldMapEntry, type FieldReference, FieldType, type FileFieldTableData, type FileFieldTableItem, FileFieldTableType, FileFormField, FormField, FormFieldCategory, type FormFieldInputType, type FormFieldType, type FormFieldTypeDefinitions, FormFieldValidator, type FormIntakeFieldMapEntry, type FormIntakeImplementation, FormSpec, type FormValidatorDefinitions, IHS_FAILURE_STATUSES, IHS_FIELD_ORIGINS, IHS_TERMINAL_STATUSES, IHS_VALID_STATUSES, type IhsDetailCategory, type IhsFieldDetail, type IhsFieldOrigin, type IhsFieldProvenance, IhsStatus, IhsValueFormat, type InstanceRow, type InstanceValue, type ManualOverrideImplementation, type PageConfig, type RHFSchemaOutput, type RHFStep, type RawPayload, type ResolvedField, Role, type SourceAdapter, type SurveyElementJSON, type SurveyJSON, type SurveyPageJSON, type TaggedFieldData, type TimePeriodUnit, type TypescriptImplementation, type UnifiedFormConfig, type Validator, type WireFormat, allCategories, applyAggregation, applyDynamicTitles, assertAdapterCategory, assertDocumentType, buildDocumentRows, buildFileFieldTables, buildFileFieldTablesFromInstances, categoryFieldsOf, categoryForField, categorySchemaOf, evaluateExpression, extractTimePeriods, formatDocumentSize, formatDocumentType, formatDocumentUploaded, generateRHFSchema, generateSurveyJson, getBaseCategories, getBaseFieldNames, getBaseFieldSpecMap, getBaseFieldSpecs, getCategoryName, getDisplayName, getDisplayNames, getDocDisplayNames, getDocumentTypeGroups, getExtractableDocTypes, getGroupDisplayNames, getPastMonthLabel, getPastYearLabel, getReuploadableDocTypes, getStepDefaultValues, getStepSchema, groupColumnsByInstance, groupColumnsByTimePeriod, groupDetailsByCategory, groupFieldsByCategory, groupFieldsByPattern, isAdapterCategory, isDocumentType, isFailureIhsStatus, isTerminalIhsStatus, isValidIhsFieldOrigin, isValidIhsStatus, parseFileField, processIhsDetails, resolveExtractionStatus, resolvePageFields, validateFormConfig, validateFormSpec, validatePagesConfig };
@@ -153,6 +153,31 @@
153
153
  "uniqueItems": true,
154
154
  "description": "v2.7.0 — partner-specific identity field names required by fetch(). Host validates per-applicant before invoking fetch() and skips the adapter when missing. Omit (or empty) for adapters that don't implement fetch(). Must NOT include core fields ('ihsId', 'ic', 'fullName') — those are always populated, and declaring 'ic' as required would cause the host to skip every non-MY applicant since 'ic' can legitimately be empty."
155
155
  },
156
+ "fieldAuthorizations": {
157
+ "type": "object",
158
+ "minProperties": 1,
159
+ "propertyNames": { "minLength": 1 },
160
+ "additionalProperties": {
161
+ "type": "object",
162
+ "minProperties": 1,
163
+ "additionalProperties": false,
164
+ "properties": {
165
+ "lenderRoles": {
166
+ "type": "array",
167
+ "minItems": 1,
168
+ "uniqueItems": true,
169
+ "items": { "type": "string", "minLength": 1 }
170
+ },
171
+ "programIds": {
172
+ "type": "array",
173
+ "minItems": 1,
174
+ "uniqueItems": true,
175
+ "items": { "type": "string", "minLength": 1 }
176
+ }
177
+ }
178
+ },
179
+ "description": "SYS-2503 — declarative per-field authorization gating, keyed by canonical field name (every key must also appear in `produces`; host validates at registration). No entry → field visible to every reader. An entry restricts: reader must satisfy EVERY declared dimension (AND across dimensions), matching ANY value within a list (OR within). Dimensions are host-interpreted opaque strings. Each entry must declare at least one non-empty dimension — an empty list would read as deny-all, better expressed by not producing the field."
180
+ },
156
181
  "notes": {
157
182
  "type": "string",
158
183
  "maxLength": 2000,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@finsys/core",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "Convert unified form configurations into Zod schemas, React Hook Form defaults, and SurveyJS JSON",
5
5
  "repository": {
6
6
  "type": "git",