7.11.0 • Published 9 months ago

@quenty/adorneedata v7.11.0

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

AdorneeData

Bridges attributes and serialization

Installation

npm install @quenty/adorneedata --save

Requirements

These are the requirements for this attribute data library.

  • Not like Tie in that it is focused on serialization/boundary between Roblox and our stuff (tie is interfaces separated by network boundary)
  • Easy to transform between data and attributes
  • No service bag requirements

Centralized definition with no server/client information

return AdorneeData.new({
  CurrencyColor = Color3.new();
  CurrencyNameTranslationKey = "";
  CurrencyFormatTranslationKey = "";
  CurrencyImageId = "";
  CurrencyShowType = CurrencyShowTypes.NONE;
  GivePlayerCurrency = false;
  CurrencySaves = false;
})

Easy to write/author

We should be able to create new data that is validated

CurrencyDefinitionData:CreateData({
  CurrencyKey = CurrencyDefinitionConstants.DEFAULT_CURRENCY_KEY
  CurrencyColor = Color3.fromRGB(55, 180, 74)
  CurrencyTranslationKey = "currency.default.name"
  CurrencyFormatTranslationKey = "currency.default.format"
  DoesSave = true
  ImageId = "rbxassetid://10049671651"
})

We should be able to create partial data

CurrencyDefinitionData:CreatePartialData({
  CurrencyKey = CurrencyDefinitionConstants.DEFAULT_CURRENCY_KEY
  CurrencyColor = Color3.fromRGB(55, 180, 74)
  CurrencyTranslationKey = "currency.default.name"
  CurrencyFormatTranslationKey = "currency.default.format"
  DoesSave = true
  ImageId = "rbxassetid://10049671651"
})

Additional authorship requirements

  • Should be able to set optional values

Easy to validate/assert/assign

We should be able to check data types

function CurrencyService:InitCurrencyDefinition(currencyDefinitionData)
  assert(CurrencyDefinitionData:IsData(currencyDefinitionData), "Bad currencyDefinitionData")

  local currencyDefinition = CurrencyDefinition:Create("Folder")
  CurrencyDefinitionData:SetAttributes(currencyDefinition, currencyDefinitionData)

  return currencyDefinition
end

Replacement files

Should replace following files:

  • CurrencyDefinitionDataUtils - Files with t interface asserting type
  • CurrencyDefinitionConstants - Files with constant attribute names
  • CurrencyDefinitionUtils - File that sets certain properties or attributes and do validation

Easy to serialize

Should be able to flash to constant

7.11.0

9 months ago

7.8.0

10 months ago

7.7.0

10 months ago

7.9.1

10 months ago

7.9.0

10 months ago

7.10.0

9 months ago

7.10.1

9 months ago

7.6.0

10 months ago

7.5.0

11 months ago

7.4.0

1 year ago

7.3.0

1 year ago

7.2.0

1 year ago

7.1.0

1 year ago

7.0.0

1 year ago

5.0.0

1 year ago

6.0.0

1 year ago

4.0.0

1 year ago

3.0.0

2 years ago

1.3.0

2 years ago

2.0.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago