ExtractSecondaryIndexIRFields<T>: {
    [FieldProp in keyof T["fields"] as T["fields"][FieldProp] extends BaseModelField<infer R>
        ? NonNullable<R> extends string | number
            ? FieldProp
            : never
        : T["fields"][FieldProp] extends EnumType | RefType<RefTypeParamShape, any, any>
            ? FieldProp
            : never]: T["fields"][FieldProp] extends BaseModelField<infer R>
        ? R
        : T["fields"][FieldProp] extends EnumType<infer values>
            ? values[number]
            : T["fields"][FieldProp] extends RefType<infer R, any, any>
                ? `${deferredRefResolvingPrefix}${R["link"]}`
                : never
}

Extract fields that are eligible to be PK or SK fields with their resolved type.

Eligible fields include:

  1. ModelField that contains string or number
  2. inline EnumType
  3. RefType that refers to a top level defined EnumType (this is enforced by validation that happens in the Schema Processor)

NOTE: at this point, there is no way to resolve the type from a RefType as we don't have access to the NonModelType at this location. So we generate am indicator string, and resolve its corresponding type later in packages/data-schema/src/runtime/client/index.ts

Type Parameters