codebase-models 3.0.4 → 3.0.6

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.
@@ -29,8 +29,9 @@ export interface IProperty extends Document {
29
29
  platform?: string;
30
30
  }
31
31
  export interface IShopify extends Document {
32
- shopDomain: string;
33
- accessToken: string;
32
+ apiKey: string;
33
+ apiSecretKey: string;
34
+ hostName: string;
34
35
  apiVersion?: string;
35
36
  }
36
37
  export interface IClient extends Document {
@@ -45,8 +45,9 @@ const PropertySchema = new mongoose_1.Schema({
45
45
  platform: { type: String, default: "GA4" },
46
46
  });
47
47
  const shopifySchema = new mongoose_1.Schema({
48
- shopDomain: { type: String, required: true },
49
- accessToken: { type: String, required: true },
48
+ apiKey: { type: String, required: true },
49
+ apiSecretKey: { type: String, required: true },
50
+ hostName: { type: String, required: true },
50
51
  apiVersion: { type: String, default: "2026-01" },
51
52
  });
52
53
  const ClientSchema = new mongoose_1.Schema({
@@ -29,15 +29,12 @@ export interface IClientScript extends Document {
29
29
  client?: mongoose.Schema.Types.ObjectId;
30
30
  adhere_dnt: Boolean;
31
31
  allow_in_iframes: Boolean;
32
- viewId?: string;
33
- clientScriptURL: string;
34
32
  jquery_include: string;
35
33
  debug: Boolean;
36
34
  restrict_debug: Boolean;
37
35
  max_cookie_lifetime: Number;
38
36
  activation_mode: string;
39
37
  use_antiflicker: Boolean;
40
- snippet_revision: Number;
41
38
  snippet_version: Number;
42
39
  rules: string;
43
40
  rules_tracking: string;
@@ -60,6 +57,7 @@ export interface IClientScript extends Document {
60
57
  goalsEnabled: Boolean;
61
58
  optedOut: Boolean;
62
59
  liveEventListenersSet: Boolean;
60
+ active: Boolean;
63
61
  }
64
62
  declare const ClientScript: mongoose.Model<any, {}, {}, {}, any, any>;
65
63
  export default ClientScript;
@@ -48,13 +48,6 @@ const ClientScriptSchema = new mongoose_1.Schema({
48
48
  type: mongoose_1.default.Schema.Types.ObjectId,
49
49
  ref: "client",
50
50
  },
51
- viewId: {
52
- type: String,
53
- },
54
- clientScriptURL: {
55
- type: String,
56
- trim: true,
57
- },
58
51
  jquery_include: {
59
52
  type: String,
60
53
  default: "false",
@@ -83,10 +76,6 @@ const ClientScriptSchema = new mongoose_1.Schema({
83
76
  type: Boolean,
84
77
  default: false,
85
78
  },
86
- snippet_revision: {
87
- type: Number,
88
- default: 1,
89
- },
90
79
  rules: {
91
80
  type: String,
92
81
  default: "return true;",
@@ -175,6 +164,10 @@ const ClientScriptSchema = new mongoose_1.Schema({
175
164
  type: Boolean,
176
165
  default: false,
177
166
  },
167
+ active: {
168
+ type: Boolean,
169
+ default: true,
170
+ },
178
171
  }, {
179
172
  timestamps: true,
180
173
  });
@@ -197,8 +190,5 @@ ClientScriptSchema.pre('save', function (next) {
197
190
  ClientScriptSchema.index({ iid: 1 }, { unique: true });
198
191
  // Compound indexes for common query patterns
199
192
  ClientScriptSchema.index({ client: 1 });
200
- // Sparse indexes for optional fields
201
- ClientScriptSchema.index({ organisationId: 1 }, { sparse: true });
202
- ClientScriptSchema.index({ asset_url: 1 }, { sparse: true });
203
193
  const ClientScript = mongoose_1.default.models.clientscript || (0, mongoose_1.model)("clientscript", ClientScriptSchema);
204
194
  exports.default = ClientScript;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebase-models",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "Common models for codebase",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -17,14 +17,16 @@ const PropertySchema: Schema = new Schema<IProperty>({
17
17
  });
18
18
 
19
19
  export interface IShopify extends Document {
20
- shopDomain: string;
21
- accessToken: string;
20
+ apiKey: string;
21
+ apiSecretKey: string;
22
+ hostName: string;
22
23
  apiVersion?: string;
23
24
  }
24
25
 
25
26
  const shopifySchema: Schema = new Schema<IShopify>({
26
- shopDomain: { type: String, required: true },
27
- accessToken: { type: String, required: true },
27
+ apiKey: { type: String, required: true },
28
+ apiSecretKey: { type: String, required: true },
29
+ hostName: { type: String, required: true },
28
30
  apiVersion: { type: String, default: "2026-01" },
29
31
  });
30
32
 
@@ -7,15 +7,12 @@ export interface IClientScript extends Document {
7
7
  client?: mongoose.Schema.Types.ObjectId;
8
8
  adhere_dnt: Boolean;
9
9
  allow_in_iframes: Boolean;
10
- viewId?: string;
11
- clientScriptURL: string;
12
10
  jquery_include: string;
13
11
  debug: Boolean;
14
12
  restrict_debug: Boolean;
15
13
  max_cookie_lifetime: Number;
16
14
  activation_mode: string;
17
15
  use_antiflicker: Boolean;
18
- snippet_revision: Number;
19
16
  snippet_version: Number;
20
17
  rules: string;
21
18
  rules_tracking: string;
@@ -38,6 +35,7 @@ export interface IClientScript extends Document {
38
35
  goalsEnabled: Boolean;
39
36
  optedOut: Boolean;
40
37
  liveEventListenersSet: Boolean;
38
+ active: Boolean;
41
39
  }
42
40
 
43
41
  const ClientScriptSchema = new Schema<IClientScript>(
@@ -55,13 +53,6 @@ const ClientScriptSchema = new Schema<IClientScript>(
55
53
  type: mongoose.Schema.Types.ObjectId,
56
54
  ref: "client",
57
55
  },
58
- viewId: {
59
- type: String,
60
- },
61
- clientScriptURL: {
62
- type: String,
63
- trim: true,
64
- },
65
56
  jquery_include: {
66
57
  type: String,
67
58
  default: "false",
@@ -90,10 +81,6 @@ const ClientScriptSchema = new Schema<IClientScript>(
90
81
  type: Boolean,
91
82
  default: false,
92
83
  },
93
- snippet_revision: {
94
- type: Number,
95
- default: 1,
96
- },
97
84
  rules: {
98
85
  type: String,
99
86
  default: "return true;",
@@ -182,6 +169,10 @@ const ClientScriptSchema = new Schema<IClientScript>(
182
169
  type: Boolean,
183
170
  default: false,
184
171
  },
172
+ active: {
173
+ type: Boolean,
174
+ default: true,
175
+ },
185
176
  },
186
177
  {
187
178
  timestamps: true,
@@ -206,9 +197,6 @@ ClientScriptSchema.pre('save', async function(next) {
206
197
  ClientScriptSchema.index({ iid: 1 }, { unique: true });
207
198
  // Compound indexes for common query patterns
208
199
  ClientScriptSchema.index({ client: 1 });
209
- // Sparse indexes for optional fields
210
- ClientScriptSchema.index({ organisationId: 1 }, { sparse: true });
211
- ClientScriptSchema.index({ asset_url: 1 }, { sparse: true });
212
200
 
213
201
 
214
202
  const ClientScript = mongoose.models.clientscript || model<IClientScript>("clientscript", ClientScriptSchema);