Flextype v0.9.13 Release Notes

Release Date: 2020-12-20 // over 1 year ago
  • ๐Ÿ”‹ Features

    • media-files: we will use fetch() method as entry point to execute different methods with fetch prefix. (#508)

      /**
       * Fetch.
       *
       * @param string $id      The path to file.
       * @param array  $options Options array.
       *
       * @access public
       *
       * @return self Returns instance of The Arrays class.
       */
      public function fetch(string $id, array $options = []): Arrays
      

      Media Files API is macroable and we will able to Added any custom fetch methods for receiving data from different sources.

      flextype('media')->files()::macro('fetchFromOtherStorage', function(string $id, array $options) {
        // fetch data from Other Storage using $id and $options
      });
      
      $data = flextype('media')->files()-> fetchFromOtherStorage($id, $options);
      
    • media-folders: we will use fetch() method as entry point to execute different methods with fetch prefix. (#509)

      /**
       * Fetch.
       *
       * @param string $id      The path to folder.
       * @param array  $options Options array.
       *
       * @access public
       *
       * @return self Returns instance of The Arrays class.
       */
      public function fetch(string $id, array $options = []): Arrays
      

      Media Folders API is macroable and we will able to Added any custom fetch methods for receiving data from different sources.

      flextype('media')->folders()::macro('fetchFromOtherStorage', function(string $id, array $options) {
        // fetch data from Other Storage using $id and $options
      });
      
      $data = flextype('media')->folders()-> fetchFromOtherStorage($id, $options);
      
    • entries: we will use fetch() method as entry point to execute different methods with fetch prefix. (#495)

      /**
      * Fetch.
      *
      * @param string $id      Unique identifier of the entry.
      * @param array  $options Options array.
      *
      * @access public
      *
      * @return mixed
      */
      public function fetch(string $id, array $options = []): Arrays
      

      Entries API is macroable and we will able to Added any custom fetch methods for receiving data from different sources.

      flextype('entries')::macro('fetchXML', function(string $id, array $options) {
      // fetch data from XML using $id and $options
      });
      
      $data = flextype('entries')->fetchXML($id, $options);
      
    • images we will use media/ folder instead of uploads/entries/ (#516)

    • serializers: standardise serializers container names with macroable ability. (#518)

      New methods to access Serializers:

      flextype('serializers')->yaml()
      flextype('serializers')->json()
      flextype('serializers')->frontmatter()
      

      Adding macros:

      flextype('serializers')::macro('NAME', CALLBACK_FUNCTION() {});
      
    • ๐Ÿ“œ parsers: standardise parsers container names with macroable ability. (#519)

      New methods to access Parsers:

      flextype('parsers')->shortcode()
      flextype('parsers')->markdown()
      

      Adding macros:

      flextype('parsers')::macro('NAME', CALLBACK_FUNCTION() {});
      
    • media: standardise media container names with macroable ability for Media API. (#517)

      New macroable common class for all media - class Media

      New methods to access Media API:

      flextype('media')->files()
      flextype('media')->files()->meta()
      flextype('media')->folders()
      flextype('media')->folders()->meta()
      

      Adding macros:

      flextype('media')::macro('NAME', CALLBACK_FUNCTION() {});
      flextype('media')->files()::macro('NAME', CALLBACK_FUNCTION() {});
      flextype('media')->files()->meta()::macro('NAME', CALLBACK_FUNCTION() {});
      flextype('media')->folders()::macro('NAME', CALLBACK_FUNCTION() {});
      flextype('media')->folders()->meta()::macro('NAME', CALLBACK_FUNCTION() {});
      
    • fields Added new field registry.get for Registry API (#494)

      Registry API provides method get() for retrieving data from registry and we should able to access them inside entries frontmatter header for retrieving data right in the entries.

      Basic Example

      Sample entry with several queries and with several nested queries inside of children entries.

      File: /project/entries/registry-root/entry.md

      ---
      title: Root
      registry:
        get:
          flextype:
            key: flextype.manifest.name
          author.name:
            key: flextype.manifest.author.name
          license:
            key: flextype.manifest.license
      entries:
        fetch:
          level1:
            id: registry-root/level-1
      ---
      

      Setting for this fields

      File: /project/config/flextype/settings.yaml

      entries:
        fields:
          registry:
            get:
              enabled: true
      

      Valid values for setting enabled is true or false

    • fields Added new field entries.fetch for Entries API (#492)

      Entries API provides methods for entries fetch: fetch() and we should able to access them inside entries frontmatter header for fetching data right in the entries. Also, we will able to Added and use any kind of fetch methods with our macroable functionality.

      Basic Example

      Catalog entry with several queries and with several nested queries inside of children entries.

      File: /project/entries/catalog/entry.md

      ---
      title: Catalog
      visibility: visible
      entries:
        fetch:
          label1:
            id: discounts/50-off
            options:
              filter:
                limit: 4
          bikes:
            id: catalog/bikes
            options:
              collection: true
              filter:
                where:
                  -
                    key: brand
                    operator: eq
                    value: gt
                limit: 10
          discounts:
            id: discounts
            options:
              collection: true
              filter:
                where:
                  -
                    key: title
                    operator: eq
                    value: '30% off'
                  -
                    key: category
                    operator: eq
                    value: bikes
      ---
      

      Setting for this fields

      File: /project/config/flextype/settings.yaml

      entries:
        fields:
          entries:
            fetch:
              enabled: true
              result: toObject
      

      Valid values for setting enabled is true or false
      Valid values for setting result is toObject or toArray

    • fields Added new field media.files.fetch and media.folders.fetch for Media API's (#501) (#500)

      Media API's provides methods for files and folders fetch: fetch() and we should able to access them inside entries frontmatter header for fetching data right in the entries. Also, we will able to Added and use any kind of fetch methods with our macroable functionality.

      ---
      title: Media
      media:
        folders:
          fetch:
            macroable_folder:
              id: 'foo'
              options:
                method: fetchExtraData
            foo_folder:
              id: 'foo'
            collection_of_folders:
              id: '/'
              options:
                collection: true
        files:
          fetch:
            macroable_file:
              id: 'foo'
              options:
                method: fetchExtraData
            foo_file:
              id: foo.txt
            collection_of_files:
              id: '/'
              options:
                collection: true
      ---
      

      Setting for this fields

      File: /project/config/flextype/settings.yaml

      entries:
        fields:
          media:
            files:
              fetch:
                enabled: true
                result: toObject
            folders:
              fetch:
                enabled: true
                result: toObject
      

      Valid values for setting enabled is true or false
      Valid values for setting result is toObject or toArray

    • entries: Added new method deleteStorage() for Entries API (#498)

    • entries: Added new method hasStorage() for Entries API (#497)

    • core: Added new method isApiRequest to Determine API Request in the basic core functionality. (#507)

    • rest-api-entries Added ability to send options for fetch() methods in Entries Rest API. (#504)

      Fetch single

      GET /api/entries?id=YOUR_ENTRY_ID&token=YOUR_ENTRIES_TOKEN
      

      Fetch single with options

      GET /api/entries?id=YOUR_ENTRY_ID&options=[filter]&token=YOUR_ENTRIES_TOKEN
      

      Fetch collection

      GET /api/entries?id=YOUR_ENTRY_ID&options[collection]=true&token=YOUR_ENTRIES_TOKEN
      

      Fetch collection with options

      GET /api/entries?id=YOUR_ENTRY_ID&options[collection]=true&options=[find]&[filter]&token=YOUR_ENTRIES_TOKEN
      
    • rest-api-entries Added ability to call macroable fetch methods. (#505)

      With help of query option ?options[method]= we should able to call any macroable fetch methods.

      Example

      Macroable method XML

      flextype('entries')::macro('fetchXml', function(string $id, array $options) {
        return ['XML DATA HERE'];
      });
      

      HTTP GET:

      GET /api/entries?id=YOUR_ID&options[method]=fetchXml&token=YOUR_ENTRIES_TOKEN
      
    • rest-api-media reorganize endpoints for Media Rest API (#514)

    • rest-api-media Added ability to call macroable fetch methods for Folder. (#512)

      With help of query option ?options[method]= we should able to call any macroable fetch methods.

      Example

      Macroable method

      flextype('media')->folders()::macro('fetchFromOtherStorage', function(string $id, array $options) {
        // fetch data from Other Storage using $id and $options
      });
      

      HTTP GET:

      GET /api/folders?id=YOUR_MEDIA_FILES_ID&options[method]= fetchFromOtherStorage&token=YOUR_MEDIA_FOLDERS_TOKEN
      
    • rest-api-media Added ability to call macroable fetch methods for Files. (#513)

      With help of query option ?option[method]= we should able to call any macroable fetch methods.

      Example

      Macroable method

      flextype('media')->files()::macro('fetchFromOtherStorage', function(string $id, array $options) {
        // fetch data from Other Storage using $id and $options
      });
      

      HTTP GET:

      GET /api/files?id=YOUR_MEDIA_FILES_ID&option[method]=fetchFromOtherStorage&token=YOUR_MEDIA_FILES_TOKEN
      

    ๐Ÿ› Bug Fixes

    • fields Fixed issue with slug field in Entries API (#520)

    • core: Fixed issue with invalid timezone setting (#490)

    • entries: Fixed issue with not exists entries collections. (#503)

    • entries: Fixed issue with collisions in Entries API $storage for entries fetching. (#496)

    • rest-api-entries Fixed issue with 404 status code in Entries Rest API (#502)

    • rest-api: Fixed issue with Rest API endpoints initialisation. (#506)

    ๐Ÿ’ฅ BREAKING CHANGES

    • media: standardise media container names with macroable ability for Media API. (#517)

      NEW CONTAINER OLD CONTAINER
      media media_files, media_files_meta, media_folders, media_folders_meta
    • ๐Ÿ“œ parsers: standardise parsers container names with macroable ability. (#519)

      NEW CONTAINER OLD CONTAINER
      parsers shortcode, markdown
    • serializers: standardise serializers container names with macroable ability. (#518)

      NEW CONTAINER OLD CONTAINER
      serializers yaml, json, frontmatter
    • rest-api-media reorganize endpoints for Media Rest API (#514)

      NEW ENDPOINT OLD ENDPOINT
      GET /api/media/files /api/files
      POST /api/media/files /api/files
      PUT /api/media/files /api/files
      PATCH /api/media/files /api/files
      DELETE /api/media/files /api/files
      POST /api/media/files/copy /api/files/copy
      PATCH /api/media/files/meta /api/files/meta
      POST /api/media/files/meta /api/files/meta
      DELETE /api/media/files/meta /api/files/meta
      GET /api/media/folders /api/folders
      POST /api/media/folders /api/folders
      PATCH /api/media/folders /api/folders
      DELETE /api/media/folders /api/folders
      POST /api/media/folders/copy /api/folders/copy

      Tokens:

      • token for files should be moved from /tokens/files/ to /tokens/media/files/
      • token for folders should be moved from /tokens/folders/ to /tokens/media/folders/

      Settings:

      api:
        ...
        media:
          files:
            enabled: true
            default_token:
          folders:
            enabled: true
            default_token:
      
    • helpers filter helper return array result every time and not int or bool. (#493)

    • helpers filter helper not support slice_offset and slice_limit because they are are duplicates already exists functionality offset and limit. (#493)

    • helpers filter helper not support count and exists. (#493)

    • entries: we have changes in the events names for Entries API (#499)

      Events:

      onEntriesFetch
      onEntriesFetchSingle instead of onEntryInitialized
      onEntriesFetchSingleCacheHasResult instead of onEntryAfterCacheInitialized
      onEntriesFetchSingleNoResult
      onEntriesFetchSingleHasResult instead of onEntryAfterInitialized
      onEntriesFetchCollection instead of onEntriesInitialized
      onEntriesFetchCollectionHasResult instead of onEntriesAfterInitialized
      onEntriesFetchCollectionNoResult
      onEntriesMove instead of onEntryMove
      onEntriesUpdate instead of onEntryUpdate
      onEntriesCreate instead of onEntryCreate
      onEntriesDelete instead of onEntryDelete
      onEntriesCopy instead of onEntryCopy
      onEntriesHas instead of onEntryHas

    • entries: Flextype EMS structure is changes because of issues with collisions (#496)

      Updated structure:

      $storage = [
          'fetch' => [
            'id' => '',
            'data' => [],
            'options' => [
                'find' => [],
                'filter' => [],
            ],
          ],
          'create' => [
            'id' => '',
            'data' => [],
          ],
          'Updated' => [
            'id' => '',
            'data' => [],
          ],
          'delete' => [
            'id' => '',
          ],
          'copy' => [
            'id' => '',
            'newID' => '',
          ],
          'move' => [
            'id' => '',
            'newID' => '',
          ],
          'has' => [
            'id' => '',
          ],
      ];
      
    • rest-api-entries Entries Rest API - for collection fetch we should define this in the request query &options[collection]=true

    • rest-api-entries Entries Rest API - instead of &filter=[] we should define filtering in the request query like this &options[find] and &options[filter]

    • rest-api-media-files Media Files Rest API - for collection fetch we should define this in the request query &options[collection]=true

    • rest-api-media-folders Media Folders Rest API - instead of &filter=[] we should define filtering in the request query like this &options[find] and &options[filter]

    • images we will use media/ folder instead of uploads/entries/ (#516)

      • folder uploads/entries/ should should be renamed to media/entries/ related to this ticket: #515
      • in the endpoint /api/images/{path:.+} path for entries, should starts with /entries/.

      Example:

      old: /api/images/home/banner.jpg new: /api/images/entries/home/banner.jpg

    • entries: we should use only fetch() method as entry point to execute different methods with fetch prefix. (#495)

      • method fetchSingle() removed. Use fetch($id, $options) method.
      • methods fetchCollection removed. Use fetch($id, ['collection' => true]) method.
    • media-folders: we should use only fetch() method as entry point to execute different methods with fetch prefix. (#509)

      • method fetchSingle() removed. Use fetch($id, $options) method.
      • methods fetchCollection removed. Use fetch($id, ['collection' => true]) method.
    • media-files: we should use only fetch() method as entry point to execute different methods with fetch prefix. (#508)

      • method fetchSingle() removed. Use fetch($id, $options) method.
      • methods fetchCollection removed. Use fetch($id, ['collection' => true]) method.