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