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

Trivial: ByteArray thoughts #156

Closed
lauckhart opened this issue May 21, 2023 · 1 comment · Fixed by #1154
Closed

Trivial: ByteArray thoughts #156

lauckhart opened this issue May 21, 2023 · 1 comment · Fixed by #1154
Assignees
Labels
question Further information is requested

Comments

@lauckhart
Copy link
Collaborator

Some quick ideas r.e. ByteArray.

  • Right now we monkeypatch Uint8Array, might be frowned upon by some library users
  • Could we make ByteArray a subclass of Uint8Array instead of an alias, and put utility functions there?
  • We could also add custom toString and toJSON methods so diagnostics like in Resuming a Session the second time fails #138 would show as hex rather than comma-separated decimal
  • I could also add the base64 utilities using the codec I made for the security stuff
@Apollon77
Copy link
Collaborator

@mfucci introduced it that way. I think the idea was that on other platforms it might nbe something else then UInt8Array, thats why "just" the alias.

@mfucci Any opinion on this?

@Apollon77 Apollon77 added the question Further information is requested label May 21, 2023
@lauckhart lauckhart self-assigned this Aug 6, 2023
lauckhart added a commit to lauckhart/matter.js that referenced this issue Sep 3, 2024
This is a partial pass deconstructing the matter.js package.  I tried to stick to decisions we'd previously agreed to.

The new @project-chip/matter.js-general package contains those portions of matter.js that are not Matter specific.

The new @project-chip/matter.js-model package contains the Matter object model.

Since I was moving stuff around I got rid of the Uint8Array monkey patches we did in ByteArray.  For the most part this just consisted of replacing the "ByteArray" type with "Uint8Array".  The methods we injected I moved to a "Bytes" namespace containing utility functions.  This is a breaking change.

Following new conventions, the new packages don't have "matter.js" in their names, so they're just in "packages/general" and "packages/model".  I also renamed packages/matter.js-tools to packages/tools.  I did not rename the other directories yet.

I updated codegen and the intermediate model package dependencies, so codegen errors do not prevent codegen from running except for the generated model files in @project-chip/matter.js-model.

The new packages are smaller so I moved to a flat namespace for exports.  So there are no subpaths exported from the "general" package, even though most of the exports were previously exported as subpaths of matter.js.  I think this improves readability and makes consumption simpler.

"model" also has a flat namespace but this was true of the previous "@project-chip/matter.js/model" module so this isn't as big of a change.

I did my best to add exports to matter.js to support backward compatibility.  However I used a little editorial control to select which exports to reproduce at the old location...  I made sure to cover all of those we used previously in the examples.  Many of the other exports were probably not ever used externally.  Shouldn't be a big deal if I got it wrong; we can add additional exports or just inform users of the new locations.

Fixes project-chip#156
lauckhart added a commit to lauckhart/matter.js that referenced this issue Sep 3, 2024
This is a partial pass deconstructing the matter.js package.  I tried to stick to decisions we'd previously agreed to.

The new @project-chip/matter.js-general package contains those portions of matter.js that are not Matter specific.

The new @project-chip/matter.js-model package contains the Matter object model.

Since I was moving stuff around I got rid of the Uint8Array monkey patches we did in ByteArray.  For the most part this just consisted of replacing the "ByteArray" type with "Uint8Array".  The methods we injected I moved to a "Bytes" namespace containing utility functions.  This is a breaking change.

Following new conventions, the new packages don't have "matter.js" in their names, so they're just in "packages/general" and "packages/model".  I also renamed packages/matter.js-tools to packages/tools.  I did not rename the other directories yet.

I updated codegen and the intermediate model package dependencies, so codegen errors do not prevent codegen from running except for the generated model files in @project-chip/matter.js-model.

The new packages are smaller so I moved to a flat namespace for exports.  So there are no subpaths exported from the "general" package, even though most of the exports were previously exported as subpaths of matter.js.  I think this improves readability and makes consumption simpler.

"model" also has a flat namespace but this was true of the previous "@project-chip/matter.js/model" module so this isn't as big of a change.

I did my best to add exports to matter.js to support backward compatibility.  However I used a little editorial control to select which exports to reproduce at the old location...  I made sure to cover all of those we used previously in the examples.  Many of the other exports were probably not ever used externally.  Shouldn't be a big deal if I got it wrong; we can add additional exports or just inform users of the new locations.

Fixes project-chip#156
lauckhart added a commit to lauckhart/matter.js that referenced this issue Sep 3, 2024
This is a partial pass deconstructing the matter.js package.  I tried to stick to decisions we'd previously agreed to.

The new @project-chip/matter.js-general package contains those portions of matter.js that are not Matter specific.

The new @project-chip/matter.js-model package contains the Matter object model.

Since I was moving stuff around I got rid of the Uint8Array monkey patches we did in ByteArray.  For the most part this just consisted of replacing the "ByteArray" type with "Uint8Array".  The methods we injected I moved to a "Bytes" namespace containing utility functions.  This is a breaking change.

Following new conventions, the new packages don't have "matter.js" in their names, so they're just in "packages/general" and "packages/model".  I also renamed packages/matter.js-tools to packages/tools.  I did not rename the other directories yet.

I updated codegen and the intermediate model package dependencies, so codegen errors do not prevent codegen from running except for the generated model files in @project-chip/matter.js-model.

The new packages are smaller so I moved to a flat namespace for exports.  So there are no subpaths exported from the "general" package, even though most of the exports were previously exported as subpaths of matter.js.  I think this improves readability and makes consumption simpler.

"model" also has a flat namespace but this was true of the previous "@project-chip/matter.js/model" module so this isn't as big of a change.

I did my best to add exports to matter.js to support backward compatibility.  However I used a little editorial control to select which exports to reproduce at the old location...  I made sure to cover all of those we used previously in the examples.  Many of the other exports were probably not ever used externally.  Shouldn't be a big deal if I got it wrong; we can add additional exports or just inform users of the new locations.

Fixes project-chip#156
lauckhart added a commit to lauckhart/matter.js that referenced this issue Sep 3, 2024
This is a partial pass deconstructing the matter.js package.  I tried to stick to decisions we'd previously agreed to.

The new @project-chip/matter.js-general package contains those portions of matter.js that are not Matter specific.

The new @project-chip/matter.js-model package contains the Matter object model.

Since I was moving stuff around I got rid of the Uint8Array monkey patches we did in ByteArray.  For the most part this just consisted of replacing the "ByteArray" type with "Uint8Array".  The methods we injected I moved to a "Bytes" namespace containing utility functions.  This is a breaking change.

Following new conventions, the new packages don't have "matter.js" in their names, so they're just in "packages/general" and "packages/model".  I also renamed packages/matter.js-tools to packages/tools.  I did not rename the other directories yet.

I updated codegen and the intermediate model package dependencies, so codegen errors do not prevent codegen from running except for the generated model files in @project-chip/matter.js-model.

The new packages are smaller so I moved to a flat namespace for exports.  So there are no subpaths exported from the "general" package, even though most of the exports were previously exported as subpaths of matter.js.  I think this improves readability and makes consumption simpler.

"model" also has a flat namespace but this was true of the previous "@project-chip/matter.js/model" module so this isn't as big of a change.

I did my best to add exports to matter.js to support backward compatibility.  However I used a little editorial control to select which exports to reproduce at the old location...  I made sure to cover all of those we used previously in the examples.  Many of the other exports were probably not ever used externally.  Shouldn't be a big deal if I got it wrong; we can add additional exports or just inform users of the new locations.

Fixes project-chip#156
lauckhart added a commit to lauckhart/matter.js that referenced this issue Sep 9, 2024
This is a partial pass deconstructing the matter.js package.  I tried to stick to decisions we'd previously agreed to.

The new @project-chip/matter.js-general package contains those portions of matter.js that are not Matter specific.

The new @project-chip/matter.js-model package contains the Matter object model.

Since I was moving stuff around I got rid of the Uint8Array monkey patches we did in ByteArray.  For the most part this just consisted of replacing the "ByteArray" type with "Uint8Array".  The methods we injected I moved to a "Bytes" namespace containing utility functions.  This is a breaking change.

Following new conventions, the new packages don't have "matter.js" in their names, so they're just in "packages/general" and "packages/model".  I also renamed packages/matter.js-tools to packages/tools.  I did not rename the other directories yet.

I updated codegen and the intermediate model package dependencies, so codegen errors do not prevent codegen from running except for the generated model files in @project-chip/matter.js-model.

The new packages are smaller so I moved to a flat namespace for exports.  So there are no subpaths exported from the "general" package, even though most of the exports were previously exported as subpaths of matter.js.  I think this improves readability and makes consumption simpler.

"model" also has a flat namespace but this was true of the previous "@project-chip/matter.js/model" module so this isn't as big of a change.

I did my best to add exports to matter.js to support backward compatibility.  However I used a little editorial control to select which exports to reproduce at the old location...  I made sure to cover all of those we used previously in the examples.  Many of the other exports were probably not ever used externally.  Shouldn't be a big deal if I got it wrong; we can add additional exports or just inform users of the new locations.

Fixes project-chip#156
lauckhart added a commit to lauckhart/matter.js that referenced this issue Sep 9, 2024
This is a partial pass deconstructing the matter.js package.  I tried to stick to decisions we'd previously agreed to.

The new @project-chip/matter.js-general package contains those portions of matter.js that are not Matter specific.

The new @project-chip/matter.js-model package contains the Matter object model.

Since I was moving stuff around I got rid of the Uint8Array monkey patches we did in ByteArray.  For the most part this just consisted of replacing the "ByteArray" type with "Uint8Array".  The methods we injected I moved to a "Bytes" namespace containing utility functions.  This is a breaking change.

Following new conventions, the new packages don't have "matter.js" in their names, so they're just in "packages/general" and "packages/model".  I also renamed packages/matter.js-tools to packages/tools.  I did not rename the other directories yet.

I updated codegen and the intermediate model package dependencies, so codegen errors do not prevent codegen from running except for the generated model files in @project-chip/matter.js-model.

The new packages are smaller so I moved to a flat namespace for exports.  So there are no subpaths exported from the "general" package, even though most of the exports were previously exported as subpaths of matter.js.  I think this improves readability and makes consumption simpler.

"model" also has a flat namespace but this was true of the previous "@project-chip/matter.js/model" module so this isn't as big of a change.

I did my best to add exports to matter.js to support backward compatibility.  However I used a little editorial control to select which exports to reproduce at the old location...  I made sure to cover all of those we used previously in the examples.  Many of the other exports were probably not ever used externally.  Shouldn't be a big deal if I got it wrong; we can add additional exports or just inform users of the new locations.

Fixes project-chip#156
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants