@unito/integration-api
Version:
The Unito Integration API
397 lines (396 loc) • 16.9 kB
JavaScript
import * as Api from './types.js';
const referenceToStringLikeConfiguration = {
field: {
type: 'sourceField',
defaults: [{ value: 'semantic:displayName' }],
description: 'The field of the referenced entry to use for the string value.',
required: true,
},
};
const stringLikeToReferenceConfiguration = {
field: {
type: 'targetField',
defaults: [{ value: 'semantic:displayName' }],
description: 'The field against which to match the string value.',
required: true,
},
};
const dateToStringlikeConfiguration = {
locale: {
type: 'enum',
defaults: [{ value: 'en-CA' }],
values: ['en-CA'],
description: 'The locale to use for formatting the date.',
},
timezone: {
type: 'enum',
defaults: [{ value: 'UTC' }],
values: ['UTC'],
description: 'The timezone to use for formatting the date.',
},
};
const htmlToRichTextConfiguration = {
decoratorTemplate: {
type: 'stringWithSourceItemFields',
description: 'Template for the decorator. Use {author} and {date} placeholders.',
defaults: [
{
sourceRelationSemantic: Api.RelationSemantics.COMMENTS,
sourceFieldSemantic: Api.Semantics.DESCRIPTION,
targetRelationSemantic: Api.RelationSemantics.COMMENTS,
targetFieldSemantic: Api.Semantics.DESCRIPTION,
value: 'On <strong>{semantic:createdAt}</strong>, <em>{semantic:user.fields.semantic:displayName}</em> commented:',
},
],
hidden: true,
},
decoratorPrefix: {
type: 'string',
description: `Prefix for the decorator. Defaults to "➤".`,
defaults: [
{
sourceRelationSemantic: Api.RelationSemantics.COMMENTS,
sourceFieldSemantic: Api.Semantics.DESCRIPTION,
targetRelationSemantic: Api.RelationSemantics.COMMENTS,
targetFieldSemantic: Api.Semantics.DESCRIPTION,
value: '➤',
},
],
hidden: true,
},
};
const markdownToRichTextConfiguration = {
decoratorTemplate: {
type: 'stringWithSourceItemFields',
description: 'Template for the decorator. Use {author} and {date} placeholders.',
defaults: [
{
sourceRelationSemantic: Api.RelationSemantics.COMMENTS,
sourceFieldSemantic: Api.Semantics.DESCRIPTION,
targetRelationSemantic: Api.RelationSemantics.COMMENTS,
targetFieldSemantic: Api.Semantics.DESCRIPTION,
value: 'On **{semantic:createdAt}**, __{semantic:user.fields.semantic:displayName}__ commented:',
},
],
hidden: true,
},
decoratorPrefix: {
type: 'string',
description: `Prefix for the decorator. Defaults to "➤".`,
defaults: [
{
sourceRelationSemantic: Api.RelationSemantics.COMMENTS,
sourceFieldSemantic: Api.Semantics.DESCRIPTION,
targetRelationSemantic: Api.RelationSemantics.COMMENTS,
targetFieldSemantic: Api.Semantics.DESCRIPTION,
value: '➤',
},
],
hidden: true,
},
};
export const fieldTypeCompatibilityMatrix = {
[]: {
[]: {},
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
},
[]: {
[]: null,
[]: {},
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: {},
[]: {},
[]: null,
[]: null,
[]: {},
[]: {},
[]: {},
[]: null,
},
[]: {
[]: null,
[]: null,
[]: {},
[]: null,
[]: {},
[]: null,
[]: null,
[]: null,
[]: {},
[]: {},
[]: null,
[]: null,
[]: dateToStringlikeConfiguration,
[]: dateToStringlikeConfiguration,
[]: dateToStringlikeConfiguration,
[]: null,
},
[]: {
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
},
[]: {
[]: null,
[]: null,
[]: {},
[]: null,
[]: {},
[]: null,
[]: null,
[]: null,
[]: {},
[]: {},
[]: null,
[]: null,
[]: dateToStringlikeConfiguration,
[]: dateToStringlikeConfiguration,
[]: dateToStringlikeConfiguration,
[]: null,
},
[]: {
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
},
[]: {
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: {},
[]: null,
[]: {},
[]: {},
[]: null,
[]: null,
[]: {},
[]: {},
[]: {},
[]: null,
},
[]: {
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: {},
[]: null,
[]: null,
[]: null,
[]: stringLikeToReferenceConfiguration,
[]: {},
[]: {},
[]: {},
[]: null,
},
[]: {
[]: null,
[]: {},
[]: {},
[]: null,
[]: {},
[]: null,
[]: null,
[]: null,
[]: {},
[]: {},
[]: null,
[]: null,
[]: {},
[]: {},
[]: {},
[]: null,
},
[]: {
[]: null,
[]: {},
[]: {},
[]: null,
[]: {},
[]: null,
[]: null,
[]: null,
[]: {},
[]: {},
[]: null,
[]: null,
[]: {},
[]: {},
[]: {},
[]: null,
},
[]: {
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
},
[]: {
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: referenceToStringLikeConfiguration,
[]: null,
[]: null,
[]: null,
[]: {
sideIds: {
type: 'sideIdOfSameCollection',
description: 'If specified, only the references kept in sync in the specified link sides will be evaluated. An empty array means no side will be evaluated.',
isArray: true,
defaults: [{ value: [] }],
},
type: {
type: 'enum',
description: 'The type of mapping, as selected by the customer.',
hidden: true,
isArray: false,
values: ['manualOnly', 'referenceOnly'],
required: true,
},
},
[]: referenceToStringLikeConfiguration,
[]: referenceToStringLikeConfiguration,
[]: referenceToStringLikeConfiguration,
[]: null,
},
[]: {
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: htmlToRichTextConfiguration,
[]: htmlToRichTextConfiguration,
[]: {},
[]: null,
},
[]: {
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: markdownToRichTextConfiguration,
[]: markdownToRichTextConfiguration,
[]: {},
[]: null,
},
[]: {
[]: null,
[]: {},
[]: {},
[]: null,
[]: {},
[]: null,
[]: null,
[]: null,
[]: {},
[]: {},
[]: null,
[]: stringLikeToReferenceConfiguration,
[]: {},
[]: {},
[]: {},
[]: null,
},
[]: {
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: null,
[]: {},
[]: {},
[]: {},
[]: {},
},
};