@fourlights/strapi-plugin-deep-populate 1.11.1-beta.1 → 1.11.1-rc.0

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.
@@ -361,13 +361,13 @@ const traverseEntity = async (visitor2, options, entity) => {
361
361
  if (fp.isNil(value) || fp.isNil(attribute)) {
362
362
  continue;
363
363
  }
364
- parent = {
365
- schema: schema2,
366
- key,
367
- attribute,
368
- path: newPath
369
- };
370
364
  if (isRelationalAttribute(attribute)) {
365
+ parent = {
366
+ schema: schema2,
367
+ key,
368
+ attribute,
369
+ path: newPath
370
+ };
371
371
  const isMorphRelation = attribute.relation.toLowerCase().startsWith("morph");
372
372
  const method = isMorphRelation ? traverseMorphRelationTarget : traverseRelationTarget(getModel(attribute.target));
373
373
  if (fp.isArray(value)) {
@@ -386,6 +386,12 @@ const traverseEntity = async (visitor2, options, entity) => {
386
386
  continue;
387
387
  }
388
388
  if (isMediaAttribute(attribute)) {
389
+ parent = {
390
+ schema: schema2,
391
+ key,
392
+ attribute,
393
+ path: newPath
394
+ };
389
395
  if (fp.isArray(value)) {
390
396
  const res = new Array(value.length);
391
397
  for (let i2 = 0; i2 < value.length; i2 += 1) {
@@ -402,6 +408,12 @@ const traverseEntity = async (visitor2, options, entity) => {
402
408
  continue;
403
409
  }
404
410
  if (attribute.type === "component") {
411
+ parent = {
412
+ schema: schema2,
413
+ key,
414
+ attribute,
415
+ path: newPath
416
+ };
405
417
  const targetSchema = getModel(attribute.component);
406
418
  if (fp.isArray(value)) {
407
419
  const res = new Array(value.length);
@@ -419,6 +431,12 @@ const traverseEntity = async (visitor2, options, entity) => {
419
431
  continue;
420
432
  }
421
433
  if (attribute.type === "dynamiczone" && fp.isArray(value)) {
434
+ parent = {
435
+ schema: schema2,
436
+ key,
437
+ attribute,
438
+ path: newPath
439
+ };
422
440
  const res = new Array(value.length);
423
441
  for (let i2 = 0; i2 < value.length; i2 += 1) {
424
442
  const arrayPath = {
@@ -1644,7 +1662,7 @@ function createValidation(config2) {
1644
1662
  sync
1645
1663
  } = _ref, rest = _objectWithoutPropertiesLoose(_ref, ["value", "path", "label", "options", "originalValue", "sync"]);
1646
1664
  const {
1647
- name,
1665
+ name: name2,
1648
1666
  test,
1649
1667
  params,
1650
1668
  message
@@ -1663,14 +1681,14 @@ function createValidation(config2) {
1663
1681
  label,
1664
1682
  path: overrides.path || path
1665
1683
  }, params, overrides.params), resolve);
1666
- const error2 = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name);
1684
+ const error2 = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name2);
1667
1685
  error2.params = nextParams;
1668
1686
  return error2;
1669
1687
  }
1670
1688
  let ctx = _extends$3({
1671
1689
  path,
1672
1690
  parent,
1673
- type: name,
1691
+ type: name2,
1674
1692
  createError,
1675
1693
  resolve,
1676
1694
  options,
@@ -2337,20 +2355,20 @@ class StringSchema extends BaseSchema {
2337
2355
  matches(regex, options) {
2338
2356
  let excludeEmptyString = false;
2339
2357
  let message;
2340
- let name;
2358
+ let name2;
2341
2359
  if (options) {
2342
2360
  if (typeof options === "object") {
2343
2361
  ({
2344
2362
  excludeEmptyString = false,
2345
2363
  message,
2346
- name
2364
+ name: name2
2347
2365
  } = options);
2348
2366
  } else {
2349
2367
  message = options;
2350
2368
  }
2351
2369
  }
2352
2370
  return this.test({
2353
- name: name || "matches",
2371
+ name: name2 || "matches",
2354
2372
  message: message || string$2.matches,
2355
2373
  params: {
2356
2374
  regex
@@ -2445,11 +2463,11 @@ class DateSchema extends BaseSchema {
2445
2463
  _typeCheck(v) {
2446
2464
  return isDate(v) && !isNaN(v.getTime());
2447
2465
  }
2448
- prepareParam(ref, name) {
2466
+ prepareParam(ref, name2) {
2449
2467
  let param;
2450
2468
  if (!Reference.isRef(ref)) {
2451
2469
  let cast = this.cast(ref);
2452
- if (!this._typeCheck(cast)) throw new TypeError(`\`${name}\` must be a Date or a value that can be \`cast()\` to a Date`);
2470
+ if (!this._typeCheck(cast)) throw new TypeError(`\`${name2}\` must be a Date or a value that can be \`cast()\` to a Date`);
2453
2471
  param = cast;
2454
2472
  } else {
2455
2473
  param = ref;
@@ -3073,18 +3091,13 @@ function setLocale(custom) {
3073
3091
  });
3074
3092
  });
3075
3093
  }
3076
- function addMethod(schemaType, name, fn) {
3094
+ function addMethod(schemaType, name2, fn) {
3077
3095
  if (!schemaType || !isSchema(schemaType.prototype)) throw new TypeError("You must provide a yup schema constructor function");
3078
- if (typeof name !== "string") throw new TypeError("A Method name must be provided");
3096
+ if (typeof name2 !== "string") throw new TypeError("A Method name must be provided");
3079
3097
  if (typeof fn !== "function") throw new TypeError("Method function must be provided");
3080
- schemaType.prototype[name] = fn;
3098
+ schemaType.prototype[name2] = fn;
3081
3099
  }
3082
3100
  var httpErrors = { exports: {} };
3083
- /*!
3084
- * depd
3085
- * Copyright(c) 2015 Douglas Christopher Wilson
3086
- * MIT Licensed
3087
- */
3088
3101
  var browser;
3089
3102
  var hasRequiredBrowser;
3090
3103
  function requireBrowser() {
@@ -3211,12 +3224,6 @@ const require$$0 = {
3211
3224
  "510": "Not Extended",
3212
3225
  "511": "Network Authentication Required"
3213
3226
  };
3214
- /*!
3215
- * statuses
3216
- * Copyright(c) 2014 Jonathan Ong
3217
- * Copyright(c) 2016 Douglas Christopher Wilson
3218
- * MIT Licensed
3219
- */
3220
3227
  var statuses;
3221
3228
  var hasRequiredStatuses;
3222
3229
  function requireStatuses() {
@@ -3321,11 +3328,6 @@ function requireInherits_browser() {
3321
3328
  }
3322
3329
  return inherits_browser.exports;
3323
3330
  }
3324
- /*!
3325
- * toidentifier
3326
- * Copyright(c) 2016 Douglas Christopher Wilson
3327
- * MIT Licensed
3328
- */
3329
3331
  var toidentifier;
3330
3332
  var hasRequiredToidentifier;
3331
3333
  function requireToidentifier() {
@@ -3339,12 +3341,6 @@ function requireToidentifier() {
3339
3341
  }
3340
3342
  return toidentifier;
3341
3343
  }
3342
- /*!
3343
- * http-errors
3344
- * Copyright(c) 2014 Jonathan Ong
3345
- * Copyright(c) 2016 Douglas Christopher Wilson
3346
- * MIT Licensed
3347
- */
3348
3344
  var hasRequiredHttpErrors;
3349
3345
  function requireHttpErrors() {
3350
3346
  if (hasRequiredHttpErrors) return httpErrors.exports;
@@ -3412,8 +3408,8 @@ function requireHttpErrors() {
3412
3408
  inherits(HttpError, Error);
3413
3409
  return HttpError;
3414
3410
  }
3415
- function createClientErrorConstructor(HttpError, name, code) {
3416
- var className = toClassName(name);
3411
+ function createClientErrorConstructor(HttpError, name2, code) {
3412
+ var className = toClassName(name2);
3417
3413
  function ClientError(message) {
3418
3414
  var msg = message != null ? message : statuses2.message[code];
3419
3415
  var err = new Error(msg);
@@ -3451,8 +3447,8 @@ function requireHttpErrors() {
3451
3447
  return val instanceof Error && typeof val.expose === "boolean" && typeof val.statusCode === "number" && val.status === val.statusCode;
3452
3448
  };
3453
3449
  }
3454
- function createServerErrorConstructor(HttpError, name, code) {
3455
- var className = toClassName(name);
3450
+ function createServerErrorConstructor(HttpError, name2, code) {
3451
+ var className = toClassName(name2);
3456
3452
  function ServerError(message) {
3457
3453
  var msg = message != null ? message : statuses2.message[code];
3458
3454
  var err = new Error(msg);
@@ -3479,33 +3475,33 @@ function requireHttpErrors() {
3479
3475
  ServerError.prototype.expose = false;
3480
3476
  return ServerError;
3481
3477
  }
3482
- function nameFunc(func, name) {
3478
+ function nameFunc(func, name2) {
3483
3479
  var desc = Object.getOwnPropertyDescriptor(func, "name");
3484
3480
  if (desc && desc.configurable) {
3485
- desc.value = name;
3481
+ desc.value = name2;
3486
3482
  Object.defineProperty(func, "name", desc);
3487
3483
  }
3488
3484
  }
3489
3485
  function populateConstructorExports(exports2, codes, HttpError) {
3490
3486
  codes.forEach(function forEachCode(code) {
3491
3487
  var CodeError;
3492
- var name = toIdentifier(statuses2.message[code]);
3488
+ var name2 = toIdentifier(statuses2.message[code]);
3493
3489
  switch (codeClass(code)) {
3494
3490
  case 400:
3495
- CodeError = createClientErrorConstructor(HttpError, name, code);
3491
+ CodeError = createClientErrorConstructor(HttpError, name2, code);
3496
3492
  break;
3497
3493
  case 500:
3498
- CodeError = createServerErrorConstructor(HttpError, name, code);
3494
+ CodeError = createServerErrorConstructor(HttpError, name2, code);
3499
3495
  break;
3500
3496
  }
3501
3497
  if (CodeError) {
3502
3498
  exports2[code] = CodeError;
3503
- exports2[name] = CodeError;
3499
+ exports2[name2] = CodeError;
3504
3500
  }
3505
3501
  });
3506
3502
  }
3507
- function toClassName(name) {
3508
- return name.substr(-5) !== "Error" ? name + "Error" : name;
3503
+ function toClassName(name2) {
3504
+ return name2.substr(-5) !== "Error" ? name2 + "Error" : name2;
3509
3505
  }
3510
3506
  })(httpErrors);
3511
3507
  return httpErrors.exports;
@@ -5077,8 +5073,8 @@ function requireEnoent() {
5077
5073
  return;
5078
5074
  }
5079
5075
  const originalEmit = cp.emit;
5080
- cp.emit = function(name, arg1) {
5081
- if (name === "exit") {
5076
+ cp.emit = function(name2, arg1) {
5077
+ if (name2 === "exit") {
5082
5078
  const err = verifyENOENT(arg1, parsed);
5083
5079
  if (err) {
5084
5080
  return originalEmit.call(cp, "error", err);
@@ -5573,7 +5569,7 @@ function requireSignals$1() {
5573
5569
  };
5574
5570
  signals$1.getSignals = getSignals;
5575
5571
  const normalizeSignal = function({
5576
- name,
5572
+ name: name2,
5577
5573
  number: defaultNumber,
5578
5574
  description,
5579
5575
  action,
@@ -5581,11 +5577,11 @@ function requireSignals$1() {
5581
5577
  standard
5582
5578
  }) {
5583
5579
  const {
5584
- signals: { [name]: constantSignal }
5580
+ signals: { [name2]: constantSignal }
5585
5581
  } = _os.constants;
5586
5582
  const supported = constantSignal !== void 0;
5587
5583
  const number2 = supported ? constantSignal : defaultNumber;
5588
- return { name, number: number2, description, supported, action, forced, standard };
5584
+ return { name: name2, number: number2, description, supported, action, forced, standard };
5589
5585
  };
5590
5586
  return signals$1;
5591
5587
  }
@@ -5602,10 +5598,10 @@ function requireMain() {
5602
5598
  const signals2 = (0, _signals.getSignals)();
5603
5599
  return signals2.reduce(getSignalByName, {});
5604
5600
  };
5605
- const getSignalByName = function(signalByNameMemo, { name, number: number2, description, supported, action, forced, standard }) {
5601
+ const getSignalByName = function(signalByNameMemo, { name: name2, number: number2, description, supported, action, forced, standard }) {
5606
5602
  return {
5607
5603
  ...signalByNameMemo,
5608
- [name]: { name, number: number2, description, supported, action, forced, standard }
5604
+ [name2]: { name: name2, number: number2, description, supported, action, forced, standard }
5609
5605
  };
5610
5606
  };
5611
5607
  const signalsByName = getSignalsByName();
@@ -5621,10 +5617,10 @@ function requireMain() {
5621
5617
  if (signal === void 0) {
5622
5618
  return {};
5623
5619
  }
5624
- const { name, description, supported, action, forced, standard } = signal;
5620
+ const { name: name2, description, supported, action, forced, standard } = signal;
5625
5621
  return {
5626
5622
  [number2]: {
5627
- name,
5623
+ name: name2,
5628
5624
  number: number2,
5629
5625
  description,
5630
5626
  supported,
@@ -5635,7 +5631,7 @@ function requireMain() {
5635
5631
  };
5636
5632
  };
5637
5633
  const findSignalByNumber = function(number2, signals2) {
5638
- const signal = signals2.find(({ name }) => _os.constants.signals[name] === number2);
5634
+ const signal = signals2.find(({ name: name2 }) => _os.constants.signals[name2] === number2);
5639
5635
  if (signal !== void 0) {
5640
5636
  return signal;
5641
5637
  }
@@ -5645,10 +5641,10 @@ function requireMain() {
5645
5641
  main.signalsByNumber = signalsByNumber;
5646
5642
  return main;
5647
5643
  }
5648
- var error;
5644
+ var error$1;
5649
5645
  var hasRequiredError;
5650
5646
  function requireError() {
5651
- if (hasRequiredError) return error;
5647
+ if (hasRequiredError) return error$1;
5652
5648
  hasRequiredError = 1;
5653
5649
  const { signalsByName } = requireMain();
5654
5650
  const getErrorPrefix = ({ timedOut, timeout, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
@@ -5719,8 +5715,8 @@ ${error2.message}` : execaMessage;
5719
5715
  error2.killed = killed && !timedOut;
5720
5716
  return error2;
5721
5717
  };
5722
- error = makeError;
5723
- return error;
5718
+ error$1 = makeError;
5719
+ return error$1;
5724
5720
  }
5725
5721
  var stdio = { exports: {} };
5726
5722
  var hasRequiredStdio;
@@ -6790,15 +6786,15 @@ function requireFindUp$1() {
6790
6786
  const locatePath2 = requireLocatePath$1();
6791
6787
  const pathExists2 = requirePathExists$2();
6792
6788
  const stop = Symbol("findUp.stop");
6793
- module2.exports = async (name, options = {}) => {
6789
+ module2.exports = async (name2, options = {}) => {
6794
6790
  let directory = path.resolve(options.cwd || "");
6795
6791
  const { root } = path.parse(directory);
6796
- const paths = [].concat(name);
6792
+ const paths = [].concat(name2);
6797
6793
  const runMatcher = async (locateOptions) => {
6798
- if (typeof name !== "function") {
6794
+ if (typeof name2 !== "function") {
6799
6795
  return locatePath2(paths, locateOptions);
6800
6796
  }
6801
- const foundPath = await name(locateOptions.cwd);
6797
+ const foundPath = await name2(locateOptions.cwd);
6802
6798
  if (typeof foundPath === "string") {
6803
6799
  return locatePath2([foundPath], locateOptions);
6804
6800
  }
@@ -6818,15 +6814,15 @@ function requireFindUp$1() {
6818
6814
  directory = path.dirname(directory);
6819
6815
  }
6820
6816
  };
6821
- module2.exports.sync = (name, options = {}) => {
6817
+ module2.exports.sync = (name2, options = {}) => {
6822
6818
  let directory = path.resolve(options.cwd || "");
6823
6819
  const { root } = path.parse(directory);
6824
- const paths = [].concat(name);
6820
+ const paths = [].concat(name2);
6825
6821
  const runMatcher = (locateOptions) => {
6826
- if (typeof name !== "function") {
6822
+ if (typeof name2 !== "function") {
6827
6823
  return locatePath2.sync(paths, locateOptions);
6828
6824
  }
6829
- const foundPath = name(locateOptions.cwd);
6825
+ const foundPath = name2(locateOptions.cwd);
6830
6826
  if (typeof foundPath === "string") {
6831
6827
  return locatePath2.sync([foundPath], locateOptions);
6832
6828
  }
@@ -6985,12 +6981,6 @@ function requireStringify() {
6985
6981
  };
6986
6982
  return stringify;
6987
6983
  }
6988
- /*!
6989
- * is-number <https://github.com/jonschlinkert/is-number>
6990
- *
6991
- * Copyright (c) 2014-present, Jon Schlinkert.
6992
- * Released under the MIT License.
6993
- */
6994
6984
  var isNumber;
6995
6985
  var hasRequiredIsNumber;
6996
6986
  function requireIsNumber() {
@@ -7007,12 +6997,6 @@ function requireIsNumber() {
7007
6997
  };
7008
6998
  return isNumber;
7009
6999
  }
7010
- /*!
7011
- * to-regex-range <https://github.com/micromatch/to-regex-range>
7012
- *
7013
- * Copyright (c) 2015-present, Jon Schlinkert.
7014
- * Released under the MIT License.
7015
- */
7016
7000
  var toRegexRange_1;
7017
7001
  var hasRequiredToRegexRange;
7018
7002
  function requireToRegexRange() {
@@ -7224,12 +7208,6 @@ function requireToRegexRange() {
7224
7208
  toRegexRange_1 = toRegexRange;
7225
7209
  return toRegexRange_1;
7226
7210
  }
7227
- /*!
7228
- * fill-range <https://github.com/jonschlinkert/fill-range>
7229
- *
7230
- * Copyright (c) 2014-present, Jon Schlinkert.
7231
- * Licensed under the MIT License.
7232
- */
7233
7211
  var fillRange;
7234
7212
  var hasRequiredFillRange;
7235
7213
  function requireFillRange() {
@@ -9995,15 +9973,15 @@ function requireFindUp() {
9995
9973
  const locatePath2 = requireLocatePath();
9996
9974
  const pathExists2 = requirePathExists$1();
9997
9975
  const stop = Symbol("findUp.stop");
9998
- module2.exports = async (name, options = {}) => {
9976
+ module2.exports = async (name2, options = {}) => {
9999
9977
  let directory = path.resolve(options.cwd || "");
10000
9978
  const { root } = path.parse(directory);
10001
- const paths = [].concat(name);
9979
+ const paths = [].concat(name2);
10002
9980
  const runMatcher = async (locateOptions) => {
10003
- if (typeof name !== "function") {
9981
+ if (typeof name2 !== "function") {
10004
9982
  return locatePath2(paths, locateOptions);
10005
9983
  }
10006
- const foundPath = await name(locateOptions.cwd);
9984
+ const foundPath = await name2(locateOptions.cwd);
10007
9985
  if (typeof foundPath === "string") {
10008
9986
  return locatePath2([foundPath], locateOptions);
10009
9987
  }
@@ -10023,15 +10001,15 @@ function requireFindUp() {
10023
10001
  directory = path.dirname(directory);
10024
10002
  }
10025
10003
  };
10026
- module2.exports.sync = (name, options = {}) => {
10004
+ module2.exports.sync = (name2, options = {}) => {
10027
10005
  let directory = path.resolve(options.cwd || "");
10028
10006
  const { root } = path.parse(directory);
10029
- const paths = [].concat(name);
10007
+ const paths = [].concat(name2);
10030
10008
  const runMatcher = (locateOptions) => {
10031
- if (typeof name !== "function") {
10009
+ if (typeof name2 !== "function") {
10032
10010
  return locatePath2.sync(paths, locateOptions);
10033
10011
  }
10034
- const foundPath = name(locateOptions.cwd);
10012
+ const foundPath = name2(locateOptions.cwd);
10035
10013
  if (typeof foundPath === "string") {
10036
10014
  return locatePath2.sync([foundPath], locateOptions);
10037
10015
  }
@@ -10520,11 +10498,11 @@ function requireGracefulFs() {
10520
10498
  }
10521
10499
  });
10522
10500
  }
10523
- var debug = noop;
10501
+ var debug2 = noop;
10524
10502
  if (util.debuglog)
10525
- debug = util.debuglog("gfs4");
10503
+ debug2 = util.debuglog("gfs4");
10526
10504
  else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
10527
- debug = function() {
10505
+ debug2 = function() {
10528
10506
  var m = util.format.apply(util, arguments);
10529
10507
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
10530
10508
  console.error(m);
@@ -10559,7 +10537,7 @@ function requireGracefulFs() {
10559
10537
  })(fs.closeSync);
10560
10538
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
10561
10539
  process.on("exit", function() {
10562
- debug(fs[gracefulQueue]);
10540
+ debug2(fs[gracefulQueue]);
10563
10541
  require$$0__default$4.default.equal(fs[gracefulQueue].length, 0);
10564
10542
  });
10565
10543
  }
@@ -10811,7 +10789,7 @@ function requireGracefulFs() {
10811
10789
  return fs2;
10812
10790
  }
10813
10791
  function enqueue(elem) {
10814
- debug("ENQUEUE", elem[0].name, elem[1]);
10792
+ debug2("ENQUEUE", elem[0].name, elem[1]);
10815
10793
  fs[gracefulQueue].push(elem);
10816
10794
  retry();
10817
10795
  }
@@ -10838,10 +10816,10 @@ function requireGracefulFs() {
10838
10816
  var startTime = elem[3];
10839
10817
  var lastTime = elem[4];
10840
10818
  if (startTime === void 0) {
10841
- debug("RETRY", fn.name, args);
10819
+ debug2("RETRY", fn.name, args);
10842
10820
  fn.apply(null, args);
10843
10821
  } else if (Date.now() - startTime >= 6e4) {
10844
- debug("TIMEOUT", fn.name, args);
10822
+ debug2("TIMEOUT", fn.name, args);
10845
10823
  var cb = args.pop();
10846
10824
  if (typeof cb === "function")
10847
10825
  cb.call(null, err);
@@ -10850,7 +10828,7 @@ function requireGracefulFs() {
10850
10828
  var sinceStart = Math.max(lastTime - startTime, 1);
10851
10829
  var desiredDelay = Math.min(sinceStart * 1.2, 100);
10852
10830
  if (sinceAttempt >= desiredDelay) {
10853
- debug("RETRY", fn.name, args);
10831
+ debug2("RETRY", fn.name, args);
10854
10832
  fn.apply(null, args.concat([startTime]));
10855
10833
  } else {
10856
10834
  fs[gracefulQueue].push(elem);
@@ -11026,8 +11004,8 @@ function requireMark() {
11026
11004
  if (hasRequiredMark) return mark;
11027
11005
  hasRequiredMark = 1;
11028
11006
  var common2 = requireCommon();
11029
- function Mark(name, buffer, position, line, column) {
11030
- this.name = name;
11007
+ function Mark(name2, buffer, position, line, column) {
11008
+ this.name = name2;
11031
11009
  this.buffer = buffer;
11032
11010
  this.position = position;
11033
11011
  this.line = line;
@@ -11112,9 +11090,9 @@ function requireType() {
11112
11090
  }
11113
11091
  function Type(tag, options) {
11114
11092
  options = options || {};
11115
- Object.keys(options).forEach(function(name) {
11116
- if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
11117
- throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
11093
+ Object.keys(options).forEach(function(name2) {
11094
+ if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name2) === -1) {
11095
+ throw new YAMLException('Unknown option "' + name2 + '" is met in definition of "' + tag + '" YAML type.');
11118
11096
  }
11119
11097
  });
11120
11098
  this.tag = tag;
@@ -11145,12 +11123,12 @@ function requireSchema() {
11145
11123
  var common2 = requireCommon();
11146
11124
  var YAMLException = requireException();
11147
11125
  var Type = requireType();
11148
- function compileList(schema2, name, result) {
11126
+ function compileList(schema2, name2, result) {
11149
11127
  var exclude = [];
11150
11128
  schema2.include.forEach(function(includedSchema) {
11151
- result = compileList(includedSchema, name, result);
11129
+ result = compileList(includedSchema, name2, result);
11152
11130
  });
11153
- schema2[name].forEach(function(currentType) {
11131
+ schema2[name2].forEach(function(currentType) {
11154
11132
  result.forEach(function(previousType, previousIndex) {
11155
11133
  if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
11156
11134
  exclude.push(previousIndex);
@@ -12136,6 +12114,18 @@ function requireLoader() {
12136
12114
  (c - 65536 & 1023) + 56320
12137
12115
  );
12138
12116
  }
12117
+ function setProperty(object2, key, value) {
12118
+ if (key === "__proto__") {
12119
+ Object.defineProperty(object2, key, {
12120
+ configurable: true,
12121
+ enumerable: true,
12122
+ writable: true,
12123
+ value
12124
+ });
12125
+ } else {
12126
+ object2[key] = value;
12127
+ }
12128
+ }
12139
12129
  var simpleEscapeCheck = new Array(256);
12140
12130
  var simpleEscapeMap = new Array(256);
12141
12131
  for (var i = 0; i < 256; i++) {
@@ -12174,7 +12164,7 @@ function requireLoader() {
12174
12164
  }
12175
12165
  }
12176
12166
  var directiveHandlers = {
12177
- YAML: function handleYamlDirective(state, name, args) {
12167
+ YAML: function handleYamlDirective(state, name2, args) {
12178
12168
  var match, major, minor;
12179
12169
  if (state.version !== null) {
12180
12170
  throwError(state, "duplication of %YAML directive");
@@ -12197,7 +12187,7 @@ function requireLoader() {
12197
12187
  throwWarning(state, "unsupported YAML version of the document");
12198
12188
  }
12199
12189
  },
12200
- TAG: function handleTagDirective(state, name, args) {
12190
+ TAG: function handleTagDirective(state, name2, args) {
12201
12191
  var handle, prefix;
12202
12192
  if (args.length !== 2) {
12203
12193
  throwError(state, "TAG directive accepts exactly two arguments");
@@ -12242,7 +12232,7 @@ function requireLoader() {
12242
12232
  for (index2 = 0, quantity = sourceKeys.length; index2 < quantity; index2 += 1) {
12243
12233
  key = sourceKeys[index2];
12244
12234
  if (!_hasOwnProperty.call(destination, key)) {
12245
- destination[key] = source[key];
12235
+ setProperty(destination, key, source[key]);
12246
12236
  overridableKeys[key] = true;
12247
12237
  }
12248
12238
  }
@@ -12281,7 +12271,7 @@ function requireLoader() {
12281
12271
  state.position = startPos || state.position;
12282
12272
  throwError(state, "duplicated mapping key");
12283
12273
  }
12284
- _result[keyNode] = valueNode;
12274
+ setProperty(_result, keyNode, valueNode);
12285
12275
  delete overridableKeys[keyNode];
12286
12276
  }
12287
12277
  return _result;
@@ -13713,9 +13703,9 @@ function requireJsYaml$1() {
13713
13703
  hasRequiredJsYaml$1 = 1;
13714
13704
  var loader2 = requireLoader();
13715
13705
  var dumper2 = requireDumper();
13716
- function deprecated(name) {
13706
+ function deprecated(name2) {
13717
13707
  return function() {
13718
- throw new Error("Function " + name + " is deprecated and cannot be used.");
13708
+ throw new Error("Function " + name2 + " is deprecated and cannot be used.");
13719
13709
  };
13720
13710
  }
13721
13711
  jsYaml$1.Type = requireType();
@@ -15121,7 +15111,7 @@ setLocale({
15121
15111
  }
15122
15112
  }
15123
15113
  });
15124
- function $constructor(name, initializer2, params) {
15114
+ function $constructor(name2, initializer2, params) {
15125
15115
  function init(inst, def) {
15126
15116
  var _a;
15127
15117
  Object.defineProperty(inst, "_zod", {
@@ -15129,7 +15119,7 @@ function $constructor(name, initializer2, params) {
15129
15119
  enumerable: false
15130
15120
  });
15131
15121
  (_a = inst._zod).traits ?? (_a.traits = /* @__PURE__ */ new Set());
15132
- inst._zod.traits.add(name);
15122
+ inst._zod.traits.add(name2);
15133
15123
  initializer2(inst, def);
15134
15124
  for (const k in _.prototype) {
15135
15125
  if (!(k in inst))
@@ -15141,7 +15131,7 @@ function $constructor(name, initializer2, params) {
15141
15131
  const Parent = params?.Parent ?? Object;
15142
15132
  class Definition extends Parent {
15143
15133
  }
15144
- Object.defineProperty(Definition, "name", { value: name });
15134
+ Object.defineProperty(Definition, "name", { value: name2 });
15145
15135
  function _(def) {
15146
15136
  var _a;
15147
15137
  const inst = params?.Parent ? new Definition() : this;
@@ -15157,10 +15147,10 @@ function $constructor(name, initializer2, params) {
15157
15147
  value: (inst) => {
15158
15148
  if (params?.Parent && inst instanceof params.Parent)
15159
15149
  return true;
15160
- return inst?._zod?.traits?.has(name);
15150
+ return inst?._zod?.traits?.has(name2);
15161
15151
  }
15162
15152
  });
15163
- Object.defineProperty(_, "name", { value: name });
15153
+ Object.defineProperty(_, "name", { value: name2 });
15164
15154
  return _;
15165
15155
  }
15166
15156
  class $ZodAsyncError extends Error {
@@ -18371,7 +18361,7 @@ async function hasDeepPopulateCacheFullTextIndex(db, tableName, columnName) {
18371
18361
  }
18372
18362
  if (client === "mysql" || client === "mysql2") {
18373
18363
  return (await db.dialect.schemaInspector.getIndexes(tableName)).find(
18374
- ({ name }) => name === `${tableName}_${columnName}_fulltext`
18364
+ ({ name: name2 }) => name2 === `${tableName}_${columnName}_fulltext`
18375
18365
  ) !== void 0;
18376
18366
  }
18377
18367
  if (client === "pg" || client === "postgres") {
@@ -18518,7 +18508,13 @@ const register = async ({ strapi: strapi2 }) => {
18518
18508
  return result;
18519
18509
  });
18520
18510
  };
18521
- const version = "1.11.1-beta.1";
18511
+ const version = "1.11.1-rc.0";
18512
+ const name = "@fourlights/strapi-plugin-deep-populate";
18513
+ const error = (msg, context = void 0) => strapi.log.error(`[${name}] ${msg}`, context);
18514
+ const warn = (msg, context = void 0) => strapi.log.warn(`[${name}] ${msg}`, context);
18515
+ const info = (msg, context = void 0) => strapi.log.info(`[${name}] ${msg}`, context);
18516
+ const debug = (msg, context = void 0) => strapi.log.debug(`[${name}] ${msg}`, context);
18517
+ const log = { error, warn, info, debug };
18522
18518
  const sanitizeObject = (obj) => {
18523
18519
  if (obj === null || typeof obj !== "object") return obj;
18524
18520
  const dangerousProps = ["__proto__", "constructor", "prototype"];
@@ -18600,10 +18596,15 @@ const cache = ({ strapi: strapi2 }) => ({
18600
18596
  const documentService = strapi2.documents("plugin::deep-populate.cache");
18601
18597
  const hash = getHash(params);
18602
18598
  const entry = await documentService.findFirst({ filters: { hash: { $eq: hash } } });
18603
- return entry ? await documentService.update({
18604
- documentId: entry.documentId,
18605
- data: { populate: populate2, dependencies: dependencies.join(",") }
18606
- }) : await documentService.create({ data: { hash, params, populate: populate2, dependencies: dependencies.join(",") } });
18599
+ try {
18600
+ return entry ? await documentService.update({
18601
+ documentId: entry.documentId,
18602
+ data: { populate: populate2, dependencies: dependencies.join(",") }
18603
+ }) : await documentService.create({ data: { hash, params, populate: populate2, dependencies: dependencies.join(",") } });
18604
+ } catch (error2) {
18605
+ log.error("[Plugin: Deep Populate] Failed to save cached entry", { error: error2 });
18606
+ return;
18607
+ }
18607
18608
  },
18608
18609
  async clear(params) {
18609
18610
  const entry = await strapi2.documents("plugin::deep-populate.cache").findFirst({ filters: { hash: { $eq: getHash(params) } } });
@@ -18641,6 +18642,18 @@ async function _populateComponent({
18641
18642
  ...params
18642
18643
  }) {
18643
18644
  const componentLookup = lookup.length === 0 ? [attrName] : [...lookup, inDynamicZone ? "on" : "populate", attrName];
18645
+ if (strapi.getModel(schema2) === void 0) {
18646
+ if (inDynamicZone) {
18647
+ const dynamicZoneName = lookup[lookup.length - 1];
18648
+ log.warn(
18649
+ `[Plugin: Deep Populate] The dynamic zone '${dynamicZoneName}' is referencing a non-existing component '${schema2}'. You should fix this.`,
18650
+ { lookup }
18651
+ );
18652
+ } else {
18653
+ log.warn(`[Plugin: Deep Populate] Could not find component: '${schema2}'`);
18654
+ }
18655
+ return true;
18656
+ }
18644
18657
  const componentPopulate = populate2;
18645
18658
  set__default.default(componentPopulate, componentLookup, { populate: "*" });
18646
18659
  if (__allow?.components && !__allow.components.includes(schema2)) return { populate: "*" };
@@ -18762,8 +18775,7 @@ async function _populate({
18762
18775
  const newPopulate = {};
18763
18776
  const model = strapi.getModel(schema2);
18764
18777
  if (!model) {
18765
- strapi.log.warn(`[Plugin: Deep Populate] Could not find model for contentType: '${schema2}'`);
18766
- strapi.log.warn("Please create a bug report and share the troublesome contentType.");
18778
+ log.warn(`Could not find model for contentType: '${schema2}'`);
18767
18779
  return {};
18768
18780
  }
18769
18781
  let relations = getRelations(model);