parent
90d70c05ea
commit
fed926ff15
@ -1 +1,36 @@ |
|||||||
export class Resource {}; |
import type { AbsentContainer } from "../concrete/AbsentContainer"; |
||||||
|
import type { AbsentLeaf } from "../concrete/AbsentLeaf"; |
||||||
|
import type { BinaryLeaf } from "../concrete/BinaryLeaf"; |
||||||
|
import type { BranchContainer } from "../concrete/BranchContainer"; |
||||||
|
import type { DataLeaf } from "../concrete/DataLeaf"; |
||||||
|
import type { RootContainer } from "../concrete/RootContainer"; |
||||||
|
import type { UnfetchedLeaf } from "../concrete/UnfetchedLeaf"; |
||||||
|
import type { UnfetchedContainer } from "../concrete/UnfetchedContainer"; |
||||||
|
import type { SolidLdoError } from "../error/SolidLdoError"; |
||||||
|
import type { FetchedClass } from "./fetchStatus/Fetched"; |
||||||
|
import type { AbsentClass } from "./fetchStatus/Absent"; |
||||||
|
import type { PresentClass } from "./fetchStatus/Present"; |
||||||
|
|
||||||
|
export type ResourceClass = |
||||||
|
| RootContainer |
||||||
|
| BranchContainer |
||||||
|
| DataLeaf |
||||||
|
| BinaryLeaf |
||||||
|
| AbsentContainer |
||||||
|
| AbsentLeaf |
||||||
|
| UnfetchedContainer |
||||||
|
| UnfetchedLeaf; |
||||||
|
export abstract class Resource { |
||||||
|
readonly uri: string; |
||||||
|
readonly lastUpdated: Date; |
||||||
|
|
||||||
|
abstract read(): Promise<FetchedClass | SolidLdoError>; |
||||||
|
abstract readIfUnfetched(): Promise<FetchedClass | SolidLdoError>; |
||||||
|
|
||||||
|
abstract createIfAbsent(): Promise<PresentClass | SolidLdoError>; |
||||||
|
abstract createOrOverride(): Promise<PresentClass | SolidLdoError>; |
||||||
|
|
||||||
|
abstract deleteIfPresent(): Promise<AbsentClass | SolidLdoError>; |
||||||
|
|
||||||
|
abstract getCurrent(): ResourceClass; |
||||||
|
} |
||||||
|
@ -1,3 +1,13 @@ |
|||||||
|
import { SolidLdoError } from "../../error/SolidLdoError"; |
||||||
import { PotentialDataResource } from "../dataResource/potentialDataResource"; |
import { PotentialDataResource } from "../dataResource/potentialDataResource"; |
||||||
|
|
||||||
export class Container extends PotentialDataResource {} |
export class Container extends PotentialDataResource { |
||||||
|
async read(): Promise<FetchedLeafClass | SolidLdoError> { |
||||||
|
// Make query
|
||||||
|
// Select the Kind of Leaf
|
||||||
|
// Create it
|
||||||
|
|
||||||
|
// Post Processing
|
||||||
|
throw new Error("Not Implemented"); |
||||||
|
} |
||||||
|
} |
||||||
|
@ -0,0 +1,9 @@ |
|||||||
|
import { Mixin } from "ts-mixer"; |
||||||
|
import type { BranchContainer } from "../../concrete/BranchContainer"; |
||||||
|
import type { RootContainer } from "../../concrete/RootContainer"; |
||||||
|
import { DataResource } from "../dataResource/DataResource"; |
||||||
|
import { Container } from "./Container"; |
||||||
|
import { Present } from "../fetchStatus/Present"; |
||||||
|
|
||||||
|
export type PresentContainerClass = RootContainer | BranchContainer; |
||||||
|
export class PresentContainer extends Mixin(Container, Present, DataResource) {} |
@ -1,13 +1,17 @@ |
|||||||
import type { AbsentContainer } from "../../concrete/AbsentContainer"; |
import type { AbsentContainer } from "../../concrete/AbsentContainer"; |
||||||
import type { AbsentLeaf } from "../../concrete/AbsentLeaf"; |
import type { AbsentLeaf } from "../../concrete/AbsentLeaf"; |
||||||
|
import type { SolidLdoError } from "../../error/SolidLdoError"; |
||||||
import { Fetched } from "./Fetched"; |
import { Fetched } from "./Fetched"; |
||||||
|
import type { PresentClass } from "./Present"; |
||||||
|
|
||||||
export type AbsentClass = AbsentContainer | AbsentLeaf; |
export type AbsentClass = AbsentContainer | AbsentLeaf; |
||||||
export class Absent extends Fetched { |
export abstract class Absent extends Fetched { |
||||||
public get isAbsent(): true { |
public get isAbsent(): true { |
||||||
return true; |
return true; |
||||||
} |
} |
||||||
public get isPresent(): false { |
public get isPresent(): false { |
||||||
return false; |
return false; |
||||||
} |
} |
||||||
|
|
||||||
|
abstract create(...args: unknown[]): Promise<PresentClass | SolidLdoError>; |
||||||
} |
} |
||||||
|
@ -0,0 +1,9 @@ |
|||||||
|
import { Mixin } from "ts-mixer"; |
||||||
|
import { Leaf } from "./Leaf"; |
||||||
|
import { Fetched } from "../fetchStatus/Fetched"; |
||||||
|
import type { DataLeaf } from "../../concrete/DataLeaf"; |
||||||
|
import type { BinaryLeaf } from "../../concrete/BinaryLeaf"; |
||||||
|
import type { AbsentLeaf } from "../../concrete/AbsentLeaf"; |
||||||
|
|
||||||
|
export type FetchedLeafClass = DataLeaf | BinaryLeaf | AbsentLeaf; |
||||||
|
export abstract class FetchedLeaf extends Mixin(Leaf, Fetched) {} |
@ -1,9 +0,0 @@ |
|||||||
import { Mixin } from "ts-mixer"; |
|
||||||
import type { AbsentLeaf } from "../../concrete/AbsentLeaf"; |
|
||||||
import type { DataLeaf } from "../../concrete/DataLeaf"; |
|
||||||
import type { UnfetchedLeaf } from "../../concrete/UnfetchedLeaf"; |
|
||||||
import { PotentialDataResource } from "../dataResource/potentialDataResource"; |
|
||||||
import { Leaf } from "./Leaf"; |
|
||||||
|
|
||||||
export type PotentialDataLeafClass = DataLeaf | AbsentLeaf | UnfetchedLeaf; |
|
||||||
export class PotentialDataLeaf extends Mixin(Leaf, PotentialDataResource) {} |
|
@ -1,8 +1,8 @@ |
|||||||
import { Mixin } from "ts-mixer"; |
import { Mixin } from "ts-mixer"; |
||||||
import { Leaf } from "./Leaf"; |
import { FetchedLeaf } from "./FetchedLeaf"; |
||||||
import { Present } from "../fetchStatus/Present"; |
import { Present } from "../fetchStatus/Present"; |
||||||
import type { DataLeaf } from "../../concrete/DataLeaf"; |
import type { DataLeaf } from "../../concrete/DataLeaf"; |
||||||
import type { BinaryLeaf } from "../../concrete/BinaryLeaf"; |
import type { BinaryLeaf } from "../../concrete/BinaryLeaf"; |
||||||
|
|
||||||
export type PresentLeafClass = DataLeaf | BinaryLeaf; |
export type PresentLeafClass = DataLeaf | BinaryLeaf; |
||||||
export class PresentLeaf extends Mixin(Leaf, Present) {} |
export abstract class PresentLeaf extends Mixin(FetchedLeaf, Present) {} |
||||||
|
@ -1,5 +1,21 @@ |
|||||||
import { Mixin } from "ts-mixer"; |
import { Mixin } from "ts-mixer"; |
||||||
import { Absent } from "../abstract/fetchStatus/Absent"; |
import { Absent, AbsentClass } from "../abstract/fetchStatus/Absent"; |
||||||
import { PotentialBinaryLeaf } from "../abstract/leaf/PotentialBinaryLeaf"; |
import { FetchedLeaf, FetchedLeafClass } from "../abstract/leaf/FetchedLeaf"; |
||||||
|
import { FetchedClass } from "../abstract/fetchStatus/Fetched"; |
||||||
|
import { PresentClass } from "../abstract/fetchStatus/Present"; |
||||||
|
import { SolidLdoError } from "../error/SolidLdoError"; |
||||||
|
|
||||||
export class AbsentLeaf extends Mixin(Absent, PotentialBinaryLeaf) {} |
export class AbsentLeaf extends Mixin(Absent, FetchedLeaf) { |
||||||
|
create(...args: unknown[]): Promise<PresentClass | SolidLdoError> { |
||||||
|
throw new Error("Method not implemented."); |
||||||
|
} |
||||||
|
read(): Promise<SolidLdoError | FetchedLeafClass> { |
||||||
|
throw new Error("Method not implemented."); |
||||||
|
} |
||||||
|
createOrOverride(): Promise<PresentClass | SolidLdoError> { |
||||||
|
throw new Error("Method not implemented."); |
||||||
|
} |
||||||
|
deleteIfPresent(): Promise<SolidLdoError | AbsentClass> { |
||||||
|
throw new Error("Method not implemented."); |
||||||
|
} |
||||||
|
} |
||||||
|
@ -1 +1,3 @@ |
|||||||
export class BranchContainer {} |
import { PresentContainer } from "../abstract/container/PresentContainer"; |
||||||
|
|
||||||
|
export class BranchContainer extends PresentContainer {} |
||||||
|
@ -0,0 +1 @@ |
|||||||
|
export class SolidLdoError extends Error {} |
Loading…
Reference in new issue