@studyportals/domain-client
Advanced tools
Comparing version 3.3.0-beta.4 to 3.3.0
{ | ||
"name": "@studyportals/domain-client", | ||
"version": "3.3.0-beta.4", | ||
"version": "3.3.0", | ||
"description": "Responsible for fetching data from the Domain API", | ||
@@ -5,0 +5,0 @@ "main": "bin/index.js", |
import { IClassFactory } from "../i-class-factory"; | ||
import { Model } from "../types"; | ||
import { CallableReturnType, Model } from "../types"; | ||
import { PortalMap } from "../types/portal-map"; | ||
@@ -7,4 +7,4 @@ export declare class InternalLinkFactory implements IClassFactory { | ||
constructor(portalMap: PortalMap); | ||
create(link: Model): Model; | ||
create(link: Model): CallableReturnType; | ||
private getPortalBaseUrl; | ||
} |
@@ -1,4 +0,4 @@ | ||
import { Model } from "./types"; | ||
import { CallableReturnType, Model } from "./types"; | ||
export interface IClassFactory { | ||
create(data: Model): Model; | ||
create(data: Model, parameters?: any[]): CallableReturnType; | ||
} |
@@ -5,3 +5,4 @@ import { AcceptedType } from "./types"; | ||
func: Record<string, AcceptedType | IModelDescription>; | ||
parameters?: any[]; | ||
} | ||
export declare function isModelDescription(arg: any): arg is IModelDescription; |
@@ -7,5 +7,5 @@ "use strict"; | ||
// eslint-disable-next-line | ||
return arg && arg.class && arg.func; | ||
return arg && arg.class && (arg.func || arg.parameters); | ||
} | ||
exports.isModelDescription = isModelDescription; | ||
//# sourceMappingURL=i-model-description.js.map |
@@ -10,2 +10,3 @@ import { IModelDescription } from "./i-model-description"; | ||
private getCallable; | ||
private unpackArray; | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const InternalLinkFactory_1 = require("./factories/InternalLinkFactory"); | ||
const DateFactory_1 = require("./factories/DateFactory"); | ||
const i_model_description_1 = require("./i-model-description"); | ||
@@ -12,2 +13,3 @@ const property_not_available_exception_1 = require("./exceptions/property-not-available-exception"); | ||
factories.set('IInternalLink', new InternalLinkFactory_1.InternalLinkFactory(portalMap)); | ||
factories.set('SerializableDateTime', new DateFactory_1.DateFactory()); | ||
this.customClassFactories = factories; | ||
@@ -32,3 +34,3 @@ } | ||
if (factory !== undefined) { | ||
return factory.create(unpacked); | ||
return factory.create(unpacked, data.parameters); | ||
} | ||
@@ -45,2 +47,5 @@ return unpacked; | ||
} | ||
else if (Array.isArray(value)) { | ||
returnValue = this.unpackArray(value); | ||
} | ||
else { | ||
@@ -61,4 +66,12 @@ returnValue = value; | ||
} | ||
unpackArray(list) { | ||
return list.map(item => { | ||
if (i_model_description_1.isModelDescription(item)) { | ||
return this.unpackClass(item); | ||
} | ||
return item; | ||
}); | ||
} | ||
} | ||
exports.ModelFactory = ModelFactory; | ||
//# sourceMappingURL=model-factory.js.map |
@@ -22,3 +22,3 @@ import { IDeadline } from "../../.."; | ||
/** | ||
* True if you can apply at any time for this programme (rolling admission) | ||
* True if you can apply at any time for this programme (rolling admission | ||
* | ||
@@ -25,0 +25,0 @@ * @return boolean |
export declare type Model = Record<string, Callable>; | ||
export declare type Callable = () => CallableReturnType; | ||
export declare type Callable = () => CallableReturnType | CallableReturnType[]; | ||
export declare type CallableReturnType = AcceptedType | Model; | ||
export declare type AcceptedType = string | string[] | number | number[] | boolean | null; | ||
export declare type AcceptedType = string | string[] | number | number[] | boolean | null | Date; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
62698
127
1414
1