Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ export function replaceReferencesWith(
? fields.source[cleanedIndex]
: fields[cleanedIndex];
if (field) {
console.log(
`integrify: Detected dynamic reference, replacing [${match}] with [${field}]`
);
// console.log(
// `integrify: Detected dynamic reference, replacing [${match}] with [${field}]`
// );
targetCollection = targetCollection.replace(match, field);
} else {
throw new Error(`integrify: Missing dynamic reference: [${match}]`);
Expand Down
14 changes: 7 additions & 7 deletions src/rules/deleteReferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ export function integrifyDeleteReferences(
): CloudFunction<QueryDocumentSnapshot> {
const functions = config.config.functions;

rule.targets.forEach(target =>
console.log(
`integrify: Creating function to delete all references to source [${rule.source.collection}] from [${target.collection}] linked by key [${target.foreignKey}]`
)
);
// rule.targets.forEach(target =>
// console.log(
// `integrify: Creating function to delete all references to source [${rule.source.collection}] from [${target.collection}] linked by key [${target.foreignKey}]`
// )
// );

const { hasPrimaryKey, primaryKey } = getPrimaryKey(rule.source.collection);
if (!hasPrimaryKey) {
Expand All @@ -64,7 +64,7 @@ export function integrifyDeleteReferences(
// Call "pre" hook if defined
if (rule.hooks && rule.hooks.pre) {
await rule.hooks.pre(snap, context);
console.log(`integrify: Running pre-hook: ${rule.hooks.pre}`);
// console.log(`integrify: Running pre-hook: ${rule.hooks.pre}`);
}

// Loop over each target
Expand Down Expand Up @@ -132,7 +132,7 @@ export function integrifyDeleteReferences(
// Call "post" hook if defined
if (rule.hooks && rule.hooks.post) {
await rule.hooks.post(snap, context);
console.log(`integrify: Running post-hook: ${rule.hooks.post}`);
// console.log(`integrify: Running post-hook: ${rule.hooks.post}`);
}
});
}
22 changes: 11 additions & 11 deletions src/rules/replicateAttributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ export function integrifyReplicateAttributes(
): CloudFunction<Change<QueryDocumentSnapshot>> {
const functions = config.config.functions;

console.log(
`integrify: Creating function to replicate source collection [${rule.source.collection}]`
);
rule.targets.forEach(target => {
Object.keys(target.attributeMapping).forEach(sourceAttribute => {
console.log(
`integrify: Replicating [${rule.source.collection}].[${sourceAttribute}] => [${target.collection}].[${target.attributeMapping[sourceAttribute]}]`
);
});
});
// console.log(
// `integrify: Creating function to replicate source collection [${rule.source.collection}]`
// );
// rule.targets.forEach(target => {
// Object.keys(target.attributeMapping).forEach(sourceAttribute => {
// console.log(
// `integrify: Replicating [${rule.source.collection}].[${sourceAttribute}] => [${target.collection}].[${target.attributeMapping[sourceAttribute]}]`
// );
// });
// });

const { hasPrimaryKey, primaryKey } = getPrimaryKey(rule.source.collection);
if (!hasPrimaryKey) {
Expand Down Expand Up @@ -78,7 +78,7 @@ export function integrifyReplicateAttributes(
// Call "pre" hook if defined
if (rule.hooks && rule.hooks.pre) {
await rule.hooks.pre(change, context);
console.log(`integrify: Running pre-hook: ${rule.hooks.pre}`);
// console.log(`integrify: Running pre-hook: ${rule.hooks.pre}`);
}

// Check if at least one of the attributes to be replicated was changed
Expand Down