Skip to content

Releases: salient-labs/toolkit

v0.99.56

15 Oct 05:44
v0.99.56
3d24403
Compare
Choose a tag to compare

Added

Utility

  • Add File::getIdentifier()
  • Add Get::list()
  • Add Reflect::getPrototype()
  • Add ShouldNotHappenException

Changed

PHPDoc

  • Add optional $includeInterfaces parameter to PHPDocUtil::getAllClassDocComments()

Polyfill

  • In PhpToken::tokenize():
    • Move trailing newlines from comments to whitespace tokens for consistency with native class
    • Replace namespaced names with PHP 8.0 name tokens

Utility

  • In Get::copy():
    • Copy anything, not just objects
    • Allow object copying behaviour to be customised via a callback

Fixed

Polyfill

  • Fix PhpToken::tokenize() issue where tokens in code with multiple end-of-line sequences may have incorrect line numbers

Utility

  • Fix Get::copy() issue where classes that extend internal classes may trigger an exception when COPY_BY_REFERENCE is enabled

v0.99.55

08 Oct 07:43
v0.99.55
4f9363e
Compare
Choose a tag to compare

Added

Contract

  • Add Flushable
  • Add Instantiable and require facade services to implement it

Sync

  • Add ReflectionSyncEntity and ReflectionSyncProvider
  • Add SyncUtil methods getStore(), getEntityTypeProvider(), getProviderEntityTypes()
  • Add context methods:
    • getEntityType()
    • withEntityType()
    • recursionDetected()
    • hasFilter()
    • getFilters() (necessary after making $key required in getFilter())
    • hasOperation()
    • getOperation()
    • withOffline()
  • Add provider methods runOperation() and filterOperationOutput() to formalise policy enforcement

Utility

  • Add Arr::combine() and adopt instead of array_combine()
  • Add Arr::search()
  • Add Reflect::getConstantValue()

Changed

Core

  • Move exception interfaces to Exception namespace
  • Move entity-related interfaces to Entity namespace
  • Move provider-related interfaces to Provider namespace
  • Move Cardinality constants to Relatable
  • Rename ArrayMapperFlag to ArrayMapperInterface, add map() method, and implement in ArrayMapper
  • Rename HierarchyInterface to Hierarchical, and Hierarchical::getDescendantCount() to countDescendants()
  • Rename Normalisable::normalise() to normaliseProperty()
  • In Constructible:
    • Rename constructList() to constructMultiple()
    • Rearrange parameters in construct() and constructMultiple()
  • Rename Providable::provideList() to provideMultiple()
  • In Extensible:
    • Add getDynamicPropertiesProperty() and getDynamicPropertyNamesProperty()
    • Rename getMetaProperties() to getDynamicProperties()
    • Replace clearMetaProperties() with setDynamicProperties()
  • Add native int type to $conformity parameters

Http

  • Add $orSame parameter to getOneHeaderLine() methods

Sync

  • Move SyncIntrospector methods isListOperation() and isWriteOperation() to SyncUtil
  • Rename SyncNamespaceHelperInterface methods for consistency (again):
    • getEntityProvider() -> getEntityTypeProvider()
    • getProviderEntities() -> getProviderEntityTypes()
  • Rename context methods:
    • stack() -> getEntities()
    • last() -> getLastEntity()
    • push() -> pushEntity()
    • withFilter() -> withOperation() and add $entityType parameter
  • In context method withOperation():
    • Allow associative array keys to be empty
    • Normalise keys with any inner whitespace, not just " "
    • Apply the provider's date formatter to DateTimeInterface instances
  • Merge received conformity levels when a context is passed to Providable::provide() or provideMultiple()

Utility

  • In Arr::pluck(), simplify parameter names and return null for any items where the value is not found
  • In Str::splitDelimited(), remove empty strings by default (for consistency with similar methods)
  • In Str::unwrap():
    • Don't unwrap leading or trailing newlines
    • Trim whitespace between unwrapped lines
    • Rename $trimTrailingWhitespace to $trimLines
  • In Str::mergeLists():
    • Update parameter names
    • Don't add a space to $headingPrefix
    • Make $itemRegex nullable, and fall back to its default value when null is given
    • Add $discardEmpty, $eol, $tabSize parameters
  • In string comparison methods:
    • Don't normalise strings for comparison by default
    • Normalise strings before checking their length

Removed

Core

  • Remove enumeration- and dictionary-related interfaces and classes:
    • EnumerationInterface
    • ConvertibleEnumerationInterface
    • DictionaryInterface
    • AbstractCatalog
    • AbstractEnumeration
    • AbstractConvertibleEnumeration
    • AbstractReflectiveEnumeration
    • AbstractDictionary
  • Remove Cardinality
  • Remove NormaliserFactory
  • Remove Extensible methods: setMetaProperty(), getMetaProperty(), isMetaPropertySet(), unsetMetaProperty()
  • Remove $container parameter from ProviderInterface::getContext()

Sync

  • Remove SyncIntrospector methods isReadOperation(), getEntityProvider(), getProviderEntities()
  • Remove context methods:
    • pushWithRecursionCheck() (pushEntity() now has an optional $detectRecursion parameter)
    • maybeThrowRecursionException() (replaced by recursionDetected())
    • getFilter{Int,String,ArrayKey,IntList,StringList,ArrayKeyList}()
    • claimFilter{Int,String,ArrayKey,IntList,StringList,ArrayKeyList}()
    • online(), offline(), offlineFirst() (replaced by withOffline())
    • applyFilterPolicy(), withFilterPolicyCallback()

Fixed

Core

  • Fix issue where ArrayMapper ignores REQUIRE_MAPPED if ADD_MISSING is also applied
  • Fix ExtensibleTrait issue where dynamic property names are remembered after they are unset

Sync

  • Fix hydration issue where entity providers may be resolved before sync namespaces are registered

Utility

  • Fix Str::mergeLists() issue where tabs are not expanded for comparison when checking for item continuation
  • Fix Str::toStream() issue where long strings may not be fully written to the stream

v0.99.54

24 Sep 05:03
v0.99.54
e351289
Compare
Choose a tag to compare

Added

Sync

  • Add SyncStoreInterface/SyncStore/Sync methods hasProvider(), hasEntityType() and getEntityType() for completeness
  • Add SyncUtil with getEntityTypeUri()

Changed

Container

  • In Application::exportHar():
    • If no $uuid is given, use the UUID of the current sync run if available when naming the HAR file
    • Export HAR files to their own subdirectory

Http

  • Rename Http to HttpUtil for consistency with other component utility classes

Sync

  • Rename "class resolvers" to "namespace helpers" to widen their scope for features like URI mapping in the future
    • Rename SyncClassResolverInterface to SyncNamespaceHelperInterface, and rename its methods for consistency:
      • entityToProvider() -> getEntityProvider()
      • providerToEntity() -> getProviderEntities()
    • Rename getClassResolver() methods to getNamespaceHelper()
  • Review SyncStoreInterface/SyncStore/Sync:
    • Accept provider signatures in getProviderId()
    • Accept provider IDs in getProvider(), and if the provider is not registered, throw an exception instead of returning null
    • Rename entity type-related methods for clarity:
      • registerEntity() -> registerEntityType()
      • getEntityId() -> getEntityTypeId()
      • getEntityUri() -> getEntityTypeUri() (and do not return null)
      • getEntityPrefix() -> getNamespacePrefix()
  • Rename interfaces:
    • SyncEntityLinkType -> LinkType
    • SyncEntitySource -> EntitySource
    • SyncEntityState -> EntityState
    • SyncErrorType -> ErrorType

v0.99.53

20 Sep 05:05
v0.99.53
1b88769
Compare
Choose a tag to compare

Added

Cli

  • Add CliApplication method getVersionString()

Utility

  • Add Str::startsWith(), Str::endsWith() and Str::isAscii()
  • Add Regex::quoteReplacement()

Changed

Utility

  • Rename Str methods:
    • toSnakeCase() -> snake()
    • toKebabCase() -> kebab()
    • toCamelCase() -> camel()
    • toPascalCase() -> pascal()
    • toWords() -> words()
  • Allow ref to be suppressed unconditionally in Package methods version() and getPackageVersion()
  • Change TKey type from array-key to mixed in Arr methods unique(), whereNotNull(), whereNotEmpty(), trim(), lower(), upper(), snakeCase(), toScalars() and toStrings()

Removed

Utility

  • Remove Str::title()
  • Remove Test::isAsciiString()

Fixed

Cli

  • Fix issue where CliApplication::reportVersion() may print the commit reference twice or print empty brackets when there is no reference

PHPDoc

  • Fix issue where trait aliases are not followed
  • Work around PHP 7.4 bug where ReflectionMethod does not honour trait aliases

Utility

  • Fix issue where Str::words() may return unexpected results when $separator contains '\', '$' or a preserved character
  • Fix Str::expandLeadingTabs() issue where tabs after a falsey value at the start of the first line may not be preserved

v0.99.52

17 Sep 06:51
v0.99.52
e757f1d
Compare
Choose a tag to compare

Added

Cli

  • Add CliApplicationInterface::reportVersion()

Sync

  • Add --har option to CLI commands

Changed

Cli

  • Change --version output to <app> <version> (<ref>) PHP <php-version>

v0.99.51

17 Sep 02:16
v0.99.51
6bd3d6f
Compare
Choose a tag to compare

Added

Curler

  • Add Curler method alwaysPaginates()

PHPStan

  • Add TypesAssignedByHasMutatorRule to check property changes made by HasMutator (previously HasImmutableProperties)

Sync

  • Add HttpSyncProvider::getAlwaysPaginate() method
  • Add $alwaysPaginate parameter to HttpSyncProvider::getCurler()
  • Add HttpSyncDefinition::$AlwaysPaginate property
  • Add $alwaysPaginate parameter to HttpSyncDefinition::withPager() for consistency with the equivalent Curler method

Changed

Console

  • In ConsoleTagFormats:
    • Implement Immutable
    • Rename set() to withFormat() and return a copy
    • Rename get() to getFormat()
  • Extend Immutable from ConsoleFormatterInterface

Core

  • In HasImmutableProperties, require implementation of Immutable
  • Rename HasImmutableProperties to HasMutator
  • Rename HasMutator::withPropertyValue() to with()
  • Rename HasMutator::withoutProperty() to without()
  • Make HasMutator methods private for better safety by default

Curler

  • Accept and return request objects in Curler method replaceQuery()
  • Don't extend CurlerPageRequestInterface from CurlerPageInterface
  • Reinstate CurlerPageInterface methods hasNextRequest() and getNextRequest()
  • Allow CurlerPageInterface::getNextRequest() to return CurlerPageRequestInterface for consistency with CurlerPagerInterface::getFirstRequest()
  • Add TPage template to CurlerPagerInterface::getPage()
  • Rename CurlerPageRequestInterface::getNextRequest() to getRequest()
  • Rename CurlerPageRequestInterface::getNextQuery() to getQuery()
  • Extend Immutable from CurlerInterface

Http

  • Accept and return request objects in Http::mergeQuery() and Http::replaceQuery()

Removed

Core

  • Remove HasMutator::clone() (previously HasImmutableProperties::clone())

Curler

  • Remove CurlerPageRequestInterface::hasNextRequest()

Fixed

Sync

  • Fix incorrect documentation that indicates HttpSyncProvider::getCurler() arguments take precedence over HttpSyncProvider::filterCurler()

v0.99.50

11 Sep 06:03
v0.99.50
44ccf2b
Compare
Choose a tag to compare

Changed

Contract

  • Simplify StreamWrapper and related interfaces

Cache

  • Remove problematic $maxAge parameters from cache store methods
  • Rename getAllKeys() to getItemKeys() for consistency
  • Rename CacheStoreInterface to CacheInterface

v0.99.49

10 Sep 08:01
v0.99.49
21e9dd1
Compare
Choose a tag to compare

Added

Contract

  • Add StreamWrapper, an abstraction of the streamWrapper prototype class described in the PHP manual

Curler

  • Add CurlerPageRequest and allow it to be returned from CurlerPagerInterface::getFirstRequest() to minimise query string deserialization between requests
  • Add CurlerPage methods getCurrent() and getTotal(), which return $current and $total values passed to __construct(), so progress can be tracked across responses if needed
  • Add AbstractRequestException and AbstractResponseException to API so middleware can extend them

Testing (new)

  • Add MockPhpStream
  • Add MockTarget (from Console)

Changed

Curler

  • In CurlerPagerInterface::getPage(), add $response and $query parameters to simplify pager code and improve consistency
  • Move isLastPage() and getNextRequest() from CurlerPageInterface to CurlerPageRequestInterface and extend the latter from the former
  • Replace isLastPage() with hasNextRequest()

Sli

  • Review sli subcommand names

Sync

  • Move SendHttpRequest from Sli to Sync, rename it to SendHttpSyncProviderRequest, and refactor for consistency
  • Rename GetSyncEntities to GetSyncEntity for consistency

Removed

Console

  • Remove ConsoleInvalidTargetException

Curler

  • Remove redundant HttpErrorExceptionInterface::getStatusCode() and isNotFoundError() methods

Fixed

Curler

  • Fix Curler issue where initial query is not passed to pagers
  • Fix Curler pagination issue where entities are returned with the same keys for each page of data

Sync

  • Fix SyncEntityProvider issue where upstream iterator keys are preserved unnecessarily, leading to possible data loss

v0.99.48

06 Sep 09:45
v0.99.48
a461a13
Compare
Choose a tag to compare

Added

Container

  • Add application method getHarFilename()

Changed

Container

  • In application method exportHar():
    • Defer creation of HAR file until first Curler request
    • Allow $uuid to be given via callback (e.g. to match Sync::getRunUuid())

Curler

  • Add optional $event parameter to CurlerHarRecorder::start()

Fixed

Http

  • Fix OAuth2Client issue where a stale JWKS may not be refreshed
  • Fix HttpHeaders issue where getLines() returns unsorted headers after the collection is sorted or reversed
  • Add and implement HttpHeadersInterface::canonicalize() to resolve issue where HttpHeaders::getLines() may return headers in an order not compliant with [RFC7230]

v0.99.47

05 Sep 03:33
v0.99.47
82fa865
Compare
Choose a tag to compare

Changed

Console

  • Adopt "^ " instead of "? " as the default warning message prefix

Curler

  • Rename CurlerHttpArchiveRecorder to CurlerHarRecorder
  • Follow Location headers in Curler instead of enabling cURL's CURLOPT_FOLLOWLOCATION option
    • This allows CurlerHarRecorder to be used when following redirects
    • It will also allow redirect behaviour, including caching, to be customised in a future release
  • Throw TooManyRedirectsException if MaxRedirects is exceeded in Curler
  • Improve cache stability by serializing header values, not HttpHeaders instances, when caching responses in Curler
  • Don't silently remove query and fragment from request URI in Curler::withRequest()
    • An exception is now thrown if the given URI has a query or fragment

Fixed

Curler

  • Fix issue where Curler response cache resolves equivalent requests separately if one has an empty path and the other path is "/"
  • Fix Curler issue where HTTP error responses are cached if they are not thrown
  • Fix Curler issue where request bodies larger than 2MiB are not rewound when they are retried after "429 Too Many Requests"
    • An exception is now thrown if a request body cannot be rewound after redirection or "429 Too Many Requests"
  • Fix Curler issue where multiple response bodies may be returned as one when a request is retried after "429 Too Many Requests"