Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[breaking] Prepare version 2.0 stable #232

Merged
merged 17 commits into from
Nov 16, 2022
Merged

Conversation

Aschen
Copy link
Contributor

@Aschen Aschen commented Oct 25, 2022

What does this PR do ?

Asset metadata will now be stored simply as objects.
Assets only have a model and a reference as identifiers, like Devices.

{
  model: "container",
  reference: "ABC123",
  metadata: {
    weight: 200
  }
}

A lot of API action has been removed to keep the plugin as simple as possible.

  • refactor the entire code following the module separation

From #231 (BREAKING)

This PR add a Model module to manage

  • Asset: declare models and register metadata for them
  • Device: register metadata for device models
  • Measure: declare new measure types

Models can be registered on the framework with one of the plugin.models.registerXXXX method or at runtime with the ModelController:

  • writeAsset|Device|Measure: upsert a model
  • deleteAsset|Device|Measure: delete a model
  • listAsset|Device|Measure: list models

Decoder are now registered alongside with a Device model

deviceManager.models.registerDevice("DummyTemp", new DummyTempDecoder(), {
  color: { type: "keyword" },
});

From #234

Add default roles to manage plugin ressources. Admins roles can do everything and reader can only read.

  • assets.admin

  • assets.reader

  • device.admin: this role cannot attach and detach devices from engines

  • device.reader

  • decoders.admin

  • measures.reader

  • measures.admin

  • device and asset models now have defaultValues for their metadata. Those values will be copied into assets and devices upon creation

  • fix bug that prevented metadata to be propagated and saved in measures collection

From #235 (BREAKING)

  • measures document
  • remove measure unit
  • embedded measures
  • measure names
  • measures definition in digital twin models

Copy link
Contributor

@Shiranuit Shiranuit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still have about 50% to review

@@ -37,6 +33,7 @@ export class DummyTempDecoder extends Decoder {
const decodedPayload = new DecodedPayload<DummyTempDecoder>(this);

if (payload?.metadata?.color) {
console.log(payload);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debug leftover

Aschen and others added 6 commits October 27, 2022 13:40
…and Measure (#231)


This PR add a `Model` module to manage 
 - Asset: declare models and register metadata for them
 - Device: register metadata for device models
 - Measure: declare new measure types

Models can be registered on the framework with one of the `plugin.models.registerXXXX` method or at runtime with the `ModelController`:
 - writeAsset|Device|Measure: upsert a model
 - deleteAsset|Device|Measure: delete a model
 - listAsset|Device|Measure: list models

Decoder are now registered alongside with a Device model
```
deviceManager.models.registerDevice("DummyTemp", new DummyTempDecoder(), {
  color: { type: "keyword" },
});
```

----

Add default roles to manage plugin ressources. Admins roles can do everything and reader can only read.
 - `assets.admin`
 - `assets.reader`
 - `device.admin`: this role cannot attach and detach devices from engines
 - `device.reader`
 - `decoders.admin`
 - `measures.reader`
 - `measures.admin` 

 - device and asset models now have `defaultValues` for their metadata. Those values will be copied into assets and devices upon creation
 - fix bug that prevented metadata to be propagated and saved in measures collection

 --- 

Changes:

    measures document
    remove measure unit
    embedded measures
    measure names
    measures definition in digital twin models

Co-authored-by: Aschen <amaret@kuzzle.io>
@Aschen Aschen changed the title [breaking] Remove AssetCategory and Metadata [breaking] Prepare version 2.0 stable Nov 16, 2022
@Aschen Aschen merged commit ed8e6c0 into 2-stable Nov 16, 2022
@Aschen Aschen deleted the refactor-asset-category branch November 16, 2022 21:32
@Aschen Aschen mentioned this pull request Nov 16, 2022
Aschen pushed a commit that referenced this pull request Nov 16, 2022
## What does this PR do ?

This release is a **major** rewrite of the plugin architecture, API and data model.

The version is supposed to be very close of the final 2.0.0 stable version of the plugin. Very few breaking changes are expected until final release.

Migration scripts may be provided as we are going forward this huge step.

The documentation will be entirely rewritten when the 2.0.0 is release.

More informations about the changes in this PR: #232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants