@epilot/entity-mapping-client 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (()=>{"use strict";var e={914:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=n(i(534));t.default=r.default},534:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"Entity Mapping API","description":"API Backend for mapping source entity into target entities","version":"1.0.0"},"tags":[{"name":"mappings","description":"Entity Mapping Configs"}],"security":[{"EpilotAuth":[]}],"paths":{"/v1/mappings":{"post":{"operationId":"storeConfig","summary":"storeConfig","description":"Store new MappingConfig","tags":["mappings"],"requestBody":{"description":"Mapping Config to store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}},"responses":{"201":{"description":"The updated entity mapping config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}}}}},"/v1/mappings/{id}":{"get":{"operationId":"getConfig","summary":"getConfig","description":"Get latest version of a mapping config by id","tags":["mappings"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mapping Config Id","schema":{"type":"string","example":"uuidv4"}}],"responses":{"200":{"description":"Entity Mapping Config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}}}},"delete":{"operationId":"deleteConfig","summary":"deleteConfig","description":"Delete entity mapping config","tags":["mappings"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mapping Config Id","schema":{"type":"string","example":"uuidv4"}}],"responses":{"200":{"description":"The deleted mapping config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}}}}},"/v1/mappings/{id}/versions":{"get":{"operationId":"getAllVersions","summary":"getAllVersions","description":"Get all version of MappingConfig","tags":["mappings"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mapping Config Id","schema":{"type":"string","example":"uuidv4"}}],"responses":{"200":{"description":"All versions of a MappingConfig","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfigsResp"}}}}}},"post":{"operationId":"storeNewVersion","summary":"storeNewVersion","description":"Store new version of MappingConfig","tags":["mappings"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mapping Config Id","schema":{"type":"string","example":"uuidv4"}}],"requestBody":{"description":"Mapping Config to store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}},"responses":{"200":{"description":"The updated entity mapping config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}}}}},"/v1/mappings:execute":{"post":{"operationId":"executeMapping","summary":"executeMapping","description":"Execute entity mapping based on a config","parameters":[{"name":"preview_mode","in":"query","required":false,"description":"True, if you want to preview the entities which will result","schema":{"type":"boolean","example":true}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteMappingReq"}}}},"tags":["mappings"],"responses":{"200":{"description":"The target entities which were mapped","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteMappingResp"}}}}}}},"/v1/mappings:search":{"post":{"operationId":"searchConfigs","summary":"searchConfigs","description":"Search mapping configs","tags":["mappings"],"requestBody":{"description":"Search Mapping Configs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchMappingReq"}}}},"responses":{"200":{"description":"Entity Mapping Config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}}}}},"/v1/mappings/{id}/history":{"get":{"operationId":"getMappingHistory","summary":"getMappingHistory","description":"Get the Mapping History","tags":["history"],"parameters":[{"in":"path","name":"id","schema":{"type":"string"},"required":true,"description":"the id of the mapping"},{"in":"query","name":"from","schema":{"type":"string","format":"datetime"},"required":false,"description":"filter the history from this date on"},{"in":"query","name":"to","schema":{"type":"string","format":"datetime"},"required":false,"description":"filter the history to this date on"}],"responses":{"200":{"description":"Query result of mapping history","content":{"application/json":{"schema":{"properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/MappingHistoryResponse"}}}}}}}}}}},"components":{"securitySchemes":{"EpilotAuth":{"type":"http","scheme":"bearer","description":"Epilot Bearer Token"}},"schemas":{"SearchMappingReq":{"type":"object","properties":{"source":{"$ref":"#/components/schemas/SourceConfig"}}},"MappingConfigsResp":{"type":"object","properties":{"configs":{"$ref":"#/components/schemas/MappingConfigs"}},"required":["configs"]},"MappingConfigs":{"type":"array","items":{"$ref":"#/components/schemas/MappingConfig"}},"MappingConfig":{"type":"object","properties":{"id":{"type":"string"},"org_id":{"type":"string"},"version":{"type":"number"},"source":{"$ref":"#/components/schemas/SourceConfig"},"targets":{"type":"array","items":{"$ref":"#/components/schemas/TargetConfig"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"created_by":{"$ref":"#/components/schemas/Owner","description":"User / service who created the entity mapping config","example":{"type":"internal_service"}},"last_updated_by":{"$ref":"#/components/schemas/Owner","description":"User / service who last updated entity mapping config","example":{"type":"user","org_id":255151,"user_id":99252}}},"required":["id","org_id","version","source","targets"]},"Owner":{"type":"object","properties":{"type":{"type":"string","enum":["user","internal_service"]},"org_id":{"type":"string"},"user_id":{"type":"string"}},"required":["type"]},"ExecuteMappingReq":{"type":"object","description":"Pass either source or source_entity","properties":{"source_ref":{"$ref":"#/components/schemas/EntityRef","description":"A reference (id and schema) to the entity to be used as source."},"targets":{"type":"array","items":{"$ref":"#/components/schemas/TargetConfig"},"description":"Mapping Configuration to apply."}},"required":["source_ref","targets"]},"ExecuteMappingResp":{"type":"object","properties":{"mapped_entities":{"type":"array","items":{"$ref":"#/components/schemas/Entity"}},"failures":{"type":"array","items":{"$ref":"#/components/schemas/MappingFailure"}}},"required":["mapped_entities"]},"MappingFailure":{"type":"object","properties":{"target":{"$ref":"#/components/schemas/TargetConfig"},"error":{"type":"object","properties":{"message":{"type":"string"}},"additionalProperties":true}}},"Entity":{"type":"object","properties":{"_id":{"type":"string"},"_schema":{"type":"string"},"_title":{"type":"string"},"_org":{"type":"string"},"_tags":{"type":"array","items":{"type":"string"}},"_created_at":{"type":"string"},"_updated_at":{"type":"string"}},"additionalProperties":true},"EntityRef":{"type":"object","properties":{"entity_id":{"type":"string","description":"id of the source entity to be mapped"},"entity_schema":{"description":"schema of the source entity","type":"string","example":"submission"}},"required":["entity_id"]},"SourceConfig":{"type":"object","properties":{"type":{"type":"string","enum":["journey","entity"]},"config":{"anyOf":[{"$ref":"#/components/schemas/JourneyRef"},{"$ref":"#/components/schemas/EntityRef"}]}}},"JourneyRef":{"type":"object","properties":{"journey_id":{"type":"string"}}},"TargetConfig":{"type":"object","properties":{"id":{"type":"string","description":"Identifier for target configuration. Useful for later usages when trying to identify which target config to map to."},"name":{"type":"string","description":"A name for this configuration"},"allow_failure":{"type":"boolean","description":"Pass it as true, when you don\'t want failures to interrupt the mapping process."},"target_schema":{"type":"string","description":"Schema of target entity"},"target_unique":{"type":"array","description":"Unique key for target entity (see upsertEntity of Entity API)","items":{"type":"string"}},"conditions":{"type":"array","description":"Conditions necessary to hold for the target entity to be mapped","items":{"$ref":"#/components/schemas/MapCondition"}},"mapping_attributes":{"type":"array","description":"Attribute mappings","items":{"anyOf":[{"$ref":"#/components/schemas/MappingAttributeV2"},{"$ref":"#/components/schemas/MappingAttribute"}]}},"relation_attributes":{"type":"array","description":"Relation mappings","items":{"$ref":"#/components/schemas/RelationAttribute"}},"linkback_relation_attribute":{"type":"string","default":"mapped_entities","description":"Relation attribute on the main entity where the target entity will be linked. Set to false to disable linkback\\n"},"linkback_relation_tags":{"type":"array","description":"Relation tags (labels) to include in main entity linkback relation attribute","items":{"type":"string"}}},"required":["target_schema","mapping_attributes"]},"MapCondition":{"type":"object","properties":{"_exists":{"$ref":"#/components/schemas/ConditionNode"},"_equals":{"$ref":"#/components/schemas/ConditionNode"},"_not_exists":{"$ref":"#/components/schemas/ConditionNode"},"_any_of":{"$ref":"#/components/schemas/ConditionNode"}}},"ConditionNode":{"type":"object","properties":{"source":{"type":"string"},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"object"},{"type":"array","items":{"type":"object"}}]}}},"RelationAttribute":{"type":"object","properties":{"target":{"type":"string","description":"Target attribute to store the relation in"},"target_tags":{"type":"array","description":"Relation tags (labels) to set for the stored relations","items":{"type":"string"}},"target_tags_include_source":{"type":"boolean","description":"Include all relation tags (labels) present on the main entity relation","default":false},"source_filter":{"type":"object","description":"A filter to identify which source entities to pick as relations from main entity","properties":{"limit":{"type":"integer","description":"Limit relations to maximum number (default, all matched relations)","minimum":0},"schema":{"type":"string","description":"Filter by specific schema"},"attribute":{"type":"string","description":"Filter by a specific relation attribute on the main entity"},"relation_tag":{"type":"string","description":"Filter by relation tag (label) on the main entity"},"tag":{"type":"string","description":"Filter by a specific tag on the related entity"},"self":{"type":"boolean","description":"Picks main entity as relation (overrides other filters)","default":false}}},"related_to":{"type":"object","additionalProperties":true,"deprecated":true},"mode":{"type":"string","enum":["append","prepend","set"]}},"required":["target","mode"]},"MappingAttributeV2":{"type":"object","properties":{"target":{"type":"string","description":"Target JSON path for the attribute to set"},"operation":{"$ref":"#/components/schemas/OperationNode"},"origin":{"$ref":"#/components/schemas/AttributeOrigin"}},"required":["targetPath","operation"],"example":{"target":"_tags","operation":{"_append":["new","tags"],"_uniq":true}}},"AttributeOrigin":{"type":"string","description":"Origin of an attribute.","enum":["system_recommendation","user_manually"]},"OperationNode":{"description":"Mapping operation nodes are either primitive values or operation node objects","oneOf":[{"$ref":"#/components/schemas/OperationObjectNode"},{"$ref":"#/components/schemas/PrimitiveJSONValue"}]},"OperationObjectNode":{"type":"object","properties":{"_set":{"$ref":"#/components/schemas/PrimitiveJSONValue"},"_append":{"description":"Append to array","items":{"$ref":"#/components/schemas/PrimitiveJSONValue"}},"_uniq":{"description":"Unique array","oneOf":[{"type":"boolean","example":true},{"type":"array","description":"Unique key consisting of object keys","example":["email"],"items":{"type":"string"}}]},"_copy":{"description":"Copy JSONPath value from source entity context","type":"string","example":"contact.first_name"}},"additionalProperties":true},"PrimitiveJSONValue":{"description":"Represents any primitive JSON value","anyOf":[{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"object","additionalProperties":true},{"type":"array"}]},"MappingAttribute":{"anyOf":[{"$ref":"#/components/schemas/SetValueMapper"},{"$ref":"#/components/schemas/CopyValueMapper"},{"$ref":"#/components/schemas/AppendValueMapper"}]},"MappingAttributeMode":{"type":"string","enum":["copy_if_exists","append_if_exists","set_value"],"description":"- copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.\\n"},"SetValueMapper":{"type":"object","deprecated":true,"properties":{"mode":{"$ref":"#/components/schemas/MappingAttributeMode"},"target":{"type":"string","description":"JSON like target path for the attribute. Eg. last_name"},"value":{"description":"Any value to be set: string, number, string[], number[], JSON object, etc. It will override existing values, if any.\\n"}},"required":["mode","target","value"]},"CopyValueMapper":{"type":"object","deprecated":true,"properties":{"mode":{"$ref":"#/components/schemas/MappingAttributeMode"},"target":{"type":"string","description":"JSON like target path for the attribute. Eg. last_name"},"source":{"type":"string","description":"JSON source path for the value to be extracted from the main entity. Eg: steps[1].[\'Product Info\'].price\\n"}},"required":["mode","target","source"]},"AppendValueMapper":{"type":"object","deprecated":true,"properties":{"mode":{"$ref":"#/components/schemas/MappingAttributeMode"},"target":{"type":"string","description":"JSON like target path for the attribute. Eg. last_name"},"source":{"type":"string","description":"JSON source path for the value to be extracted from the main entity. Eg: steps[1].[\'Product Info\'].price\\n"},"value_json":{"type":"string","description":"To be provided only when mapping json objects into a target attribute. Eg array of addresses.\\n"},"target_unique":{"type":"array","items":{"type":"string"},"description":"Array of keys which should be used when checking for uniqueness. Eg: [country, city, postal_code]\\n"}},"required":["mode","target","value_json"]},"MappingHistoryResponse":{"type":"object","properties":{"configId":{"type":"string","example":"source#entity_id"},"timestamp":{"type":"string","format":"datetime"},"version":{"type":"string","example":"v1"},"attributes":{"type":"object"}}}}},"servers":[{"url":"null"}]}')}},t={},i=function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),s.exports}(914),n=exports;for(var r in i)n[r]=i[r];i.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={914:function(e,t,i){var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var r=n(i(534));t.default=r.default},534:e=>{e.exports=JSON.parse('{"openapi":"3.0.3","info":{"title":"Entity Mapping API","description":"API Backend for mapping source entity into target entities","version":"1.0.0"},"tags":[{"name":"mappings","description":"Entity Mapping Configs"}],"security":[{"EpilotAuth":[]}],"paths":{"/v1/mappings":{"post":{"operationId":"storeConfig","summary":"storeConfig","description":"Store new MappingConfig","tags":["mappings"],"requestBody":{"description":"Mapping Config to store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}},"responses":{"201":{"description":"The updated entity mapping config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}}}}},"/v1/mappings/{id}":{"get":{"operationId":"getConfig","summary":"getConfig","description":"Get latest version of a mapping config by id","tags":["mappings"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mapping Config Id","schema":{"type":"string","example":"uuidv4"}}],"responses":{"200":{"description":"Entity Mapping Config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}}}},"delete":{"operationId":"deleteConfig","summary":"deleteConfig","description":"Delete entity mapping config","tags":["mappings"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mapping Config Id","schema":{"type":"string","example":"uuidv4"}}],"responses":{"200":{"description":"The deleted mapping config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}}}}},"/v1/mappings/{id}/versions":{"get":{"operationId":"getAllVersions","summary":"getAllVersions","description":"Get all version of MappingConfig","tags":["mappings"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mapping Config Id","schema":{"type":"string","example":"uuidv4"}}],"responses":{"200":{"description":"All versions of a MappingConfig","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfigsResp"}}}}}},"post":{"operationId":"storeNewVersion","summary":"storeNewVersion","description":"Store new version of MappingConfig","tags":["mappings"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mapping Config Id","schema":{"type":"string","example":"uuidv4"}}],"requestBody":{"description":"Mapping Config to store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}},"responses":{"200":{"description":"The updated entity mapping config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}}}}},"/v1/mappings/{id}/versions/{version}":{"get":{"operationId":"getConfigVersion","summary":"getConfigVersion","description":"Get specific version of a mapping config by id & version","tags":["mappings"],"parameters":[{"name":"id","in":"path","required":true,"description":"Mapping Config Id","schema":{"type":"string","example":"uuidv4"}},{"name":"version","in":"path","required":true,"description":"Version to be loaded","schema":{"type":"number","example":3}}],"responses":{"200":{"description":"Entity Mapping Config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}}}}},"/v1/mappings:execute":{"post":{"operationId":"executeMapping","summary":"executeMapping","description":"Execute entity mapping based on a config","parameters":[{"name":"preview_mode","in":"query","required":false,"description":"True, if you want to preview the entities which will result","schema":{"type":"boolean","example":true}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteMappingReq"}}}},"tags":["mappings"],"responses":{"200":{"description":"The target entities which were mapped","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteMappingResp"}}}}}}},"/v1/mappings:search":{"post":{"operationId":"searchConfigs","summary":"searchConfigs","description":"Search mapping configs","tags":["mappings"],"requestBody":{"description":"Search Mapping Configs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchMappingReq"}}}},"responses":{"200":{"description":"Entity Mapping Config","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingConfig"}}}}}}},"/v1/mappings/history":{"get":{"operationId":"queryMappingHistory","summary":"queryMappingHistory","description":"Get the Mapping History","tags":["mappings"],"parameters":[{"in":"query","name":"from","schema":{"type":"string","format":"datetime"},"required":false,"description":"filter the history from this date on"},{"in":"query","name":"to","schema":{"type":"string","format":"datetime"},"required":false,"description":"filter the history to this date on"},{"in":"query","name":"targetEntityId","schema":{"type":"string","format":"uuid"}},{"in":"query","name":"sourceEntityId","schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Query result of mapping history","content":{"application/json":{"schema":{"properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/MappingHistoryResp"}}}}}}}}}}},"components":{"securitySchemes":{"EpilotAuth":{"type":"http","scheme":"bearer","description":"Epilot Bearer Token"}},"schemas":{"SearchMappingReq":{"type":"object","properties":{"source":{"$ref":"#/components/schemas/SourceConfig"}}},"MappingConfigsResp":{"type":"object","properties":{"configs":{"$ref":"#/components/schemas/MappingConfigs"}},"required":["configs"]},"MappingConfigs":{"type":"array","items":{"$ref":"#/components/schemas/MappingConfig"}},"MappingConfig":{"type":"object","properties":{"id":{"type":"string"},"org_id":{"type":"string"},"version":{"type":"number"},"source":{"$ref":"#/components/schemas/SourceConfig"},"targets":{"type":"array","items":{"$ref":"#/components/schemas/TargetConfig"}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"created_by":{"$ref":"#/components/schemas/Owner","description":"User / service who created the entity mapping config","example":{"type":"internal_service"}},"last_updated_by":{"$ref":"#/components/schemas/Owner","description":"User / service who last updated entity mapping config","example":{"type":"user","org_id":255151,"user_id":99252}}},"required":["id","org_id","version","source","targets"]},"Owner":{"type":"object","properties":{"type":{"type":"string","enum":["user","internal_service"]},"org_id":{"type":"string"},"user_id":{"type":"string"}},"required":["type"]},"ExecuteMappingReq":{"type":"object","description":"Pass either source or source_entity","properties":{"source_ref":{"$ref":"#/components/schemas/EntityRef","description":"A reference (id and schema) to the entity to be used as source."},"targets":{"type":"array","items":{"$ref":"#/components/schemas/TargetConfig"},"description":"Mapping Configuration to apply."}},"required":["source_ref","targets"]},"ExecuteMappingResp":{"type":"object","properties":{"mapped_entities":{"type":"array","items":{"$ref":"#/components/schemas/Entity"}},"failures":{"type":"array","items":{"$ref":"#/components/schemas/MappingFailure"}}},"required":["mapped_entities"]},"MappingFailure":{"type":"object","properties":{"target":{"$ref":"#/components/schemas/TargetConfig"},"error":{"type":"object","properties":{"message":{"type":"string"}},"additionalProperties":true}}},"Entity":{"type":"object","properties":{"_id":{"type":"string"},"_schema":{"type":"string"},"_title":{"type":"string"},"_org":{"type":"string"},"_tags":{"type":"array","items":{"type":"string"}},"_created_at":{"type":"string"},"_updated_at":{"type":"string"}},"additionalProperties":true},"EntityRef":{"type":"object","properties":{"entity_id":{"type":"string","description":"id of the source entity to be mapped"},"entity_schema":{"description":"schema of the source entity","type":"string","example":"submission"}},"required":["entity_id"]},"SourceConfig":{"type":"object","properties":{"type":{"type":"string","enum":["journey","entity"]},"config":{"anyOf":[{"$ref":"#/components/schemas/JourneyRef"},{"$ref":"#/components/schemas/EntityRef"}]}}},"JourneyRef":{"type":"object","properties":{"journey_id":{"type":"string"}}},"TargetConfig":{"type":"object","properties":{"id":{"type":"string","description":"Identifier for target configuration. Useful for later usages when trying to identify which target config to map to."},"name":{"type":"string","description":"A name for this configuration"},"allow_failure":{"type":"boolean","description":"Pass it as true, when you don\'t want failures to interrupt the mapping process."},"target_schema":{"type":"string","description":"Schema of target entity"},"target_unique":{"type":"array","description":"Unique key for target entity (see upsertEntity of Entity API)","items":{"type":"string"}},"conditions":{"type":"array","description":"Conditions necessary to hold for the target entity to be mapped","items":{"$ref":"#/components/schemas/MapCondition"}},"mapping_attributes":{"type":"array","description":"Attribute mappings","items":{"anyOf":[{"$ref":"#/components/schemas/MappingAttributeV2"},{"$ref":"#/components/schemas/MappingAttribute"}]}},"relation_attributes":{"type":"array","description":"Relation mappings","items":{"$ref":"#/components/schemas/RelationAttribute"}},"linkback_relation_attribute":{"type":"string","default":"mapped_entities","description":"Relation attribute on the main entity where the target entity will be linked. Set to false to disable linkback\\n"},"linkback_relation_tags":{"type":"array","description":"Relation tags (labels) to include in main entity linkback relation attribute","items":{"type":"string"}}},"required":["target_schema","mapping_attributes"]},"MapCondition":{"type":"object","properties":{"_exists":{"$ref":"#/components/schemas/ConditionNode"},"_equals":{"$ref":"#/components/schemas/ConditionNode"},"_not_exists":{"$ref":"#/components/schemas/ConditionNode"},"_any_of":{"$ref":"#/components/schemas/ConditionNode"}}},"ConditionNode":{"type":"object","properties":{"source":{"type":"string"},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"object"},{"type":"array","items":{"type":"object"}}]}}},"RelationAttribute":{"type":"object","properties":{"target":{"type":"string","description":"Target attribute to store the relation in"},"target_tags":{"type":"array","description":"Relation tags (labels) to set for the stored relations","items":{"type":"string"}},"target_tags_include_source":{"type":"boolean","description":"Include all relation tags (labels) present on the main entity relation","default":false},"source_filter":{"type":"object","description":"A filter to identify which source entities to pick as relations from main entity","properties":{"limit":{"type":"integer","description":"Limit relations to maximum number (default, all matched relations)","minimum":0},"schema":{"type":"string","description":"Filter by specific schema"},"attribute":{"type":"string","description":"Filter by a specific relation attribute on the main entity"},"relation_tag":{"type":"string","description":"Filter by relation tag (label) on the main entity"},"tag":{"type":"string","description":"Filter by a specific tag on the related entity"},"self":{"type":"boolean","description":"Picks main entity as relation (overrides other filters)","default":false}}},"related_to":{"type":"object","additionalProperties":true,"deprecated":true},"mode":{"type":"string","enum":["append","prepend","set"]}},"required":["target","mode"]},"MappingAttributeV2":{"type":"object","properties":{"target":{"type":"string","description":"Target JSON path for the attribute to set"},"operation":{"$ref":"#/components/schemas/OperationNode"},"origin":{"$ref":"#/components/schemas/AttributeOrigin"}},"required":["target","operation"],"example":{"target":"_tags","operation":{"_append":["new","tags"],"_uniq":true}}},"AttributeOrigin":{"type":"string","description":"Origin of an attribute.","enum":["system_recommendation","user_manually"]},"OperationNode":{"description":"Mapping operation nodes are either primitive values or operation node objects","oneOf":[{"$ref":"#/components/schemas/OperationObjectNode"},{"$ref":"#/components/schemas/PrimitiveJSONValue"}]},"OperationObjectNode":{"type":"object","properties":{"_set":{"$ref":"#/components/schemas/PrimitiveJSONValue"},"_append":{"description":"Append to array","items":{"$ref":"#/components/schemas/PrimitiveJSONValue"}},"_uniq":{"description":"Unique array","oneOf":[{"type":"boolean","example":true},{"type":"array","description":"Unique key consisting of object keys","example":["email"],"items":{"type":"string"}}]},"_copy":{"description":"Copy JSONPath value from source entity context","type":"string","example":"contact.first_name"},"_template":{"description":"Define handlebars template to output a string","type":"string","example":"{{contact.first_name}} {{contact.last_name}}"},"_random":{"description":"Generate random ids / numbers","$ref":"#/components/schemas/RandomOperation"}},"additionalProperties":true},"PrimitiveJSONValue":{"description":"Represents any primitive JSON value","anyOf":[{"type":"string"},{"type":"boolean"},{"type":"number"},{"type":"object","additionalProperties":true},{"type":"array"}]},"RandomOperation":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["uuid","nanoid"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["number"]},"min":{"type":"number","default":0},"max":{"type":"number","default":1}},"required":["type"]}]},"MappingAttribute":{"anyOf":[{"$ref":"#/components/schemas/SetValueMapper"},{"$ref":"#/components/schemas/CopyValueMapper"},{"$ref":"#/components/schemas/AppendValueMapper"}]},"MappingAttributeMode":{"type":"string","enum":["copy_if_exists","append_if_exists","set_value"],"description":"- copy_if_exists - it replaces the target attribute with the source value - append_if_exists - it currently replaces target attribute with array like values. Useful when you have multiple values to be added into one attribute. - set_value - it sets a value to a predefined value. Must be used together with value property.\\n"},"SetValueMapper":{"type":"object","deprecated":true,"properties":{"mode":{"$ref":"#/components/schemas/MappingAttributeMode"},"target":{"type":"string","description":"JSON like target path for the attribute. Eg. last_name"},"value":{"description":"Any value to be set: string, number, string[], number[], JSON object, etc. It will override existing values, if any.\\n"}},"required":["mode","target","value"]},"CopyValueMapper":{"type":"object","deprecated":true,"properties":{"mode":{"$ref":"#/components/schemas/MappingAttributeMode"},"target":{"type":"string","description":"JSON like target path for the attribute. Eg. last_name"},"source":{"type":"string","description":"JSON source path for the value to be extracted from the main entity. Eg: steps[1].[\'Product Info\'].price\\n"}},"required":["mode","target","source"]},"AppendValueMapper":{"type":"object","deprecated":true,"properties":{"mode":{"$ref":"#/components/schemas/MappingAttributeMode"},"target":{"type":"string","description":"JSON like target path for the attribute. Eg. last_name"},"source":{"type":"string","description":"JSON source path for the value to be extracted from the main entity. Eg: steps[1].[\'Product Info\'].price\\n"},"value_json":{"type":"string","description":"To be provided only when mapping json objects into a target attribute. Eg array of addresses.\\n"},"target_unique":{"type":"array","items":{"type":"string"},"description":"Array of keys which should be used when checking for uniqueness. Eg: [country, city, postal_code]\\n"}},"required":["mode","target","value_json"]},"MappingHistoryResp":{"type":"object","properties":{"results":{"type":"array","items":{"$ref":"#/components/schemas/MappingHistoryEntry"}}},"required":["results"]},"MappingHistoryEntry":{"type":"object","properties":{"id":{"type":"string","example":"uuidv4"},"timestamp":{"type":"string","format":"ISO datetime"},"source_entity_snapshot":{"$ref":"#/components/schemas/Entity"},"mapped_entities_snapshot":{"type":"array","items":{"$ref":"#/components/schemas/Entity"}},"target_configs_snapshot":{"type":"array","items":{"$ref":"#/components/schemas/TargetConfig"}}},"required":["id","timestamp","source_entity_snapshot","target_configs_snapshot","mapped_entities_snapshot"]}}},"servers":[{"url":"null"}]}')}},t={},i=function i(n){var r=t[n];if(void 0!==r)return r.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,i),s.exports}(914),n=exports;for(var r in i)n[r]=i[r];i.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
package/dist/openapi.d.ts CHANGED
@@ -134,7 +134,7 @@ declare namespace Components {
134
134
  /**
135
135
  * Target JSON path for the attribute to set
136
136
  */
137
- target?: string;
137
+ target: string;
138
138
  operation: /* Mapping operation nodes are either primitive values or operation node objects */ OperationNode;
139
139
  origin?: /* Origin of an attribute. */ AttributeOrigin;
140
140
  }
@@ -176,21 +176,19 @@ declare namespace Components {
176
176
  message?: string;
177
177
  };
178
178
  }
179
- export interface MappingHistoryResponse {
180
- /**
181
- * example:
182
- * source#entity_id
183
- */
184
- configId?: string;
185
- timestamp?: string; // datetime
179
+ export interface MappingHistoryEntry {
186
180
  /**
187
181
  * example:
188
- * v1
182
+ * uuidv4
189
183
  */
190
- version?: string;
191
- attributes?: {
192
- [key: string]: any;
193
- };
184
+ id: string;
185
+ timestamp: string; // ISO datetime
186
+ source_entity_snapshot: Entity;
187
+ mapped_entities_snapshot: Entity[];
188
+ target_configs_snapshot: TargetConfig[];
189
+ }
190
+ export interface MappingHistoryResp {
191
+ results: MappingHistoryEntry[];
194
192
  }
195
193
  /**
196
194
  * Mapping operation nodes are either primitive values or operation node objects
@@ -213,6 +211,16 @@ declare namespace Components {
213
211
  * contact.first_name
214
212
  */
215
213
  _copy?: string;
214
+ /**
215
+ * Define handlebars template to output a string
216
+ * example:
217
+ * {{contact.first_name}} {{contact.last_name}}
218
+ */
219
+ _template?: string;
220
+ /**
221
+ * Generate random ids / numbers
222
+ */
223
+ _random?: RandomOperation;
216
224
  }
217
225
  export interface Owner {
218
226
  type: "user" | "internal_service";
@@ -225,6 +233,13 @@ declare namespace Components {
225
233
  export type PrimitiveJSONValue = /* Represents any primitive JSON value */ string | boolean | number | {
226
234
  [name: string]: any;
227
235
  } | any[];
236
+ export type RandomOperation = {
237
+ type: "uuid" | "nanoid";
238
+ } | {
239
+ type: "number";
240
+ min?: number;
241
+ max?: number;
242
+ };
228
243
  export interface RelationAttribute {
229
244
  /**
230
245
  * Target attribute to store the relation in
@@ -431,22 +446,51 @@ declare namespace Paths {
431
446
  export type $200 = Components.Schemas.MappingConfig;
432
447
  }
433
448
  }
434
- namespace GetMappingHistory {
449
+ namespace GetConfigVersion {
435
450
  namespace Parameters {
436
- export type From = string; // datetime
451
+ /**
452
+ * example:
453
+ * uuidv4
454
+ */
437
455
  export type Id = string;
438
- export type To = string; // datetime
456
+ /**
457
+ * example:
458
+ * 3
459
+ */
460
+ export type Version = number;
439
461
  }
440
462
  export interface PathParameters {
441
- id: Parameters.Id;
463
+ id: /**
464
+ * example:
465
+ * uuidv4
466
+ */
467
+ Parameters.Id;
468
+ version: /**
469
+ * example:
470
+ * 3
471
+ */
472
+ Parameters.Version;
473
+ }
474
+ namespace Responses {
475
+ export type $200 = Components.Schemas.MappingConfig;
476
+ }
477
+ }
478
+ namespace QueryMappingHistory {
479
+ namespace Parameters {
480
+ export type From = string; // datetime
481
+ export type SourceEntityId = string; // uuid
482
+ export type TargetEntityId = string; // uuid
483
+ export type To = string; // datetime
442
484
  }
443
485
  export interface QueryParameters {
444
486
  from?: Parameters.From /* datetime */;
445
487
  to?: Parameters.To /* datetime */;
488
+ targetEntityId?: Parameters.TargetEntityId /* uuid */;
489
+ sourceEntityId?: Parameters.SourceEntityId /* uuid */;
446
490
  }
447
491
  namespace Responses {
448
492
  export interface $200 {
449
- results?: Components.Schemas.MappingHistoryResponse[];
493
+ results?: Components.Schemas.MappingHistoryResp[];
450
494
  }
451
495
  }
452
496
  }
@@ -535,6 +579,16 @@ export interface OperationMethods {
535
579
  data?: Paths.StoreNewVersion.RequestBody,
536
580
  config?: AxiosRequestConfig
537
581
  ): OperationResponse<Paths.StoreNewVersion.Responses.$200>
582
+ /**
583
+ * getConfigVersion - getConfigVersion
584
+ *
585
+ * Get specific version of a mapping config by id & version
586
+ */
587
+ 'getConfigVersion'(
588
+ parameters?: Parameters<Paths.GetConfigVersion.PathParameters> | null,
589
+ data?: any,
590
+ config?: AxiosRequestConfig
591
+ ): OperationResponse<Paths.GetConfigVersion.Responses.$200>
538
592
  /**
539
593
  * executeMapping - executeMapping
540
594
  *
@@ -556,15 +610,15 @@ export interface OperationMethods {
556
610
  config?: AxiosRequestConfig
557
611
  ): OperationResponse<Paths.SearchConfigs.Responses.$200>
558
612
  /**
559
- * getMappingHistory - getMappingHistory
613
+ * queryMappingHistory - queryMappingHistory
560
614
  *
561
615
  * Get the Mapping History
562
616
  */
563
- 'getMappingHistory'(
564
- parameters?: Parameters<Paths.GetMappingHistory.PathParameters & Paths.GetMappingHistory.QueryParameters> | null,
617
+ 'queryMappingHistory'(
618
+ parameters?: Parameters<Paths.QueryMappingHistory.QueryParameters> | null,
565
619
  data?: any,
566
620
  config?: AxiosRequestConfig
567
- ): OperationResponse<Paths.GetMappingHistory.Responses.$200>
621
+ ): OperationResponse<Paths.QueryMappingHistory.Responses.$200>
568
622
  }
569
623
 
570
624
  export interface PathsDictionary {
@@ -624,6 +678,18 @@ export interface PathsDictionary {
624
678
  config?: AxiosRequestConfig
625
679
  ): OperationResponse<Paths.StoreNewVersion.Responses.$200>
626
680
  }
681
+ ['/v1/mappings/{id}/versions/{version}']: {
682
+ /**
683
+ * getConfigVersion - getConfigVersion
684
+ *
685
+ * Get specific version of a mapping config by id & version
686
+ */
687
+ 'get'(
688
+ parameters?: Parameters<Paths.GetConfigVersion.PathParameters> | null,
689
+ data?: any,
690
+ config?: AxiosRequestConfig
691
+ ): OperationResponse<Paths.GetConfigVersion.Responses.$200>
692
+ }
627
693
  ['/v1/mappings:execute']: {
628
694
  /**
629
695
  * executeMapping - executeMapping
@@ -648,17 +714,17 @@ export interface PathsDictionary {
648
714
  config?: AxiosRequestConfig
649
715
  ): OperationResponse<Paths.SearchConfigs.Responses.$200>
650
716
  }
651
- ['/v1/mappings/{id}/history']: {
717
+ ['/v1/mappings/history']: {
652
718
  /**
653
- * getMappingHistory - getMappingHistory
719
+ * queryMappingHistory - queryMappingHistory
654
720
  *
655
721
  * Get the Mapping History
656
722
  */
657
723
  'get'(
658
- parameters?: Parameters<Paths.GetMappingHistory.PathParameters & Paths.GetMappingHistory.QueryParameters> | null,
724
+ parameters?: Parameters<Paths.QueryMappingHistory.QueryParameters> | null,
659
725
  data?: any,
660
726
  config?: AxiosRequestConfig
661
- ): OperationResponse<Paths.GetMappingHistory.Responses.$200>
727
+ ): OperationResponse<Paths.QueryMappingHistory.Responses.$200>
662
728
  }
663
729
  }
664
730
 
package/dist/openapi.json CHANGED
@@ -191,6 +191,50 @@
191
191
  }
192
192
  }
193
193
  },
194
+ "/v1/mappings/{id}/versions/{version}": {
195
+ "get": {
196
+ "operationId": "getConfigVersion",
197
+ "summary": "getConfigVersion",
198
+ "description": "Get specific version of a mapping config by id & version",
199
+ "tags": [
200
+ "mappings"
201
+ ],
202
+ "parameters": [
203
+ {
204
+ "name": "id",
205
+ "in": "path",
206
+ "required": true,
207
+ "description": "Mapping Config Id",
208
+ "schema": {
209
+ "type": "string",
210
+ "example": "uuidv4"
211
+ }
212
+ },
213
+ {
214
+ "name": "version",
215
+ "in": "path",
216
+ "required": true,
217
+ "description": "Version to be loaded",
218
+ "schema": {
219
+ "type": "number",
220
+ "example": 3
221
+ }
222
+ }
223
+ ],
224
+ "responses": {
225
+ "200": {
226
+ "description": "Entity Mapping Config",
227
+ "content": {
228
+ "application/json": {
229
+ "schema": {
230
+ "$ref": "#/components/schemas/MappingConfig"
231
+ }
232
+ }
233
+ }
234
+ }
235
+ }
236
+ }
237
+ },
194
238
  "/v1/mappings:execute": {
195
239
  "post": {
196
240
  "operationId": "executeMapping",
@@ -266,24 +310,15 @@
266
310
  }
267
311
  }
268
312
  },
269
- "/v1/mappings/{id}/history": {
313
+ "/v1/mappings/history": {
270
314
  "get": {
271
- "operationId": "getMappingHistory",
272
- "summary": "getMappingHistory",
315
+ "operationId": "queryMappingHistory",
316
+ "summary": "queryMappingHistory",
273
317
  "description": "Get the Mapping History",
274
318
  "tags": [
275
- "history"
319
+ "mappings"
276
320
  ],
277
321
  "parameters": [
278
- {
279
- "in": "path",
280
- "name": "id",
281
- "schema": {
282
- "type": "string"
283
- },
284
- "required": true,
285
- "description": "the id of the mapping"
286
- },
287
322
  {
288
323
  "in": "query",
289
324
  "name": "from",
@@ -303,6 +338,22 @@
303
338
  },
304
339
  "required": false,
305
340
  "description": "filter the history to this date on"
341
+ },
342
+ {
343
+ "in": "query",
344
+ "name": "targetEntityId",
345
+ "schema": {
346
+ "type": "string",
347
+ "format": "uuid"
348
+ }
349
+ },
350
+ {
351
+ "in": "query",
352
+ "name": "sourceEntityId",
353
+ "schema": {
354
+ "type": "string",
355
+ "format": "uuid"
356
+ }
306
357
  }
307
358
  ],
308
359
  "responses": {
@@ -315,7 +366,7 @@
315
366
  "results": {
316
367
  "type": "array",
317
368
  "items": {
318
- "$ref": "#/components/schemas/MappingHistoryResponse"
369
+ "$ref": "#/components/schemas/MappingHistoryResp"
319
370
  }
320
371
  }
321
372
  }
@@ -772,7 +823,7 @@
772
823
  }
773
824
  },
774
825
  "required": [
775
- "targetPath",
826
+ "target",
776
827
  "operation"
777
828
  ],
778
829
  "example": {
@@ -840,6 +891,15 @@
840
891
  "description": "Copy JSONPath value from source entity context",
841
892
  "type": "string",
842
893
  "example": "contact.first_name"
894
+ },
895
+ "_template": {
896
+ "description": "Define handlebars template to output a string",
897
+ "type": "string",
898
+ "example": "{{contact.first_name}} {{contact.last_name}}"
899
+ },
900
+ "_random": {
901
+ "description": "Generate random ids / numbers",
902
+ "$ref": "#/components/schemas/RandomOperation"
843
903
  }
844
904
  },
845
905
  "additionalProperties": true
@@ -865,6 +925,47 @@
865
925
  }
866
926
  ]
867
927
  },
928
+ "RandomOperation": {
929
+ "oneOf": [
930
+ {
931
+ "type": "object",
932
+ "properties": {
933
+ "type": {
934
+ "type": "string",
935
+ "enum": [
936
+ "uuid",
937
+ "nanoid"
938
+ ]
939
+ }
940
+ },
941
+ "required": [
942
+ "type"
943
+ ]
944
+ },
945
+ {
946
+ "type": "object",
947
+ "properties": {
948
+ "type": {
949
+ "type": "string",
950
+ "enum": [
951
+ "number"
952
+ ]
953
+ },
954
+ "min": {
955
+ "type": "number",
956
+ "default": 0
957
+ },
958
+ "max": {
959
+ "type": "number",
960
+ "default": 1
961
+ }
962
+ },
963
+ "required": [
964
+ "type"
965
+ ]
966
+ }
967
+ ]
968
+ },
868
969
  "MappingAttribute": {
869
970
  "anyOf": [
870
971
  {
@@ -963,25 +1064,54 @@
963
1064
  "value_json"
964
1065
  ]
965
1066
  },
966
- "MappingHistoryResponse": {
1067
+ "MappingHistoryResp": {
967
1068
  "type": "object",
968
1069
  "properties": {
969
- "configId": {
1070
+ "results": {
1071
+ "type": "array",
1072
+ "items": {
1073
+ "$ref": "#/components/schemas/MappingHistoryEntry"
1074
+ }
1075
+ }
1076
+ },
1077
+ "required": [
1078
+ "results"
1079
+ ]
1080
+ },
1081
+ "MappingHistoryEntry": {
1082
+ "type": "object",
1083
+ "properties": {
1084
+ "id": {
970
1085
  "type": "string",
971
- "example": "source#entity_id"
1086
+ "example": "uuidv4"
972
1087
  },
973
1088
  "timestamp": {
974
1089
  "type": "string",
975
- "format": "datetime"
1090
+ "format": "ISO datetime"
976
1091
  },
977
- "version": {
978
- "type": "string",
979
- "example": "v1"
1092
+ "source_entity_snapshot": {
1093
+ "$ref": "#/components/schemas/Entity"
980
1094
  },
981
- "attributes": {
982
- "type": "object"
1095
+ "mapped_entities_snapshot": {
1096
+ "type": "array",
1097
+ "items": {
1098
+ "$ref": "#/components/schemas/Entity"
1099
+ }
1100
+ },
1101
+ "target_configs_snapshot": {
1102
+ "type": "array",
1103
+ "items": {
1104
+ "$ref": "#/components/schemas/TargetConfig"
1105
+ }
983
1106
  }
984
- }
1107
+ },
1108
+ "required": [
1109
+ "id",
1110
+ "timestamp",
1111
+ "source_entity_snapshot",
1112
+ "target_configs_snapshot",
1113
+ "mapped_entities_snapshot"
1114
+ ]
985
1115
  }
986
1116
  }
987
1117
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/entity-mapping-client",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "JavaScript client library for the ePilot Entity Mapping API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -53,7 +53,7 @@
53
53
  "@dazn/lambda-powertools-correlation-ids": "^1.28.1",
54
54
  "buffer": "^6.0.3",
55
55
  "https-browserify": "^1.0.0",
56
- "openapi-client-axios": "^5.1.1",
56
+ "openapi-client-axios": "^5.3.0",
57
57
  "stream-http": "^3.1.1",
58
58
  "url": "^0.11.0",
59
59
  "util": "^0.12.3"
@@ -72,6 +72,5 @@
72
72
  "typescript": "^4.1.3",
73
73
  "webpack": "^5.18.0",
74
74
  "webpack-cli": "^4.4.0"
75
- },
76
- "gitHead": "cbaa47cb33ec5c4906bd40513ec886ec04ae3e9b"
75
+ }
77
76
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2022 epilot GmbH
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.