This repository was archived by the owner on Feb 26, 2026. It is now read-only.
Extract PLC directory functions into plc.ts#39
Merged
johnbillion merged 2 commits intotrunkfrom Jan 10, 2026
Merged
Conversation
Move all functions that call createPlcClient into a new plc.ts file: - createPlcClient() and PLC_DIRECTORY_URL constant - submitDID(), updateDID(), and all DID update functions - getFairAlias() and related error classes (NoAliasError, MultipleAliasesError) The operation builder functions (updateServiceUrlInOp, addVerificationKeyToOp, etc.) remain in did.ts as they are pure functions that don't interact with the network. All moved functions are re-exported from did.ts and domain.ts for backward compatibility, ensuring no breaking changes for existing code.
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request extracts PLC directory client functions from did.ts and domain.ts into a new dedicated plc.ts file to improve code organization. The refactoring separates network-related functions (those that interact with the PLC directory) from pure data transformation functions.
Changes:
- Created new
plc.tsfile containing PLC client functions, DID update operations, and alias management - Retained pure operation builder functions in
did.tsfor local data manipulation - Maintained backward compatibility through re-exports in both
did.tsanddomain.ts
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/plc.ts | New file containing PLC directory client, all network-based DID update functions, and getFairAlias functionality with error classes |
| src/did.ts | Removed network functions, kept pure operation builders, added re-exports for backward compatibility, imports submitDID from plc.ts |
| src/domain.ts | Removed getFairAlias and error classes, re-exports them from plc.ts for backward compatibility |
| src/verify.ts | Updated imports to reference plc.ts for PLC_DIRECTORY_URL and createPlcClient |
| src/plc-log.ts | Updated import to reference plc.ts for PLC_DIRECTORY_URL |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Move all functions that call createPlcClient into a new plc.ts file:
The operation builder functions (updateServiceUrlInOp, addVerificationKeyToOp, etc.)
remain in did.ts as they are pure functions that don't interact with the network.
All moved functions are re-exported from did.ts and domain.ts for backward
compatibility, ensuring no breaking changes for existing code.