{"version":3,"sources":["../../../src/functions-v1-function-form-schema-function-form-schemas.universal.ts","../../../src/functions-v1-function-form-schema-function-form-schemas.http.ts","../../../src/functions-v1-function-form-schema-function-form-schemas.public.ts","../../../src/functions-v1-function-form-schema-function-form-schemas.context.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n  renameKeysFromSDKRequestToRESTRequest,\n  renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixFunctionsV1FunctionFormSchema from './functions-v1-function-form-schema-function-form-schemas.http.js';\n\n/** FunctionFormSchema entity */\nexport interface FunctionFormSchema {\n  /**\n   * FunctionFormSchema ID. Matches ID of the function for which it was created.\n   * @format GUID\n   * @readonly\n   */\n  _id?: string | null;\n  /**\n   * The JSONSchema for FormTemplate, specifying input title, description, type, constraints.\n   * @readonly\n   */\n  jsonSchema?: Record<string, any> | null;\n  /**\n   * The UI Schema for FormTemplate, containing the input display specification, currently only the placeholders.\n   * @readonly\n   */\n  uiSchema?: Record<string, any> | null;\n  /**\n   * Field keys by input source.\n   * @readonly\n   * @maxSize 100\n   */\n  formFieldSources?: FormFieldSource[];\n}\n\nexport enum FormFieldSourceType {\n  SPI_CONFIG = 'SPI_CONFIG',\n  ACTION_SET_VARIABLES = 'ACTION_SET_VARIABLES',\n  ACTION_OUTPUT = 'ACTION_OUTPUT',\n  ACTION_OUTPUT_1 = 'ACTION_OUTPUT_1',\n  ACTION_OUTPUT_2 = 'ACTION_OUTPUT_2',\n  ACTION_OUTPUT_3 = 'ACTION_OUTPUT_3',\n  ACTION_OUTPUT_4 = 'ACTION_OUTPUT_4',\n  ACTION_OUTPUT_5 = 'ACTION_OUTPUT_5',\n  ACTION_OUTPUT_6 = 'ACTION_OUTPUT_6',\n  ACTION_OUTPUT_7 = 'ACTION_OUTPUT_7',\n  ACTION_OUTPUT_8 = 'ACTION_OUTPUT_8',\n  ACTION_OUTPUT_9 = 'ACTION_OUTPUT_9',\n  ACTION_CONDITION = 'ACTION_CONDITION',\n  ACTION_APP_DEFINED_SET_VARIABLES = 'ACTION_APP_DEFINED_SET_VARIABLES',\n}\n\n/** @enumType */\nexport type FormFieldSourceTypeWithLiterals =\n  | FormFieldSourceType\n  | 'SPI_CONFIG'\n  | 'ACTION_SET_VARIABLES'\n  | 'ACTION_OUTPUT'\n  | 'ACTION_OUTPUT_1'\n  | 'ACTION_OUTPUT_2'\n  | 'ACTION_OUTPUT_3'\n  | 'ACTION_OUTPUT_4'\n  | 'ACTION_OUTPUT_5'\n  | 'ACTION_OUTPUT_6'\n  | 'ACTION_OUTPUT_7'\n  | 'ACTION_OUTPUT_8'\n  | 'ACTION_OUTPUT_9'\n  | 'ACTION_CONDITION'\n  | 'ACTION_APP_DEFINED_SET_VARIABLES';\n\nexport interface FormFieldSource {\n  /** The source for the input field. */\n  formFieldSourceType?: FormFieldSourceTypeWithLiterals;\n  /**\n   * The field keys of the source. Limited by the target field constraints of the FormTemplate\n   * @readonly\n   * @maxSize 1000\n   * @maxLength 200\n   */\n  formFieldKeys?: string[];\n}\n\nexport interface GetFunctionFormSchemaRequest {\n  /**\n   * ID of the function of the returned FunctionFormSchema.\n   * @format GUID\n   */\n  functionId: string;\n}\n\nexport interface GetFunctionFormSchemaResponse {\n  /** The requested FunctionFormSchema. */\n  functionFormSchema?: FunctionFormSchema;\n}\n\n/**\n * Retrieves a FunctionFormSchema.\n * @param functionId - ID of the function of the returned FunctionFormSchema.\n * @internal\n * @documentationMaturity preview\n * @requiredField functionId\n * @permissionId FUNCTIONS.FUNCTION_FORM_SCHEMA_READ\n * @applicableIdentity APP\n * @returns The requested FunctionFormSchema.\n * @fqn wix.functions.formschemas.v1.FunctionFormSchemas.GetFunctionFormSchema\n */\nexport async function getFunctionFormSchema(\n  functionId: string\n): Promise<\n  NonNullablePaths<\n    FunctionFormSchema,\n    `formFieldSources` | `formFieldSources.${number}.formFieldSourceType`,\n    4\n  >\n> {\n  // @ts-ignore\n  const { httpClient, sideEffects } = arguments[1] as {\n    httpClient: HttpClient;\n    sideEffects?: any;\n  };\n\n  const payload = renameKeysFromSDKRequestToRESTRequest({\n    functionId: functionId,\n  });\n\n  const reqOpts =\n    ambassadorWixFunctionsV1FunctionFormSchema.getFunctionFormSchema(payload);\n\n  sideEffects?.onSiteCall?.();\n  try {\n    const result = await httpClient.request(reqOpts);\n    sideEffects?.onSuccess?.(result);\n\n    return renameKeysFromRESTResponseToSDKResponse(result.data)\n      ?.functionFormSchema!;\n  } catch (err: any) {\n    const transformedError = sdkTransformError(\n      err,\n      {\n        spreadPathsToArguments: {},\n        explicitPathsToArguments: { functionId: '$[0]' },\n        singleArgumentUnchanged: false,\n      },\n      ['functionId']\n    );\n    sideEffects?.onError?.(err);\n\n    throw transformedError;\n  }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixFunctionsFormschemasV1FunctionFormSchemasUrl(\n  opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n  const domainToMappings = {\n    'dev._base_domain_': [\n      {\n        srcPath: '/_api/functions/v1/function-form-schemas',\n        destPath: '/v1/function-form-schemas',\n      },\n    ],\n    'manage._base_domain_': [\n      {\n        srcPath: '/_api/functions/v1/function-form-schemas',\n        destPath: '/v1/function-form-schemas',\n      },\n    ],\n    'www.wixapis.com': [\n      {\n        srcPath: '/functions/v1/function-form-schemas',\n        destPath: '/v1/function-form-schemas',\n      },\n    ],\n  };\n\n  return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_functions_function-form-schemas';\n\n/** Retrieves a FunctionFormSchema. */\nexport function getFunctionFormSchema(\n  payload: object\n): RequestOptionsFactory<any> {\n  function __getFunctionFormSchema({ host }: any) {\n    const metadata = {\n      entityFqdn: 'wix.functions.v1.function_form_schema',\n      method: 'GET' as any,\n      methodFqn:\n        'wix.functions.formschemas.v1.FunctionFormSchemas.GetFunctionFormSchema',\n      packageName: PACKAGE_NAME,\n      migrationOptions: {\n        optInTransformResponse: true,\n      },\n      url: resolveWixFunctionsFormschemasV1FunctionFormSchemasUrl({\n        protoPath: '/v1/function-form-schemas/{functionId}',\n        data: payload,\n        host,\n      }),\n      params: toURLSearchParams(payload),\n    };\n\n    return metadata;\n  }\n\n  return __getFunctionFormSchema;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n  FunctionFormSchema,\n  getFunctionFormSchema as universalGetFunctionFormSchema,\n} from './functions-v1-function-form-schema-function-form-schemas.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/functions' };\n\n/** @internal */\nexport function getFunctionFormSchema(\n  httpClient: HttpClient\n): GetFunctionFormSchemaSignature {\n  return (functionId: string) =>\n    universalGetFunctionFormSchema(\n      functionId,\n      // @ts-ignore\n      { httpClient }\n    );\n}\n\ninterface GetFunctionFormSchemaSignature {\n  /**\n   * Retrieves a FunctionFormSchema.\n   * @param - ID of the function of the returned FunctionFormSchema.\n   * @returns The requested FunctionFormSchema.\n   */\n  (functionId: string): Promise<\n    NonNullablePaths<\n      FunctionFormSchema,\n      `formFieldSources` | `formFieldSources.${number}.formFieldSourceType`,\n      4\n    >\n  >;\n}\n\nexport {\n  FormFieldSource,\n  FormFieldSourceType,\n  FunctionFormSchema,\n  GetFunctionFormSchemaRequest,\n  GetFunctionFormSchemaResponse,\n} from './functions-v1-function-form-schema-function-form-schemas.universal.js';\n","import { getFunctionFormSchema as publicGetFunctionFormSchema } from './functions-v1-function-form-schema-function-form-schemas.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\n/** @internal */\nexport const getFunctionFormSchema: MaybeContext<\n  BuildRESTFunction<typeof publicGetFunctionFormSchema> &\n    typeof publicGetFunctionFormSchema\n> = /*#__PURE__*/ createRESTModule(publicGetFunctionFormSchema);\n\nexport { FormFieldSourceType } from './functions-v1-function-form-schema-function-form-schemas.universal.js';\nexport {\n  FunctionFormSchema,\n  FormFieldSource,\n  GetFunctionFormSchemaRequest,\n  GetFunctionFormSchemaResponse,\n} from './functions-v1-function-form-schema-function-form-schemas.universal.js';\nexport { FormFieldSourceTypeWithLiterals } from './functions-v1-function-form-schema-function-form-schemas.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,kBAAkB;AAI3B,SAAS,uDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,mBAAmB;AAAA,MACjB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,EACF;AAEA,SAAO,WAAW,OAAO,OAAO,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,sBACd,SAC4B;AAC5B,WAAS,wBAAwB,EAAE,KAAK,GAAQ;AAC9C,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WACE;AAAA,MACF,aAAa;AAAA,MACb,kBAAkB;AAAA,QAChB,wBAAwB;AAAA,MAC1B;AAAA,MACA,KAAK,uDAAuD;AAAA,QAC1D,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,QAAQ,kBAAkB,OAAO;AAAA,IACnC;AAEA,WAAO;AAAA,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