async ContentTypes() {
    this.contentTypes = this.contentTypes || {};

    // Personally available types
    let typeAddresses = await this.Collection({collectionType: "contentTypes"});

    // Content space types
    const contentSpaceTypes = await this.ContentObjectMetadata({
      libraryId: this.contentSpaceLibraryId,
      objectId: this.contentSpaceObjectId,
      metadataSubtree: "contentTypes"
    }) || {};

    const contentSpaceTypeAddresses = Object.values(contentSpaceTypes)
      .map(typeId => this.utils.HashToAddress(typeId));

    typeAddresses = typeAddresses
      .concat(contentSpaceTypeAddresses)
      .filter(address => address)
      .map(address => this.utils.FormatAddress(address))
      .filter((v, i, a) => a.indexOf(v) === i);

    await Promise.all(
      typeAddresses.map(async typeAddress => {
        const typeId = this.utils.AddressToObjectId(typeAddress);

        if(!this.contentTypes[typeId]) {
          try {
            this.contentTypes[typeId] = await this.ContentType({typeId});
          } catch(error) {
            // eslint-disable-next-line no-console
            // console.error(error);
          }
        }
      })
    );

    return this.contentTypes;
  }
/**
   * List all content types accessible to this user.
   *
   * @methodGroup Content Types
   * @namedParams
   *
   * @return {Promise<Object>} - Available content types
   */
List all content types accessible to this user.
@methodGroup Content Types
@namedParams

@return {Promise} - Available content types
List all content types accessible to this user . @methodGroup Content Types @namedParams @return { Promise } - Available content types
async ContentTypes() {
    this.contentTypes = this.contentTypes || {};
    let typeAddresses = await this.Collection({collectionType: "contentTypes"});
    const contentSpaceTypes = await this.ContentObjectMetadata({
      libraryId: this.contentSpaceLibraryId,
      objectId: this.contentSpaceObjectId,
      metadataSubtree: "contentTypes"
    }) || {};
    const contentSpaceTypeAddresses = Object.values(contentSpaceTypes)
      .map(typeId => this.utils.HashToAddress(typeId));
    typeAddresses = typeAddresses
      .concat(contentSpaceTypeAddresses)
      .filter(address => address)
      .map(address => this.utils.FormatAddress(address))
      .filter((v, i, a) => a.indexOf(v) === i);
    await Promise.all(
      typeAddresses.map(async typeAddress => {
        const typeId = this.utils.AddressToObjectId(typeAddress);
        if(!this.contentTypes[typeId]) {
          try {
            this.contentTypes[typeId] = await this.ContentType({typeId});
          } catch(error) {
          }
        }
      })
    );
    return this.contentTypes;
  }
async ContentTypes ( ) { this . contentTypes = this . contentTypes || { } ; let typeAddresses = await this . Collection ( { collectionType : "contentTypes" } ) ; const contentSpaceTypes = await this . ContentObjectMetadata ( { libraryId : this . contentSpaceLibraryId , objectId : this . contentSpaceObjectId , metadataSubtree : "contentTypes" } ) || { } ; const contentSpaceTypeAddresses = Object . values ( contentSpaceTypes ) . map ( typeId => this . utils . HashToAddress ( typeId ) ) ; typeAddresses = typeAddresses . concat ( contentSpaceTypeAddresses ) . filter ( address => address ) . map ( address => this . utils . FormatAddress ( address ) ) . filter ( ( v , i , a ) => a . indexOf ( v ) === i ) ; await Promise . all ( typeAddresses . map ( async typeAddress => { const typeId = this . utils . AddressToObjectId ( typeAddress ) ; if ( ! this . contentTypes [ typeId ] ) { try { this . contentTypes [ typeId ] = await this . ContentType ( { typeId } ) ; } catch ( error ) { } } } ) ) ; return this . contentTypes ; }
List all content types accessible to this user.
List all content types accessible to this user .
// Personally available types // Content space types // eslint-disable-next-line no-console // console.error(error);