import { OBJECT_IDENTIFIER } from "@wildboar/asn1"; import type { EntryInformationSelection } from "../modules/DirectoryAbstractService/EntryInformationSelection.ta.mjs"; import { EntryInformation } from "../modules/DirectoryAbstractService/EntryInformation.ta.mjs"; import type ContextMatcher from "../types/ContextMatcher.mjs"; /** * @summary Select information from an entry to produce `EntryInformation` * @description * * This function implements most of the entry information selection algorithm * described in the International Telecommunication Union's (ITU) Recommendation * X.511 (2016), Section 7.6. * * This implementation handles (inclusively): * * - Attribute subtyping * - The `preference` alternative in context assertions * - The special attribute type, `id-oa-allAttributeTypes` * * This implementation does _not_ handle the `familyReturn` option, because this * is too closely tied with how entries are stored, read, and represented in * memory. For complete support for entry information selection, the system * using this function should just read this option before passing it into this * function and should call this function for every family member. * * This implementation might seem to not support the `noSubtypeSelection` * service control, but this can be trivially supported by using a * `getAttributeSupertypes` function that always returns an empty array. The * same may be said for the `dontSelectFriends` service control. This function * expects the final and complete entry containing all attributes that are to * be selected from; if friends are desired in the selected output, they should * be included in the `information` of the `entry` parameter; if friends are not * desired, they should simply be excluded. * * The returned `EntryInformation` is brand-new. The input is not modified. * However, some of its innermost references may still be held in common with * the output `EntryInformation`. * * ### ASN.1 Definitions: * * ```asn1 * EntryInformationSelection ::= SET { * attributes CHOICE { * allUserAttributes [0] NULL, * select [1] SET OF AttributeType * -- empty set implies no attributes are requested -- } DEFAULT allUserAttributes:NULL, * infoTypes [2] INTEGER { * attributeTypesOnly (0), * attributeTypesAndValues (1)} DEFAULT attributeTypesAndValues, * extraAttributes CHOICE { * allOperationalAttributes [3] NULL, * select [4] SET SIZE (1..MAX) OF AttributeType } OPTIONAL, * contextSelection ContextSelection OPTIONAL, * returnContexts BOOLEAN DEFAULT FALSE, * familyReturn FamilyReturn DEFAULT {memberSelect contributingEntriesOnly} } * * ContextSelection ::= CHOICE { * allContexts NULL, * selectedContexts SET SIZE (1..MAX) OF TypeAndContextAssertion, * ... } * * TypeAndContextAssertion ::= SEQUENCE { * type AttributeType, * contextAssertions CHOICE { * preference SEQUENCE OF ContextAssertion, * all SET OF ContextAssertion, * ...}, * ... } * * EntryInformation ::= SEQUENCE { * name Name, * fromEntry BOOLEAN DEFAULT TRUE, * information SET SIZE (1..MAX) OF CHOICE { * attributeType AttributeType, * attribute Attribute{{SupportedAttributes}}, * ...} OPTIONAL, * incompleteEntry [3] BOOLEAN DEFAULT FALSE, * partialName [4] BOOLEAN DEFAULT FALSE, * derivedEntry [5] BOOLEAN DEFAULT FALSE, * ... } * ``` * * @param {EntryInformationSelection} eis The entry information selection. * @param {EntryInformation} entry The entry whose information is to be selected. * @param {function} isOperationalAttribute A function that determines if an * attribute type is operational, returning `true` if it is. * @param {function} getAttributeSupertypes A function that returns the object * identifiers of the supertypes of the input attribute type. * @param {function} getContextMatcher A function that takes a context type * object identifier and returns a function that can be used to evaluate a * context value of that type against the corresponding assertion type. * @returns {EntryInformation} A brand new `EntryInformation` that has been * filtered according to the selections imposed by `eis`. * @function */ export declare function selectFromEntry(eis: EntryInformationSelection, entry: EntryInformation, isOperationalAttribute: (attributeType: OBJECT_IDENTIFIER) => boolean | undefined, getAttributeSupertypes: (attributeType: OBJECT_IDENTIFIER) => OBJECT_IDENTIFIER[], getContextMatcher: (contextType: OBJECT_IDENTIFIER) => ContextMatcher | undefined, determineAbsentMatch: (contextType: OBJECT_IDENTIFIER) => boolean): EntryInformation; export default selectFromEntry; //# sourceMappingURL=selectFromEntry.d.mts.map