import { Observable } from 'rxjs/Observable'; import { CustomFieldId } from 'teambition-types'; import { QueryToken } from '../../db'; import { CustomFieldSchema } from '../../schemas'; import { SDK } from '../../SDK'; import { SDKFetch } from '../../SDKFetch'; export declare function getCustomFieldFetch(this: SDKFetch, customFieldId: CustomFieldId): Observable; declare module '../../SDKFetch' { interface SDKFetch { getCustomField: typeof getCustomFieldFetch; } } export interface GetCustomFieldOptions { request?: Observable | Observable; /** * 填补数据,通常结合 withChoices=true | withProjects=true 一起使用 * * 主要考虑如下场景: * 1. 使用 getScenarioFieldConfigs(appendCommonGroupChoices=false) 拿到的 需求分类/缺陷分类 缺少 choices 字段; * 2. 使用 getScenarioFieldConfigs(appendCommonGroupChoices=true) 拿到的 需求分类/缺陷分类 会带有 choices 字段; * 第 1 步,会把无效 choices 写入 RDB 缓存,为避免出现“无效 choices 在 RDB 长驻”这个问题, * 可指定 withChoices=true 解决,同时使用 padding=第 2 步拿到的有效数据 避免去后端重新请求造成浪费。 */ padding?: Observable; /** * 要求存在 choices 字段 * * 使用 getScenarioFieldConfigs 拿到的 需求分类/缺陷分类 缺少 choices 字段, * 当指明 withChoices=true 时候,会通过 padding 获取完整数据。 */ withChoices?: boolean; /** * 要求存在 projects 字段 * * 使用 getScenarioFieldConfigs 拿到的 CustomField 缺少 projects 字段, * 当指明 withProjects=true 时候,会通过 padding 获取完整数据。 */ withProjects?: boolean; } export declare function getCustomField(this: SDK, customFieldId: CustomFieldId, options?: GetCustomFieldOptions): QueryToken; declare module '../../SDK' { interface SDK { getCustomField: typeof getCustomField; } }