@eluvio/elv-client-js 3.2.35 → 3.2.36
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
CHANGED
|
@@ -49,10 +49,14 @@ exports.permissionLevels = {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
exports.Visibility = async function({id}) {
|
|
52
|
+
exports.Visibility = async function({id, clearCache}) {
|
|
53
53
|
try {
|
|
54
54
|
const address = this.utils.HashToAddress(id);
|
|
55
55
|
|
|
56
|
+
if(clearCache) {
|
|
57
|
+
delete this.visibilityInfo[address];
|
|
58
|
+
}
|
|
59
|
+
|
|
56
60
|
if(!this.visibilityInfo[address]) {
|
|
57
61
|
this.visibilityInfo[address] = new Promise(async (resolve, reject) => {
|
|
58
62
|
try {
|
|
@@ -103,14 +107,14 @@ exports.Visibility = async function({id}) {
|
|
|
103
107
|
*
|
|
104
108
|
* @return {string} - Key for the permission of the object - Use this to retrieve more details from client.permissionLevels
|
|
105
109
|
*/
|
|
106
|
-
exports.Permission = async function({objectId}) {
|
|
110
|
+
exports.Permission = async function({objectId, clearCache}) {
|
|
107
111
|
ValidateObject(objectId);
|
|
108
112
|
|
|
109
113
|
if((await this.AccessType({id: objectId})) !== this.authClient.ACCESS_TYPES.OBJECT) {
|
|
110
114
|
throw Error("Permission only valid for normal content objects: " + objectId);
|
|
111
115
|
}
|
|
112
116
|
|
|
113
|
-
const visibility = await this.Visibility({id: objectId});
|
|
117
|
+
const visibility = await this.Visibility({id: objectId, clearCache});
|
|
114
118
|
|
|
115
119
|
const kmsAddress = await this.CallContractMethod({
|
|
116
120
|
contractAddress: this.utils.HashToAddress(objectId),
|
|
@@ -209,7 +209,13 @@ const InitializeTenant = async ({configUrl, kmsId, tenantName}) => {
|
|
|
209
209
|
|
|
210
210
|
const masterTypeId = await client.CreateContentType({
|
|
211
211
|
name: `${tenantName} - Title Master`,
|
|
212
|
-
metadata: {
|
|
212
|
+
metadata: {
|
|
213
|
+
bitcode_flags: "abrmaster",
|
|
214
|
+
bitcode_format: "builtin",
|
|
215
|
+
public: {
|
|
216
|
+
"eluv.manageApp": "default",
|
|
217
|
+
}
|
|
218
|
+
}
|
|
213
219
|
});
|
|
214
220
|
|
|
215
221
|
await SetObjectPermissions(client, masterTypeId, tenantAdminGroupAddress, contentAdminGroupAddress, contentUserGroupAddress);
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const ScriptBase = require("./parentClasses/ScriptBase");
|
|
2
|
+
|
|
3
|
+
class ListLibrary extends ScriptBase {
|
|
4
|
+
|
|
5
|
+
async body() {
|
|
6
|
+
const client = await this.client();
|
|
7
|
+
client.SetAuth(false);
|
|
8
|
+
|
|
9
|
+
const libraryId = this.args.libraryId;
|
|
10
|
+
const path = (this.args.path.startsWith("/")) ? this.args.path.substring(1) : this.args.path;
|
|
11
|
+
|
|
12
|
+
const response = await client.ContentObjects({
|
|
13
|
+
libraryId: libraryId,
|
|
14
|
+
filterOptions: {
|
|
15
|
+
limit: 100000,
|
|
16
|
+
select: path
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
let rows;
|
|
21
|
+
if(path.startsWith("public")) {
|
|
22
|
+
rows = response.contents;
|
|
23
|
+
} else {
|
|
24
|
+
rows = await Promise.all(response.contents.map(async (object, i) => {
|
|
25
|
+
const objectMeta = await client.ContentObjectMetadata({
|
|
26
|
+
libraryId,
|
|
27
|
+
objectId: object.id
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if(objectMeta.public) delete objectMeta.public;
|
|
31
|
+
response.contents[i].versions[0]["meta"] = objectMeta;
|
|
32
|
+
return response.contents[i];
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// eslint-disable-next-line no-console
|
|
37
|
+
console.log(JSON.stringify(rows, null, 2));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
footer() {
|
|
41
|
+
return "";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
header() {
|
|
45
|
+
return "";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
options() {
|
|
49
|
+
return super.options()
|
|
50
|
+
.option("libraryId", {
|
|
51
|
+
alias: "library-id",
|
|
52
|
+
demandOption: true,
|
|
53
|
+
describe: "Library ID (should start with 'ilib')",
|
|
54
|
+
type: "string"
|
|
55
|
+
})
|
|
56
|
+
.option("path", {
|
|
57
|
+
demandOption: true,
|
|
58
|
+
describe: "Path (can be public or private)",
|
|
59
|
+
type: "string"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const script = new ListLibrary();
|
|
65
|
+
script.run();
|