@ems-press/content-api-types
Advanced tools
Comparing version 1.0.0-alpha.15 to 1.0.0-alpha.16
@@ -0,1 +1,2 @@ | ||
import { OptionalProperty } from './util'; | ||
export declare type DateFilter<N extends string> = { | ||
@@ -7,1 +8,6 @@ [k in `${N}${'Before' | 'After'}`]?: Date; | ||
}; | ||
export declare type IsInFilter<Attributes, K extends Extract<keyof Attributes, string>> = { | ||
[k in K]?: Exclude<Attributes[k], undefined>[]; | ||
} & { | ||
[k in OptionalProperty<Pick<Attributes, K>> as `${k}Empty`]?: true; | ||
}; |
@@ -5,2 +5,2 @@ export { Field, Fields } from './fields'; | ||
export * as Resources from './resources/index'; | ||
export { Sort } from './sort'; | ||
export { SortOption } from './sort'; |
@@ -0,1 +1,2 @@ | ||
import { SortOption } from '../sort'; | ||
import * as PersonGroups from './person-groups'; | ||
@@ -18,2 +19,6 @@ import * as Serials from './serials'; | ||
}[T]; | ||
export declare type SortOptionForType<T extends Type> = { | ||
'person-groups': SortOption<PersonGroups.SortField>; | ||
serials: SortOption<Serials.SortField>; | ||
}[T]; | ||
export declare type FilterForType<T extends Type> = { | ||
@@ -29,1 +34,10 @@ 'person-groups': PersonGroups.Filter; | ||
}; | ||
export declare const filterKeys: { | ||
[T in Type]: (keyof FilterForType<T>)[]; | ||
}; | ||
export declare const sortFields: { | ||
[T in Type]: SortFieldForType<T>[]; | ||
}; | ||
export declare const sortOptions: { | ||
[T in Type]: SortOptionForType<T>[]; | ||
}; |
@@ -22,3 +22,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.relationshipKeys = exports.attributeKeys = exports.Serials = exports.PersonGroups = exports.types = void 0; | ||
exports.sortOptions = exports.sortFields = exports.filterKeys = exports.relationshipKeys = exports.attributeKeys = exports.Serials = exports.PersonGroups = exports.types = void 0; | ||
const PersonGroups = __importStar(require("./person-groups")); | ||
@@ -28,3 +28,3 @@ exports.PersonGroups = PersonGroups; | ||
exports.Serials = Serials; | ||
exports.types = ['person-groups', 'serials']; | ||
exports.types = ["person-groups", "serials"]; | ||
exports.attributeKeys = { | ||
@@ -38,3 +38,14 @@ 'person-groups': ["groupType", "name"], | ||
}; | ||
// TODO: sortables and filters | ||
exports.filterKeys = { | ||
'person-groups': ["groupType"], | ||
serials: ["createdBefore", "updatedBefore", "createdAfter", "updatedAfter", "serialType", "s2oStatus", "s2oStatusEmpty", "code"], | ||
}; | ||
exports.sortFields = { | ||
'person-groups': [], | ||
serials: ["code", "createdAt", "updatedAt", "name"], | ||
}; | ||
exports.sortOptions = { | ||
'person-groups': [], | ||
serials: ["code", "createdAt", "updatedAt", "name", "-code", "-createdAt", "-updatedAt", "-name"], | ||
}; | ||
//# sourceMappingURL=index.js.map |
import { EqualFilter } from '../filter'; | ||
import { Serials } from './index'; | ||
export declare type PersonGroupType = 'authors' | 'editors' | 'translators'; | ||
export declare const personGroupTypes: PersonGroupType[]; | ||
export declare type Type = 'person-groups'; | ||
@@ -5,0 +6,0 @@ export declare type Attributes = { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.personGroupTypes = void 0; | ||
exports.personGroupTypes = ["authors", "editors", "translators"]; | ||
//# sourceMappingURL=person-groups.js.map |
import { PersonGroups } from './index'; | ||
import { DateFilter, EqualFilter } from '../filter'; | ||
import { Sort } from '../sort'; | ||
import { DateFilter, EqualFilter, IsInFilter } from '../filter'; | ||
export declare type SerialType = 'journal' | 'magazine' | 'serial'; | ||
export declare const serialTypes: SerialType[]; | ||
export declare type SerialPublishingModel = 'diamond' | 's2o' | 'subscription'; | ||
export declare const serialPublishingModels: SerialPublishingModel[]; | ||
export declare type S2oStatus = 'open-access' | 'subscription'; | ||
export declare const s2oStatuses: S2oStatus[]; | ||
export declare type Type = 'serials'; | ||
@@ -48,3 +50,3 @@ export declare type Attributes = { | ||
}; | ||
export declare type SortField = Sort<Attributes, 'createdAt' | 'updatedAt'>; | ||
export declare type Filter = DateFilter<'created' | 'updated'> & EqualFilter<Attributes, 'serialType' | 's2oStatus'>; | ||
export declare type SortField = 'createdAt' | 'updatedAt' | 'code' | 'name'; | ||
export declare type Filter = DateFilter<'created' | 'updated'> & IsInFilter<Attributes, 'serialType' | 's2oStatus'> & EqualFilter<Attributes, 'code'>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.s2oStatuses = exports.serialPublishingModels = exports.serialTypes = void 0; | ||
exports.serialTypes = ["journal", "magazine", "serial"]; | ||
exports.serialPublishingModels = ["diamond", "s2o", "subscription"]; | ||
exports.s2oStatuses = ["subscription", "open-access"]; | ||
//# sourceMappingURL=serials.js.map |
@@ -1,1 +0,1 @@ | ||
export declare type Sort<Attributes, K extends keyof Attributes> = K extends string ? K | `-${K}` : never; | ||
export declare type SortOption<K extends string> = K | `-${K}`; |
{ | ||
"name": "@ems-press/content-api-types", | ||
"version": "1.0.0-alpha.15", | ||
"version": "1.0.0-alpha.16", | ||
"description": "Typescript types for the EMS Press Content API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49690
31
249