@epilot/entity-mapping-client 0.2.2 → 0.3.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.
- package/LICENSE +21 -0
- package/dist/client.d.ts +1 -0
- package/dist/client.js +10 -2
- package/dist/definition.js +1 -1
- package/dist/openapi.d.ts +4 -0
- package/dist/openapi.json +9 -0
- package/package.json +3 -2
- package/package-lock.json +0 -6546
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.
|
package/dist/client.d.ts
CHANGED
package/dist/client.js
CHANGED
|
@@ -14,16 +14,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getClient = void 0;
|
|
17
|
+
exports.createClient = exports.getClient = void 0;
|
|
18
18
|
var lambda_powertools_correlation_ids_1 = __importDefault(require("@dazn/lambda-powertools-correlation-ids"));
|
|
19
19
|
var openapi_client_axios_1 = __importDefault(require("openapi-client-axios"));
|
|
20
20
|
var definition_1 = __importDefault(require("./definition"));
|
|
21
|
+
var client;
|
|
21
22
|
var getClient = function () {
|
|
23
|
+
if (!client) {
|
|
24
|
+
client = (0, exports.createClient)();
|
|
25
|
+
}
|
|
26
|
+
return client;
|
|
27
|
+
};
|
|
28
|
+
exports.getClient = getClient;
|
|
29
|
+
var createClient = function () {
|
|
22
30
|
var _a;
|
|
23
31
|
var api = new openapi_client_axios_1.default({ definition: definition_1.default, quick: true });
|
|
24
32
|
var apiClient = api.initSync();
|
|
25
33
|
apiClient.defaults.headers.common = __assign(__assign({}, ((_a = apiClient.defaults.headers.common) !== null && _a !== void 0 ? _a : {})), (lambda_powertools_correlation_ids_1.default.get() || {}));
|
|
26
34
|
return apiClient;
|
|
27
35
|
};
|
|
28
|
-
exports.
|
|
36
|
+
exports.createClient = createClient;
|
|
29
37
|
//# sourceMappingURL=client.js.map
|
package/dist/definition.js
CHANGED
|
@@ -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/{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})})();
|
|
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"}},"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"]}}},"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
|
@@ -331,6 +331,10 @@ declare namespace Components {
|
|
|
331
331
|
* Unique key for target entity (see upsertEntity of Entity API)
|
|
332
332
|
*/
|
|
333
333
|
target_unique?: string[];
|
|
334
|
+
/**
|
|
335
|
+
* Mode of how conditions are considered valid
|
|
336
|
+
*/
|
|
337
|
+
conditionMode?: "oneOf" | "anyOf" | "allOf";
|
|
334
338
|
/**
|
|
335
339
|
* Conditions necessary to hold for the target entity to be mapped
|
|
336
340
|
*/
|
package/dist/openapi.json
CHANGED
|
@@ -648,6 +648,15 @@
|
|
|
648
648
|
"type": "string"
|
|
649
649
|
}
|
|
650
650
|
},
|
|
651
|
+
"conditionMode": {
|
|
652
|
+
"description": "Mode of how conditions are considered valid",
|
|
653
|
+
"type": "string",
|
|
654
|
+
"enum": [
|
|
655
|
+
"oneOf",
|
|
656
|
+
"anyOf",
|
|
657
|
+
"allOf"
|
|
658
|
+
]
|
|
659
|
+
},
|
|
651
660
|
"conditions": {
|
|
652
661
|
"type": "array",
|
|
653
662
|
"description": "Conditions necessary to hold for the target entity to be mapped",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epilot/entity-mapping-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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",
|
|
@@ -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": "d41cf7334964ffb68c562b531d6cf3c286367f76"
|
|
76
77
|
}
|