UNPKG

dingtalk-docs-cool-app

Version:

钉钉文档酷应用插件扩展 开发者初始化包

1 lines 1.54 kB
import{AuthorizationType}from"./types/auth";export var FieldDecoratorKit=function(){function t(){this.decorator=void 0,this.domainList=void 0}var e=t.prototype;return e.setDecorator=function(t){this.decorator=t},e.getDecorator=function(){return this.decorator},e.setDomainList=function(t){this.domainList=t},e.getDomainList=function(){return this.domainList},e.t=function(t){return"${{"+t+"}}"},t}();export var fieldDecoratorKit=new FieldDecoratorKit;export var getManifestByFieldDecorator=function(t){var e=t.getDecorator();return e?{name:{"zh-CN":e.name||"字段捷径 - fass模板"},i18nMap:e.i18nMap||{},isDebug:!0,fields:[{fieldType:e.resultType.type,uiSchema:{fieldMetaEditor:{component:"FieldMetaEditor",props:{schema:{items:e.formItems,authorizations:e.authorizations}}}},presetFieldConfig:{externalEditorConfig:{},fieldProperty:e.resultType.extra||{}}}],extensionSubType:"faas"}:{}};export var getAuthertications=function(t){var e,o,r,i,n,a;return(null==t||null==(e=t.fields)||null==(o=e[0])||null==(r=o.uiSchema)||null==(i=r.fieldMetaEditor)||null==(n=i.props)||null==(a=n.schema)?void 0:a.authorizations)||null};export var getAuthenticationHeader=function(t,e,o){var r=getAuthertications(t);return r?e!==r.id?(console.warn("授权id不匹配"),{}):r.type===AuthorizationType.HeaderBearerToken?"string"!=typeof o?(console.warn("HeaderBearerToken 授权配置错误"),{}):{authorization:"Bear "+o}:r.type===AuthorizationType.MultiHeaderToken?"object"!=typeof o?(console.warn("MultiHeaderToken 授权配置错误"),{}):o:{}:{}};