drapcode-utility 1.9.7 → 1.9.78
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/build/encryption/utility.d.ts +1 -2
- package/build/encryption/utility.js +4 -39
- package/build/format-fields/index.js +1 -1
- package/build/index.d.ts +3 -1
- package/build/index.js +3 -1
- package/build/utils/check-error.js +7 -7
- package/build/utils/common-util.d.ts +78 -0
- package/build/utils/common-util.js +219 -0
- package/build/utils/date-util.js +0 -13
- package/build/utils/file-util.d.ts +7 -0
- package/build/utils/file-util.js +118 -0
- package/build/utils/prepare-query.d.ts +0 -148
- package/build/utils/prepare-query.js +1 -100
- package/build/utils/project-util.d.ts +1 -0
- package/build/utils/project-util.js +31 -49
- package/build/utils/{query-paser-new.js → query-parser-new.js} +24 -174
- package/build/utils/query-parser.d.ts +0 -12
- package/build/utils/query-parser.js +16 -280
- package/build/utils/query-utils.d.ts +20 -0
- package/build/utils/query-utils.js +254 -0
- package/build/utils/rest-client.d.ts +6 -0
- package/build/utils/rest-client.js +342 -0
- package/build/utils/util.d.ts +77 -3
- package/build/utils/util.js +493 -29
- package/package.json +10 -5
- /package/build/utils/{query-paser-new.d.ts → query-parser-new.d.ts} +0 -0
|
@@ -1,151 +1,3 @@
|
|
|
1
|
-
export declare const prepareCollectionQuery: (matchQuery: object, filterId: string) => ({
|
|
2
|
-
$match: object;
|
|
3
|
-
$addFields?: undefined;
|
|
4
|
-
$unwind?: undefined;
|
|
5
|
-
$group?: undefined;
|
|
6
|
-
$project?: undefined;
|
|
7
|
-
} | {
|
|
8
|
-
$addFields: {
|
|
9
|
-
finder: {
|
|
10
|
-
$filter: {
|
|
11
|
-
input: string;
|
|
12
|
-
as: string;
|
|
13
|
-
cond: {
|
|
14
|
-
$eq: string[];
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
refCollectionFields: {
|
|
19
|
-
$filter: {
|
|
20
|
-
input: string;
|
|
21
|
-
as: string;
|
|
22
|
-
cond: {
|
|
23
|
-
$or: {
|
|
24
|
-
$eq: string[];
|
|
25
|
-
}[];
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
filterFinder?: undefined;
|
|
30
|
-
};
|
|
31
|
-
$match?: undefined;
|
|
32
|
-
$unwind?: undefined;
|
|
33
|
-
$group?: undefined;
|
|
34
|
-
$project?: undefined;
|
|
35
|
-
} | {
|
|
36
|
-
$unwind: string;
|
|
37
|
-
$match?: undefined;
|
|
38
|
-
$addFields?: undefined;
|
|
39
|
-
$group?: undefined;
|
|
40
|
-
$project?: undefined;
|
|
41
|
-
} | {
|
|
42
|
-
$addFields: {
|
|
43
|
-
filterFinder: string;
|
|
44
|
-
finder?: undefined;
|
|
45
|
-
refCollectionFields?: undefined;
|
|
46
|
-
};
|
|
47
|
-
$match?: undefined;
|
|
48
|
-
$unwind?: undefined;
|
|
49
|
-
$group?: undefined;
|
|
50
|
-
$project?: undefined;
|
|
51
|
-
} | {
|
|
52
|
-
$unwind: {
|
|
53
|
-
path: string;
|
|
54
|
-
preserveNullAndEmptyArrays: boolean;
|
|
55
|
-
};
|
|
56
|
-
$match?: undefined;
|
|
57
|
-
$addFields?: undefined;
|
|
58
|
-
$group?: undefined;
|
|
59
|
-
$project?: undefined;
|
|
60
|
-
} | {
|
|
61
|
-
$group: {
|
|
62
|
-
_id: null;
|
|
63
|
-
filterFinder: {
|
|
64
|
-
$first: string;
|
|
65
|
-
};
|
|
66
|
-
fields: {
|
|
67
|
-
$first: string;
|
|
68
|
-
};
|
|
69
|
-
noOfExternalParams: {
|
|
70
|
-
$first: string;
|
|
71
|
-
};
|
|
72
|
-
isPrivate: {
|
|
73
|
-
$first: string;
|
|
74
|
-
};
|
|
75
|
-
enableLookup: {
|
|
76
|
-
$first: string;
|
|
77
|
-
};
|
|
78
|
-
lookups: {
|
|
79
|
-
$first: string;
|
|
80
|
-
};
|
|
81
|
-
finder: {
|
|
82
|
-
$first: string;
|
|
83
|
-
};
|
|
84
|
-
refCollectionFields: {
|
|
85
|
-
$first: string;
|
|
86
|
-
};
|
|
87
|
-
constants: {
|
|
88
|
-
$first: string;
|
|
89
|
-
};
|
|
90
|
-
isInMemory: {
|
|
91
|
-
$first: string;
|
|
92
|
-
};
|
|
93
|
-
projectId: {
|
|
94
|
-
$first: string;
|
|
95
|
-
};
|
|
96
|
-
lastRefreshTime: {
|
|
97
|
-
$first: string;
|
|
98
|
-
};
|
|
99
|
-
collectionName: {
|
|
100
|
-
$first: string;
|
|
101
|
-
};
|
|
102
|
-
externalParams: {
|
|
103
|
-
$push: {
|
|
104
|
-
$cond: (string | {
|
|
105
|
-
$and: ({
|
|
106
|
-
$gt: (string | number)[];
|
|
107
|
-
$eq?: undefined;
|
|
108
|
-
} | {
|
|
109
|
-
$eq: (string | boolean)[];
|
|
110
|
-
$gt?: undefined;
|
|
111
|
-
})[];
|
|
112
|
-
})[];
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
permissionLevelSecurity: {
|
|
116
|
-
$first: string;
|
|
117
|
-
};
|
|
118
|
-
rowLevelSecurityFilter: {
|
|
119
|
-
$first: string;
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
$match?: undefined;
|
|
123
|
-
$addFields?: undefined;
|
|
124
|
-
$unwind?: undefined;
|
|
125
|
-
$project?: undefined;
|
|
126
|
-
} | {
|
|
127
|
-
$project: {
|
|
128
|
-
noOfExternalParams: number;
|
|
129
|
-
finder: string;
|
|
130
|
-
isInMemory: number;
|
|
131
|
-
lookups: number;
|
|
132
|
-
enableLookup: number;
|
|
133
|
-
lastRefreshTime: number;
|
|
134
|
-
constants: number;
|
|
135
|
-
collectionName: number;
|
|
136
|
-
refCollectionFields: number;
|
|
137
|
-
externalParams: number;
|
|
138
|
-
projectId: number;
|
|
139
|
-
isPrivate: number;
|
|
140
|
-
fields: number;
|
|
141
|
-
permissionLevelSecurity: number;
|
|
142
|
-
rowLevelSecurityFilter: number;
|
|
143
|
-
};
|
|
144
|
-
$match?: undefined;
|
|
145
|
-
$addFields?: undefined;
|
|
146
|
-
$unwind?: undefined;
|
|
147
|
-
$group?: undefined;
|
|
148
|
-
})[];
|
|
149
1
|
export declare const prepareCreatedByLookup: (lookupConfig: any, aggregateQuery: any[], field: any) => void;
|
|
150
2
|
export declare const prepareChildRefCreatedByLookup: (collectionName: string, findCollInLookup: any, lookupConfig: any, field: any, aggregateQuery: any[]) => void;
|
|
151
3
|
export declare const commonLookupSetting: (field: any, lookupConfig: any, aggregateQuery: any) => void;
|
|
@@ -1,106 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.commonLookupSetting = exports.prepareChildRefCreatedByLookup = exports.prepareCreatedByLookup =
|
|
3
|
+
exports.commonLookupSetting = exports.prepareChildRefCreatedByLookup = exports.prepareCreatedByLookup = void 0;
|
|
4
4
|
var drapcode_constant_1 = require("drapcode-constant");
|
|
5
|
-
var prepareCollectionQuery = function (matchQuery, filterId) {
|
|
6
|
-
var query = [
|
|
7
|
-
{ $match: matchQuery },
|
|
8
|
-
{
|
|
9
|
-
$addFields: {
|
|
10
|
-
finder: {
|
|
11
|
-
$filter: {
|
|
12
|
-
input: "$finders",
|
|
13
|
-
as: "finder",
|
|
14
|
-
cond: { $eq: ["$$finder.uuid", filterId] },
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
refCollectionFields: {
|
|
18
|
-
$filter: {
|
|
19
|
-
input: "$fields",
|
|
20
|
-
as: "fields",
|
|
21
|
-
cond: {
|
|
22
|
-
$or: [
|
|
23
|
-
{ $eq: ["$$fields.type", "reference"] },
|
|
24
|
-
{ $eq: ["$$fields.type", "multi_reference"] },
|
|
25
|
-
{ $eq: ["$$fields.type", "belongsTo"] },
|
|
26
|
-
{ $eq: ["$$fields.type", "createdBy"] },
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
{ $unwind: "$finder" },
|
|
34
|
-
{
|
|
35
|
-
$addFields: { filterFinder: "$finder" },
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
$unwind: {
|
|
39
|
-
path: "$finder.conditions",
|
|
40
|
-
preserveNullAndEmptyArrays: true,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
$group: {
|
|
45
|
-
_id: null,
|
|
46
|
-
filterFinder: { $first: "$filterFinder" },
|
|
47
|
-
fields: { $first: "$fields" },
|
|
48
|
-
noOfExternalParams: { $first: "$finder.noOfExternalParams" },
|
|
49
|
-
isPrivate: { $first: "$finder.isPrivate" },
|
|
50
|
-
enableLookup: { $first: "$finder.enableLookup" },
|
|
51
|
-
lookups: { $first: "$finder.lookups" },
|
|
52
|
-
finder: { $first: "$finder" },
|
|
53
|
-
refCollectionFields: { $first: "$refCollectionFields" },
|
|
54
|
-
constants: { $first: "$constants" },
|
|
55
|
-
isInMemory: { $first: "$isInMemory" },
|
|
56
|
-
projectId: { $first: "$projectId" },
|
|
57
|
-
lastRefreshTime: { $first: "$lastRefreshTime" },
|
|
58
|
-
collectionName: { $first: "$collectionName" },
|
|
59
|
-
externalParams: {
|
|
60
|
-
$push: {
|
|
61
|
-
$cond: [
|
|
62
|
-
{
|
|
63
|
-
$and: [
|
|
64
|
-
{
|
|
65
|
-
$gt: ["$finder.noOfExternalParams", 0],
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
$eq: ["$finder.conditions.requiredExternal", true],
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
"$finder.conditions.query.value",
|
|
73
|
-
"$$REMOVE",
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
permissionLevelSecurity: { $first: "$permissionLevelSecurity" },
|
|
78
|
-
rowLevelSecurityFilter: { $first: "$rowLevelSecurityFilter" },
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
$project: {
|
|
83
|
-
noOfExternalParams: 1,
|
|
84
|
-
finder: "$filterFinder",
|
|
85
|
-
isInMemory: 1,
|
|
86
|
-
lookups: 1,
|
|
87
|
-
enableLookup: 1,
|
|
88
|
-
lastRefreshTime: 1,
|
|
89
|
-
constants: 1,
|
|
90
|
-
collectionName: 1,
|
|
91
|
-
refCollectionFields: 1,
|
|
92
|
-
externalParams: 1,
|
|
93
|
-
projectId: 1,
|
|
94
|
-
isPrivate: 1,
|
|
95
|
-
fields: 1,
|
|
96
|
-
permissionLevelSecurity: 1,
|
|
97
|
-
rowLevelSecurityFilter: 1,
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
];
|
|
101
|
-
return query;
|
|
102
|
-
};
|
|
103
|
-
exports.prepareCollectionQuery = prepareCollectionQuery;
|
|
104
5
|
var prepareCreatedByLookup = function (lookupConfig, aggregateQuery, field) {
|
|
105
6
|
var _a;
|
|
106
7
|
var enableLookup = lookupConfig.enableLookup, lookups = lookupConfig.lookups;
|
|
@@ -2,3 +2,4 @@ export declare const saveProjectToFile: (project: any) => void;
|
|
|
2
2
|
export declare const findProjectFromFile: (query: any) => any;
|
|
3
3
|
export declare const updateProjectInFile: () => void;
|
|
4
4
|
export declare const removeProjectFromFile: (project: any) => void;
|
|
5
|
+
export declare const clearProjectSubfolder: (projectId: string, subfolder: string) => null | undefined;
|
|
@@ -3,60 +3,63 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.removeProjectFromFile = exports.updateProjectInFile = exports.findProjectFromFile = exports.saveProjectToFile = void 0;
|
|
6
|
+
exports.clearProjectSubfolder = exports.removeProjectFromFile = exports.updateProjectInFile = exports.findProjectFromFile = exports.saveProjectToFile = void 0;
|
|
7
7
|
var fs_1 = require("fs");
|
|
8
8
|
var path_1 = __importDefault(require("path"));
|
|
9
|
+
var file_util_1 = require("./file-util");
|
|
9
10
|
var filePath = process.env.BUILD_FOLDER;
|
|
10
11
|
var saveProjectToFile = function (project) {
|
|
11
12
|
if (!project) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
checkFolder(filePath);
|
|
15
|
+
(0, file_util_1.checkFolder)(filePath);
|
|
16
16
|
var projectPath = path_1.default.join(filePath, "projects");
|
|
17
|
-
|
|
18
|
-
checkFolder(projectPath);
|
|
17
|
+
(0, file_util_1.checkFolder)(projectPath);
|
|
19
18
|
var uuid = project.uuid, seoName = project.seoName, apiDomainName = project.apiDomainName, domainName = project.domainName;
|
|
20
19
|
console.log("Create UUID JSON file");
|
|
21
|
-
createFile(path_1.default.join(projectPath, "".concat(uuid, ".json")), project);
|
|
20
|
+
(0, file_util_1.createFile)(path_1.default.join(projectPath, "".concat(uuid, ".json")), project);
|
|
22
21
|
console.log("Create SeoName JSON file");
|
|
23
|
-
createFile(path_1.default.join(projectPath, "".concat(seoName, ".json")), project);
|
|
22
|
+
(0, file_util_1.createFile)(path_1.default.join(projectPath, "".concat(seoName, ".json")), project);
|
|
24
23
|
if (apiDomainName) {
|
|
25
24
|
console.log("Create API Domain JSON file");
|
|
26
|
-
createFile(path_1.default.join(projectPath, "".concat(apiDomainName, ".json")), project);
|
|
25
|
+
(0, file_util_1.createFile)(path_1.default.join(projectPath, "".concat(apiDomainName, ".json")), project);
|
|
27
26
|
}
|
|
28
27
|
if (domainName) {
|
|
29
28
|
console.log("Create Domain JSON file");
|
|
30
|
-
createFile(path_1.default.join(projectPath, "".concat(domainName, ".json")), project);
|
|
29
|
+
(0, file_util_1.createFile)(path_1.default.join(projectPath, "".concat(domainName, ".json")), project);
|
|
31
30
|
}
|
|
32
31
|
};
|
|
33
32
|
exports.saveProjectToFile = saveProjectToFile;
|
|
34
33
|
var findProjectFromFile = function (query) {
|
|
35
34
|
var _a, _b;
|
|
36
|
-
console.log("query :>> ", query);
|
|
37
35
|
var isMainExists = verifyProjectsFolder();
|
|
38
36
|
if (!isMainExists) {
|
|
39
37
|
return null;
|
|
40
38
|
}
|
|
41
39
|
var projectPath = path_1.default.join(filePath, "projects");
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
var or = query.or, apiDomainName = query.apiDomainName, seoName = query.seoName, domainName = query.domainName, uuid = query.uuid;
|
|
41
|
+
if (uuid) {
|
|
42
|
+
//If uuid exists then please check with this no need of or
|
|
43
|
+
console.log("Checking for Project UUID");
|
|
44
|
+
var project = (0, file_util_1.readFile)(path_1.default.join(projectPath, "".concat(uuid, ".json")));
|
|
45
|
+
return project;
|
|
46
|
+
}
|
|
44
47
|
if (apiDomainName) {
|
|
45
48
|
//If api domain exists then please check with this no need of or
|
|
46
49
|
console.log("Checking for Project API Domain");
|
|
47
|
-
var project = readFile(path_1.default.join(projectPath, "".concat(apiDomainName, ".json")));
|
|
50
|
+
var project = (0, file_util_1.readFile)(path_1.default.join(projectPath, "".concat(apiDomainName, ".json")));
|
|
48
51
|
return project;
|
|
49
52
|
}
|
|
50
53
|
if (seoName) {
|
|
51
54
|
//IF api seo name exists then not need to check or
|
|
52
55
|
console.log("Checking for Project SEO Name");
|
|
53
|
-
var project = readFile(path_1.default.join(projectPath, "".concat(seoName, ".json")));
|
|
56
|
+
var project = (0, file_util_1.readFile)(path_1.default.join(projectPath, "".concat(seoName, ".json")));
|
|
54
57
|
return project;
|
|
55
58
|
}
|
|
56
59
|
if (domainName) {
|
|
57
60
|
//IF api seo name exists then not need to check or
|
|
58
61
|
console.log("Checking for Project SEO Name");
|
|
59
|
-
var project = readFile(path_1.default.join(projectPath, "".concat(domainName, ".json")));
|
|
62
|
+
var project = (0, file_util_1.readFile)(path_1.default.join(projectPath, "".concat(domainName, ".json")));
|
|
60
63
|
return project;
|
|
61
64
|
}
|
|
62
65
|
if (!or || or.length === 0) {
|
|
@@ -70,13 +73,13 @@ var findProjectFromFile = function (query) {
|
|
|
70
73
|
if (pSeoName) {
|
|
71
74
|
//IF api seo name exists then not need to check or
|
|
72
75
|
console.log("Checking for Project SEO Name");
|
|
73
|
-
var project = readFile(path_1.default.join(projectPath, "".concat(pSeoName, ".json")));
|
|
76
|
+
var project = (0, file_util_1.readFile)(path_1.default.join(projectPath, "".concat(pSeoName, ".json")));
|
|
74
77
|
return project;
|
|
75
78
|
}
|
|
76
79
|
if (pDomainName) {
|
|
77
80
|
//IF api seo name exists then not need to check or
|
|
78
81
|
console.log("Checking for Project Domain Name");
|
|
79
|
-
var project = readFile(path_1.default.join(projectPath, "".concat(pDomainName, ".json")));
|
|
82
|
+
var project = (0, file_util_1.readFile)(path_1.default.join(projectPath, "".concat(pDomainName, ".json")));
|
|
80
83
|
return project;
|
|
81
84
|
}
|
|
82
85
|
return null;
|
|
@@ -96,7 +99,7 @@ var removeProjectFromFile = function (project) {
|
|
|
96
99
|
if (!isMainExists) {
|
|
97
100
|
return;
|
|
98
101
|
}
|
|
99
|
-
var projectPath =
|
|
102
|
+
var projectPath = path_1.default.join(filePath, "projects");
|
|
100
103
|
console.log("Check path", projectPath);
|
|
101
104
|
var uuid = project.uuid, seoName = project.seoName, apiDomainName = project.apiDomainName, domainName = project.domainName;
|
|
102
105
|
console.log("Removing UUID JSON");
|
|
@@ -113,33 +116,21 @@ var removeProjectFromFile = function (project) {
|
|
|
113
116
|
}
|
|
114
117
|
};
|
|
115
118
|
exports.removeProjectFromFile = removeProjectFromFile;
|
|
116
|
-
var
|
|
117
|
-
if (!
|
|
119
|
+
var clearProjectSubfolder = function (projectId, subfolder) {
|
|
120
|
+
if (!projectId)
|
|
118
121
|
return;
|
|
119
|
-
|
|
120
|
-
if (!
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
catch (error) {
|
|
125
|
-
console.error(error);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
122
|
+
var isMainExists = (0, file_util_1.verifyProjectSettingFolder)(projectId);
|
|
123
|
+
if (!isMainExists)
|
|
124
|
+
return null;
|
|
125
|
+
var projectPath = path_1.default.join(filePath, "project_".concat(projectId), subfolder);
|
|
126
|
+
removeFolder(projectPath);
|
|
128
127
|
};
|
|
128
|
+
exports.clearProjectSubfolder = clearProjectSubfolder;
|
|
129
129
|
var verifyProjectsFolder = function () {
|
|
130
130
|
var projectPath = path_1.default.join(filePath, "projects");
|
|
131
131
|
return (0, fs_1.existsSync)(filePath) && (0, fs_1.existsSync)(projectPath);
|
|
132
132
|
};
|
|
133
|
-
var createFile = function (filePath, content) {
|
|
134
|
-
try {
|
|
135
|
-
(0, fs_1.writeFileSync)(filePath, JSON.stringify(content));
|
|
136
|
-
}
|
|
137
|
-
catch (error) {
|
|
138
|
-
console.log("error :>> ", error);
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
133
|
var removeFile = function (filePath) {
|
|
142
|
-
console.log("removeFile filePath :>> ", filePath);
|
|
143
134
|
try {
|
|
144
135
|
(0, fs_1.existsSync)(filePath) && (0, fs_1.unlinkSync)(filePath);
|
|
145
136
|
}
|
|
@@ -147,21 +138,12 @@ var removeFile = function (filePath) {
|
|
|
147
138
|
console.log("error :>> ", error);
|
|
148
139
|
}
|
|
149
140
|
};
|
|
150
|
-
var
|
|
141
|
+
var removeFolder = function (folderPath) {
|
|
151
142
|
try {
|
|
152
|
-
|
|
153
|
-
if (!(0, fs_1.existsSync)(filePath)) {
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
var content = (0, fs_1.readFileSync)(filePath, "utf8");
|
|
157
|
-
if (!content)
|
|
158
|
-
return null;
|
|
159
|
-
console.log("*******************************");
|
|
160
|
-
return JSON.parse(content);
|
|
143
|
+
(0, fs_1.existsSync)(folderPath) && (0, fs_1.rmdirSync)(folderPath, { recursive: true });
|
|
161
144
|
}
|
|
162
145
|
catch (error) {
|
|
163
146
|
console.log("error :>> ", error);
|
|
164
|
-
return null;
|
|
165
147
|
}
|
|
166
148
|
};
|
|
167
149
|
function extractDomainSeo(or, key) {
|