This repository has been archived by the owner on Aug 28, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 86
The Return of the SettingsGateway Rewrite #691
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* refactor: No more _update * cleanup: More re-organization * src: More refactors * Settings#{list,resolveString} -> Settings#display * style: Rename constant name * refactor: Re-add Conf#check and reduce duplicated code in Settings#reset * fix: _resolveUpdateOverloads not parsing reset args correctly * fix: Synchronize the Settings entry on update or reset instead of returning wrong results * typings: Fixed QB types and updated everything * docs: Added missing jsdocs and refactored Settings#get * fix: conf and userconf always throwing on empty values * fix: Better Schema#get * fix: Settings#show using Map[key] instead of Map#get(key) * fix: Settings#_resolveUpdateOverloads not checking for the lack of a key * fix: conf command not passing all args for check * fix: Fixed multiple things * docs: Update guides to reflect latest changes * pr: Update changelog
Now it's the time when I run and hide for such a silly mistake.
* wip: Settings rewrite * design: Chain SettingsFolder#get instead of recursing, remove '*' wildcard * refactor: Made SettingsFolder#get use Array#reduce * src: Add Settings#init * src: Added SettingsFolder#display * src: Remove Settings and all traces of it * src: Update Gateway, move SettingsFolder#existenceStatus to Settings * docs: Documented all methods and properties of Settings and SettingsFolder * naming: Gateway#type -> Gateway#name * src: Change all occurrences of Settings[key] to Settings.get(key) * src: SettingsUpdateOptions#{action|avoidUnconfigurable} -> {arrayAction|onlyConfigurable} * src: guildSettings[key] -> guildSettings.get(key) * typings: GatewayStorage#type -> GatewayStorage#name * refactor: Faster Schema#get * typings: Fix Settings class typings * typings: Iterable -> IterableIterator * docs: Fixed util docs * fix: Use Map#call instead of inherited SettingsFolder#get and Schema * fix: Settings#init deepCloning the wrong value * fix: KlasaGuild#language using Settings[key] instead of Settings.get(key) * inspection: Make Settings#{id|base} non-enumerable * fix: Sandbox Schema#get to mimic previous functionality * fix: Better errors for Settings#{reset,update} * fix: Fixed SettingsFolder#display * docs: Added comments to justify the usage of Map.prototype.get.call * fix: SettingsFolder#display not getting the right path * fix: Revert change to commandHandler's mention only check * docs: Justify the prefix.length in commandHandler's mentionOnly * feat: SettingsFolder#pluck * fix: Updated providers helpers for the new Gateway results * fix: SettingsFolder#update not overloading well * fix: Settings and SettingsFolder trying to access client * fix: Fixed updating not patching correctly * fix: settingsUpdateEntry event receiving a SettingsFolder instead of the Settings instance * src: Better relative path parsing, fixed update inserting full values into db * fix: JSON provider not parsing create queries * fix: Configuration commands not checking correctly * src: Added Settings#target, Gateway#{create,acquire}, removed create in get * fix: Init schedule before pieces (but after SG) * i18n,fix: Default guild option in Settings#{update,reset}, i18n all errors * refactor: Better guild resolving for Settings#{reset,update} * fix: resolveGuild calls without client * fix: SQLProvider accessing to the gateway wrongly * changelog: Updated for the PR * fix: Settings#clone not working as expected * misc: Make Settings#{id,gateway,target} enumerable * revert: Settings#{gateway,target} enumerability * cleanup: Remove GatewayStorage#defaults * misc: Make Schema#defaults a property * fix: Call this.init() in destroy instead of patching * docs: Updated changelog * lint: Fixed lint * docs: Fixed jsdocs * src: Reorganize files * style: Remove optional property in Settings#id * memory: Deepclone patch, not init * fix: Access to undefined * fix: Settings#update not serializing arrays correctly * src: Remove all usage of deepClone in SettingsGateway * misc: Make Schema#defaults a SettingsFolder instance * docs: Finished changelog * misc: Remove guild option from the conf command * docs: Forgot to mention arrayPosition->arrayIndex in CHANGELOG * perf: Optimize Gateway#sync to the clouds for empty schemas
* feat: Added `KlasaClient#settingsSyncEntry` event. * docs: Correct PR number in CHANGELOG * src: Emit settingsSyncEntry on broadcastEval * fix: Entry settings not setting their existence status to true in shards * misc: Renamed `KlasaClient#{settingsUpdateEntry,settingsDeleteEntry,settingsCreateEntry}` to `KlasaClient#{settingsUpdate,settingsDelete,settingsCreate}`. * misc: Rename prefix settingsUpdate core event to... coreSettingsUpdate * fix: coreSettingsUpdate is not an once event
* fix: Added core event handler for settingsDelete * docs: Updated IncludedEvents * docs: Correct changelog PR number * fix: Don't check this.client.shard in both core settings event handlers * misc: Add IS support for both core settings events handlers * misc: Much better and faster shard check for both settings events
* refactor: Convert GatewayDriver into a Collection<string, Gateway> (#467) * refactor: Convert GatewayDriver into a Collection<string, Gateway> * fix: Better error message for gateway existence in register Co-Authored-By: kyranet <kyradiscord@gmail.com> * refactor: Upgrade API for Settings#update (#426) * refactor: No more _update * cleanup: More re-organization * src: More refactors * Settings#{list,resolveString} -> Settings#display * style: Rename constant name * refactor: Re-add Conf#check and reduce duplicated code in Settings#reset * fix: _resolveUpdateOverloads not parsing reset args correctly * fix: Synchronize the Settings entry on update or reset instead of returning wrong results * typings: Fixed QB types and updated everything * docs: Added missing jsdocs and refactored Settings#get * fix: conf and userconf always throwing on empty values * fix: Better Schema#get * fix: Settings#show using Map[key] instead of Map#get(key) * fix: Settings#_resolveUpdateOverloads not checking for the lack of a key * fix: conf command not passing all args for check * fix: Fixed multiple things * docs: Update guides to reflect latest changes * pr: Update changelog * fix: Collection not being destructured from discord.js Now it's the time when I run and hide for such a silly mistake. * Settings rewrite (#471) * wip: Settings rewrite * design: Chain SettingsFolder#get instead of recursing, remove '*' wildcard * refactor: Made SettingsFolder#get use Array#reduce * src: Add Settings#init * src: Added SettingsFolder#display * src: Remove Settings and all traces of it * src: Update Gateway, move SettingsFolder#existenceStatus to Settings * docs: Documented all methods and properties of Settings and SettingsFolder * naming: Gateway#type -> Gateway#name * src: Change all occurrences of Settings[key] to Settings.get(key) * src: SettingsUpdateOptions#{action|avoidUnconfigurable} -> {arrayAction|onlyConfigurable} * src: guildSettings[key] -> guildSettings.get(key) * typings: GatewayStorage#type -> GatewayStorage#name * refactor: Faster Schema#get * typings: Fix Settings class typings * typings: Iterable -> IterableIterator * docs: Fixed util docs * fix: Use Map#call instead of inherited SettingsFolder#get and Schema * fix: Settings#init deepCloning the wrong value * fix: KlasaGuild#language using Settings[key] instead of Settings.get(key) * inspection: Make Settings#{id|base} non-enumerable * fix: Sandbox Schema#get to mimic previous functionality * fix: Better errors for Settings#{reset,update} * fix: Fixed SettingsFolder#display * docs: Added comments to justify the usage of Map.prototype.get.call * fix: SettingsFolder#display not getting the right path * fix: Revert change to commandHandler's mention only check * docs: Justify the prefix.length in commandHandler's mentionOnly * feat: SettingsFolder#pluck * fix: Updated providers helpers for the new Gateway results * fix: SettingsFolder#update not overloading well * fix: Settings and SettingsFolder trying to access client * fix: Fixed updating not patching correctly * fix: settingsUpdateEntry event receiving a SettingsFolder instead of the Settings instance * src: Better relative path parsing, fixed update inserting full values into db * fix: JSON provider not parsing create queries * fix: Configuration commands not checking correctly * src: Added Settings#target, Gateway#{create,acquire}, removed create in get * fix: Init schedule before pieces (but after SG) * i18n,fix: Default guild option in Settings#{update,reset}, i18n all errors * refactor: Better guild resolving for Settings#{reset,update} * fix: resolveGuild calls without client * fix: SQLProvider accessing to the gateway wrongly * changelog: Updated for the PR * fix: Settings#clone not working as expected * misc: Make Settings#{id,gateway,target} enumerable * revert: Settings#{gateway,target} enumerability * cleanup: Remove GatewayStorage#defaults * misc: Make Schema#defaults a property * fix: Call this.init() in destroy instead of patching * docs: Updated changelog * lint: Fixed lint * docs: Fixed jsdocs * src: Reorganize files * style: Remove optional property in Settings#id * memory: Deepclone patch, not init * fix: Access to undefined * fix: Settings#update not serializing arrays correctly * src: Remove all usage of deepClone in SettingsGateway * misc: Make Schema#defaults a SettingsFolder instance * docs: Finished changelog * misc: Remove guild option from the conf command * docs: Forgot to mention arrayPosition->arrayIndex in CHANGELOG * perf: Optimize Gateway#sync to the clouds for empty schemas * feat: Added `KlasaClient#settingsSync` event. (#475) * feat: Added `KlasaClient#settingsSyncEntry` event. * docs: Correct PR number in CHANGELOG * src: Emit settingsSyncEntry on broadcastEval * fix: Entry settings not setting their existence status to true in shards * misc: Renamed `KlasaClient#{settingsUpdateEntry,settingsDeleteEntry,settingsCreateEntry}` to `KlasaClient#{settingsUpdate,settingsDelete,settingsCreate}`. * misc: Rename prefix settingsUpdate core event to... coreSettingsUpdate * fix: coreSettingsUpdate is not an once event * fix: Old typings, patch before emitting events * fix: Settings delete core event (#477) * fix: Added core event handler for settingsDelete * docs: Updated IncludedEvents * docs: Correct changelog PR number * fix: Don't check this.client.shard in both core settings event handlers * misc: Add IS support for both core settings events handlers * misc: Much better and faster shard check for both settings events * src: GatewayDriver#register changes * fix: I missed this * misc: Requested changes * src: Requested change * fix: Who did this * fix: settings is not defined in the evals
* feat: resolve helper * feat: fully working resolve method * docs: changelog * fix: doc block spacing * fix: language of null Co-Authored-By: UnseenFaith <tba28012@hotmail.com> * fix: relative pathing vs absolute Co-Authored-By: UnseenFaith <tba28012@hotmail.com> * fix: change to more cpu/gpu friendly method * typings: Updated for ece217f * fix: arrays setting entire keys to null instead of the index also all deserialize funcs are async for consistency * docs: add typedef for resolve
* cleanup: move code to a more appropriate place * fix: client not this * fix: option is plural not singular * docs: these don't belong here...
remove is effectively made useless because you have to add every key using .add() now, to remove just remove the .add() call
* src: make piece serializer better and add aliases * src: fix build * Update src/languages/en-US.js Co-Authored-By: UnseenFaith <tba28012@hotmail.com>
* src: Rename SchemaPiece to SchemaEntry and all occurrences * consistency: More requested changes * doc: Fix typedef in UnderstandingSchemaEntries.md * doc: Fixed SchemaEntryOptions's typedef
* feat: Add GatewayStorage#sync so they can be registered. * src: change gatewaystorage to be consistent * fix: one more occurence of providerName * fix: build * typings: Updated for latest commit, added GatewayOptions typedef * fix: GatewayStorage options argument not defaulting * doc: GatewayStorage#_private should be marked as private
* src: Rewrite QueryBuilder to be a Map * doc: Updated CreatingSQLProviders * fix: SQLProvider#_parseGatewayInput * misc: QueryBuilder#parseDefault -> generateDatatype * misc: Rename resolvers to serializers * src: Added QB#debug(), QueryBuilderDatatype.aliasOf, and SQLProvider#validateQueryBuilder * fix: Object.create's properties are not enumerable, object spread fails here * fix: Use Object.assign instead of mergeDefault when a datatype exists * misc: Rename QueryBuilderDatatype.aliasOf to extends to match actual behaviour * misc: Remove QueryBuilder#add's string overload for type * typings: Bugfixes * typings: Fix KlasaClientOptions, added support for strict TS * typings: Fix SchemaFolderOptions interface * fix: Whoops * fix: GatewayStorage throwing the wrong provider name * lint: Added missing semicolon * typings: Fixed some definitions for strict mode * src: Added more QB default types, fixed some of them, added number * typings: Add overloads for Schema * fix: Do not stringify null
* Fix patch and sharding related bugs * delete should also emit sync to send defaults back * fix destroy not setting existenceStatus to false
* throwOnError option * better checks * docs * create namespace for settings * fix spacing? * typings: Updated to latest commit
* typings: Fixed typings for Provider and SQLProvider * typings: Fixed indentation for the regions
* refactor: Use RequestHandler to handle synchronization * chore: Update `@klasa/request-handler` to `0.0.2` * fix: Re-implement Gateway{Storage}#sync * docs: Fixed wrong element in README * chore: Update `@klasa/request-handler` to `0.0.3` * fix: Resolved synchronization issues in Settings
Co-Authored-By: Gryffon Bellish <owenbellish@gmail.com>
this has been done with the latest master rewrite, closing this PR, but keeping the branch around until we are sure we can depend on the klasa 0.6.0+ |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
Meta: Refactor
Issues and PRs related to refactors.
Mod: SettingsGateway
Issues and PRs related to SettingsGateway.
SEM: Major
PRs that contain breaking changes and should be released in the next major version.
Type: Caching
Issues and PRs related to caching.
Type: Enhancement
Issues and PRs related to feature enhancement.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the PR
Fixes #425.
Changes Proposed in this Pull Request (List new items in CHANGELOG.MD)
Added:
KlasaClient#settingsDelete
event handler to destroy instances in other shards. (kyranet)KlasaClient#settingsSync
event. (kyranet)Gateway#create
andGateway#acquire
. (kyranet)SETTING_GATEWAY_CHOOSE_KEY
andSETTING_GATEWAY_UNCONFIGURABLE_FOLDER
i18n keys into en-US. (kyranet)SettingsFolder
, with the common operations (update, reset...) for better OOP compliancy. (kyranet)Schema#configurableValues
, similar toSchema#configurableKeys
. (kyranet)SettingsUpdateOptions.rejectOnError
to makeSettings#update
reject when any of the keys are invalid or the parse turns out wrong. (kyranet)Changed:
settings
option. (UnseenFaith)Settings#get
to always deep clone values. (UnseenFaith)Language#get
's generic types to include an array of function values. (Favna)SettingsFolder#{pluck,resolve}
to return arrays instead of objects. (Skillz4Killz)Settings#get()
. (Faith)QueryBuilder
to extend a Map instead of being a pseudo-map. (kyranet)GatewayDriver#register
to take aGatewayStorage
instance. (kyranet)KlasaClient#{settingsUpdateEntry,settingsDeleteEntry,settingsCreateEntry}
toKlasaClient#{settingsUpdate,settingsDelete,settingsCreate}
. (kyranet)Schema#defaults
type from Object literal to aSettingsFolder
instance. (kyranet)Schema#defaults
to be a property instead of a getter. (kyranet)Gateway#get
to take only id. For get or create, useGateway#acquire
instead. (kyranet)Settings#{update,reset}
output to return{ key: string, value: any, piece: Schema | SchemaPiece }
instead of{ data: string, any], piece: Schema | SchemaPiece }
in theupdated
field. (kyranet)Settings
completely, they're not longer dictionaries but (nested)SettingsFolder
s. (kyranet)Util.resolveGuild
to also resolve members. (kyranet)Schedule
before initializing pieces. (kyranet)Gateway#syncQueue
toGateway#syncMap
, changing also its type fromCollection<string, Promise<Settings>>
toWeakMap<string,- Promise<Settings>>
. (kyranet)GatewayDriver#type
toGatewayDriver#name
. (kyranet)SettingsUpdateOptions.{action,arrayPosition,avoidUnconfigurable}
toSettingsUpdateOptions.{arrayAction,arrayIndex,onlyConfigurable}
. (kyranet)Settings#{list,resolveString}
->Settings#display
. (kyranet)SettingsUpdateOptions
. (kyranet)GatewayDriver
to extendCollection<string, Gateway>
as opposed to being a dictionary type. (kyranet)Removed:
Gateway#store
. (kyranet)Gateway#defaults
. Refer toSchema#defaults
instead. (kyranet)Gateway#getPath
. They're now resolved inside Settings. (kyranet)Fixed:
KlasaUser#toJSON
. (PyroTechniac)Store.walk
. (PyroTechniac)userconf
command using the guilds gateway instead of the users one. (UnseenFaith)Semver Classification