Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit e57bb7a

Browse files
Dan Leedataform.co
authored andcommitted
make declarations optional
1 parent 12a38b9 commit e57bb7a

1 file changed

Lines changed: 22 additions & 17 deletions

File tree

index.js

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,37 @@ module.exports = (params) => {
1515
customPageFields: [], // list of custom fields to extract from the pages table
1616
customUserFields: [], // list of custom fields to extract from the identifies table
1717
customTrackFields: [], // list of custom fields to extract from the tracks table
18+
declareSources: true,
1819
...params
1920
};
2021

2122
const {
2223
defaultConfig,
23-
segmentSchema
24+
segmentSchema,
25+
declareSources
2426
} = params;
27+
28+
let identifies, pages, tracks;
2529

26-
// Declare the source segment tables.
27-
const identifies = declare({
28-
...defaultConfig,
29-
schema: segmentSchema,
30-
name: "identifies"
31-
});
30+
if (declareSources) {
31+
identifies = declare({
32+
...defaultConfig,
33+
schema: segmentSchema,
34+
name: "identifies"
35+
});
3236

33-
const pages = declare({
34-
...defaultConfig,
35-
schema: segmentSchema,
36-
name: "pages"
37-
});
37+
pages = declare({
38+
...defaultConfig,
39+
schema: segmentSchema,
40+
name: "pages"
41+
});
3842

39-
const tracks = declare({
40-
...defaultConfig,
41-
schema: segmentSchema,
42-
name: "tracks"
43-
});
43+
tracks = declare({
44+
...defaultConfig,
45+
schema: segmentSchema,
46+
name: "tracks"
47+
});
48+
}
4449

4550
// Publish and return datasets.
4651
return {

0 commit comments

Comments
 (0)