Open Cap Table Protocol Canton SDK - v0.2.224
    Preparing search index...

    Function normalizeDeprecatedEquityCompensationIssuanceFields

    • Normalize deprecated equity compensation issuance fields to their canonical form.

      This helper converts the legacy option_grant_type field to the current compensation_type field, applying value mappings as needed:

      • NSOOPTION_NSO
      • ISOOPTION_ISO
      • INTLOPTION
      • Unknown values are passed through unchanged

      Behavior:

      • If only option_grant_type is provided, it is converted to compensation_type with the appropriate value mapping and usedDeprecatedField is set to true.
      • If compensation_type is provided and non-empty, it is used as-is and usedDeprecatedField is set to false, even if option_grant_type is also present.
      • If neither field is provided, compensation_type will be null.

      The input object is not mutated.

      Parameters

      • data: EquityCompensationIssuanceDataWithDeprecatedField

        Equity compensation issuance data that may contain either the deprecated option_grant_type field, the newer compensation_type field, or both.

      • Optionalcontext: string

        Optional human-readable context used when emitting deprecation warnings. Defaults to "EquityCompensationIssuance" when not provided.

      Returns NormalizedEquityCompensationIssuanceFields

      Normalized fields including compensation_type, a usedDeprecatedField flag, and optionally the originalDeprecatedValue if conversion occurred.

      const normalized = normalizeDeprecatedEquityCompensationIssuanceFields({
      option_grant_type: 'NSO',
      });
      normalized.compensation_type; // 'OPTION_NSO'
      normalized.usedDeprecatedField; // true
      normalized.originalDeprecatedValue; // 'NSO'
      const normalized = normalizeDeprecatedEquityCompensationIssuanceFields({
      option_grant_type: 'ISO',
      compensation_type: 'RSU',
      });
      // The current field takes precedence when both are present.
      normalized.compensation_type; // 'RSU'
      normalized.usedDeprecatedField; // false