@epilot/entity-mapping-client 0.3.1 → 0.3.3

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
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.
@@ -1 +1 @@
1
- (()=>{"use strict";var e={914:function(e,t,i){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=r(i(534));t.default=n.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":{"isSilent":{"type":"boolean"},"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"}},"conditionMode":{"description":"Mode of how conditions are considered valid","type":"string","enum":["oneOf","anyOf","allOf"]},"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"]},"MappingSource":{"type":"object","properties":{"key":{"type":"string","description":"Key aiming to identify source"},"sub_properties":{"description":"Each item describes a property under the main source and a possibly, a default value for its target attribute","type":"array","items":{"$ref":"#/components/schemas/MappingSourceProperty"}},"source_type":{"type":"string","description":"Data Structure type of source"},"possible_target_types":{"type":"array","items":{"$ref":"#/components/schemas/MappingSourceTargetType"},"description":"Data Structure Type of the underlaying output value"},"initial_relation":{"description":"Initial value of a relation to be added","$ref":"#/components/schemas/RelationAttribute"},"title":{"type":"string","description":"Human readable name of the Source"},"sub_title":{"type":"string","description":"Human readable type of the source"},"target_settings":{"type":"object","properties":{"allowed_ui_actions":{"type":"string","enum":["schema-select","attribute-select","target-delete","target-add","target"],"description":"Describes which actions the user can perform on each target, if specified. If not specified, all actions are allowed"},"locked":{"type":"string","enum":["each","first"],"description":"Whether its a read-only ui or not. Can be each target, or only the first. Overwrites uiActions"},"isSingleTarget":{"type":"boolean","description":"Whether all source mappings flow into a single attribute (e.g. address)"},"visibility":{"description":"Determines whether a mapping target should be shown or not. Use if there are targets which cannot be manipulated by the UI. E.g journey_data","type":"object","properties":{"mode":{"type":"string","enum":["hide","show"]},"if":{"type":"object","additionalProperties":{"type":"string"}},"message":{"type":"string"}},"required":["mode","if"]}}}},"required":["key","title","source_type"]},"MappingSourceProperty":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"},"initial_target_value":{"type":"string"},"possible_target_types":{"type":"array","items":{"$ref":"#/components/schemas/MappingSourceTargetType"},"description":"Data Structure Type of the underlaying output value"}},"required":["value","label"]},"MappingSourceTargetType":{"type":"string","enum":["string","date","datetime","boolean","number","image","file","address","email","phone","select","multiselect"]}}},"servers":[{"url":"null"}]}')}},t={},i=function i(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,i),s.exports}(914),r=exports;for(var n in i)r[n]=i[n];i.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
1
+ (()=>{"use strict";var e={914:function(e,t,i){var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var n=r(i(534));t.default=n.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":{"isSilent":{"type":"boolean"},"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"}},"conditionMode":{"description":"Mode of how conditions are considered valid","type":"string","enum":["oneOf","anyOf","allOf"]},"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"]},"MappingSource":{"type":"object","properties":{"key":{"type":"string","description":"Key aiming to identify source"},"sub_properties":{"description":"Each item describes a property under the main source and a possibly, a default value for its target attribute","type":"array","items":{"$ref":"#/components/schemas/MappingSourceProperty"}},"source_type":{"type":"string","description":"Data Structure type of source"},"possible_target_types":{"type":"array","items":{"$ref":"#/components/schemas/MappingSourceTargetType"},"description":"Data Structure Type of the underlaying output value"},"initial_relation":{"description":"Initial value of a relation to be added","$ref":"#/components/schemas/RelationAttribute"},"title":{"type":"string","description":"Human readable name of the Source"},"sub_title":{"type":"string","description":"Human readable type of the source"},"target_settings":{"type":"object","properties":{"allowed_ui_actions":{"type":"array","items":{"type":"string","enum":["schema-select","attribute-select","target-delete","target-add","target"]},"description":"Describes which actions the user can perform on each target, if specified. If not specified, all actions are allowed"},"locked":{"type":"string","enum":["each","first"],"description":"Whether its a read-only ui or not. Can be each target, or only the first. Overwrites uiActions"},"isSingleTarget":{"type":"boolean","description":"Whether all source mappings flow into a single attribute (e.g. address)"},"visibility":{"description":"Determines whether a mapping target should be shown or not. Use if there are targets which cannot be manipulated by the UI. E.g journey_data","type":"object","properties":{"mode":{"type":"string","enum":["hide","show","message"]},"if":{"type":"object","additionalProperties":{"type":"string"}},"message":{"type":"string"}},"required":["mode","if"]}}}},"required":["key","title","source_type"]},"MappingSourceProperty":{"type":"object","properties":{"value":{"type":"string"},"label":{"type":"string"},"initial_target_value":{"type":"string"},"possible_target_types":{"type":"array","items":{"$ref":"#/components/schemas/MappingSourceTargetType"},"description":"Data Structure Type of the underlaying output value"}},"required":["value","label"]},"MappingSourceTargetType":{"type":"string","enum":["string","date","datetime","boolean","number","image","file","address","email","phone","select","multiselect"]}}},"servers":[{"url":"null"}]}')}},t={},i=function i(r){var n=t[r];if(void 0!==n)return n.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,i),s.exports}(914),r=exports;for(var n in i)r[n]=i[n];i.__esModule&&Object.defineProperty(r,"__esModule",{value:!0})})();
package/dist/openapi.d.ts CHANGED
@@ -224,7 +224,7 @@ declare namespace Components {
224
224
  /**
225
225
  * Describes which actions the user can perform on each target, if specified. If not specified, all actions are allowed
226
226
  */
227
- allowed_ui_actions?: "schema-select" | "attribute-select" | "target-delete" | "target-add" | "target";
227
+ allowed_ui_actions?: ("schema-select" | "attribute-select" | "target-delete" | "target-add" | "target")[];
228
228
  /**
229
229
  * Whether its a read-only ui or not. Can be each target, or only the first. Overwrites uiActions
230
230
  */
@@ -237,7 +237,7 @@ declare namespace Components {
237
237
  * Determines whether a mapping target should be shown or not. Use if there are targets which cannot be manipulated by the UI. E.g journey_data
238
238
  */
239
239
  visibility?: {
240
- mode: "hide" | "show";
240
+ mode: "hide" | "show" | "message";
241
241
  if: {
242
242
  [name: string]: string;
243
243
  };
package/dist/openapi.json CHANGED
@@ -1166,14 +1166,17 @@
1166
1166
  "type": "object",
1167
1167
  "properties": {
1168
1168
  "allowed_ui_actions": {
1169
- "type": "string",
1170
- "enum": [
1171
- "schema-select",
1172
- "attribute-select",
1173
- "target-delete",
1174
- "target-add",
1175
- "target"
1176
- ],
1169
+ "type": "array",
1170
+ "items": {
1171
+ "type": "string",
1172
+ "enum": [
1173
+ "schema-select",
1174
+ "attribute-select",
1175
+ "target-delete",
1176
+ "target-add",
1177
+ "target"
1178
+ ]
1179
+ },
1177
1180
  "description": "Describes which actions the user can perform on each target, if specified. If not specified, all actions are allowed"
1178
1181
  },
1179
1182
  "locked": {
@@ -1196,7 +1199,8 @@
1196
1199
  "type": "string",
1197
1200
  "enum": [
1198
1201
  "hide",
1199
- "show"
1202
+ "show",
1203
+ "message"
1200
1204
  ]
1201
1205
  },
1202
1206
  "if": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/entity-mapping-client",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
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",
@@ -25,7 +25,7 @@
25
25
  "test": "jest",
26
26
  "typescript": "tsc",
27
27
  "bundle-definition": "webpack",
28
- "openapi": "../../scripts/update-openapi.sh https://docs.api.epilot.io/entity-mapping-api.yaml",
28
+ "openapi": "node ../../scripts/update-openapi.js https://docs.api.epilot.io/entity-mapping-api.yaml",
29
29
  "typegen": "echo '/* eslint-disable */' > src/openapi.d.ts && typegen ./src/openapi.json >> src/openapi.d.ts",
30
30
  "build": "tsc && npm run bundle-definition",
31
31
  "build:watch": "npm run build && tsc -w",
@@ -72,5 +72,6 @@
72
72
  "typescript": "^4.1.3",
73
73
  "webpack": "^5.18.0",
74
74
  "webpack-cli": "^4.4.0"
75
- }
75
+ },
76
+ "gitHead": "ae107d0f83073ee8bef10ff51f194ae08a3d2bac"
76
77
  }