@malevich-studio/strapi-sdk-typescript 1.2.6 → 1.2.8

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/dist/index.mjs CHANGED
@@ -1,4 +1,6 @@
1
1
  import require$$0 from 'util';
2
+ import require$$1 from 'tty';
3
+ import require$$0$1 from 'os';
2
4
 
3
5
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
6
 
@@ -20071,6 +20073,1221 @@ function requireLib () {
20071
20073
  var libExports = requireLib();
20072
20074
  var qs = /*@__PURE__*/getDefaultExportFromCjs(libExports);
20073
20075
 
20076
+ var src = {exports: {}};
20077
+
20078
+ var browser = {exports: {}};
20079
+
20080
+ /**
20081
+ * Helpers.
20082
+ */
20083
+
20084
+ var ms;
20085
+ var hasRequiredMs;
20086
+
20087
+ function requireMs () {
20088
+ if (hasRequiredMs) return ms;
20089
+ hasRequiredMs = 1;
20090
+ var s = 1000;
20091
+ var m = s * 60;
20092
+ var h = m * 60;
20093
+ var d = h * 24;
20094
+ var w = d * 7;
20095
+ var y = d * 365.25;
20096
+
20097
+ /**
20098
+ * Parse or format the given `val`.
20099
+ *
20100
+ * Options:
20101
+ *
20102
+ * - `long` verbose formatting [false]
20103
+ *
20104
+ * @param {String|Number} val
20105
+ * @param {Object} [options]
20106
+ * @throws {Error} throw an error if val is not a non-empty string or a number
20107
+ * @return {String|Number}
20108
+ * @api public
20109
+ */
20110
+
20111
+ ms = function (val, options) {
20112
+ options = options || {};
20113
+ var type = typeof val;
20114
+ if (type === 'string' && val.length > 0) {
20115
+ return parse(val);
20116
+ } else if (type === 'number' && isFinite(val)) {
20117
+ return options.long ? fmtLong(val) : fmtShort(val);
20118
+ }
20119
+ throw new Error(
20120
+ 'val is not a non-empty string or a valid number. val=' +
20121
+ JSON.stringify(val)
20122
+ );
20123
+ };
20124
+
20125
+ /**
20126
+ * Parse the given `str` and return milliseconds.
20127
+ *
20128
+ * @param {String} str
20129
+ * @return {Number}
20130
+ * @api private
20131
+ */
20132
+
20133
+ function parse(str) {
20134
+ str = String(str);
20135
+ if (str.length > 100) {
20136
+ return;
20137
+ }
20138
+ var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(
20139
+ str
20140
+ );
20141
+ if (!match) {
20142
+ return;
20143
+ }
20144
+ var n = parseFloat(match[1]);
20145
+ var type = (match[2] || 'ms').toLowerCase();
20146
+ switch (type) {
20147
+ case 'years':
20148
+ case 'year':
20149
+ case 'yrs':
20150
+ case 'yr':
20151
+ case 'y':
20152
+ return n * y;
20153
+ case 'weeks':
20154
+ case 'week':
20155
+ case 'w':
20156
+ return n * w;
20157
+ case 'days':
20158
+ case 'day':
20159
+ case 'd':
20160
+ return n * d;
20161
+ case 'hours':
20162
+ case 'hour':
20163
+ case 'hrs':
20164
+ case 'hr':
20165
+ case 'h':
20166
+ return n * h;
20167
+ case 'minutes':
20168
+ case 'minute':
20169
+ case 'mins':
20170
+ case 'min':
20171
+ case 'm':
20172
+ return n * m;
20173
+ case 'seconds':
20174
+ case 'second':
20175
+ case 'secs':
20176
+ case 'sec':
20177
+ case 's':
20178
+ return n * s;
20179
+ case 'milliseconds':
20180
+ case 'millisecond':
20181
+ case 'msecs':
20182
+ case 'msec':
20183
+ case 'ms':
20184
+ return n;
20185
+ default:
20186
+ return undefined;
20187
+ }
20188
+ }
20189
+
20190
+ /**
20191
+ * Short format for `ms`.
20192
+ *
20193
+ * @param {Number} ms
20194
+ * @return {String}
20195
+ * @api private
20196
+ */
20197
+
20198
+ function fmtShort(ms) {
20199
+ var msAbs = Math.abs(ms);
20200
+ if (msAbs >= d) {
20201
+ return Math.round(ms / d) + 'd';
20202
+ }
20203
+ if (msAbs >= h) {
20204
+ return Math.round(ms / h) + 'h';
20205
+ }
20206
+ if (msAbs >= m) {
20207
+ return Math.round(ms / m) + 'm';
20208
+ }
20209
+ if (msAbs >= s) {
20210
+ return Math.round(ms / s) + 's';
20211
+ }
20212
+ return ms + 'ms';
20213
+ }
20214
+
20215
+ /**
20216
+ * Long format for `ms`.
20217
+ *
20218
+ * @param {Number} ms
20219
+ * @return {String}
20220
+ * @api private
20221
+ */
20222
+
20223
+ function fmtLong(ms) {
20224
+ var msAbs = Math.abs(ms);
20225
+ if (msAbs >= d) {
20226
+ return plural(ms, msAbs, d, 'day');
20227
+ }
20228
+ if (msAbs >= h) {
20229
+ return plural(ms, msAbs, h, 'hour');
20230
+ }
20231
+ if (msAbs >= m) {
20232
+ return plural(ms, msAbs, m, 'minute');
20233
+ }
20234
+ if (msAbs >= s) {
20235
+ return plural(ms, msAbs, s, 'second');
20236
+ }
20237
+ return ms + ' ms';
20238
+ }
20239
+
20240
+ /**
20241
+ * Pluralization helper.
20242
+ */
20243
+
20244
+ function plural(ms, msAbs, n, name) {
20245
+ var isPlural = msAbs >= n * 1.5;
20246
+ return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
20247
+ }
20248
+ return ms;
20249
+ }
20250
+
20251
+ var common;
20252
+ var hasRequiredCommon;
20253
+
20254
+ function requireCommon () {
20255
+ if (hasRequiredCommon) return common;
20256
+ hasRequiredCommon = 1;
20257
+ /**
20258
+ * This is the common logic for both the Node.js and web browser
20259
+ * implementations of `debug()`.
20260
+ */
20261
+
20262
+ function setup(env) {
20263
+ createDebug.debug = createDebug;
20264
+ createDebug.default = createDebug;
20265
+ createDebug.coerce = coerce;
20266
+ createDebug.disable = disable;
20267
+ createDebug.enable = enable;
20268
+ createDebug.enabled = enabled;
20269
+ createDebug.humanize = requireMs();
20270
+ createDebug.destroy = destroy;
20271
+
20272
+ Object.keys(env).forEach(key => {
20273
+ createDebug[key] = env[key];
20274
+ });
20275
+
20276
+ /**
20277
+ * The currently active debug mode names, and names to skip.
20278
+ */
20279
+
20280
+ createDebug.names = [];
20281
+ createDebug.skips = [];
20282
+
20283
+ /**
20284
+ * Map of special "%n" handling functions, for the debug "format" argument.
20285
+ *
20286
+ * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
20287
+ */
20288
+ createDebug.formatters = {};
20289
+
20290
+ /**
20291
+ * Selects a color for a debug namespace
20292
+ * @param {String} namespace The namespace string for the debug instance to be colored
20293
+ * @return {Number|String} An ANSI color code for the given namespace
20294
+ * @api private
20295
+ */
20296
+ function selectColor(namespace) {
20297
+ let hash = 0;
20298
+
20299
+ for (let i = 0; i < namespace.length; i++) {
20300
+ hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
20301
+ hash |= 0; // Convert to 32bit integer
20302
+ }
20303
+
20304
+ return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
20305
+ }
20306
+ createDebug.selectColor = selectColor;
20307
+
20308
+ /**
20309
+ * Create a debugger with the given `namespace`.
20310
+ *
20311
+ * @param {String} namespace
20312
+ * @return {Function}
20313
+ * @api public
20314
+ */
20315
+ function createDebug(namespace) {
20316
+ let prevTime;
20317
+ let enableOverride = null;
20318
+ let namespacesCache;
20319
+ let enabledCache;
20320
+
20321
+ function debug(...args) {
20322
+ // Disabled?
20323
+ if (!debug.enabled) {
20324
+ return;
20325
+ }
20326
+
20327
+ const self = debug;
20328
+
20329
+ // Set `diff` timestamp
20330
+ const curr = Number(new Date());
20331
+ const ms = curr - (prevTime || curr);
20332
+ self.diff = ms;
20333
+ self.prev = prevTime;
20334
+ self.curr = curr;
20335
+ prevTime = curr;
20336
+
20337
+ args[0] = createDebug.coerce(args[0]);
20338
+
20339
+ if (typeof args[0] !== 'string') {
20340
+ // Anything else let's inspect with %O
20341
+ args.unshift('%O');
20342
+ }
20343
+
20344
+ // Apply any `formatters` transformations
20345
+ let index = 0;
20346
+ args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
20347
+ // If we encounter an escaped % then don't increase the array index
20348
+ if (match === '%%') {
20349
+ return '%';
20350
+ }
20351
+ index++;
20352
+ const formatter = createDebug.formatters[format];
20353
+ if (typeof formatter === 'function') {
20354
+ const val = args[index];
20355
+ match = formatter.call(self, val);
20356
+
20357
+ // Now we need to remove `args[index]` since it's inlined in the `format`
20358
+ args.splice(index, 1);
20359
+ index--;
20360
+ }
20361
+ return match;
20362
+ });
20363
+
20364
+ // Apply env-specific formatting (colors, etc.)
20365
+ createDebug.formatArgs.call(self, args);
20366
+
20367
+ const logFn = self.log || createDebug.log;
20368
+ logFn.apply(self, args);
20369
+ }
20370
+
20371
+ debug.namespace = namespace;
20372
+ debug.useColors = createDebug.useColors();
20373
+ debug.color = createDebug.selectColor(namespace);
20374
+ debug.extend = extend;
20375
+ debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
20376
+
20377
+ Object.defineProperty(debug, 'enabled', {
20378
+ enumerable: true,
20379
+ configurable: false,
20380
+ get: () => {
20381
+ if (enableOverride !== null) {
20382
+ return enableOverride;
20383
+ }
20384
+ if (namespacesCache !== createDebug.namespaces) {
20385
+ namespacesCache = createDebug.namespaces;
20386
+ enabledCache = createDebug.enabled(namespace);
20387
+ }
20388
+
20389
+ return enabledCache;
20390
+ },
20391
+ set: v => {
20392
+ enableOverride = v;
20393
+ }
20394
+ });
20395
+
20396
+ // Env-specific initialization logic for debug instances
20397
+ if (typeof createDebug.init === 'function') {
20398
+ createDebug.init(debug);
20399
+ }
20400
+
20401
+ return debug;
20402
+ }
20403
+
20404
+ function extend(namespace, delimiter) {
20405
+ const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
20406
+ newDebug.log = this.log;
20407
+ return newDebug;
20408
+ }
20409
+
20410
+ /**
20411
+ * Enables a debug mode by namespaces. This can include modes
20412
+ * separated by a colon and wildcards.
20413
+ *
20414
+ * @param {String} namespaces
20415
+ * @api public
20416
+ */
20417
+ function enable(namespaces) {
20418
+ createDebug.save(namespaces);
20419
+ createDebug.namespaces = namespaces;
20420
+
20421
+ createDebug.names = [];
20422
+ createDebug.skips = [];
20423
+
20424
+ const split = (typeof namespaces === 'string' ? namespaces : '')
20425
+ .trim()
20426
+ .replace(' ', ',')
20427
+ .split(',')
20428
+ .filter(Boolean);
20429
+
20430
+ for (const ns of split) {
20431
+ if (ns[0] === '-') {
20432
+ createDebug.skips.push(ns.slice(1));
20433
+ } else {
20434
+ createDebug.names.push(ns);
20435
+ }
20436
+ }
20437
+ }
20438
+
20439
+ /**
20440
+ * Checks if the given string matches a namespace template, honoring
20441
+ * asterisks as wildcards.
20442
+ *
20443
+ * @param {String} search
20444
+ * @param {String} template
20445
+ * @return {Boolean}
20446
+ */
20447
+ function matchesTemplate(search, template) {
20448
+ let searchIndex = 0;
20449
+ let templateIndex = 0;
20450
+ let starIndex = -1;
20451
+ let matchIndex = 0;
20452
+
20453
+ while (searchIndex < search.length) {
20454
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
20455
+ // Match character or proceed with wildcard
20456
+ if (template[templateIndex] === '*') {
20457
+ starIndex = templateIndex;
20458
+ matchIndex = searchIndex;
20459
+ templateIndex++; // Skip the '*'
20460
+ } else {
20461
+ searchIndex++;
20462
+ templateIndex++;
20463
+ }
20464
+ } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
20465
+ // Backtrack to the last '*' and try to match more characters
20466
+ templateIndex = starIndex + 1;
20467
+ matchIndex++;
20468
+ searchIndex = matchIndex;
20469
+ } else {
20470
+ return false; // No match
20471
+ }
20472
+ }
20473
+
20474
+ // Handle trailing '*' in template
20475
+ while (templateIndex < template.length && template[templateIndex] === '*') {
20476
+ templateIndex++;
20477
+ }
20478
+
20479
+ return templateIndex === template.length;
20480
+ }
20481
+
20482
+ /**
20483
+ * Disable debug output.
20484
+ *
20485
+ * @return {String} namespaces
20486
+ * @api public
20487
+ */
20488
+ function disable() {
20489
+ const namespaces = [
20490
+ ...createDebug.names,
20491
+ ...createDebug.skips.map(namespace => '-' + namespace)
20492
+ ].join(',');
20493
+ createDebug.enable('');
20494
+ return namespaces;
20495
+ }
20496
+
20497
+ /**
20498
+ * Returns true if the given mode name is enabled, false otherwise.
20499
+ *
20500
+ * @param {String} name
20501
+ * @return {Boolean}
20502
+ * @api public
20503
+ */
20504
+ function enabled(name) {
20505
+ for (const skip of createDebug.skips) {
20506
+ if (matchesTemplate(name, skip)) {
20507
+ return false;
20508
+ }
20509
+ }
20510
+
20511
+ for (const ns of createDebug.names) {
20512
+ if (matchesTemplate(name, ns)) {
20513
+ return true;
20514
+ }
20515
+ }
20516
+
20517
+ return false;
20518
+ }
20519
+
20520
+ /**
20521
+ * Coerce `val`.
20522
+ *
20523
+ * @param {Mixed} val
20524
+ * @return {Mixed}
20525
+ * @api private
20526
+ */
20527
+ function coerce(val) {
20528
+ if (val instanceof Error) {
20529
+ return val.stack || val.message;
20530
+ }
20531
+ return val;
20532
+ }
20533
+
20534
+ /**
20535
+ * XXX DO NOT USE. This is a temporary stub function.
20536
+ * XXX It WILL be removed in the next major release.
20537
+ */
20538
+ function destroy() {
20539
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
20540
+ }
20541
+
20542
+ createDebug.enable(createDebug.load());
20543
+
20544
+ return createDebug;
20545
+ }
20546
+
20547
+ common = setup;
20548
+ return common;
20549
+ }
20550
+
20551
+ /* eslint-env browser */
20552
+
20553
+ var hasRequiredBrowser;
20554
+
20555
+ function requireBrowser () {
20556
+ if (hasRequiredBrowser) return browser.exports;
20557
+ hasRequiredBrowser = 1;
20558
+ (function (module, exports) {
20559
+ /**
20560
+ * This is the web browser implementation of `debug()`.
20561
+ */
20562
+
20563
+ exports.formatArgs = formatArgs;
20564
+ exports.save = save;
20565
+ exports.load = load;
20566
+ exports.useColors = useColors;
20567
+ exports.storage = localstorage();
20568
+ exports.destroy = (() => {
20569
+ let warned = false;
20570
+
20571
+ return () => {
20572
+ if (!warned) {
20573
+ warned = true;
20574
+ console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
20575
+ }
20576
+ };
20577
+ })();
20578
+
20579
+ /**
20580
+ * Colors.
20581
+ */
20582
+
20583
+ exports.colors = [
20584
+ '#0000CC',
20585
+ '#0000FF',
20586
+ '#0033CC',
20587
+ '#0033FF',
20588
+ '#0066CC',
20589
+ '#0066FF',
20590
+ '#0099CC',
20591
+ '#0099FF',
20592
+ '#00CC00',
20593
+ '#00CC33',
20594
+ '#00CC66',
20595
+ '#00CC99',
20596
+ '#00CCCC',
20597
+ '#00CCFF',
20598
+ '#3300CC',
20599
+ '#3300FF',
20600
+ '#3333CC',
20601
+ '#3333FF',
20602
+ '#3366CC',
20603
+ '#3366FF',
20604
+ '#3399CC',
20605
+ '#3399FF',
20606
+ '#33CC00',
20607
+ '#33CC33',
20608
+ '#33CC66',
20609
+ '#33CC99',
20610
+ '#33CCCC',
20611
+ '#33CCFF',
20612
+ '#6600CC',
20613
+ '#6600FF',
20614
+ '#6633CC',
20615
+ '#6633FF',
20616
+ '#66CC00',
20617
+ '#66CC33',
20618
+ '#9900CC',
20619
+ '#9900FF',
20620
+ '#9933CC',
20621
+ '#9933FF',
20622
+ '#99CC00',
20623
+ '#99CC33',
20624
+ '#CC0000',
20625
+ '#CC0033',
20626
+ '#CC0066',
20627
+ '#CC0099',
20628
+ '#CC00CC',
20629
+ '#CC00FF',
20630
+ '#CC3300',
20631
+ '#CC3333',
20632
+ '#CC3366',
20633
+ '#CC3399',
20634
+ '#CC33CC',
20635
+ '#CC33FF',
20636
+ '#CC6600',
20637
+ '#CC6633',
20638
+ '#CC9900',
20639
+ '#CC9933',
20640
+ '#CCCC00',
20641
+ '#CCCC33',
20642
+ '#FF0000',
20643
+ '#FF0033',
20644
+ '#FF0066',
20645
+ '#FF0099',
20646
+ '#FF00CC',
20647
+ '#FF00FF',
20648
+ '#FF3300',
20649
+ '#FF3333',
20650
+ '#FF3366',
20651
+ '#FF3399',
20652
+ '#FF33CC',
20653
+ '#FF33FF',
20654
+ '#FF6600',
20655
+ '#FF6633',
20656
+ '#FF9900',
20657
+ '#FF9933',
20658
+ '#FFCC00',
20659
+ '#FFCC33'
20660
+ ];
20661
+
20662
+ /**
20663
+ * Currently only WebKit-based Web Inspectors, Firefox >= v31,
20664
+ * and the Firebug extension (any Firefox version) are known
20665
+ * to support "%c" CSS customizations.
20666
+ *
20667
+ * TODO: add a `localStorage` variable to explicitly enable/disable colors
20668
+ */
20669
+
20670
+ // eslint-disable-next-line complexity
20671
+ function useColors() {
20672
+ // NB: In an Electron preload script, document will be defined but not fully
20673
+ // initialized. Since we know we're in Chrome, we'll just detect this case
20674
+ // explicitly
20675
+ if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
20676
+ return true;
20677
+ }
20678
+
20679
+ // Internet Explorer and Edge do not support colors.
20680
+ if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
20681
+ return false;
20682
+ }
20683
+
20684
+ let m;
20685
+
20686
+ // Is webkit? http://stackoverflow.com/a/16459606/376773
20687
+ // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
20688
+ // eslint-disable-next-line no-return-assign
20689
+ return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
20690
+ // Is firebug? http://stackoverflow.com/a/398120/376773
20691
+ (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
20692
+ // Is firefox >= v31?
20693
+ // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
20694
+ (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
20695
+ // Double check webkit in userAgent just in case we are in a worker
20696
+ (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
20697
+ }
20698
+
20699
+ /**
20700
+ * Colorize log arguments if enabled.
20701
+ *
20702
+ * @api public
20703
+ */
20704
+
20705
+ function formatArgs(args) {
20706
+ args[0] = (this.useColors ? '%c' : '') +
20707
+ this.namespace +
20708
+ (this.useColors ? ' %c' : ' ') +
20709
+ args[0] +
20710
+ (this.useColors ? '%c ' : ' ') +
20711
+ '+' + module.exports.humanize(this.diff);
20712
+
20713
+ if (!this.useColors) {
20714
+ return;
20715
+ }
20716
+
20717
+ const c = 'color: ' + this.color;
20718
+ args.splice(1, 0, c, 'color: inherit');
20719
+
20720
+ // The final "%c" is somewhat tricky, because there could be other
20721
+ // arguments passed either before or after the %c, so we need to
20722
+ // figure out the correct index to insert the CSS into
20723
+ let index = 0;
20724
+ let lastC = 0;
20725
+ args[0].replace(/%[a-zA-Z%]/g, match => {
20726
+ if (match === '%%') {
20727
+ return;
20728
+ }
20729
+ index++;
20730
+ if (match === '%c') {
20731
+ // We only are interested in the *last* %c
20732
+ // (the user may have provided their own)
20733
+ lastC = index;
20734
+ }
20735
+ });
20736
+
20737
+ args.splice(lastC, 0, c);
20738
+ }
20739
+
20740
+ /**
20741
+ * Invokes `console.debug()` when available.
20742
+ * No-op when `console.debug` is not a "function".
20743
+ * If `console.debug` is not available, falls back
20744
+ * to `console.log`.
20745
+ *
20746
+ * @api public
20747
+ */
20748
+ exports.log = console.debug || console.log || (() => {});
20749
+
20750
+ /**
20751
+ * Save `namespaces`.
20752
+ *
20753
+ * @param {String} namespaces
20754
+ * @api private
20755
+ */
20756
+ function save(namespaces) {
20757
+ try {
20758
+ if (namespaces) {
20759
+ exports.storage.setItem('debug', namespaces);
20760
+ } else {
20761
+ exports.storage.removeItem('debug');
20762
+ }
20763
+ } catch (error) {
20764
+ // Swallow
20765
+ // XXX (@Qix-) should we be logging these?
20766
+ }
20767
+ }
20768
+
20769
+ /**
20770
+ * Load `namespaces`.
20771
+ *
20772
+ * @return {String} returns the previously persisted debug modes
20773
+ * @api private
20774
+ */
20775
+ function load() {
20776
+ let r;
20777
+ try {
20778
+ r = exports.storage.getItem('debug');
20779
+ } catch (error) {
20780
+ // Swallow
20781
+ // XXX (@Qix-) should we be logging these?
20782
+ }
20783
+
20784
+ // If debug isn't set in LS, and we're in Electron, try to load $DEBUG
20785
+ if (!r && typeof process !== 'undefined' && 'env' in process) {
20786
+ r = process.env.DEBUG;
20787
+ }
20788
+
20789
+ return r;
20790
+ }
20791
+
20792
+ /**
20793
+ * Localstorage attempts to return the localstorage.
20794
+ *
20795
+ * This is necessary because safari throws
20796
+ * when a user disables cookies/localstorage
20797
+ * and you attempt to access it.
20798
+ *
20799
+ * @return {LocalStorage}
20800
+ * @api private
20801
+ */
20802
+
20803
+ function localstorage() {
20804
+ try {
20805
+ // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
20806
+ // The Browser also has localStorage in the global context.
20807
+ return localStorage;
20808
+ } catch (error) {
20809
+ // Swallow
20810
+ // XXX (@Qix-) should we be logging these?
20811
+ }
20812
+ }
20813
+
20814
+ module.exports = requireCommon()(exports);
20815
+
20816
+ const {formatters} = module.exports;
20817
+
20818
+ /**
20819
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
20820
+ */
20821
+
20822
+ formatters.j = function (v) {
20823
+ try {
20824
+ return JSON.stringify(v);
20825
+ } catch (error) {
20826
+ return '[UnexpectedJSONParseError]: ' + error.message;
20827
+ }
20828
+ };
20829
+ } (browser, browser.exports));
20830
+ return browser.exports;
20831
+ }
20832
+
20833
+ var node = {exports: {}};
20834
+
20835
+ var hasFlag;
20836
+ var hasRequiredHasFlag;
20837
+
20838
+ function requireHasFlag () {
20839
+ if (hasRequiredHasFlag) return hasFlag;
20840
+ hasRequiredHasFlag = 1;
20841
+
20842
+ hasFlag = (flag, argv = process.argv) => {
20843
+ const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
20844
+ const position = argv.indexOf(prefix + flag);
20845
+ const terminatorPosition = argv.indexOf('--');
20846
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
20847
+ };
20848
+ return hasFlag;
20849
+ }
20850
+
20851
+ var supportsColor_1;
20852
+ var hasRequiredSupportsColor;
20853
+
20854
+ function requireSupportsColor () {
20855
+ if (hasRequiredSupportsColor) return supportsColor_1;
20856
+ hasRequiredSupportsColor = 1;
20857
+ const os = require$$0$1;
20858
+ const tty = require$$1;
20859
+ const hasFlag = requireHasFlag();
20860
+
20861
+ const {env} = process;
20862
+
20863
+ let forceColor;
20864
+ if (hasFlag('no-color') ||
20865
+ hasFlag('no-colors') ||
20866
+ hasFlag('color=false') ||
20867
+ hasFlag('color=never')) {
20868
+ forceColor = 0;
20869
+ } else if (hasFlag('color') ||
20870
+ hasFlag('colors') ||
20871
+ hasFlag('color=true') ||
20872
+ hasFlag('color=always')) {
20873
+ forceColor = 1;
20874
+ }
20875
+
20876
+ if ('FORCE_COLOR' in env) {
20877
+ if (env.FORCE_COLOR === 'true') {
20878
+ forceColor = 1;
20879
+ } else if (env.FORCE_COLOR === 'false') {
20880
+ forceColor = 0;
20881
+ } else {
20882
+ forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
20883
+ }
20884
+ }
20885
+
20886
+ function translateLevel(level) {
20887
+ if (level === 0) {
20888
+ return false;
20889
+ }
20890
+
20891
+ return {
20892
+ level,
20893
+ hasBasic: true,
20894
+ has256: level >= 2,
20895
+ has16m: level >= 3
20896
+ };
20897
+ }
20898
+
20899
+ function supportsColor(haveStream, streamIsTTY) {
20900
+ if (forceColor === 0) {
20901
+ return 0;
20902
+ }
20903
+
20904
+ if (hasFlag('color=16m') ||
20905
+ hasFlag('color=full') ||
20906
+ hasFlag('color=truecolor')) {
20907
+ return 3;
20908
+ }
20909
+
20910
+ if (hasFlag('color=256')) {
20911
+ return 2;
20912
+ }
20913
+
20914
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
20915
+ return 0;
20916
+ }
20917
+
20918
+ const min = forceColor || 0;
20919
+
20920
+ if (env.TERM === 'dumb') {
20921
+ return min;
20922
+ }
20923
+
20924
+ if (process.platform === 'win32') {
20925
+ // Windows 10 build 10586 is the first Windows release that supports 256 colors.
20926
+ // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
20927
+ const osRelease = os.release().split('.');
20928
+ if (
20929
+ Number(osRelease[0]) >= 10 &&
20930
+ Number(osRelease[2]) >= 10586
20931
+ ) {
20932
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
20933
+ }
20934
+
20935
+ return 1;
20936
+ }
20937
+
20938
+ if ('CI' in env) {
20939
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
20940
+ return 1;
20941
+ }
20942
+
20943
+ return min;
20944
+ }
20945
+
20946
+ if ('TEAMCITY_VERSION' in env) {
20947
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
20948
+ }
20949
+
20950
+ if (env.COLORTERM === 'truecolor') {
20951
+ return 3;
20952
+ }
20953
+
20954
+ if ('TERM_PROGRAM' in env) {
20955
+ const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
20956
+
20957
+ switch (env.TERM_PROGRAM) {
20958
+ case 'iTerm.app':
20959
+ return version >= 3 ? 3 : 2;
20960
+ case 'Apple_Terminal':
20961
+ return 2;
20962
+ // No default
20963
+ }
20964
+ }
20965
+
20966
+ if (/-256(color)?$/i.test(env.TERM)) {
20967
+ return 2;
20968
+ }
20969
+
20970
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
20971
+ return 1;
20972
+ }
20973
+
20974
+ if ('COLORTERM' in env) {
20975
+ return 1;
20976
+ }
20977
+
20978
+ return min;
20979
+ }
20980
+
20981
+ function getSupportLevel(stream) {
20982
+ const level = supportsColor(stream, stream && stream.isTTY);
20983
+ return translateLevel(level);
20984
+ }
20985
+
20986
+ supportsColor_1 = {
20987
+ supportsColor: getSupportLevel,
20988
+ stdout: translateLevel(supportsColor(true, tty.isatty(1))),
20989
+ stderr: translateLevel(supportsColor(true, tty.isatty(2)))
20990
+ };
20991
+ return supportsColor_1;
20992
+ }
20993
+
20994
+ /**
20995
+ * Module dependencies.
20996
+ */
20997
+
20998
+ var hasRequiredNode;
20999
+
21000
+ function requireNode () {
21001
+ if (hasRequiredNode) return node.exports;
21002
+ hasRequiredNode = 1;
21003
+ (function (module, exports) {
21004
+ const tty = require$$1;
21005
+ const util = require$$0;
21006
+
21007
+ /**
21008
+ * This is the Node.js implementation of `debug()`.
21009
+ */
21010
+
21011
+ exports.init = init;
21012
+ exports.log = log;
21013
+ exports.formatArgs = formatArgs;
21014
+ exports.save = save;
21015
+ exports.load = load;
21016
+ exports.useColors = useColors;
21017
+ exports.destroy = util.deprecate(
21018
+ () => {},
21019
+ 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
21020
+ );
21021
+
21022
+ /**
21023
+ * Colors.
21024
+ */
21025
+
21026
+ exports.colors = [6, 2, 3, 4, 5, 1];
21027
+
21028
+ try {
21029
+ // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
21030
+ // eslint-disable-next-line import/no-extraneous-dependencies
21031
+ const supportsColor = requireSupportsColor();
21032
+
21033
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
21034
+ exports.colors = [
21035
+ 20,
21036
+ 21,
21037
+ 26,
21038
+ 27,
21039
+ 32,
21040
+ 33,
21041
+ 38,
21042
+ 39,
21043
+ 40,
21044
+ 41,
21045
+ 42,
21046
+ 43,
21047
+ 44,
21048
+ 45,
21049
+ 56,
21050
+ 57,
21051
+ 62,
21052
+ 63,
21053
+ 68,
21054
+ 69,
21055
+ 74,
21056
+ 75,
21057
+ 76,
21058
+ 77,
21059
+ 78,
21060
+ 79,
21061
+ 80,
21062
+ 81,
21063
+ 92,
21064
+ 93,
21065
+ 98,
21066
+ 99,
21067
+ 112,
21068
+ 113,
21069
+ 128,
21070
+ 129,
21071
+ 134,
21072
+ 135,
21073
+ 148,
21074
+ 149,
21075
+ 160,
21076
+ 161,
21077
+ 162,
21078
+ 163,
21079
+ 164,
21080
+ 165,
21081
+ 166,
21082
+ 167,
21083
+ 168,
21084
+ 169,
21085
+ 170,
21086
+ 171,
21087
+ 172,
21088
+ 173,
21089
+ 178,
21090
+ 179,
21091
+ 184,
21092
+ 185,
21093
+ 196,
21094
+ 197,
21095
+ 198,
21096
+ 199,
21097
+ 200,
21098
+ 201,
21099
+ 202,
21100
+ 203,
21101
+ 204,
21102
+ 205,
21103
+ 206,
21104
+ 207,
21105
+ 208,
21106
+ 209,
21107
+ 214,
21108
+ 215,
21109
+ 220,
21110
+ 221
21111
+ ];
21112
+ }
21113
+ } catch (error) {
21114
+ // Swallow - we only care if `supports-color` is available; it doesn't have to be.
21115
+ }
21116
+
21117
+ /**
21118
+ * Build up the default `inspectOpts` object from the environment variables.
21119
+ *
21120
+ * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
21121
+ */
21122
+
21123
+ exports.inspectOpts = Object.keys(process.env).filter(key => {
21124
+ return /^debug_/i.test(key);
21125
+ }).reduce((obj, key) => {
21126
+ // Camel-case
21127
+ const prop = key
21128
+ .substring(6)
21129
+ .toLowerCase()
21130
+ .replace(/_([a-z])/g, (_, k) => {
21131
+ return k.toUpperCase();
21132
+ });
21133
+
21134
+ // Coerce string value into JS value
21135
+ let val = process.env[key];
21136
+ if (/^(yes|on|true|enabled)$/i.test(val)) {
21137
+ val = true;
21138
+ } else if (/^(no|off|false|disabled)$/i.test(val)) {
21139
+ val = false;
21140
+ } else if (val === 'null') {
21141
+ val = null;
21142
+ } else {
21143
+ val = Number(val);
21144
+ }
21145
+
21146
+ obj[prop] = val;
21147
+ return obj;
21148
+ }, {});
21149
+
21150
+ /**
21151
+ * Is stdout a TTY? Colored output is enabled when `true`.
21152
+ */
21153
+
21154
+ function useColors() {
21155
+ return 'colors' in exports.inspectOpts ?
21156
+ Boolean(exports.inspectOpts.colors) :
21157
+ tty.isatty(process.stderr.fd);
21158
+ }
21159
+
21160
+ /**
21161
+ * Adds ANSI color escape codes if enabled.
21162
+ *
21163
+ * @api public
21164
+ */
21165
+
21166
+ function formatArgs(args) {
21167
+ const {namespace: name, useColors} = this;
21168
+
21169
+ if (useColors) {
21170
+ const c = this.color;
21171
+ const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
21172
+ const prefix = ` ${colorCode};1m${name} \u001B[0m`;
21173
+
21174
+ args[0] = prefix + args[0].split('\n').join('\n' + prefix);
21175
+ args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
21176
+ } else {
21177
+ args[0] = getDate() + name + ' ' + args[0];
21178
+ }
21179
+ }
21180
+
21181
+ function getDate() {
21182
+ if (exports.inspectOpts.hideDate) {
21183
+ return '';
21184
+ }
21185
+ return new Date().toISOString() + ' ';
21186
+ }
21187
+
21188
+ /**
21189
+ * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
21190
+ */
21191
+
21192
+ function log(...args) {
21193
+ return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
21194
+ }
21195
+
21196
+ /**
21197
+ * Save `namespaces`.
21198
+ *
21199
+ * @param {String} namespaces
21200
+ * @api private
21201
+ */
21202
+ function save(namespaces) {
21203
+ if (namespaces) {
21204
+ process.env.DEBUG = namespaces;
21205
+ } else {
21206
+ // If you set a process.env field to null or undefined, it gets cast to the
21207
+ // string 'null' or 'undefined'. Just delete instead.
21208
+ delete process.env.DEBUG;
21209
+ }
21210
+ }
21211
+
21212
+ /**
21213
+ * Load `namespaces`.
21214
+ *
21215
+ * @return {String} returns the previously persisted debug modes
21216
+ * @api private
21217
+ */
21218
+
21219
+ function load() {
21220
+ return process.env.DEBUG;
21221
+ }
21222
+
21223
+ /**
21224
+ * Init logic for `debug` instances.
21225
+ *
21226
+ * Create a new `inspectOpts` object in case `useColors` is set
21227
+ * differently for a particular `debug` instance.
21228
+ */
21229
+
21230
+ function init(debug) {
21231
+ debug.inspectOpts = {};
21232
+
21233
+ const keys = Object.keys(exports.inspectOpts);
21234
+ for (let i = 0; i < keys.length; i++) {
21235
+ debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
21236
+ }
21237
+ }
21238
+
21239
+ module.exports = requireCommon()(exports);
21240
+
21241
+ const {formatters} = module.exports;
21242
+
21243
+ /**
21244
+ * Map %o to `util.inspect()`, all on a single line.
21245
+ */
21246
+
21247
+ formatters.o = function (v) {
21248
+ this.inspectOpts.colors = this.useColors;
21249
+ return util.inspect(v, this.inspectOpts)
21250
+ .split('\n')
21251
+ .map(str => str.trim())
21252
+ .join(' ');
21253
+ };
21254
+
21255
+ /**
21256
+ * Map %O to `util.inspect()`, allowing multiple lines if needed.
21257
+ */
21258
+
21259
+ formatters.O = function (v) {
21260
+ this.inspectOpts.colors = this.useColors;
21261
+ return util.inspect(v, this.inspectOpts);
21262
+ };
21263
+ } (node, node.exports));
21264
+ return node.exports;
21265
+ }
21266
+
21267
+ /**
21268
+ * Detect Electron renderer / nwjs process, which is node, but we should
21269
+ * treat as a browser.
21270
+ */
21271
+
21272
+ var hasRequiredSrc;
21273
+
21274
+ function requireSrc () {
21275
+ if (hasRequiredSrc) return src.exports;
21276
+ hasRequiredSrc = 1;
21277
+ if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
21278
+ src.exports = requireBrowser();
21279
+ } else {
21280
+ src.exports = requireNode();
21281
+ }
21282
+ return src.exports;
21283
+ }
21284
+
21285
+ var srcExports = requireSrc();
21286
+ var createDebug = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
21287
+
21288
+ const logger = (namespace) => createDebug(`strapi-sdk-typescript:${namespace}`);
21289
+
21290
+ const log = logger('request');
20074
21291
  class Strapi {
20075
21292
  constructor(url, token) {
20076
21293
  this.url = url;
@@ -20207,15 +21424,11 @@ class Strapi {
20207
21424
  }
20208
21425
  } : {}),
20209
21426
  }, params));
20210
- if (!response.ok) {
20211
- console.log(`${this.url}/api/${endpoint}`);
20212
- console.log(response);
20213
- const data = await response.json();
20214
- console.log(data);
20215
- console.log(data?.error?.details?.errors);
20216
- throw new Error(`Помилка запиту до Strapi: ${response.status} ${response.statusText}`);
20217
- }
20218
- return (await response.json());
21427
+ const data = await response.json();
21428
+ log(`${this.url}/api/${endpoint}`);
21429
+ log(response);
21430
+ log(data);
21431
+ return data;
20219
21432
  }
20220
21433
  }
20221
21434