-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Support for new recipe management and example of initial domain mappi…
…ng (#7) Added support for new recipe management which includes creation of recipe blueprint and installing initial domain mapping file.
1 parent
ce8016c
commit 1bb8757
Showing
6 changed files
with
140 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import extraction from './functions/extraction/index'; | ||
import extraction from './functions/extraction'; | ||
import install_initial_domain_mapping from './functions/install_initial_domain_mapping'; | ||
|
||
export const functionFactory = { | ||
extraction, | ||
install_initial_domain_mapping, | ||
} as const; | ||
|
||
export type FunctionFactoryType = keyof typeof functionFactory; |
107 changes: 107 additions & 0 deletions
107
code/src/functions/extraction/initial_domain_mapping.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
{ | ||
"starting_recipe_blueprint": { | ||
"external_record_types": { | ||
"contacts": { | ||
"forward": true, | ||
"reverse": false, | ||
"shard": { | ||
"constructed_custom_fields": {}, | ||
"devrev_leaf_type": { | ||
"object_type": "revu" | ||
}, | ||
"shard": "create_shard", | ||
"stock_field_mappings": { | ||
"display_name": { | ||
"forward": true, | ||
"primary_external_field": "name", | ||
"reverse": false, | ||
"transformation_method": { | ||
"transformation_method": "use_directly" | ||
} | ||
}, | ||
"email": { | ||
"forward": true, | ||
"primary_external_field": "email", | ||
"reverse": false, | ||
"transformation_method": { | ||
"transformation_method": "use_directly" | ||
} | ||
}, | ||
"full_name": { | ||
"forward": true, | ||
"primary_external_field": "name", | ||
"reverse": false, | ||
"transformation_method": { | ||
"transformation_method": "use_directly" | ||
} | ||
}, | ||
"state": { | ||
"forward": true, | ||
"reverse": false, | ||
"transformation_method": { | ||
"enum": "UNASSIGNED", | ||
"transformation_method": "use_fixed_value", | ||
"value": "enum_value" | ||
} | ||
}, | ||
"user_type": { | ||
"forward": true, | ||
"reverse": false, | ||
"transformation_method": { | ||
"enum": "IDENTIFIED", | ||
"transformation_method": "use_fixed_value", | ||
"value": "enum_value" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"users": { | ||
"forward": true, | ||
"reverse": false, | ||
"shard": { | ||
"constructed_custom_fields": {}, | ||
"devrev_leaf_type": { | ||
"object_type": "devu" | ||
}, | ||
"shard": "create_shard", | ||
"stock_field_mappings": { | ||
"display_name": { | ||
"forward": true, | ||
"primary_external_field": "name", | ||
"reverse": false, | ||
"transformation_method": { | ||
"transformation_method": "use_directly" | ||
} | ||
}, | ||
"email": { | ||
"forward": true, | ||
"primary_external_field": "email", | ||
"reverse": false, | ||
"transformation_method": { | ||
"transformation_method": "use_directly" | ||
} | ||
}, | ||
"full_name": { | ||
"forward": true, | ||
"primary_external_field": "name", | ||
"reverse": false, | ||
"transformation_method": { | ||
"transformation_method": "use_directly" | ||
} | ||
}, | ||
"state": { | ||
"forward": true, | ||
"reverse": false, | ||
"transformation_method": { | ||
"enum": "UNASSIGNED", | ||
"transformation_method": "use_fixed_value", | ||
"value": "enum_value" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
code/src/functions/install_initial_domain_mapping/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { AirdropEvent, installInitialDomainMapping } from '@devrev/ts-adaas'; | ||
|
||
import initialDomainMapping from '../extraction/initial_domain_mapping.json'; | ||
|
||
const run = async (events: AirdropEvent[]) => { | ||
for (const event of events) { | ||
try { | ||
await installInitialDomainMapping(event, initialDomainMapping); | ||
} catch (error) { | ||
console.error('Failed to install initial domain mappings', error); | ||
throw error; | ||
} | ||
} | ||
}; | ||
|
||
export default run; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters