Skip to content

Commit

Permalink
Merge pull request #105 from MauroDataMapper/feature/mdm-core-gh-406
Browse files Browse the repository at this point in the history
Updates to path endpoints:
  • Loading branch information
joe-crawford authored Apr 24, 2023
2 parents 9065d69 + f2a550c commit d7bbc40
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 9 deletions.
17 changes: 14 additions & 3 deletions src/core/mdm-catalogue-item.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
MdmIndexResponse,
MdmResponse,
Payload,
QueryParameters,
Uuid
} from '../mdm-common.model';

Expand Down Expand Up @@ -153,6 +154,17 @@ export type PathableDomainType =
| 'versionedFolders'
| 'versionLinks';

/**
* Query parameters for the Path endpoints.
*/
export interface PathQueryParameters extends QueryParameters {
/**
* If true, only locate the latest finalised version of models, unless a specific version identitifer is
* used in the path.
*/
finalised?: boolean;
}

export type RuleDomainType =
| 'codeSets'
| 'dataClasses'
Expand Down Expand Up @@ -200,6 +212,5 @@ export interface RuleRepresentation
export type RuleResponse = MdmResponse<Rule>;
export type RuleIndexResponse = MdmIndexResponse<Rule>;
export type RuleRepresentationResponse = MdmResponse<RuleRepresentation>;
export type RuleRepresentationIndexResponse = MdmIndexResponse<
RuleRepresentation
>;
export type RuleRepresentationIndexResponse =
MdmIndexResponse<RuleRepresentation>;
11 changes: 9 additions & 2 deletions src/core/mdm-catalogue-item.resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
AnnotationChildCreatePayload,
AnnotationCreatePayload,
PathableDomainType,
PathQueryParameters,
ReferenceFile,
ReferenceFileCreatePayload,
RuleDomainType,
Expand Down Expand Up @@ -819,11 +820,17 @@ export class MdmCatalogueItemResource extends MdmResource {
* getPath('codeSets', 'cs:My Code Set')
* getPath('folders', 'fo:My Folder')
* ```
*
* You can also request only latest finalised models are located too by passing the parameter:
*
* ```ts
* getPath('dataModels', `dm:My Data Model', { finalised: true })
* ```
*/
getPath(
domainType: PathableDomainType,
path: string,
query?: QueryParameters,
query?: PathQueryParameters,
options?: RequestSettings
) {
const encodedPath = encodeURIComponent(path);
Expand Down Expand Up @@ -855,7 +862,7 @@ export class MdmCatalogueItemResource extends MdmResource {
domainType: PathableDomainType,
id: Uuid,
path: string,
query?: QueryParameters,
query?: PathQueryParameters,
options?: RequestSettings
) {
const encodedPath = encodeURIComponent(path);
Expand Down
14 changes: 10 additions & 4 deletions src/mdm-common.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,13 @@ export interface CatalogueItem {
domainType: CatalogueItemDomainType;
}

export interface Pathable {
/**
* A read-only path generated by Mauro representing the location of this item in the catalogue.
*/
path: string;
}

export interface CatalogueItemDetail extends Required<CatalogueItem> {
[key: string]: any;
label: string;
Expand Down Expand Up @@ -553,9 +560,8 @@ export interface CatalogueItemSearchResult extends CatalogueItem {
breadcrumbs: Breadcrumb[];
}

export type CatalogueItemSearchResponse = MdmIndexResponse<
CatalogueItemSearchResult
>;
export type CatalogueItemSearchResponse =
MdmIndexResponse<CatalogueItemSearchResult>;

/**
* Set of parameters to define if an operation should be handled asynchronously.
Expand All @@ -571,4 +577,4 @@ export interface AsyncParameters {
* other requests.
*/
asynchronous?: boolean;
}
}

0 comments on commit d7bbc40

Please sign in to comment.