agrs-sequelize-sdk 1.3.37 → 1.3.44

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.
@@ -0,0 +1,231 @@
1
+ /**
2
+ * TemplateMetadata Model
3
+ * Stores rich metadata for banner templates with AI-generated insights
4
+ * Used for advanced filtering, sorting, and template library management
5
+ */
6
+
7
+ const { DataTypes } = require("sequelize");
8
+
9
+ module.exports = (sequelize) => {
10
+ const TemplateMetadata = sequelize.define(
11
+ "TemplateMetadata",
12
+ {
13
+ id: {
14
+ type: DataTypes.INTEGER,
15
+ primaryKey: true,
16
+ autoIncrement: true,
17
+ comment: "Auto-incremented primary key",
18
+ },
19
+ templateId: {
20
+ type: DataTypes.INTEGER,
21
+ allowNull: false,
22
+ unique: true,
23
+ field: "template_id",
24
+ comment: "Reference to templateConfig.json ID (1-59)",
25
+ },
26
+ name: {
27
+ type: DataTypes.STRING(255),
28
+ allowNull: false,
29
+ comment: "Template name (e.g., 'Template 1')",
30
+ },
31
+ status: {
32
+ type: DataTypes.STRING(20),
33
+ allowNull: false,
34
+ defaultValue: "Active",
35
+ comment: "Template status (e.g., 'Active', 'Inactive')",
36
+ },
37
+ description: {
38
+ type: DataTypes.TEXT,
39
+ allowNull: true,
40
+ comment: "Short description (200 chars)",
41
+ },
42
+ detailedDescription: {
43
+ type: DataTypes.TEXT,
44
+ allowNull: true,
45
+ field: "detailed_description",
46
+ comment: "Full template description from templateDescriptions.js",
47
+ },
48
+
49
+ // ===== Metadata Fields =====
50
+ imageType: {
51
+ type: DataTypes.STRING(50),
52
+ allowNull: true,
53
+ field: "image_type",
54
+ comment:
55
+ "Best image type for this template (e.g., 'photo', 'illustration', 'render3d', 'collage', 'solid', 'cartoon', 'mixed')",
56
+ },
57
+ category: {
58
+ type: DataTypes.STRING(100),
59
+ allowNull: true,
60
+ comment: "Layout category (e.g., 'asymmetric-split', 'vertical-stack')",
61
+ },
62
+ tags: {
63
+ type: DataTypes.JSON,
64
+ allowNull: true,
65
+ defaultValue: [],
66
+ comment: "Array of descriptive tags for filtering",
67
+ },
68
+ elements: {
69
+ type: DataTypes.JSON,
70
+ allowNull: true,
71
+ defaultValue: [],
72
+ comment:
73
+ "Array of visual elements (e.g., ['Photo', 'Headline', 'CTA'])",
74
+ },
75
+ complexity: {
76
+ type: DataTypes.STRING(20),
77
+ allowNull: true,
78
+ comment: "Template complexity level (e.g., 'low', 'medium', 'high')",
79
+ },
80
+ textDensity: {
81
+ type: DataTypes.STRING(20),
82
+ allowNull: true,
83
+ field: "text_density",
84
+ comment:
85
+ "Amount of text in template (e.g., 'none', 'low', 'medium', 'high')",
86
+ },
87
+ imageCount: {
88
+ type: DataTypes.INTEGER,
89
+ allowNull: true,
90
+ field: "image_count",
91
+ comment: "Number of image slots",
92
+ },
93
+
94
+ // ===== Layout Fields =====
95
+ layoutStructure: {
96
+ type: DataTypes.TEXT,
97
+ allowNull: true,
98
+ field: "layout_structure",
99
+ comment: "Description of layout structure",
100
+ },
101
+ composition: {
102
+ type: DataTypes.TEXT,
103
+ allowNull: true,
104
+ comment: "Description of visual composition",
105
+ },
106
+ textPlacement: {
107
+ type: DataTypes.JSON,
108
+ allowNull: true,
109
+ defaultValue: [],
110
+ field: "text_placement",
111
+ comment: "Array of text placement descriptions",
112
+ },
113
+ imagePlacement: {
114
+ type: DataTypes.JSON,
115
+ allowNull: true,
116
+ defaultValue: [],
117
+ field: "image_placement",
118
+ comment: "Array of image placement descriptions",
119
+ },
120
+
121
+ // ===== Prompt Fields (for AI generation) =====
122
+ imageStyle: {
123
+ type: DataTypes.STRING(50),
124
+ allowNull: true,
125
+ field: "image_style",
126
+ comment: "Image style for AI prompt (e.g., 'PHOTO', 'ILLUSTRATION')",
127
+ },
128
+ layoutDescription: {
129
+ type: DataTypes.TEXT,
130
+ allowNull: true,
131
+ field: "layout_description",
132
+ comment: "Detailed layout description for AI prompt",
133
+ },
134
+ textPositions: {
135
+ type: DataTypes.JSON,
136
+ allowNull: true,
137
+ field: "text_positions",
138
+ comment: "Text positioning info for AI prompt (headline, cta, subtext)",
139
+ },
140
+ backgroundType: {
141
+ type: DataTypes.STRING(50),
142
+ allowNull: true,
143
+ field: "background_type",
144
+ comment: "Background type description",
145
+ },
146
+ colorPalette: {
147
+ type: DataTypes.JSON,
148
+ allowNull: true,
149
+ defaultValue: [],
150
+ field: "color_palette",
151
+ comment: "Array of color palette hints",
152
+ },
153
+ mood: {
154
+ type: DataTypes.STRING(100),
155
+ allowNull: true,
156
+ comment: "Mood/aesthetic description",
157
+ },
158
+
159
+ // ===== Sample Images =====
160
+ sampleImages: {
161
+ type: DataTypes.JSON,
162
+ allowNull: true,
163
+ defaultValue: [],
164
+ field: "sample_images",
165
+ comment: "Array of sample image URLs",
166
+ },
167
+
168
+ // ===== Legacy Grid Config (for backward compatibility) =====
169
+ legacyGridConfig: {
170
+ type: DataTypes.JSON,
171
+ allowNull: true,
172
+ field: "legacy_grid_config",
173
+ comment: "Original Grid CSS config from templateConfig.json",
174
+ },
175
+ originalCreatedAt: {
176
+ type: DataTypes.DATE,
177
+ allowNull: true,
178
+ field: "original_created_at",
179
+ comment: "Original creation date from templateConfig.json",
180
+ },
181
+
182
+ // ===== Timestamps =====
183
+ createdAt: {
184
+ type: DataTypes.DATE,
185
+ allowNull: false,
186
+ defaultValue: DataTypes.NOW,
187
+ field: "created_at",
188
+ },
189
+ updatedAt: {
190
+ type: DataTypes.DATE,
191
+ allowNull: false,
192
+ defaultValue: DataTypes.NOW,
193
+ field: "updated_at",
194
+ },
195
+ },
196
+ {
197
+ tableName: "template_metadata",
198
+ timestamps: true,
199
+ underscored: true,
200
+ indexes: [
201
+ {
202
+ name: "idx_template_metadata_template_id",
203
+ fields: ["template_id"],
204
+ unique: true,
205
+ },
206
+ {
207
+ name: "idx_template_metadata_status",
208
+ fields: ["status"],
209
+ },
210
+ {
211
+ name: "idx_template_metadata_image_type",
212
+ fields: ["image_type"],
213
+ },
214
+ {
215
+ name: "idx_template_metadata_complexity",
216
+ fields: ["complexity"],
217
+ },
218
+ {
219
+ name: "idx_template_metadata_category",
220
+ fields: ["category"],
221
+ },
222
+ {
223
+ name: "idx_template_metadata_image_count",
224
+ fields: ["image_count"],
225
+ },
226
+ ],
227
+ }
228
+ );
229
+
230
+ return TemplateMetadata;
231
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agrs-sequelize-sdk",
3
- "version": "1.3.37",
3
+ "version": "1.3.44",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "start": "node index.js",