/*! * Copyright (C) Microsoft Corporation. All rights reserved. */ import type { JsonObject } from '../../Common/jsonTypes.js'; /** Returns true if the schema root represents a Dataverse entity table. */ export declare function isDataverseEntity(root: unknown): boolean; /** Returns the Dataverse entity set name for a schema (used as the OData API path), or null if not defined. */ export declare function getDataverseEntitySetName(root: unknown): string | null; /** Returns true if the property is a Dataverse lookup relationship to another table. */ export declare function isDataverseLookupProperty(propValue: JsonObject): boolean; /** Collects all lookup relationship columns from a properties node, keyed by property name. */ export declare function getDataverseLookupColumns(propertiesNode: JsonObject): Map; /** * Returns true if Dataverse metadata identifies the property as a virtual mirror of a lookup * attribute. The `AttributeOf` relationship is authoritative; property-name suffixes are not, * because legitimate physical columns can also end in `name`. */ export declare function isDataverseLookupMirrorProperty(propValue: JsonObject, propertiesNode: JsonObject): boolean; /** Compatibility check for schemas saved before `AttributeOf` metadata was available. */ export declare function isLegacyLookupNameProperty(propName: string, lookupColumns: ReadonlyMap): boolean; /** Collects the names of all owner (`OwnerType`) columns in a properties node. */ export declare function getDataverseOwnerColumnNames(propertiesNode: JsonObject): Set; /** * Returns true if the property is a system-managed Dataverse column that cannot be written on * create or update, and therefore must be excluded from the write (Base) interface. Covers the * system-managed attribute types (`OwnerType`, `EntityNameType`) as well as the derived, * denormalized name columns of an owner column (e.g. `owneridname`, `owneridyominame`). */ export declare function isDataverseSystemManagedProperty(propName: string, propValue: JsonObject, ownerColumnNames: ReadonlySet): boolean; /** Returns the write-form property name for a lookup column, used when creating or updating Dataverse records. */ export declare function generateODataBindPropertyName(schemaName: string): string; /** Returns the navigation-property names accepted when writing a Dataverse lookup. */ export declare function getDataverseBindPropertyNames(propertyName: string, propValue: JsonObject): string[]; /** Returns the read-form property name for a lookup's resolved GUID value. */ export declare function generateLookupValuePropertyName(lookupPropertyName: string): string; /** * Returns true if the property is a Dataverse boolean (yes/no) field. * These fields have enum/x-ms-enum-values in the schema but must be typed as `boolean`, * not as a numeric optionset, because the Dataverse Web API expects true/false. */ export declare function isDataverseBooleanProperty(propValue: JsonObject): boolean; /** * Returns true if the property is a Dataverse numeric field (integer, decimal, double, money, bigint). * These fields have `"type": "string"` in the schema but must be typed as `number` because * the Dataverse Web API sends and receives them as JSON numbers. */ export declare function isDataverseNumericProperty(propValue: JsonObject): boolean; /** * Returns true if the property is a Dataverse multi-select picklist (multi-choice) field. * These fields allow multiple selections and should be typed as an array of the enum type. */ export declare function isDataverseMultiSelectPicklistProperty(propValue: JsonObject): boolean; /** * Returns the names of all MultiSelectPicklist (multi-choice) properties in a Dataverse entity * properties node — i.e., properties that have optionset data AND are typed as MultiSelectPicklistType. * These fields require serialization (array → comma-separated string) when writing to the Dataverse API * and deserialization (comma-separated string → array) when reading back from it. */ export declare function getDataverseMultiSelectPicklistFields(propertiesNode: JsonObject): string[]; /** Returns true if the property represents an optionset (choice) column with enumerable values. */ export declare function hasOptionsetData(propValue: JsonObject): boolean; /** Produces the TypeScript identifier used for the enum or const generated from an optionset property. */ export declare function generateOptionsetEnumName(modelName: string, propName: string): string; /** * Escapes a string for safe embedding inside a single-quoted TypeScript string literal. * * Preserves all Unicode characters (e.g. Vietnamese, CJK, Arabic) and only escapes the * characters that would otherwise break the literal: backslash, single quote, and line * terminators (including the U+2028/U+2029 line/paragraph separators). */ export declare function escapeSingleQuotedString(str: string): string; /** Formats an optionset display label as a TypeScript string literal for use in union types and const declarations. */ export declare function formatEnumLabel(label: unknown): string; type GenericColumn = { type: 'lookupRelated' | 'normal'; propName: string; propValue: JsonObject; readOnly: boolean; }; type LookupColumn = { type: 'lookup'; propName: string; propValue: JsonObject; readOnly: boolean; bindPropertyNames: string[]; }; /** Yields each property in a Dataverse entity's properties node, tagged by its role and mutability, for use in interface generation. */ export declare function iterateDataverseProperties(propertiesNode: JsonObject, lookupColumns: Map, includeLegacyLookupNames?: boolean): Generator; export {}; //# sourceMappingURL=dataverseUtils.d.ts.map