agrs-sequelize-sdk 1.1.9 → 1.1.11
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/models/AdAccount.js +4 -0
- package/models/AdAccountValues.js +25 -25
- package/models/AdHistory.js +30 -30
- package/models/AdSetHistory.js +30 -30
- package/models/Buyers.js +25 -25
- package/models/CampaignHistory.js +33 -33
- package/models/Domain.js +25 -25
- package/models/Feed.js +33 -33
- package/models/KeywordPerformance.js +4 -0
- package/models/Pages.js +34 -34
- package/models/PipelineExecution.js +46 -46
- package/models/RulesValues.js +30 -30
- package/models/Vertical.js +25 -25
- package/models/newFiles.js +68 -68
- package/package.json +21 -19
- package/run.sh +214 -214
package/models/AdAccount.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const AdAccountValues = sequelize.define(
|
|
3
|
-
"AdAccountValues",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
name: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
code: {
|
|
15
|
-
type: DataTypes.STRING,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
unique: true,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
tableName: "AdAccountValues",
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return AdAccountValues;
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const AdAccountValues = sequelize.define(
|
|
3
|
+
"AdAccountValues",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
code: {
|
|
15
|
+
type: DataTypes.STRING,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
unique: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
tableName: "AdAccountValues",
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return AdAccountValues;
|
|
26
26
|
};
|
package/models/AdHistory.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const AdHistory = sequelize.define(
|
|
3
|
-
"AdHistory",
|
|
4
|
-
{
|
|
5
|
-
HistoryID: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
AdID: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
DataSnapshot: {
|
|
15
|
-
type: DataTypes.JSONB, // Store the full Ad row as a JSON object
|
|
16
|
-
allowNull: false,
|
|
17
|
-
},
|
|
18
|
-
timestamp: {
|
|
19
|
-
type: DataTypes.DATE,
|
|
20
|
-
defaultValue: DataTypes.NOW,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
tableName: "AdHistory",
|
|
25
|
-
timestamps: false, // Disable Sequelize timestamps
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
return AdHistory;
|
|
30
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const AdHistory = sequelize.define(
|
|
3
|
+
"AdHistory",
|
|
4
|
+
{
|
|
5
|
+
HistoryID: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
AdID: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
DataSnapshot: {
|
|
15
|
+
type: DataTypes.JSONB, // Store the full Ad row as a JSON object
|
|
16
|
+
allowNull: false,
|
|
17
|
+
},
|
|
18
|
+
timestamp: {
|
|
19
|
+
type: DataTypes.DATE,
|
|
20
|
+
defaultValue: DataTypes.NOW,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
tableName: "AdHistory",
|
|
25
|
+
timestamps: false, // Disable Sequelize timestamps
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return AdHistory;
|
|
30
|
+
};
|
package/models/AdSetHistory.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const AdSetHistory = sequelize.define(
|
|
3
|
-
"AdSetHistory",
|
|
4
|
-
{
|
|
5
|
-
HistoryID: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
AdSetID: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
DataSnapshot: {
|
|
15
|
-
type: DataTypes.JSONB, // Store the full AdSet row as a JSON object
|
|
16
|
-
allowNull: false,
|
|
17
|
-
},
|
|
18
|
-
timestamp: {
|
|
19
|
-
type: DataTypes.DATE,
|
|
20
|
-
defaultValue: DataTypes.NOW,
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
tableName: "AdSetHistory",
|
|
25
|
-
timestamps: false,
|
|
26
|
-
}
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
return AdSetHistory;
|
|
30
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const AdSetHistory = sequelize.define(
|
|
3
|
+
"AdSetHistory",
|
|
4
|
+
{
|
|
5
|
+
HistoryID: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
AdSetID: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
DataSnapshot: {
|
|
15
|
+
type: DataTypes.JSONB, // Store the full AdSet row as a JSON object
|
|
16
|
+
allowNull: false,
|
|
17
|
+
},
|
|
18
|
+
timestamp: {
|
|
19
|
+
type: DataTypes.DATE,
|
|
20
|
+
defaultValue: DataTypes.NOW,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
tableName: "AdSetHistory",
|
|
25
|
+
timestamps: false,
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
return AdSetHistory;
|
|
30
|
+
};
|
package/models/Buyers.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Buyers = sequelize.define(
|
|
3
|
-
"Buyers",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
name: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
code: {
|
|
15
|
-
type: DataTypes.STRING,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
unique: true,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
tableName: "Buyers",
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return Buyers;
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const Buyers = sequelize.define(
|
|
3
|
+
"Buyers",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
code: {
|
|
15
|
+
type: DataTypes.STRING,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
unique: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
tableName: "Buyers",
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return Buyers;
|
|
26
26
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const CampaignHistory = sequelize.define(
|
|
3
|
-
"CampaignHistory",
|
|
4
|
-
{
|
|
5
|
-
HistoryID: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
CampaignID: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
TableName: {
|
|
15
|
-
type: DataTypes.STRING, // Useful for multi-table history tracking
|
|
16
|
-
defaultValue: "Campaign",
|
|
17
|
-
},
|
|
18
|
-
DataSnapshot: {
|
|
19
|
-
type: DataTypes.JSONB, // Store the entire row as JSON
|
|
20
|
-
allowNull: false,
|
|
21
|
-
},
|
|
22
|
-
timestamp: {
|
|
23
|
-
type: DataTypes.DATE,
|
|
24
|
-
defaultValue: DataTypes.NOW,
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
tableName: "CampaignHistory",
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
return CampaignHistory;
|
|
33
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const CampaignHistory = sequelize.define(
|
|
3
|
+
"CampaignHistory",
|
|
4
|
+
{
|
|
5
|
+
HistoryID: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
CampaignID: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
TableName: {
|
|
15
|
+
type: DataTypes.STRING, // Useful for multi-table history tracking
|
|
16
|
+
defaultValue: "Campaign",
|
|
17
|
+
},
|
|
18
|
+
DataSnapshot: {
|
|
19
|
+
type: DataTypes.JSONB, // Store the entire row as JSON
|
|
20
|
+
allowNull: false,
|
|
21
|
+
},
|
|
22
|
+
timestamp: {
|
|
23
|
+
type: DataTypes.DATE,
|
|
24
|
+
defaultValue: DataTypes.NOW,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
tableName: "CampaignHistory",
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
return CampaignHistory;
|
|
33
|
+
};
|
package/models/Domain.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Domain = sequelize.define(
|
|
3
|
-
"Domain",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
name: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
code: {
|
|
15
|
-
type: DataTypes.STRING,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
unique: true,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
tableName: "Domain",
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return Domain;
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const Domain = sequelize.define(
|
|
3
|
+
"Domain",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
code: {
|
|
15
|
+
type: DataTypes.STRING,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
unique: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
tableName: "Domain",
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return Domain;
|
|
26
26
|
};
|
package/models/Feed.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Feed = sequelize.define(
|
|
3
|
-
"Feed",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
label: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
code: {
|
|
15
|
-
type: DataTypes.STRING,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
unique: true,
|
|
18
|
-
},
|
|
19
|
-
sheet: {
|
|
20
|
-
type: DataTypes.STRING,
|
|
21
|
-
allowNull: false,
|
|
22
|
-
},
|
|
23
|
-
feedProvider: {
|
|
24
|
-
type: DataTypes.STRING,
|
|
25
|
-
allowNull: false,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
tableName: "Feed",
|
|
30
|
-
}
|
|
31
|
-
);
|
|
32
|
-
|
|
33
|
-
return Feed;
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const Feed = sequelize.define(
|
|
3
|
+
"Feed",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
label: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
code: {
|
|
15
|
+
type: DataTypes.STRING,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
unique: true,
|
|
18
|
+
},
|
|
19
|
+
sheet: {
|
|
20
|
+
type: DataTypes.STRING,
|
|
21
|
+
allowNull: false,
|
|
22
|
+
},
|
|
23
|
+
feedProvider: {
|
|
24
|
+
type: DataTypes.STRING,
|
|
25
|
+
allowNull: false,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
tableName: "Feed",
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
return Feed;
|
|
34
34
|
};
|
package/models/Pages.js
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Pages = sequelize.define(
|
|
3
|
-
"Pages",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
name: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
code: {
|
|
15
|
-
type: DataTypes.STRING,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
unique: true,
|
|
18
|
-
},
|
|
19
|
-
link: {
|
|
20
|
-
type: DataTypes.STRING,
|
|
21
|
-
allowNull: true,
|
|
22
|
-
},
|
|
23
|
-
feedProvider: {
|
|
24
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
25
|
-
allowNull: false,
|
|
26
|
-
defaultValue: [], // Default value is an empty array
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
tableName: "Pages",
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
return Pages;
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const Pages = sequelize.define(
|
|
3
|
+
"Pages",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
code: {
|
|
15
|
+
type: DataTypes.STRING,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
unique: true,
|
|
18
|
+
},
|
|
19
|
+
link: {
|
|
20
|
+
type: DataTypes.STRING,
|
|
21
|
+
allowNull: true,
|
|
22
|
+
},
|
|
23
|
+
feedProvider: {
|
|
24
|
+
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
25
|
+
allowNull: false,
|
|
26
|
+
defaultValue: [], // Default value is an empty array
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
tableName: "Pages",
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return Pages;
|
|
35
35
|
};
|
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const PipelineExecution = sequelize.define(
|
|
3
|
-
"PipelineExecution",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
startTime: {
|
|
11
|
-
type: DataTypes.DATE,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
endTime: {
|
|
15
|
-
type: DataTypes.DATE,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
},
|
|
18
|
-
status: {
|
|
19
|
-
type: DataTypes.ENUM("success", "failed"),
|
|
20
|
-
allowNull: false,
|
|
21
|
-
},
|
|
22
|
-
fbDaysBack: {
|
|
23
|
-
type: DataTypes.INTEGER,
|
|
24
|
-
allowNull: true,
|
|
25
|
-
},
|
|
26
|
-
codeFuelDaysBack: {
|
|
27
|
-
type: DataTypes.INTEGER,
|
|
28
|
-
allowNull: true,
|
|
29
|
-
},
|
|
30
|
-
tonicDaysBack: {
|
|
31
|
-
type: DataTypes.INTEGER,
|
|
32
|
-
allowNull: true,
|
|
33
|
-
},
|
|
34
|
-
error: {
|
|
35
|
-
type: DataTypes.TEXT,
|
|
36
|
-
allowNull: true,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
tableName: "pipeline_executions",
|
|
41
|
-
timestamps: true,
|
|
42
|
-
}
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
return PipelineExecution;
|
|
46
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const PipelineExecution = sequelize.define(
|
|
3
|
+
"PipelineExecution",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
startTime: {
|
|
11
|
+
type: DataTypes.DATE,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
endTime: {
|
|
15
|
+
type: DataTypes.DATE,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
},
|
|
18
|
+
status: {
|
|
19
|
+
type: DataTypes.ENUM("success", "failed"),
|
|
20
|
+
allowNull: false,
|
|
21
|
+
},
|
|
22
|
+
fbDaysBack: {
|
|
23
|
+
type: DataTypes.INTEGER,
|
|
24
|
+
allowNull: true,
|
|
25
|
+
},
|
|
26
|
+
codeFuelDaysBack: {
|
|
27
|
+
type: DataTypes.INTEGER,
|
|
28
|
+
allowNull: true,
|
|
29
|
+
},
|
|
30
|
+
tonicDaysBack: {
|
|
31
|
+
type: DataTypes.INTEGER,
|
|
32
|
+
allowNull: true,
|
|
33
|
+
},
|
|
34
|
+
error: {
|
|
35
|
+
type: DataTypes.TEXT,
|
|
36
|
+
allowNull: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
tableName: "pipeline_executions",
|
|
41
|
+
timestamps: true,
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return PipelineExecution;
|
|
46
|
+
};
|
package/models/RulesValues.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const RulesValues = sequelize.define(
|
|
3
|
-
"RulesValues",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
name: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
code: {
|
|
15
|
-
type: DataTypes.STRING,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
unique: true,
|
|
18
|
-
},
|
|
19
|
-
permissions: {
|
|
20
|
-
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
21
|
-
allowNull: false,
|
|
22
|
-
defaultValue: [], // Default value is an empty array
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
tableName: "RulesValues",
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
return RulesValues;
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const RulesValues = sequelize.define(
|
|
3
|
+
"RulesValues",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
code: {
|
|
15
|
+
type: DataTypes.STRING,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
unique: true,
|
|
18
|
+
},
|
|
19
|
+
permissions: {
|
|
20
|
+
type: DataTypes.ARRAY(DataTypes.STRING),
|
|
21
|
+
allowNull: false,
|
|
22
|
+
defaultValue: [], // Default value is an empty array
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
tableName: "RulesValues",
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
return RulesValues;
|
|
31
31
|
};
|
package/models/Vertical.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const Vertical = sequelize.define(
|
|
3
|
-
"Vertical",
|
|
4
|
-
{
|
|
5
|
-
id: {
|
|
6
|
-
type: DataTypes.UUID,
|
|
7
|
-
defaultValue: DataTypes.UUIDV4,
|
|
8
|
-
primaryKey: true,
|
|
9
|
-
},
|
|
10
|
-
name: {
|
|
11
|
-
type: DataTypes.STRING,
|
|
12
|
-
allowNull: false,
|
|
13
|
-
},
|
|
14
|
-
code: {
|
|
15
|
-
type: DataTypes.STRING,
|
|
16
|
-
allowNull: false,
|
|
17
|
-
unique: true,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
tableName: "Vertical",
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
return Vertical;
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const Vertical = sequelize.define(
|
|
3
|
+
"Vertical",
|
|
4
|
+
{
|
|
5
|
+
id: {
|
|
6
|
+
type: DataTypes.UUID,
|
|
7
|
+
defaultValue: DataTypes.UUIDV4,
|
|
8
|
+
primaryKey: true,
|
|
9
|
+
},
|
|
10
|
+
name: {
|
|
11
|
+
type: DataTypes.STRING,
|
|
12
|
+
allowNull: false,
|
|
13
|
+
},
|
|
14
|
+
code: {
|
|
15
|
+
type: DataTypes.STRING,
|
|
16
|
+
allowNull: false,
|
|
17
|
+
unique: true,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
tableName: "Vertical",
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
return Vertical;
|
|
26
26
|
};
|
package/models/newFiles.js
CHANGED
|
@@ -1,68 +1,68 @@
|
|
|
1
|
-
module.exports = (sequelize, DataTypes) => {
|
|
2
|
-
const NewFiles = sequelize.define("NewFiles", {
|
|
3
|
-
id: {
|
|
4
|
-
type: DataTypes.STRING,
|
|
5
|
-
primaryKey: true,
|
|
6
|
-
},
|
|
7
|
-
accounts: {
|
|
8
|
-
type: DataTypes.JSONB(),
|
|
9
|
-
allowNull: true,
|
|
10
|
-
},
|
|
11
|
-
name: {
|
|
12
|
-
type: DataTypes.STRING,
|
|
13
|
-
allowNull: false,
|
|
14
|
-
},
|
|
15
|
-
// need to add a field of the name in the gcp bucket
|
|
16
|
-
gcpFileName: {
|
|
17
|
-
type: DataTypes.STRING,
|
|
18
|
-
allowNull: true,
|
|
19
|
-
},
|
|
20
|
-
type: {
|
|
21
|
-
type: DataTypes.STRING, // Can be "image" or "video"
|
|
22
|
-
allowNull: false,
|
|
23
|
-
},
|
|
24
|
-
URL: {
|
|
25
|
-
type: DataTypes.STRING, // URL for the file
|
|
26
|
-
allowNull: false,
|
|
27
|
-
},
|
|
28
|
-
FileType: {
|
|
29
|
-
type: DataTypes.STRING,
|
|
30
|
-
allowNull: true,
|
|
31
|
-
defaultValue: "image",
|
|
32
|
-
},
|
|
33
|
-
Size: {
|
|
34
|
-
type: DataTypes.STRING,
|
|
35
|
-
allowNull: true,
|
|
36
|
-
},
|
|
37
|
-
Language: {
|
|
38
|
-
type: DataTypes.STRING,
|
|
39
|
-
allowNull: true,
|
|
40
|
-
},
|
|
41
|
-
Vertical: {
|
|
42
|
-
type: DataTypes.STRING,
|
|
43
|
-
allowNull: true,
|
|
44
|
-
},
|
|
45
|
-
// want to add length ( duration of the video) if the file is a video.
|
|
46
|
-
// maybe call it duration
|
|
47
|
-
Duration: {
|
|
48
|
-
type: DataTypes.STRING,
|
|
49
|
-
allowNull: true,
|
|
50
|
-
},
|
|
51
|
-
// Thumbnail URL
|
|
52
|
-
Thumbnail: {
|
|
53
|
-
type: DataTypes.TEXT,
|
|
54
|
-
allowNull: true,
|
|
55
|
-
},
|
|
56
|
-
Thumbnai2: {
|
|
57
|
-
type: DataTypes.TEXT,
|
|
58
|
-
allowNull: true,
|
|
59
|
-
},
|
|
60
|
-
// ImageHash
|
|
61
|
-
ImageHash: {
|
|
62
|
-
type: DataTypes.STRING,
|
|
63
|
-
allowNull: true,
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
return NewFiles;
|
|
68
|
-
};
|
|
1
|
+
module.exports = (sequelize, DataTypes) => {
|
|
2
|
+
const NewFiles = sequelize.define("NewFiles", {
|
|
3
|
+
id: {
|
|
4
|
+
type: DataTypes.STRING,
|
|
5
|
+
primaryKey: true,
|
|
6
|
+
},
|
|
7
|
+
accounts: {
|
|
8
|
+
type: DataTypes.JSONB(),
|
|
9
|
+
allowNull: true,
|
|
10
|
+
},
|
|
11
|
+
name: {
|
|
12
|
+
type: DataTypes.STRING,
|
|
13
|
+
allowNull: false,
|
|
14
|
+
},
|
|
15
|
+
// need to add a field of the name in the gcp bucket
|
|
16
|
+
gcpFileName: {
|
|
17
|
+
type: DataTypes.STRING,
|
|
18
|
+
allowNull: true,
|
|
19
|
+
},
|
|
20
|
+
type: {
|
|
21
|
+
type: DataTypes.STRING, // Can be "image" or "video"
|
|
22
|
+
allowNull: false,
|
|
23
|
+
},
|
|
24
|
+
URL: {
|
|
25
|
+
type: DataTypes.STRING, // URL for the file
|
|
26
|
+
allowNull: false,
|
|
27
|
+
},
|
|
28
|
+
FileType: {
|
|
29
|
+
type: DataTypes.STRING,
|
|
30
|
+
allowNull: true,
|
|
31
|
+
defaultValue: "image",
|
|
32
|
+
},
|
|
33
|
+
Size: {
|
|
34
|
+
type: DataTypes.STRING,
|
|
35
|
+
allowNull: true,
|
|
36
|
+
},
|
|
37
|
+
Language: {
|
|
38
|
+
type: DataTypes.STRING,
|
|
39
|
+
allowNull: true,
|
|
40
|
+
},
|
|
41
|
+
Vertical: {
|
|
42
|
+
type: DataTypes.STRING,
|
|
43
|
+
allowNull: true,
|
|
44
|
+
},
|
|
45
|
+
// want to add length ( duration of the video) if the file is a video.
|
|
46
|
+
// maybe call it duration
|
|
47
|
+
Duration: {
|
|
48
|
+
type: DataTypes.STRING,
|
|
49
|
+
allowNull: true,
|
|
50
|
+
},
|
|
51
|
+
// Thumbnail URL
|
|
52
|
+
Thumbnail: {
|
|
53
|
+
type: DataTypes.TEXT,
|
|
54
|
+
allowNull: true,
|
|
55
|
+
},
|
|
56
|
+
Thumbnai2: {
|
|
57
|
+
type: DataTypes.TEXT,
|
|
58
|
+
allowNull: true,
|
|
59
|
+
},
|
|
60
|
+
// ImageHash
|
|
61
|
+
ImageHash: {
|
|
62
|
+
type: DataTypes.STRING,
|
|
63
|
+
allowNull: true,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return NewFiles;
|
|
68
|
+
};
|
package/package.json
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "agrs-sequelize-sdk",
|
|
3
|
+
"version": "1.1.11",
|
|
4
|
+
"main": "index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "node index.js",
|
|
7
|
+
"sync": "node services/sequelizeService.js",
|
|
8
|
+
"test": "echo \"Error: no test specified\" \u0026\u0026 exit 1"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
|
|
12
|
+
],
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"description": "",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"pg": "^8.13.0",
|
|
18
|
+
"pg-hstore": "^2.3.4",
|
|
19
|
+
"sequelize": "^6.37.4"
|
|
20
|
+
}
|
|
21
|
+
}
|
package/run.sh
CHANGED
|
@@ -1,214 +1,214 @@
|
|
|
1
|
-
# #!/bin/bash
|
|
2
|
-
|
|
3
|
-
# # Check if root is only required for jq installation
|
|
4
|
-
# require_root_for_jq=0
|
|
5
|
-
|
|
6
|
-
# # Check if jq is installed
|
|
7
|
-
# if ! command -v jq &> /dev/null; then
|
|
8
|
-
# echo "jq not found. Installing jq..."
|
|
9
|
-
# require_root_for_jq=1
|
|
10
|
-
# if command -v apt-get &> /dev/null; then
|
|
11
|
-
# sudo apt-get update && sudo apt-get install -y jq
|
|
12
|
-
# elif command -v brew &> /dev/null; then
|
|
13
|
-
# brew install jq
|
|
14
|
-
# else
|
|
15
|
-
# echo "Please install jq manually."
|
|
16
|
-
# exit 1
|
|
17
|
-
# fi
|
|
18
|
-
# fi
|
|
19
|
-
|
|
20
|
-
# # Only require root if jq installation was needed
|
|
21
|
-
# if [[ $require_root_for_jq -eq 1 && $EUID -ne 0 ]]; then
|
|
22
|
-
# echo "This script must be run as root for jq installation. Please use sudo."
|
|
23
|
-
# exit 1
|
|
24
|
-
# fi
|
|
25
|
-
|
|
26
|
-
# # Step 1: Check if logged in to NPM
|
|
27
|
-
# npmUsername=$(npm whoami 2>&1)
|
|
28
|
-
# if [[ $npmUsername == *"ERR"* ]]; then
|
|
29
|
-
# echo "Not logged in. Please log in to NPM."
|
|
30
|
-
# npm login
|
|
31
|
-
# if [[ $? -ne 0 ]]; then
|
|
32
|
-
# echo "NPM login failed. Exiting..."
|
|
33
|
-
# exit 1
|
|
34
|
-
# fi
|
|
35
|
-
# else
|
|
36
|
-
# echo "Already logged in to NPM as $npmUsername"
|
|
37
|
-
# fi
|
|
38
|
-
|
|
39
|
-
# # Step 2: Increment version in package.json
|
|
40
|
-
# if [[ ! -f package.json ]]; then
|
|
41
|
-
# echo "package.json not found. Exiting..."
|
|
42
|
-
# exit 1
|
|
43
|
-
# fi
|
|
44
|
-
|
|
45
|
-
# currentVersion=$(jq -r '.version' package.json)
|
|
46
|
-
|
|
47
|
-
# if [[ -z "$currentVersion" ]]; then
|
|
48
|
-
# echo "Could not find version in package.json"
|
|
49
|
-
# exit 1
|
|
50
|
-
# fi
|
|
51
|
-
|
|
52
|
-
# # Split version into major, minor, patch
|
|
53
|
-
# IFS='.' read -r major minor patch <<< "$currentVersion"
|
|
54
|
-
|
|
55
|
-
# # Increment version numbers with three-digit logic
|
|
56
|
-
# if [[ $patch -eq 99 ]]; then
|
|
57
|
-
# patch=0
|
|
58
|
-
# if [[ $minor -eq 99 ]]; then
|
|
59
|
-
# minor=0
|
|
60
|
-
# ((major++))
|
|
61
|
-
# else
|
|
62
|
-
# ((minor++))
|
|
63
|
-
# fi
|
|
64
|
-
# else
|
|
65
|
-
# ((patch++))
|
|
66
|
-
# fi
|
|
67
|
-
|
|
68
|
-
# newVersion="$major.$minor.$patch"
|
|
69
|
-
|
|
70
|
-
# # Update the version in package.json while maintaining formatting
|
|
71
|
-
# jq --arg version "$newVersion" '.version = $version' package.json > tmp.json && mv tmp.json package.json
|
|
72
|
-
# echo "Version updated from $currentVersion to $newVersion"
|
|
73
|
-
|
|
74
|
-
# # Step 3: Publish the package to NPM
|
|
75
|
-
# npm publish
|
|
76
|
-
# if [[ $? -ne 0 ]]; then
|
|
77
|
-
# echo "NPM publish failed. Exiting..."
|
|
78
|
-
# exit 1
|
|
79
|
-
# fi
|
|
80
|
-
|
|
81
|
-
# # Step 4: Commit the changes and push to GitHub
|
|
82
|
-
# git add .
|
|
83
|
-
# git commit -m "Bump version to $newVersion"
|
|
84
|
-
# git push origin main
|
|
85
|
-
|
|
86
|
-
# if [[ $? -ne 0 ]]; then
|
|
87
|
-
# echo "Failed to push changes to GitHub. Exiting..."
|
|
88
|
-
# exit 1
|
|
89
|
-
# fi
|
|
90
|
-
|
|
91
|
-
# echo "Version $newVersion published and changes pushed to GitHub successfully!"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
#!/bin/bash
|
|
95
|
-
|
|
96
|
-
# Check if root is only required for jq installation
|
|
97
|
-
require_root_for_jq=0
|
|
98
|
-
|
|
99
|
-
# Check if jq is installed
|
|
100
|
-
if ! command -v jq &> /dev/null; then
|
|
101
|
-
echo "jq not found. Installing jq..."
|
|
102
|
-
require_root_for_jq=1
|
|
103
|
-
if command -v apt-get &> /dev/null; then
|
|
104
|
-
sudo apt-get update && sudo apt-get install -y jq
|
|
105
|
-
elif command -v brew &> /dev/null; then
|
|
106
|
-
brew install jq
|
|
107
|
-
else
|
|
108
|
-
echo "Please install jq manually."
|
|
109
|
-
exit 1
|
|
110
|
-
fi
|
|
111
|
-
fi
|
|
112
|
-
|
|
113
|
-
# Only require root if jq installation was needed
|
|
114
|
-
if [[ $require_root_for_jq -eq 1 && $EUID -ne 0 ]]; then
|
|
115
|
-
echo "This script must be run as root for jq installation. Please use sudo."
|
|
116
|
-
exit 1
|
|
117
|
-
fi
|
|
118
|
-
|
|
119
|
-
# Step 1: Check if logged in to NPM
|
|
120
|
-
npmUsername=$(npm whoami 2>&1)
|
|
121
|
-
if [[ $npmUsername == *"ERR"* ]]; then
|
|
122
|
-
echo "Not logged in. Please log in to NPM."
|
|
123
|
-
npm login
|
|
124
|
-
if [[ $? -ne 0 ]]; then
|
|
125
|
-
echo "NPM login failed. Exiting..."
|
|
126
|
-
exit 1
|
|
127
|
-
fi
|
|
128
|
-
else
|
|
129
|
-
echo "Already logged in to NPM as $npmUsername"
|
|
130
|
-
fi
|
|
131
|
-
|
|
132
|
-
# Step 2: Check the latest published version from NPM
|
|
133
|
-
packageName=$(jq -r '.name' package.json)
|
|
134
|
-
if [[ -z "$packageName" ]]; then
|
|
135
|
-
echo "Could not find package name in package.json"
|
|
136
|
-
exit 1
|
|
137
|
-
fi
|
|
138
|
-
|
|
139
|
-
latestPublishedVersion=$(npm view "$packageName" version)
|
|
140
|
-
if [[ $? -ne 0 ]]; then
|
|
141
|
-
echo "Failed to fetch the latest published version. Exiting..."
|
|
142
|
-
exit 1
|
|
143
|
-
fi
|
|
144
|
-
|
|
145
|
-
echo "Latest published version on NPM: $latestPublishedVersion"
|
|
146
|
-
|
|
147
|
-
# Step 3: Increment version in package.json
|
|
148
|
-
if [[ ! -f package.json ]]; then
|
|
149
|
-
echo "package.json not found. Exiting..."
|
|
150
|
-
exit 1
|
|
151
|
-
fi
|
|
152
|
-
|
|
153
|
-
currentVersion=$(jq -r '.version' package.json)
|
|
154
|
-
|
|
155
|
-
if [[ -z "$currentVersion" ]]; then
|
|
156
|
-
echo "Could not find version in package.json"
|
|
157
|
-
exit 1
|
|
158
|
-
fi
|
|
159
|
-
|
|
160
|
-
# Split version into major, minor, patch
|
|
161
|
-
IFS='.' read -r major minor patch <<< "$currentVersion"
|
|
162
|
-
|
|
163
|
-
# Increment version numbers with three-digit logic
|
|
164
|
-
if [[ $patch -eq 99 ]]; then
|
|
165
|
-
patch=0
|
|
166
|
-
if [[ $minor -eq 99 ]]; then
|
|
167
|
-
minor=0
|
|
168
|
-
((major++))
|
|
169
|
-
else
|
|
170
|
-
((minor++))
|
|
171
|
-
fi
|
|
172
|
-
else
|
|
173
|
-
((patch++))
|
|
174
|
-
fi
|
|
175
|
-
|
|
176
|
-
newVersion="$major.$minor.$patch"
|
|
177
|
-
|
|
178
|
-
# Ensure the new version is greater than the latest published version
|
|
179
|
-
if [[ "$(printf '%s\n' "$newVersion" "$latestPublishedVersion" | sort -V | tail -1)" != "$newVersion" ]]; then
|
|
180
|
-
echo "Error: New version ($newVersion) is not greater than the latest published version ($latestPublishedVersion)."
|
|
181
|
-
echo "Please manually update the version in package.json or adjust the script logic."
|
|
182
|
-
exit 1
|
|
183
|
-
fi
|
|
184
|
-
|
|
185
|
-
# Update the version in package.json while maintaining formatting
|
|
186
|
-
jq --arg version "$newVersion" '.version = $version' package.json > tmp.json && mv tmp.json package.json
|
|
187
|
-
echo "Version updated from $currentVersion to $newVersion"
|
|
188
|
-
|
|
189
|
-
# Step 4: Publish the package to NPM
|
|
190
|
-
npm publish
|
|
191
|
-
if [[ $? -ne 0 ]]; then
|
|
192
|
-
echo "NPM publish failed. Exiting..."
|
|
193
|
-
exit 1
|
|
194
|
-
fi
|
|
195
|
-
|
|
196
|
-
# Step 5: Commit the changes and push to GitHub
|
|
197
|
-
git add .
|
|
198
|
-
git commit -m "Bump version to $newVersion"
|
|
199
|
-
|
|
200
|
-
# Pull latest changes to ensure there are no conflicts
|
|
201
|
-
git pull origin main --rebase
|
|
202
|
-
if [[ $? -ne 0 ]]; then
|
|
203
|
-
echo "Git pull failed. Please resolve conflicts manually. Exiting..."
|
|
204
|
-
exit 1
|
|
205
|
-
fi
|
|
206
|
-
|
|
207
|
-
# Push changes to remote
|
|
208
|
-
git push origin main
|
|
209
|
-
if [[ $? -ne 0 ]]; then
|
|
210
|
-
echo "Failed to push changes to GitHub. Exiting..."
|
|
211
|
-
exit 1
|
|
212
|
-
fi
|
|
213
|
-
|
|
214
|
-
echo "Version $newVersion published and changes pushed to GitHub successfully!"
|
|
1
|
+
# #!/bin/bash
|
|
2
|
+
|
|
3
|
+
# # Check if root is only required for jq installation
|
|
4
|
+
# require_root_for_jq=0
|
|
5
|
+
|
|
6
|
+
# # Check if jq is installed
|
|
7
|
+
# if ! command -v jq &> /dev/null; then
|
|
8
|
+
# echo "jq not found. Installing jq..."
|
|
9
|
+
# require_root_for_jq=1
|
|
10
|
+
# if command -v apt-get &> /dev/null; then
|
|
11
|
+
# sudo apt-get update && sudo apt-get install -y jq
|
|
12
|
+
# elif command -v brew &> /dev/null; then
|
|
13
|
+
# brew install jq
|
|
14
|
+
# else
|
|
15
|
+
# echo "Please install jq manually."
|
|
16
|
+
# exit 1
|
|
17
|
+
# fi
|
|
18
|
+
# fi
|
|
19
|
+
|
|
20
|
+
# # Only require root if jq installation was needed
|
|
21
|
+
# if [[ $require_root_for_jq -eq 1 && $EUID -ne 0 ]]; then
|
|
22
|
+
# echo "This script must be run as root for jq installation. Please use sudo."
|
|
23
|
+
# exit 1
|
|
24
|
+
# fi
|
|
25
|
+
|
|
26
|
+
# # Step 1: Check if logged in to NPM
|
|
27
|
+
# npmUsername=$(npm whoami 2>&1)
|
|
28
|
+
# if [[ $npmUsername == *"ERR"* ]]; then
|
|
29
|
+
# echo "Not logged in. Please log in to NPM."
|
|
30
|
+
# npm login
|
|
31
|
+
# if [[ $? -ne 0 ]]; then
|
|
32
|
+
# echo "NPM login failed. Exiting..."
|
|
33
|
+
# exit 1
|
|
34
|
+
# fi
|
|
35
|
+
# else
|
|
36
|
+
# echo "Already logged in to NPM as $npmUsername"
|
|
37
|
+
# fi
|
|
38
|
+
|
|
39
|
+
# # Step 2: Increment version in package.json
|
|
40
|
+
# if [[ ! -f package.json ]]; then
|
|
41
|
+
# echo "package.json not found. Exiting..."
|
|
42
|
+
# exit 1
|
|
43
|
+
# fi
|
|
44
|
+
|
|
45
|
+
# currentVersion=$(jq -r '.version' package.json)
|
|
46
|
+
|
|
47
|
+
# if [[ -z "$currentVersion" ]]; then
|
|
48
|
+
# echo "Could not find version in package.json"
|
|
49
|
+
# exit 1
|
|
50
|
+
# fi
|
|
51
|
+
|
|
52
|
+
# # Split version into major, minor, patch
|
|
53
|
+
# IFS='.' read -r major minor patch <<< "$currentVersion"
|
|
54
|
+
|
|
55
|
+
# # Increment version numbers with three-digit logic
|
|
56
|
+
# if [[ $patch -eq 99 ]]; then
|
|
57
|
+
# patch=0
|
|
58
|
+
# if [[ $minor -eq 99 ]]; then
|
|
59
|
+
# minor=0
|
|
60
|
+
# ((major++))
|
|
61
|
+
# else
|
|
62
|
+
# ((minor++))
|
|
63
|
+
# fi
|
|
64
|
+
# else
|
|
65
|
+
# ((patch++))
|
|
66
|
+
# fi
|
|
67
|
+
|
|
68
|
+
# newVersion="$major.$minor.$patch"
|
|
69
|
+
|
|
70
|
+
# # Update the version in package.json while maintaining formatting
|
|
71
|
+
# jq --arg version "$newVersion" '.version = $version' package.json > tmp.json && mv tmp.json package.json
|
|
72
|
+
# echo "Version updated from $currentVersion to $newVersion"
|
|
73
|
+
|
|
74
|
+
# # Step 3: Publish the package to NPM
|
|
75
|
+
# npm publish
|
|
76
|
+
# if [[ $? -ne 0 ]]; then
|
|
77
|
+
# echo "NPM publish failed. Exiting..."
|
|
78
|
+
# exit 1
|
|
79
|
+
# fi
|
|
80
|
+
|
|
81
|
+
# # Step 4: Commit the changes and push to GitHub
|
|
82
|
+
# git add .
|
|
83
|
+
# git commit -m "Bump version to $newVersion"
|
|
84
|
+
# git push origin main
|
|
85
|
+
|
|
86
|
+
# if [[ $? -ne 0 ]]; then
|
|
87
|
+
# echo "Failed to push changes to GitHub. Exiting..."
|
|
88
|
+
# exit 1
|
|
89
|
+
# fi
|
|
90
|
+
|
|
91
|
+
# echo "Version $newVersion published and changes pushed to GitHub successfully!"
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
#!/bin/bash
|
|
95
|
+
|
|
96
|
+
# Check if root is only required for jq installation
|
|
97
|
+
require_root_for_jq=0
|
|
98
|
+
|
|
99
|
+
# Check if jq is installed
|
|
100
|
+
if ! command -v jq &> /dev/null; then
|
|
101
|
+
echo "jq not found. Installing jq..."
|
|
102
|
+
require_root_for_jq=1
|
|
103
|
+
if command -v apt-get &> /dev/null; then
|
|
104
|
+
sudo apt-get update && sudo apt-get install -y jq
|
|
105
|
+
elif command -v brew &> /dev/null; then
|
|
106
|
+
brew install jq
|
|
107
|
+
else
|
|
108
|
+
echo "Please install jq manually."
|
|
109
|
+
exit 1
|
|
110
|
+
fi
|
|
111
|
+
fi
|
|
112
|
+
|
|
113
|
+
# Only require root if jq installation was needed
|
|
114
|
+
if [[ $require_root_for_jq -eq 1 && $EUID -ne 0 ]]; then
|
|
115
|
+
echo "This script must be run as root for jq installation. Please use sudo."
|
|
116
|
+
exit 1
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
# Step 1: Check if logged in to NPM
|
|
120
|
+
npmUsername=$(npm whoami 2>&1)
|
|
121
|
+
if [[ $npmUsername == *"ERR"* ]]; then
|
|
122
|
+
echo "Not logged in. Please log in to NPM."
|
|
123
|
+
npm login
|
|
124
|
+
if [[ $? -ne 0 ]]; then
|
|
125
|
+
echo "NPM login failed. Exiting..."
|
|
126
|
+
exit 1
|
|
127
|
+
fi
|
|
128
|
+
else
|
|
129
|
+
echo "Already logged in to NPM as $npmUsername"
|
|
130
|
+
fi
|
|
131
|
+
|
|
132
|
+
# Step 2: Check the latest published version from NPM
|
|
133
|
+
packageName=$(jq -r '.name' package.json)
|
|
134
|
+
if [[ -z "$packageName" ]]; then
|
|
135
|
+
echo "Could not find package name in package.json"
|
|
136
|
+
exit 1
|
|
137
|
+
fi
|
|
138
|
+
|
|
139
|
+
latestPublishedVersion=$(npm view "$packageName" version)
|
|
140
|
+
if [[ $? -ne 0 ]]; then
|
|
141
|
+
echo "Failed to fetch the latest published version. Exiting..."
|
|
142
|
+
exit 1
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
echo "Latest published version on NPM: $latestPublishedVersion"
|
|
146
|
+
|
|
147
|
+
# Step 3: Increment version in package.json
|
|
148
|
+
if [[ ! -f package.json ]]; then
|
|
149
|
+
echo "package.json not found. Exiting..."
|
|
150
|
+
exit 1
|
|
151
|
+
fi
|
|
152
|
+
|
|
153
|
+
currentVersion=$(jq -r '.version' package.json)
|
|
154
|
+
|
|
155
|
+
if [[ -z "$currentVersion" ]]; then
|
|
156
|
+
echo "Could not find version in package.json"
|
|
157
|
+
exit 1
|
|
158
|
+
fi
|
|
159
|
+
|
|
160
|
+
# Split version into major, minor, patch
|
|
161
|
+
IFS='.' read -r major minor patch <<< "$currentVersion"
|
|
162
|
+
|
|
163
|
+
# Increment version numbers with three-digit logic
|
|
164
|
+
if [[ $patch -eq 99 ]]; then
|
|
165
|
+
patch=0
|
|
166
|
+
if [[ $minor -eq 99 ]]; then
|
|
167
|
+
minor=0
|
|
168
|
+
((major++))
|
|
169
|
+
else
|
|
170
|
+
((minor++))
|
|
171
|
+
fi
|
|
172
|
+
else
|
|
173
|
+
((patch++))
|
|
174
|
+
fi
|
|
175
|
+
|
|
176
|
+
newVersion="$major.$minor.$patch"
|
|
177
|
+
|
|
178
|
+
# Ensure the new version is greater than the latest published version
|
|
179
|
+
if [[ "$(printf '%s\n' "$newVersion" "$latestPublishedVersion" | sort -V | tail -1)" != "$newVersion" ]]; then
|
|
180
|
+
echo "Error: New version ($newVersion) is not greater than the latest published version ($latestPublishedVersion)."
|
|
181
|
+
echo "Please manually update the version in package.json or adjust the script logic."
|
|
182
|
+
exit 1
|
|
183
|
+
fi
|
|
184
|
+
|
|
185
|
+
# Update the version in package.json while maintaining formatting
|
|
186
|
+
jq --arg version "$newVersion" '.version = $version' package.json > tmp.json && mv tmp.json package.json
|
|
187
|
+
echo "Version updated from $currentVersion to $newVersion"
|
|
188
|
+
|
|
189
|
+
# Step 4: Publish the package to NPM
|
|
190
|
+
npm publish
|
|
191
|
+
if [[ $? -ne 0 ]]; then
|
|
192
|
+
echo "NPM publish failed. Exiting..."
|
|
193
|
+
exit 1
|
|
194
|
+
fi
|
|
195
|
+
|
|
196
|
+
# Step 5: Commit the changes and push to GitHub
|
|
197
|
+
git add .
|
|
198
|
+
git commit -m "Bump version to $newVersion"
|
|
199
|
+
|
|
200
|
+
# Pull latest changes to ensure there are no conflicts
|
|
201
|
+
git pull origin main --rebase
|
|
202
|
+
if [[ $? -ne 0 ]]; then
|
|
203
|
+
echo "Git pull failed. Please resolve conflicts manually. Exiting..."
|
|
204
|
+
exit 1
|
|
205
|
+
fi
|
|
206
|
+
|
|
207
|
+
# Push changes to remote
|
|
208
|
+
git push origin main
|
|
209
|
+
if [[ $? -ne 0 ]]; then
|
|
210
|
+
echo "Failed to push changes to GitHub. Exiting..."
|
|
211
|
+
exit 1
|
|
212
|
+
fi
|
|
213
|
+
|
|
214
|
+
echo "Version $newVersion published and changes pushed to GitHub successfully!"
|