|
| 1 | +/** |
| 2 | + * LINKURIOUS CONFIDENTIAL |
| 3 | + * Copyright Linkurious SAS 2012 - 2025 |
| 4 | + * |
| 5 | + * - Created on 2025-11-27. |
| 6 | + */ |
| 7 | +import {IDataSourceParams, SharingMode} from '../commonTypes'; |
| 8 | +import {EntityType} from '../GraphSchema'; |
| 9 | + |
| 10 | +export type CreateImportTemplateParams = |
| 11 | + | CreateNodeImportTemplateParams |
| 12 | + | CreateEdgeImportTemplateParams; |
| 13 | + |
| 14 | +export interface CreateNodeImportTemplateParams extends CreateBaseImportTemplateParams { |
| 15 | + entityType: EntityType.NODE; |
| 16 | +} |
| 17 | + |
| 18 | +export interface CreateEdgeImportTemplateParams extends CreateBaseImportTemplateParams { |
| 19 | + entityType: EntityType.EDGE; |
| 20 | + sourceNode: ImportTemplateNodeReference; |
| 21 | + targetNode: ImportTemplateNodeReference; |
| 22 | +} |
| 23 | + |
| 24 | +interface CreateBaseImportTemplateParams extends IDataSourceParams { |
| 25 | + name: string; |
| 26 | + description?: string; |
| 27 | + sharing: SharingMode.PRIVATE | SharingMode.SOURCE; |
| 28 | + /** |
| 29 | + * The target node category / edge type. |
| 30 | + */ |
| 31 | + itemType: string; |
| 32 | + /** |
| 33 | + * How to map imported fields to node/edge properties. |
| 34 | + */ |
| 35 | + properties: ImportTemplatePropertyMapping[]; |
| 36 | +} |
| 37 | + |
| 38 | +export interface ImportTemplatePropertyMapping { |
| 39 | + /** |
| 40 | + * The field in the imported file. |
| 41 | + */ |
| 42 | + sourceField: string; |
| 43 | + /** |
| 44 | + * The destination property key on the node/edge. |
| 45 | + */ |
| 46 | + targetProperty: string; |
| 47 | +} |
| 48 | + |
| 49 | +export interface ImportTemplateNodeReference { |
| 50 | + /** |
| 51 | + * The field in the imported file. |
| 52 | + */ |
| 53 | + sourceField: string; |
| 54 | + /** |
| 55 | + * The destination node category. |
| 56 | + */ |
| 57 | + targetCategory: string; |
| 58 | + /** |
| 59 | + * The destination property key on the node. If it is undefined, the destination is the native |
| 60 | + * ID of the node. |
| 61 | + */ |
| 62 | + targetProperty?: string; |
| 63 | +} |
| 64 | + |
| 65 | +export interface DeleteImportTemplateParams extends IDataSourceParams { |
| 66 | + id: number; |
| 67 | +} |
| 68 | + |
| 69 | +export interface GetImportTemplatesParams extends IDataSourceParams { |
| 70 | + entityType?: EntityType; |
| 71 | +} |
| 72 | + |
| 73 | +export type ImportTemplate = CreateImportTemplateParams & { |
| 74 | + id: number; |
| 75 | + sourceKey: string; |
| 76 | +}; |
0 commit comments