@payloadcms/plugin-nested-docs 1.0.6 → 1.0.7
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/package.json +6 -3
- package/dist/formatBreadcrumb.d.ts +0 -4
- package/dist/formatBreadcrumb.js +0 -25
- package/dist/formatBreadcrumb.js.map +0 -1
- package/dist/getParents.d.ts +0 -4
- package/dist/getParents.js +0 -89
- package/dist/getParents.js.map +0 -1
- package/dist/populateBreadcrumbs.d.ts +0 -4
- package/dist/populateBreadcrumbs.js +0 -83
- package/dist/populateBreadcrumbs.js.map +0 -1
- package/dist/utilities/deepMerge.d.ts +0 -2
- package/dist/utilities/deepMerge.js +0 -44
- package/dist/utilities/deepMerge.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/plugin-nested-docs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"homepage:": "https://payloadcms.com",
|
|
5
5
|
"repository": "git@github.com:payloadcms/plugin-nested-docs.git",
|
|
6
6
|
"description": "Nested documents plugin for Payload",
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"build": "tsc",
|
|
11
11
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
12
12
|
"lint": "eslint src",
|
|
13
|
-
"lint:fix": "eslint --fix --ext .ts,.tsx src"
|
|
13
|
+
"lint:fix": "eslint --fix --ext .ts,.tsx src",
|
|
14
|
+
"clean": "rimraf dist",
|
|
15
|
+
"prepublishOnly": "yarn clean && yarn build"
|
|
14
16
|
},
|
|
15
17
|
"keywords": [
|
|
16
18
|
"payload",
|
|
@@ -25,7 +27,7 @@
|
|
|
25
27
|
"author": "dev@payloadcms.com",
|
|
26
28
|
"license": "MIT",
|
|
27
29
|
"peerDependencies": {
|
|
28
|
-
"payload": "^0.18.5 || ^1.0.0",
|
|
30
|
+
"payload": "^0.18.5 || ^1.0.0 || ^2.0.0",
|
|
29
31
|
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
|
|
30
32
|
},
|
|
31
33
|
"devDependencies": {
|
|
@@ -49,6 +51,7 @@
|
|
|
49
51
|
"payload": "^1.8.2",
|
|
50
52
|
"prettier": "^2.7.1",
|
|
51
53
|
"react": "^18.0.0",
|
|
54
|
+
"rimraf": "^5.0.5",
|
|
52
55
|
"ts-node": "^9.1.1",
|
|
53
56
|
"typescript": "^4.8.4"
|
|
54
57
|
},
|
package/dist/formatBreadcrumb.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var formatBreadcrumb = function (options, collection, docs) {
|
|
4
|
-
var _a;
|
|
5
|
-
var url = undefined;
|
|
6
|
-
var label;
|
|
7
|
-
var lastDoc = docs[docs.length - 1];
|
|
8
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.generateURL) === 'function') {
|
|
9
|
-
url = options.generateURL(docs, lastDoc);
|
|
10
|
-
}
|
|
11
|
-
if (typeof (options === null || options === void 0 ? void 0 : options.generateLabel) === 'function') {
|
|
12
|
-
label = options.generateLabel(docs, lastDoc);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
var useAsTitle = ((_a = collection === null || collection === void 0 ? void 0 : collection.admin) === null || _a === void 0 ? void 0 : _a.useAsTitle) || 'id';
|
|
16
|
-
label = lastDoc[useAsTitle];
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
label: label,
|
|
20
|
-
url: url,
|
|
21
|
-
doc: lastDoc.id,
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
exports.default = formatBreadcrumb;
|
|
25
|
-
//# sourceMappingURL=formatBreadcrumb.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formatBreadcrumb.js","sourceRoot":"","sources":["../src/formatBreadcrumb.ts"],"names":[],"mappings":";;AAGA,IAAM,gBAAgB,GAAG,UACvB,OAAgB,EAChB,UAA4B,EAC5B,IAA+B;;IAE/B,IAAI,GAAG,GAAuB,SAAS,CAAC;IACxC,IAAI,KAAa,CAAC;IAElB,IAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEtC,IAAI,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,CAAA,KAAK,UAAU,EAAE;QAC9C,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KAC1C;IAED,IAAI,OAAO,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,aAAa,CAAA,KAAK,UAAU,EAAE;QAChD,KAAK,GAAG,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KAC9C;SAAM;QACL,IAAM,UAAU,GAAG,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,KAAK,0CAAE,UAAU,KAAI,IAAI,CAAC;QACzD,KAAK,GAAG,OAAO,CAAC,UAAU,CAAW,CAAC;KACvC;IAED,OAAO;QACL,KAAK,OAAA;QACL,GAAG,KAAA;QACH,GAAG,EAAE,OAAO,CAAC,EAAY;KAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,gBAAgB,CAAC"}
|
package/dist/getParents.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { CollectionConfig } from 'payload/types';
|
|
2
|
-
import { Options } from './types';
|
|
3
|
-
declare const getParents: (req: any, options: Options, collection: CollectionConfig, doc: Record<string, unknown>, docs?: Record<string, unknown>[]) => Promise<Record<string, unknown>[]>;
|
|
4
|
-
export default getParents;
|
package/dist/getParents.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
-
if (ar || !(i in from)) {
|
|
41
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
-
ar[i] = from[i];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
-
};
|
|
47
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
-
var getParents = function (req, options, collection, doc, docs) {
|
|
49
|
-
if (docs === void 0) { docs = []; }
|
|
50
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
51
|
-
var parent, retrievedParent;
|
|
52
|
-
return __generator(this, function (_a) {
|
|
53
|
-
switch (_a.label) {
|
|
54
|
-
case 0:
|
|
55
|
-
parent = doc[(options === null || options === void 0 ? void 0 : options.parentFieldSlug) || 'parent'];
|
|
56
|
-
if (!parent) return [3 /*break*/, 3];
|
|
57
|
-
if (!(typeof parent === 'string')) return [3 /*break*/, 2];
|
|
58
|
-
return [4 /*yield*/, req.payload.findByID({
|
|
59
|
-
req: req,
|
|
60
|
-
id: parent,
|
|
61
|
-
collection: collection.slug,
|
|
62
|
-
depth: 0,
|
|
63
|
-
})];
|
|
64
|
-
case 1:
|
|
65
|
-
retrievedParent = _a.sent();
|
|
66
|
-
_a.label = 2;
|
|
67
|
-
case 2:
|
|
68
|
-
// If auto-populated
|
|
69
|
-
if (typeof parent === 'object') {
|
|
70
|
-
retrievedParent = parent;
|
|
71
|
-
}
|
|
72
|
-
if (retrievedParent) {
|
|
73
|
-
if (retrievedParent.parent) {
|
|
74
|
-
return [2 /*return*/, getParents(req, options, collection, retrievedParent, __spreadArray([
|
|
75
|
-
retrievedParent
|
|
76
|
-
], docs, true))];
|
|
77
|
-
}
|
|
78
|
-
return [2 /*return*/, __spreadArray([
|
|
79
|
-
retrievedParent
|
|
80
|
-
], docs, true)];
|
|
81
|
-
}
|
|
82
|
-
_a.label = 3;
|
|
83
|
-
case 3: return [2 /*return*/, docs];
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
exports.default = getParents;
|
|
89
|
-
//# sourceMappingURL=getParents.js.map
|
package/dist/getParents.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getParents.js","sourceRoot":"","sources":["../src/getParents.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAM,UAAU,GAAG,UACjB,GAAQ,EACR,OAAgB,EAChB,UAA4B,EAC5B,GAA4B,EAC5B,IAAoC;IAApC,qBAAA,EAAA,SAAoC;;;;;;oBAE9B,MAAM,GAAG,GAAG,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,eAAe,KAAI,QAAQ,CAAC,CAAC;yBAGrD,MAAM,EAAN,wBAAM;yBAEJ,CAAA,OAAO,MAAM,KAAK,QAAQ,CAAA,EAA1B,wBAA0B;oBACV,qBAAM,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC;4BAC3C,GAAG,KAAA;4BACH,EAAE,EAAE,MAAM;4BACV,UAAU,EAAE,UAAU,CAAC,IAAI;4BAC3B,KAAK,EAAE,CAAC;yBACT,CAAC,EAAA;;oBALF,eAAe,GAAG,SAKhB,CAAC;;;oBAGL,oBAAoB;oBACpB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;wBAC9B,eAAe,GAAG,MAAM,CAAC;qBAC1B;oBAED,IAAI,eAAe,EAAE;wBACnB,IAAI,eAAe,CAAC,MAAM,EAAE;4BAC1B,sBAAO,UAAU,CACf,GAAG,EACH,OAAO,EACP,UAAU,EACV,eAAe;oCAEb,eAAe;mCACZ,IAAI,QAEV,EAAC;yBACH;wBAED;gCACE,eAAe;+BACZ,IAAI,SACP;qBACH;;wBAGH,sBAAO,IAAI,EAAC;;;;CACb,CAAC;AAEF,kBAAe,UAAU,CAAC"}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
-
if (ar || !(i in from)) {
|
|
52
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
-
ar[i] = from[i];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
-
};
|
|
58
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
|
-
};
|
|
61
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
-
var getParents_1 = __importDefault(require("./getParents"));
|
|
63
|
-
var formatBreadcrumb_1 = __importDefault(require("./formatBreadcrumb"));
|
|
64
|
-
var populateBreadcrumbs = function (req, options, collection, data, originalDoc) { return __awaiter(void 0, void 0, void 0, function () {
|
|
65
|
-
var newData, breadcrumbDocs, _a, breadcrumbs;
|
|
66
|
-
var _b;
|
|
67
|
-
return __generator(this, function (_c) {
|
|
68
|
-
switch (_c.label) {
|
|
69
|
-
case 0:
|
|
70
|
-
newData = data;
|
|
71
|
-
_a = [[]];
|
|
72
|
-
return [4 /*yield*/, (0, getParents_1.default)(req, options, collection, __assign(__assign({}, originalDoc), data))];
|
|
73
|
-
case 1:
|
|
74
|
-
breadcrumbDocs = __spreadArray.apply(void 0, [__spreadArray.apply(void 0, _a.concat([_c.sent(), true])), [
|
|
75
|
-
__assign(__assign(__assign({}, originalDoc), data), { id: originalDoc === null || originalDoc === void 0 ? void 0 : originalDoc.id }),
|
|
76
|
-
], false]);
|
|
77
|
-
breadcrumbs = breadcrumbDocs.map(function (_, i) { return (0, formatBreadcrumb_1.default)(options, collection, breadcrumbDocs.slice(0, i + 1)); });
|
|
78
|
-
return [2 /*return*/, __assign(__assign({}, newData), (_b = {}, _b[(options === null || options === void 0 ? void 0 : options.breadcrumbsFieldSlug) || 'breadcrumbs'] = breadcrumbs, _b))];
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}); };
|
|
82
|
-
exports.default = populateBreadcrumbs;
|
|
83
|
-
//# sourceMappingURL=populateBreadcrumbs.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"populateBreadcrumbs.js","sourceRoot":"","sources":["../src/populateBreadcrumbs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,4DAAsC;AACtC,wEAAkD;AAElD,IAAM,mBAAmB,GAAG,UAAO,GAAQ,EAAE,OAAgB,EAAE,UAA4B,EAAE,IAAS,EAAE,WAAiB;;;;;;gBACjH,OAAO,GAAG,IAAI,CAAC;;gBAEhB,qBAAM,IAAA,oBAAU,EAAC,GAAG,EAAE,OAAO,EAAE,UAAU,wBACvC,WAAW,GACX,IAAI,EACP,EAAA;;gBAJE,cAAc,uEACf,SAGD;uDAEG,WAAW,GACX,IAAI,KACP,EAAE,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,EAAE;8BAEtB;gBAEK,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,UAAC,CAAC,EAAE,CAAC,IAAK,OAAA,IAAA,0BAAgB,EAAC,OAAO,EAAE,UAAU,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAArE,CAAqE,CAAC,CAAC;gBAExH,4CACK,OAAO,gBACT,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,oBAAoB,KAAI,aAAa,IAAG,WAAW,QAC7D;;;KACH,CAAC;AAEF,kBAAe,mBAAmB,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.isObject = void 0;
|
|
15
|
-
function isObject(item) {
|
|
16
|
-
return Boolean(item && typeof item === 'object' && !Array.isArray(item));
|
|
17
|
-
}
|
|
18
|
-
exports.isObject = isObject;
|
|
19
|
-
function deepMerge(target, source) {
|
|
20
|
-
var output = __assign({}, target);
|
|
21
|
-
if (isObject(target) && isObject(source)) {
|
|
22
|
-
Object.keys(source).forEach(function (key) {
|
|
23
|
-
var _a, _b;
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
if (isObject(source[key])) {
|
|
26
|
-
if (!(key in target)) {
|
|
27
|
-
// @ts-ignore
|
|
28
|
-
Object.assign(output, (_a = {}, _a[key] = source[key], _a));
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
output[key] = deepMerge(target[key], source[key]);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
Object.assign(output, (_b = {}, _b[key] = source[key], _b));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return output;
|
|
42
|
-
}
|
|
43
|
-
exports.default = deepMerge;
|
|
44
|
-
//# sourceMappingURL=deepMerge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deepMerge.js","sourceRoot":"","sources":["../../src/utilities/deepMerge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,SAAgB,QAAQ,CAAC,IAAa;IACpC,OAAO,OAAO,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC3E,CAAC;AAFD,4BAEC;AAED,SAAwB,SAAS,CAAO,MAAS,EAAE,MAAS;IAC1D,IAAM,MAAM,gBAAQ,MAAM,CAAE,CAAC;IAC7B,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;QACxC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAC,GAAG;;YAC9B,aAAa;YACb,IAAI,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE;gBACzB,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE;oBACpB,aAAa;oBACb,MAAM,CAAC,MAAM,CAAC,MAAM,YAAI,GAAC,GAAG,IAAG,MAAM,CAAC,GAAG,CAAC,MAAG,CAAC;iBAC/C;qBAAM;oBACL,aAAa;oBACb,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;iBACnD;aACF;iBAAM;gBACL,aAAa;gBACb,MAAM,CAAC,MAAM,CAAC,MAAM,YAAI,GAAC,GAAG,IAAG,MAAM,CAAC,GAAG,CAAC,MAAG,CAAC;aAC/C;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AArBD,4BAqBC"}
|