Skip to content

Commit

Permalink
feat: add CustomIdCodec getters for separators and namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Amgelo563 committed Jan 26, 2024
1 parent e72117c commit a5edab0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/core/src/customId/CustomIdCodec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* MIT License
*
* Copyright (c) 2023 Amgelo563
* Copyright (c) 2024 Amgelo563
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -39,4 +39,13 @@ export interface CustomIdCodec<Serialized extends Identifiable<string>> {

/** Creates a {@link StringIterator} from a customId, leaving only the data that is not related to the referred object. */
createIteratorFromCustomId(customId: string): StringIterator | null;

/** Returns the separator used to separate the data in the customId. */
getSeparator(): string;

/** Returns the separator used to separate protected data in the customId. */
getDataSeparator(): string;

/** Returns the namespace used to identify the customId. */
getNamespace(): string;
}
12 changes: 12 additions & 0 deletions packages/framework/src/customId/BasicCustomIdCodec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,16 @@ export class BasicCustomIdCodec<Serialized extends Identifiable<string>>

return builder ? builder.getObjectId() : null;
}

public getNamespace(): string {
return this.namespace;
}

public getSeparator(): string {
return this.separator;
}

public getDataSeparator(): string {
return this.dataSeparator;
}
}

0 comments on commit a5edab0

Please sign in to comment.