@webbycrown/webbycommerce 1.0.1 → 1.0.2

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.
@@ -1361,23 +1361,35 @@ var require_extend_user_schema = __commonJS({
1361
1361
  const tableName = "up_users";
1362
1362
  let fieldsExist = false;
1363
1363
  try {
1364
- const contentType = strapi2.contentTypes["plugin::users-permissions.user"];
1365
- if (contentType && contentType.attributes) {
1366
- fieldsExist = "otp" in contentType.attributes && "isOtpVerified" in contentType.attributes;
1364
+ const connection2 = db.connection;
1365
+ const knex2 = connection2;
1366
+ if (client === "postgres") {
1367
+ const result = await knex2.raw(`
1368
+ SELECT column_name
1369
+ FROM information_schema.columns
1370
+ WHERE table_name='${tableName}'
1371
+ AND (column_name='otp' OR column_name='is_otp_verified')
1372
+ `);
1373
+ fieldsExist = result.rows.length >= 2;
1374
+ } else if (client === "mysql" || client === "mysql2") {
1375
+ const result = await knex2.raw(`
1376
+ SELECT COLUMN_NAME
1377
+ FROM INFORMATION_SCHEMA.COLUMNS
1378
+ WHERE TABLE_SCHEMA = DATABASE()
1379
+ AND TABLE_NAME = '${tableName}'
1380
+ AND (COLUMN_NAME = 'otp' OR COLUMN_NAME = 'is_otp_verified')
1381
+ `);
1382
+ fieldsExist = result[0].length >= 2;
1383
+ } else {
1384
+ const tableInfo = await knex2.raw(`PRAGMA table_info(${tableName})`);
1385
+ const columns = tableInfo.map((col) => col.name);
1386
+ fieldsExist = columns.includes("otp") && columns.includes("is_otp_verified");
1367
1387
  }
1368
1388
  } catch (err) {
1369
- try {
1370
- await db.query("plugin::users-permissions.user").findOne({
1371
- select: ["id", "otp", "isOtpVerified"],
1372
- limit: 1
1373
- });
1374
- fieldsExist = true;
1375
- } catch (queryErr) {
1376
- fieldsExist = false;
1377
- }
1389
+ fieldsExist = false;
1378
1390
  }
1379
1391
  if (fieldsExist) {
1380
- strapi2.log.info("[webbycommerce] OTP fields already exist in user schema");
1392
+ strapi2.log.info("[webbycommerce] OTP fields already exist in database");
1381
1393
  return true;
1382
1394
  }
1383
1395
  strapi2.log.info("[webbycommerce] OTP fields not found, adding them to user schema...");
@@ -1454,34 +1466,6 @@ var require_extend_user_schema = __commonJS({
1454
1466
  );
1455
1467
  return false;
1456
1468
  }
1457
- try {
1458
- const contentType = strapi2.contentTypes["plugin::users-permissions.user"];
1459
- if (contentType && contentType.attributes) {
1460
- if (otpAdded || !("otp" in contentType.attributes)) {
1461
- contentType.attributes.otp = {
1462
- type: "integer",
1463
- required: false,
1464
- private: true
1465
- };
1466
- strapi2.log.info('[webbycommerce] Registered "otp" field in Strapi content-type');
1467
- }
1468
- if (isOtpVerifiedAdded || !("isOtpVerified" in contentType.attributes)) {
1469
- contentType.attributes.isOtpVerified = {
1470
- type: "boolean",
1471
- default: false,
1472
- required: false,
1473
- private: true
1474
- };
1475
- strapi2.log.info('[webbycommerce] Registered "isOtpVerified" field in Strapi content-type');
1476
- }
1477
- }
1478
- } catch (schemaError) {
1479
- strapi2.log.warn("[webbycommerce] Could not register fields in content-type schema:", schemaError.message);
1480
- strapi2.log.warn("[webbycommerce] Database columns were added, but schema registration failed.");
1481
- strapi2.log.warn(
1482
- "[webbycommerce] You may need to restart Strapi or create a schema extension file in your main Strapi project."
1483
- );
1484
- }
1485
1469
  strapi2.log.info("[webbycommerce] User schema extension completed successfully");
1486
1470
  return true;
1487
1471
  } catch (error) {
@@ -2255,7 +2239,14 @@ var require_schema6 = __commonJS({
2255
2239
  draftAndPublish: false,
2256
2240
  timestamps: true
2257
2241
  },
2258
- pluginOptions: {},
2242
+ pluginOptions: {
2243
+ "content-manager": {
2244
+ visible: true
2245
+ },
2246
+ "content-api": {
2247
+ visible: true
2248
+ }
2249
+ },
2259
2250
  attributes: {
2260
2251
  name: {
2261
2252
  type: "string",
@@ -2345,7 +2336,14 @@ var require_schema7 = __commonJS({
2345
2336
  draftAndPublish: false,
2346
2337
  timestamps: true
2347
2338
  },
2348
- pluginOptions: {},
2339
+ pluginOptions: {
2340
+ "content-manager": {
2341
+ visible: true
2342
+ },
2343
+ "content-api": {
2344
+ visible: true
2345
+ }
2346
+ },
2349
2347
  attributes: {
2350
2348
  value: {
2351
2349
  type: "string",
@@ -3276,7 +3274,7 @@ var require_bootstrap = __commonJS({
3276
3274
  }
3277
3275
  }
3278
3276
  } catch (error) {
3279
- strapi2.log.error(`[webbycommerce] JWT verification failed:`, error.message);
3277
+ strapi2.log.debug(`[webbycommerce] JWT verification failed:`, error.message);
3280
3278
  }
3281
3279
  }
3282
3280
  }
@@ -3322,7 +3320,7 @@ var require_bootstrap = __commonJS({
3322
3320
  }
3323
3321
  }
3324
3322
  } catch (error) {
3325
- strapi2.log.error(`[webbycommerce] JWT verification failed for address route:`, error.message);
3323
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for address route:`, error.message);
3326
3324
  }
3327
3325
  }
3328
3326
  }
@@ -3415,7 +3413,7 @@ var require_bootstrap = __commonJS({
3415
3413
  }
3416
3414
  }
3417
3415
  } catch (error) {
3418
- strapi2.log.error(`[webbycommerce] JWT verification failed for product route:`, error.message);
3416
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for product route:`, error.message);
3419
3417
  }
3420
3418
  }
3421
3419
  }
@@ -3545,7 +3543,7 @@ var require_bootstrap = __commonJS({
3545
3543
  }
3546
3544
  }
3547
3545
  } catch (error) {
3548
- strapi2.log.error(`[webbycommerce] JWT verification failed for cart route:`, error.message);
3546
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for cart route:`, error.message);
3549
3547
  }
3550
3548
  }
3551
3549
  }
@@ -3652,7 +3650,7 @@ var require_bootstrap = __commonJS({
3652
3650
  }
3653
3651
  }
3654
3652
  } catch (error) {
3655
- strapi2.log.error(`[webbycommerce] JWT verification failed for product-variant route:`, error.message);
3653
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for product-variant route:`, error.message);
3656
3654
  }
3657
3655
  }
3658
3656
  }
@@ -3735,7 +3733,7 @@ var require_bootstrap = __commonJS({
3735
3733
  }
3736
3734
  }
3737
3735
  } catch (error) {
3738
- strapi2.log.error(`[webbycommerce] JWT verification failed for product-attribute route:`, error.message);
3736
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for product-attribute route:`, error.message);
3739
3737
  }
3740
3738
  }
3741
3739
  }
@@ -3838,7 +3836,7 @@ var require_bootstrap = __commonJS({
3838
3836
  }
3839
3837
  }
3840
3838
  } catch (error) {
3841
- strapi2.log.error(`[webbycommerce] JWT verification failed for product-attribute-value route:`, error.message);
3839
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for product-attribute-value route:`, error.message);
3842
3840
  }
3843
3841
  }
3844
3842
  }
@@ -3943,7 +3941,7 @@ var require_bootstrap = __commonJS({
3943
3941
  }
3944
3942
  }
3945
3943
  } catch (error) {
3946
- strapi2.log.error(`[webbycommerce] JWT verification failed for wishlist route:`, error.message);
3944
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for wishlist route:`, error.message);
3947
3945
  }
3948
3946
  }
3949
3947
  }
@@ -4018,7 +4016,7 @@ var require_bootstrap = __commonJS({
4018
4016
  }
4019
4017
  }
4020
4018
  } catch (error) {
4021
- strapi2.log.error(`[webbycommerce] JWT verification failed for move-to-cart route:`, error.message);
4019
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for move-to-cart route:`, error.message);
4022
4020
  }
4023
4021
  }
4024
4022
  }
@@ -4090,7 +4088,7 @@ var require_bootstrap = __commonJS({
4090
4088
  }
4091
4089
  }
4092
4090
  } catch (error) {
4093
- strapi2.log.error(`[webbycommerce] JWT verification failed for compare route:`, error.message);
4091
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for compare route:`, error.message);
4094
4092
  }
4095
4093
  }
4096
4094
  }
@@ -4181,7 +4179,7 @@ var require_bootstrap = __commonJS({
4181
4179
  }
4182
4180
  }
4183
4181
  } catch (error) {
4184
- strapi2.log.error(`[webbycommerce] JWT verification failed for product-category route:`, error.message);
4182
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for product-category route:`, error.message);
4185
4183
  }
4186
4184
  }
4187
4185
  }
@@ -4264,7 +4262,7 @@ var require_bootstrap = __commonJS({
4264
4262
  }
4265
4263
  }
4266
4264
  } catch (error) {
4267
- strapi2.log.error(`[webbycommerce] JWT verification failed for tag route:`, error.message);
4265
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for tag route:`, error.message);
4268
4266
  }
4269
4267
  }
4270
4268
  }
@@ -4369,7 +4367,7 @@ var require_bootstrap = __commonJS({
4369
4367
  }
4370
4368
  }
4371
4369
  } catch (error) {
4372
- strapi2.log.error(`[webbycommerce] JWT verification failed for payment route:`, error.message);
4370
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for payment route:`, error.message);
4373
4371
  }
4374
4372
  }
4375
4373
  }
@@ -4462,7 +4460,7 @@ var require_bootstrap = __commonJS({
4462
4460
  }
4463
4461
  }
4464
4462
  } catch (error) {
4465
- strapi2.log.error(`[webbycommerce] JWT verification failed for order route:`, error.message);
4463
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for order route:`, error.message);
4466
4464
  }
4467
4465
  }
4468
4466
  }
@@ -4613,7 +4611,7 @@ var require_bootstrap = __commonJS({
4613
4611
  }
4614
4612
  }
4615
4613
  } catch (error) {
4616
- strapi2.log.error(`[webbycommerce] JWT verification failed for shipping admin route:`, error.message);
4614
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for shipping admin route:`, error.message);
4617
4615
  ctx.forbidden("Authentication failed.");
4618
4616
  return;
4619
4617
  }
@@ -4642,7 +4640,7 @@ var require_bootstrap = __commonJS({
4642
4640
  }
4643
4641
  }
4644
4642
  } catch (error) {
4645
- strapi2.log.error(`[webbycommerce] JWT verification failed for shipping route:`, error.message);
4643
+ strapi2.log.debug(`[webbycommerce] JWT verification failed for shipping route:`, error.message);
4646
4644
  }
4647
4645
  }
4648
4646
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webbycrown/webbycommerce",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "keywords": [
5
5
  "strapi",
6
6
  "plugin",