Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add skos and jsonld utils #22

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions built-types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { getHerokuReleaseInfo } from "./herokuUtils";
import { Lenses } from "./lenses";
import { recursivelyRemoveAtSigns } from "./openActiveUtils";
import { recursivelySetAtSigns } from "./openActiveUtils";
import { httpFetchJsonld } from "./jsonLdUtils";
import { getConceptSchemeFromFilePath } from "./skosUtils";
import { getConceptSchemeFromUrl } from "./skosUtils";
export declare namespace expressUtils {
export { validateReq };
export { validateReqQuery };
Expand All @@ -19,4 +22,11 @@ export declare namespace openActiveUtils {
export { recursivelyRemoveAtSigns };
export { recursivelySetAtSigns };
}
export declare namespace jsonLdUtils {
export { httpFetchJsonld };
}
export declare namespace skosUtils {
export { getConceptSchemeFromFilePath };
export { getConceptSchemeFromUrl };
}
export { logger, kongSecretMiddleware, postgres, syncDbMigrations, Lenses };
4 changes: 4 additions & 0 deletions built-types/jsonLdUtils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* @param {string} url
*/
export function httpFetchJsonld(url: string): Promise<any>;
1 change: 1 addition & 0 deletions built-types/lenses.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export namespace Lenses {
let aggregateOffer: R.Lens<TOpportunity, any>;
let remainingCapacity: import('ramda').Lens<TOpportunity, number>;
let maxCapacity: import('ramda').Lens<TOpportunity, number>;
let iminTag: import('ramda').Lens<TOpportunity, Array<string>>;
namespace util {
let throwErrorIfUsed: import('ramda').Lens<any, any>;
}
Expand Down
10 changes: 10 additions & 0 deletions built-types/skosUtils.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @param {string} url
* @returns {Promise<import('./types/skos').ConceptScheme>}
*/
export function getConceptSchemeFromUrl(url: string): Promise<import('./types/skos').ConceptScheme>;
/**
* @param {string} jsonLdFilePath
* @returns {Promise<import('./types/skos').ConceptScheme>}
*/
export function getConceptSchemeFromFilePath(jsonLdFilePath: string): Promise<import('./types/skos').ConceptScheme>;
34 changes: 34 additions & 0 deletions built-types/types/skos.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// We should give this to OpenActive when finished.

export class Concept {
constructor();
id: string;
prefLabel: string;
type?: string;
activity?: string[];
getNarrower: () => Concept[];
getNarrowerTransitive: () => Concept[];
getBroader: () => Concept[];
getBroaderTransitive: () => Concept[];
getRelated: () => Concept[];
equals: (concept: Concept) => Boolean;
toString: () => string;
getJSON: () => Object;
static compare: (a: Concept, b: Concept) => Number;
}
export class ConceptScheme {
constructor(
scheme: Object | Array<Object>,
id?: string,
filter?: Object | Array<Object>
);
getConceptByID: (id: string) => Concept | null;
getConceptByLabel: (label: string) => Concept | null;
getAllConcepts: () => Concept[];
getAllConceptsByID: () => Concept[];
getAllConceptsByLabel: () => Concept[];
getTopConcepts: () => Concept[];
getJSON: () => Object;
toString: () => string;
generateSubset: (filter: Object | Array<Object>) => ConceptScheme;
}
Loading