infopark_fiona7 1.2.0.1.1 → 1.2.0.1.3

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.
@@ -0,0 +1,650 @@
1
+ 'use strict';
2
+
3
+ var _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();
4
+
5
+ var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();
6
+
7
+ var _get = function get(_x4, _x5, _x6) { var _again = true; _function: while (_again) { var object = _x4, property = _x5, receiver = _x6; _again = false; if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x4 = parent; _x5 = property; _x6 = receiver; _again = true; desc = parent = undefined; continue _function; } } else if ('value' in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } };
8
+
9
+ function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; return arr2; } else { return Array.from(arr); } }
10
+
11
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }
12
+
13
+ function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
14
+
15
+ (function () {
16
+ var SYSTEM_ATTRIBUTES = {
17
+ _id: 'id',
18
+ _obj_class: 'objClass',
19
+ _path: 'path',
20
+ _permalink: 'permalink',
21
+ _last_changed: 'lastChanged'
22
+ };
23
+
24
+ /**
25
+ * The base class for CMS objects.
26
+ *
27
+ * A CMS object is a collection of properties and their values, as defined
28
+ * by its object class.
29
+ *
30
+ * @borrows scrivito.AttributeContent#get as #get
31
+ */
32
+ scrivito.BasicObj = (function (_scrivito$AttributeContent) {
33
+ _inherits(BasicObj, _scrivito$AttributeContent);
34
+
35
+ _createClass(BasicObj, null, [{
36
+ key: 'fetch',
37
+
38
+ /**
39
+ * Fetch a given Obj by its `id`.
40
+ *
41
+ * @param {string} id - The id of the Obj
42
+ * @returns {Promise<scrivito.BasicObj>} A promise that resolves to the obj with the given
43
+ * id. In case no CMS object with the given `id` exists, the promise is rejected with
44
+ * a {@link scrivito.ResourceNotFoundError}.
45
+ */
46
+ value: function fetch(id) {
47
+ scrivito.asyncMethodStub();
48
+ }
49
+
50
+ /**
51
+ * Get a given Obj by its `id`.
52
+ *
53
+ * @param {string} id - The id of the Obj
54
+ * @throws {scrivito.ResourceNotFoundError} If the CMS object with the given `id`
55
+ * does not exists.
56
+ * @throws {scrivito.NotLoadedError} If the CMS object is not yet loaded.
57
+ * @returns {scrivito.BasicObj}
58
+ */
59
+ }, {
60
+ key: 'get',
61
+ value: function get(id) {
62
+ var objData = scrivito.ObjDataStore.get(id);
63
+ return new scrivito.BasicObj(objData);
64
+ }
65
+
66
+ /**
67
+ * Create a new {@link scrivito.BasicObj Obj}.
68
+ *
69
+ * @param attributes the new obj's attributes. The `_obj_class` has to be provided
70
+ *
71
+ * @return {scrivito.BasicObj} the newly created obj.
72
+ * @throws {scrivito.ArgumentError} if the `_obj_class` is missing or invalid.
73
+ */
74
+ }, {
75
+ key: 'create',
76
+ value: function create(attributes) {
77
+ ensureObjClassExists(attributes._obj_class);
78
+
79
+ if (!attributes._id) {
80
+ attributes._id = this.generateId();
81
+ }
82
+
83
+ return this.createWithSerializedAttributes(_.pick(attributes, '_obj_class', '_id'), attributes);
84
+ }
85
+ }, {
86
+ key: 'createWithDefaults',
87
+ value: function createWithDefaults(_ref) {
88
+ var _this = this;
89
+
90
+ var _obj_class = _ref._obj_class;
91
+ var _path = _ref._path;
92
+
93
+ var attributes = undefined;
94
+ if (_path) {
95
+ attributes = { _path: _path };
96
+ }
97
+
98
+ return scrivito.ObjClass.find(_obj_class).fetchDefaults(attributes).then(function (serializedAttributes) {
99
+ return _this.createWithSerializedAttributes(serializedAttributes);
100
+ }).then(function (obj) {
101
+ return obj.finishSaving().then(function () {
102
+ return obj;
103
+ });
104
+ });
105
+ }
106
+ }, {
107
+ key: 'addChildWithSerializedAttributes',
108
+ value: function addChildWithSerializedAttributes(parentPath, serializedAttributes) {
109
+ var objId = scrivito.BasicObj.generateId();
110
+ var defaultName = serializedAttributes._obj_class || objId; // <-- PATCH HERE
111
+ return this.createWithSerializedAttributes(_.extend({}, serializedAttributes, {
112
+ _id: objId,
113
+ _path: parentPath + '/' + defaultName }));
114
+ }
115
+ }, {
116
+ key: 'createWithSerializedAttributes',
117
+ // <-- PATCH HERE
118
+ value: function createWithSerializedAttributes(serializedAttributes, attributeDict) {
119
+ if (!attributeDict) {
120
+ return this.createWithSerializedAttributes.apply(this, _toConsumableArray(extractAttributeDict(serializedAttributes)));
121
+ }
122
+
123
+ // -- PATCH BEGINS HERE --
124
+ if (!serializedAttributes._path) {
125
+ var page = scrivito.application_document().page();
126
+ var path = typeof page.provided_path === 'function' && page.provided_path();
127
+ if (path) {
128
+ var blobName = undefined;
129
+ if (serializedAttributes.blob && typeof serializedAttributes.blob === 'object') {
130
+ blobName = serializedAttributes.blob.name || serializedAttributes.blob.filename;
131
+ } else {
132
+ blobName = undefined;
133
+ }
134
+ var defaultName = blobName || serializedAttributes._name || serializedAttributes._obj_class || serializedAttributes._id;
135
+ serializedAttributes._path = path + '/' + defaultName;
136
+ }
137
+ }
138
+ // -- PATCH ENDS HERE --
139
+
140
+ var objData = scrivito.ObjDataStore.createObjData(serializedAttributes._id);
141
+ objData.update(serializedAttributes);
142
+
143
+ var obj = new scrivito.BasicObj(objData);
144
+ obj.update(attributeDict);
145
+
146
+ return obj;
147
+ }
148
+ }, {
149
+ key: 'generateId',
150
+ value: function generateId() {
151
+ return scrivito.random_id();
152
+ }
153
+
154
+ /**
155
+ * Returns an {@link scrivito.ObjSearchIterable} of all {@link scrivito.BasicObj}s.
156
+ * @return {scrivito.ObjSearchIterable}
157
+ */
158
+ }, {
159
+ key: 'all',
160
+ value: function all() {
161
+ return new scrivito.ObjSearchIterable().batchSize(1000);
162
+ }
163
+
164
+ /**
165
+ * Returns an {@link scrivito.ObjSearchIterable} with the given initial subquery consisting
166
+ * of the four arguments.
167
+ *
168
+ * Note that `field` and `value` can also be arrays for searching several fields or searching
169
+ * for several values. For detailed information see {@link scrivito.ObjSearchIterable}.
170
+ *
171
+ * @example
172
+ * // Look for objects with left-over "Lorem", boosting headline matches:
173
+ * scrivito.BasicObj.where(:*, :contains, 'Lorem', headline: 2)
174
+ *
175
+ * @param {String|String[]} field See {@link scrivito.ObjSearchIterable#and} for details
176
+ * @param {String} operator See {@link scrivito.ObjSearchIterable#and} for details
177
+ * @param {String|String[]} value See {@link scrivito.ObjSearchIterable#and} for details
178
+ * @param {Object} [boost] See {@link scrivito.ObjSearchIterable#and} for details
179
+ * @return {scrivito.ObjSearchIterable}
180
+ */
181
+ }, {
182
+ key: 'where',
183
+ value: function where(field, operator, value) {
184
+ var boost = arguments.length <= 3 || arguments[3] === undefined ? null : arguments[3];
185
+
186
+ return new scrivito.ObjSearchIterable().and(field, operator, value, boost);
187
+ }
188
+
189
+ /**
190
+ * Find the {@link scrivito.BasicObj Obj} with the given path.
191
+ * Returns `null` if no matching Obj exists.
192
+ * @param {String} path Path of the {@link scrivito.BasicObj Obj}.
193
+ * @return {scrivito.BasicObj?}
194
+ * @throws {scrivito.NotLoadedError} If the CMS object is not yet loaded.
195
+ */
196
+ }, {
197
+ key: 'findByPath',
198
+ value: function findByPath(path) {
199
+ return scrivito.iterable.firstValueFromIterator(this.where('_path', 'equals', path).iterator());
200
+ }
201
+
202
+ /**
203
+ * Returns the {@link scrivito.BasicObj Obj} with the given permalink, or `null` if no
204
+ * matching Obj exists.
205
+ * @param {String} permalink The permalink of the {@link scrivito.BasicObj Obj}.
206
+ * @return {scrivito.BasicObj?}
207
+ * @throws {scrivito.NotLoadedError} If the CMS object is not yet loaded.
208
+ */
209
+ }, {
210
+ key: 'findByPermalink',
211
+ value: function findByPermalink(permalink) {
212
+ var iterator = this.where('_permalink', 'equals', permalink).iterator();
213
+ return scrivito.iterable.firstValueFromIterator(iterator);
214
+ }
215
+
216
+ /**
217
+ * The constructor is not part of the public API and should **not** be used.
218
+ *
219
+ * Please use {@link scrivito.BasicObj.fetch} to access existing CMS objects or
220
+ * {@link scrivito.BasicObj.create} to create a new one.
221
+ */
222
+ }]);
223
+
224
+ function BasicObj(objData) {
225
+ _classCallCheck(this, BasicObj);
226
+
227
+ _get(Object.getPrototypeOf(BasicObj.prototype), 'constructor', this).call(this);
228
+ this.objData = objData;
229
+ }
230
+
231
+ /**
232
+ * The `id` of the CMS object
233
+ * @type {String}
234
+ */
235
+
236
+ _createClass(BasicObj, [{
237
+ key: 'getParent',
238
+ value: function getParent() {
239
+ if (this._hasParent()) {
240
+ return scrivito.BasicObj.findByPath(computeParentPath(this.path));
241
+ }
242
+
243
+ return null;
244
+ }
245
+ }, {
246
+ key: 'hasConflicts',
247
+ value: function hasConflicts() {
248
+ return !!this._current._conflicts;
249
+ }
250
+ }, {
251
+ key: 'fetchParent',
252
+
253
+ /**
254
+ * Fetches the {@link scrivito.BasicObj} that is the parent of this Obj.
255
+ *
256
+ * @returns {Promise<scrivito.BasicObj>} A promise that resolves to the parent Obj.
257
+ * Resolves to `null` if the obj has no parent.
258
+ */
259
+ value: function fetchParent() {
260
+ scrivito.asyncMethodStub();
261
+ }
262
+
263
+ /**
264
+ * Returns a list of all child {@link scrivito.BasicObj Objs}
265
+ *
266
+ * Throws a {@link scrivito.NotLoadedError} if the children are not yet loaded.
267
+ *
268
+ * @type {scrivito.BasicObj[]}
269
+ */
270
+ }, {
271
+ key: 'update',
272
+
273
+ /**
274
+ * Updates the attributes of the current CMS object.
275
+ *
276
+ * @param {Object} attributes - the new attributes
277
+ *
278
+ * @example
279
+ * // Change the permalink of a CMS object
280
+ * obj.update({_permalink: '/blog'});
281
+ *
282
+ * @example
283
+ * // Change a string and reorder widgets
284
+ * obj.update({title: 'New Title', body: obj.get('body').reverse()});
285
+ */
286
+ value: function update(attributes) {
287
+ this._persistWidgets(this, this._objClass, attributes);
288
+ var patch = scrivito.AttributeSerializer.serialize(this._objClass, attributes);
289
+ this.objData.update(patch);
290
+ this._linkResolution.start();
291
+ }
292
+ }, {
293
+ key: 'copyAsync',
294
+ value: function copyAsync() {
295
+ var copyOptions = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
296
+
297
+ assertValidCopyOptions(copyOptions);
298
+
299
+ return this._copyAttributes().then(function (copiedAttributes) {
300
+ var serializedAttributes = _.extend(copiedAttributes, copyOptions);
301
+ var obj = scrivito.BasicObj.createWithSerializedAttributes(serializedAttributes);
302
+ return obj.finishSaving().then(function () {
303
+ return obj;
304
+ });
305
+ });
306
+ }
307
+ }, {
308
+ key: 'moveToAsync',
309
+ value: function moveToAsync(parentPath) {
310
+ this.update({ _path: parentPath + '/' + this.id });
311
+ return this.finishSaving();
312
+ }
313
+ }, {
314
+ key: 'markResolvedAsync',
315
+ value: function markResolvedAsync() {
316
+ this.update({ _conflicts: null });
317
+ return this.finishSaving();
318
+ }
319
+
320
+ /**
321
+ * Resolves when all previous {@link scrivito.BasicObj#update updates} have been persisted.
322
+ * If an update fails the promise is rejected.
323
+ *
324
+ * @returns {Promise}
325
+ */
326
+ }, {
327
+ key: 'finishSaving',
328
+ value: function finishSaving() {
329
+ var _this2 = this;
330
+
331
+ var finish = this._linkResolution.finishResolving().then(function () {
332
+ return _this2.objData.finishSaving();
333
+ });
334
+ return new scrivito.PublicPromise(finish);
335
+ }
336
+
337
+ /**
338
+ * Access widgets by their ids
339
+ *
340
+ * @param {String} id - the widget's id
341
+ * @returns {?scrivito.BasicWidget}
342
+ */
343
+ }, {
344
+ key: 'widget',
345
+ value: function widget(id) {
346
+ if (this.widgetData(id)) {
347
+ return scrivito.BasicWidget.build(id, this);
348
+ }
349
+ return null;
350
+ }
351
+
352
+ /**
353
+ * Returns all widgets of the given CMS object
354
+ *
355
+ * @returns {scrivito.BasicWidget[]}
356
+ */
357
+ }, {
358
+ key: 'widgets',
359
+ value: function widgets() {
360
+ var _this3 = this;
361
+
362
+ return _.map(_.keys(this._widgetPool), function (id) {
363
+ return _this3.widget(id);
364
+ });
365
+ }
366
+ }, {
367
+ key: 'widgetData',
368
+ value: function widgetData(id) {
369
+ return this._widgetPool[id];
370
+ }
371
+ }, {
372
+ key: 'generateWidgetId',
373
+ value: function generateWidgetId() {
374
+ for (var i = 0; i < 10; i++) {
375
+ var id = scrivito.random_hex();
376
+
377
+ if (!this.widget(id)) {
378
+ return id;
379
+ }
380
+ }
381
+
382
+ $.error('Could not generate a new unused widget id.');
383
+ }
384
+ }, {
385
+ key: 'serializeAttributes',
386
+ value: function serializeAttributes() {
387
+ var serializedAttributes = _get(Object.getPrototypeOf(BasicObj.prototype), 'serializeAttributes', this).call(this);
388
+
389
+ delete serializedAttributes._conflicts;
390
+ delete serializedAttributes._modification;
391
+ delete serializedAttributes._last_changed;
392
+
393
+ return serializedAttributes;
394
+ }
395
+ }, {
396
+ key: '_hasParent',
397
+ value: function _hasParent() {
398
+ return this.path && this.path !== '/';
399
+ }
400
+ }, {
401
+ key: '_copyAttributes',
402
+ value: function _copyAttributes() {
403
+ var objId = scrivito.BasicObj.generateId();
404
+ var serializedAttributes = this.serializeAttributes();
405
+ var uploadPromises = [];
406
+
407
+ _.each(serializedAttributes, function (typeAndValue, name) {
408
+ if (name[0] === '_') {
409
+ delete serializedAttributes[name];
410
+ return;
411
+ }
412
+
413
+ var _typeAndValue = _slicedToArray(typeAndValue, 2);
414
+
415
+ var type = _typeAndValue[0];
416
+ var value = _typeAndValue[1];
417
+
418
+ if (type === 'binary' && value) {
419
+ var futureBinary = new scrivito.FutureBinary({ idToCopy: value.id });
420
+ var promise = futureBinary.into(objId).then(function (binary) {
421
+ return { name: name, binary: binary };
422
+ });
423
+ uploadPromises.push(promise);
424
+ }
425
+ });
426
+
427
+ serializedAttributes._id = objId;
428
+ serializedAttributes._obj_class = this.objClass;
429
+ if (this.path) {
430
+ serializedAttributes._path = computeParentPath(this.path) + '/' + objId;
431
+ }
432
+
433
+ return scrivito.PublicPromise.all(uploadPromises).then(function (binaries) {
434
+ _.each(binaries, function (_ref2) {
435
+ var name = _ref2.name;
436
+ var binary = _ref2.binary;
437
+
438
+ serializedAttributes[name] = ['binary', { id: binary.id }];
439
+ });
440
+
441
+ return serializedAttributes;
442
+ });
443
+ }
444
+ }, {
445
+ key: 'id',
446
+ get: function get() {
447
+ return this._current._id;
448
+ }
449
+
450
+ /**
451
+ * The object class name of the CMS object
452
+ * @type {String}
453
+ */
454
+ }, {
455
+ key: 'objClass',
456
+ get: function get() {
457
+ return this._current._obj_class;
458
+ }
459
+
460
+ /**
461
+ * The date the CMS object was last changed.
462
+ * Returns `null` if the obj has not been changed yet.
463
+ * @type {?Date}
464
+ */
465
+ }, {
466
+ key: 'lastChanged',
467
+ get: function get() {
468
+ if (this._current._last_changed) {
469
+ return scrivito.parseDate(this._current._last_changed);
470
+ }
471
+
472
+ return null;
473
+ }
474
+
475
+ /**
476
+ * The path of the CMS object
477
+ * @type {?String}
478
+ */
479
+ }, {
480
+ key: 'path',
481
+ get: function get() {
482
+ return this._current._path || null;
483
+ }
484
+
485
+ /**
486
+ * The permalink of the CMS object
487
+ * @type {?String}
488
+ */
489
+ }, {
490
+ key: 'permalink',
491
+ get: function get() {
492
+ return this._current._permalink || null;
493
+ }
494
+
495
+ /**
496
+ * Returns the {@link scrivito.BasicObj} that is the parent of this Obj.
497
+ * Returns `null` if the obj has no `path` or is the root Obj.
498
+ *
499
+ * Throws a {@link scrivito.NotLoadedError} if the parent is not yet loaded.
500
+ *
501
+ * @type {?scrivito.BasicObj}
502
+ */
503
+ }, {
504
+ key: 'parent',
505
+ get: function get() {
506
+ return this.getParent();
507
+ }
508
+ }, {
509
+ key: 'modification',
510
+ get: function get() {
511
+ return this._current._modification || null;
512
+ }
513
+ }, {
514
+ key: 'children',
515
+ get: function get() {
516
+ if (this.path) {
517
+ var iterator = scrivito.BasicObj.where('_parent_path', 'equals', this.path).iterator();
518
+ return scrivito.iterable.collectValuesFromIterator(iterator);
519
+ }
520
+
521
+ return [];
522
+ }
523
+
524
+ /**
525
+ * Returns an Array of all the ancestor {@link scrivito.BasicObj Objs}, starting at the
526
+ * root and ending at the parent of this object.
527
+ *
528
+ * Throws a {@link scrivito.NotLoadedError} if the ancestors are not yet loaded.
529
+ *
530
+ * @type {scrivito.BasicObj[]}
531
+ */
532
+ }, {
533
+ key: 'ancestors',
534
+ get: function get() {
535
+ if (this._hasParent()) {
536
+ var parentPath = computeParentPath(this.path);
537
+
538
+ return collectPathComponents(parentPath).map(function (ancestorPath) {
539
+ return scrivito.BasicObj.findByPath(ancestorPath);
540
+ });
541
+ }
542
+
543
+ return [];
544
+ }
545
+ }, {
546
+ key: '_widgetPool',
547
+ get: function get() {
548
+ return this._current._widget_pool || {};
549
+ }
550
+ }, {
551
+ key: '_systemAttributes',
552
+ get: function get() {
553
+ return SYSTEM_ATTRIBUTES;
554
+ }
555
+ }, {
556
+ key: '_current',
557
+ get: function get() {
558
+ return this.objData.current;
559
+ }
560
+ }, {
561
+ key: '_objClass',
562
+ get: function get() {
563
+ return scrivito.ObjClass.find(this.objClass);
564
+ }
565
+ }, {
566
+ key: '_linkResolution',
567
+ get: function get() {
568
+ return scrivito.LinkResolution['for'](this.objData);
569
+ }
570
+ }]);
571
+
572
+ return BasicObj;
573
+ })(scrivito.AttributeContent);
574
+
575
+ scrivito.provideAsyncClassMethods(scrivito.BasicObj, {
576
+ get: 'fetch'
577
+ });
578
+
579
+ scrivito.provideAsyncInstanceMethods(scrivito.BasicObj, {
580
+ getParent: 'fetchParent'
581
+ });
582
+
583
+ function ensureObjClassExists(objClass) {
584
+ if (!objClass) {
585
+ throw new scrivito.ArgumentError('Please provide an obj class as the "_obj_class" property.');
586
+ }
587
+
588
+ if (!scrivito.ObjClass.find(objClass)) {
589
+ throw new scrivito.ArgumentError('The obj class "' + objClass + '" does not exist.');
590
+ }
591
+ }
592
+
593
+ function extractAttributeDict(attributes) {
594
+ var serializedAttributes = {};
595
+ var attributeDict = {};
596
+
597
+ _.each(attributes, function (serializedValue, name) {
598
+ if (_.isArray(serializedValue) && _.first(serializedValue) === 'widgetlist') {
599
+ var widgetlist = _.last(serializedValue);
600
+ attributeDict[name] = _.map(widgetlist, function (serializedWidgetAttributes) {
601
+ return scrivito.BasicWidget.newWithSerializedAttributes(serializedWidgetAttributes);
602
+ });
603
+ } else {
604
+ serializedAttributes[name] = serializedValue;
605
+ }
606
+ });
607
+
608
+ if (!serializedAttributes._id) {
609
+ serializedAttributes._id = scrivito.BasicObj.generateId();
610
+ }
611
+
612
+ return [serializedAttributes, attributeDict];
613
+ }
614
+
615
+ function collectPathComponents(_x7) {
616
+ var _arguments2 = arguments;
617
+ var _again2 = true;
618
+
619
+ _function2: while (_again2) {
620
+ var path = _x7;
621
+ _again2 = false;
622
+ var results = _arguments2.length <= 1 || _arguments2[1] === undefined ? [] : _arguments2[1];
623
+
624
+ if (path === '/') {
625
+ return ['/'].concat(_toConsumableArray(results));
626
+ }
627
+ _arguments2 = [_x7 = computeParentPath(path), [path].concat(_toConsumableArray(results))];
628
+ _again2 = true;
629
+ results = undefined;
630
+ continue _function2;
631
+ }
632
+ }
633
+
634
+ function computeParentPath(path) {
635
+ var pathComponents = path.split('/');
636
+ pathComponents.pop();
637
+ if (pathComponents.length === 1) {
638
+ return '/';
639
+ }
640
+ return pathComponents.join('/');
641
+ }
642
+
643
+ function assertValidCopyOptions(copyOptions) {
644
+ var validCopyOptions = ['_path'];
645
+
646
+ if (_.difference(_.keys(copyOptions), validCopyOptions).length) {
647
+ throw new scrivito.ArgumentError('Currently only "_path" copy option is supported.');
648
+ }
649
+ }
650
+ })();