parent
fed926ff15
commit
0fa45f82de
@ -0,0 +1,195 @@ |
||||
const resourceMethods: Record<string, string[]> = { |
||||
RootContainerResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"ldoDataset", |
||||
"getIsRootContainer", |
||||
"createContainerIn", |
||||
"createDataResourceIn", |
||||
"uploadBinaryIn", |
||||
"createOrOverwrite", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"clear", |
||||
"clearIfPresent", |
||||
], |
||||
ContainerResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getIsRootContainer", |
||||
"getParentContainer", |
||||
"childResources", |
||||
"getRootContainer", |
||||
"createContainerIn", |
||||
"createDataResourceIn", |
||||
"uploadBinaryIn", |
||||
"ldoDataset", |
||||
"createOrOverwrite", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"delete", |
||||
"deleteIfPresent", |
||||
"clear", |
||||
"clearIfPresent", |
||||
], |
||||
ChildDataResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getParentContainer", |
||||
"hasData", |
||||
"ldoDataset", |
||||
"getRootContainer", |
||||
"createOrOverwrite", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"delete", |
||||
"deleteIfPresent", |
||||
], |
||||
BinaryResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"mimeType", |
||||
"fileExtension", |
||||
"getRootContainer", |
||||
"getParentContainer", |
||||
"uploadOrOverwrite", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"delete", |
||||
"deleteIfPresent", |
||||
], |
||||
AbsentContainerResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getIsRootContainer", |
||||
"getParentContainer", |
||||
"getRootContainer", |
||||
"createContainerIn", |
||||
"createDataResourceIn", |
||||
"uploadBinaryIn", |
||||
"createOrOverwrite", |
||||
"create", |
||||
"createIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"deleteIfPresent", |
||||
"clearIfPresent", |
||||
], |
||||
AbsentChildDataResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getParentContainer", |
||||
"getRootContainer", |
||||
"createOrOverwrite", |
||||
"create", |
||||
"createIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"deleteIfPresent", |
||||
], |
||||
AbsentBinaryResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getParentContainer", |
||||
"getRootContainer", |
||||
"uploadOrOverwrite", |
||||
"upload", |
||||
"uploadIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"deleteIfPresent", |
||||
], |
||||
UnfetchedContainerResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"getIsRootContainer", |
||||
"getParentContainer", |
||||
"getRootContainer", |
||||
"createContainerIn", |
||||
"createDataResourceIn", |
||||
"uploadBinaryIn", |
||||
"createOrOverwrite", |
||||
"createIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"clearIfPresent", |
||||
], |
||||
UnfetchedChildDataResource: [ |
||||
"parentContainer", |
||||
"getParentContainer", |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"getRootContainer", |
||||
"createOrOverwrite", |
||||
"createIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"deleteIfPresent", |
||||
], |
||||
UnfetchedBinaryResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getParentContainer", |
||||
"getRootContainer", |
||||
"uploadOrOverwrite", |
||||
"createOrOverwrite", |
||||
"uploadIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"deleteIfPresent", |
||||
], |
||||
}; |
||||
|
||||
function processTypes() { |
||||
const usedKeys = new Set(); |
||||
const interfaces = Object.keys(resourceMethods); |
||||
const groupMap: Record<string, string[]> = {}; |
||||
|
||||
interfaces.forEach((interfaceName) => { |
||||
resourceMethods[interfaceName].forEach((methodKey) => { |
||||
if (!usedKeys.has(methodKey)) { |
||||
usedKeys.add(methodKey); |
||||
|
||||
let groupName = ""; |
||||
interfaces.forEach((interfaceName) => { |
||||
if (resourceMethods[interfaceName].includes(methodKey)) { |
||||
groupName += `${interfaceName}|`; |
||||
} |
||||
}); |
||||
if (!groupMap[groupName]) { |
||||
groupMap[groupName] = []; |
||||
} |
||||
groupMap[groupName].push(methodKey); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
console.log(groupMap); |
||||
} |
||||
processTypes(); |
@ -1,195 +1,22 @@ |
||||
const resourceMethods: Record<string, string[]> = { |
||||
RootContainerResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"ldoDataset", |
||||
"getIsRootContainer", |
||||
"createContainerIn", |
||||
"createDataResourceIn", |
||||
"uploadBinaryIn", |
||||
"createOrOverwrite", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"clear", |
||||
"clearIfPresent", |
||||
], |
||||
ContainerResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getIsRootContainer", |
||||
"getParentContainer", |
||||
"childResources", |
||||
"getRootContainer", |
||||
"createContainerIn", |
||||
"createDataResourceIn", |
||||
"uploadBinaryIn", |
||||
"ldoDataset", |
||||
"createOrOverwrite", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"delete", |
||||
"deleteIfPresent", |
||||
"clear", |
||||
"clearIfPresent", |
||||
], |
||||
ChildDataResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getParentContainer", |
||||
"hasData", |
||||
"ldoDataset", |
||||
"getRootContainer", |
||||
"createOrOverwrite", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"delete", |
||||
"deleteIfPresent", |
||||
], |
||||
BinaryResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"mimeType", |
||||
"fileExtension", |
||||
"getRootContainer", |
||||
"getParentContainer", |
||||
"uploadOrOverwrite", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"delete", |
||||
"deleteIfPresent", |
||||
], |
||||
AbsentContainerResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getIsRootContainer", |
||||
"getParentContainer", |
||||
"getRootContainer", |
||||
"createContainerIn", |
||||
"createDataResourceIn", |
||||
"uploadBinaryIn", |
||||
"createOrOverwrite", |
||||
"create", |
||||
"createIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"deleteIfPresent", |
||||
"clearIfPresent", |
||||
], |
||||
AbsentChildDataResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getParentContainer", |
||||
"getRootContainer", |
||||
"createOrOverwrite", |
||||
"create", |
||||
"createIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"deleteIfPresent", |
||||
], |
||||
AbsentBinaryResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getParentContainer", |
||||
"getRootContainer", |
||||
"uploadOrOverwrite", |
||||
"upload", |
||||
"uploadIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"deleteIfPresent", |
||||
], |
||||
UnfetchedContainerResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"getIsRootContainer", |
||||
"getParentContainer", |
||||
"getRootContainer", |
||||
"createContainerIn", |
||||
"createDataResourceIn", |
||||
"uploadBinaryIn", |
||||
"createOrOverwrite", |
||||
"createIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"clearIfPresent", |
||||
], |
||||
UnfetchedChildDataResource: [ |
||||
"parentContainer", |
||||
"getParentContainer", |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"getRootContainer", |
||||
"createOrOverwrite", |
||||
"createIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"deleteIfPresent", |
||||
], |
||||
UnfetchedBinaryResource: [ |
||||
"uri", |
||||
"isLoading", |
||||
"didInitialFetch", |
||||
"parentContainer", |
||||
"getParentContainer", |
||||
"getRootContainer", |
||||
"uploadOrOverwrite", |
||||
"createOrOverwrite", |
||||
"uploadIfAbsent", |
||||
"read", |
||||
"reload", |
||||
"load", |
||||
"deleteIfPresent", |
||||
], |
||||
}; |
||||
import { Mixin } from "ts-mixer"; |
||||
|
||||
function processTypes() { |
||||
const usedKeys = new Set(); |
||||
const interfaces = Object.keys(resourceMethods); |
||||
const groupMap: Record<string, string[]> = {}; |
||||
|
||||
interfaces.forEach((interfaceName) => { |
||||
resourceMethods[interfaceName].forEach((methodKey) => { |
||||
if (!usedKeys.has(methodKey)) { |
||||
usedKeys.add(methodKey); |
||||
|
||||
let groupName = ""; |
||||
interfaces.forEach((interfaceName) => { |
||||
if (resourceMethods[interfaceName].includes(methodKey)) { |
||||
groupName += `${interfaceName}|`; |
||||
class Foo { |
||||
protected makeFoo() { |
||||
return "foo"; |
||||
} |
||||
}); |
||||
if (!groupMap[groupName]) { |
||||
groupMap[groupName] = []; |
||||
} |
||||
groupMap[groupName].push(methodKey); |
||||
} |
||||
|
||||
class Bar { |
||||
protected makeFoo() { |
||||
return "bar"; |
||||
} |
||||
}); |
||||
}); |
||||
} |
||||
|
||||
console.log(groupMap); |
||||
class FooBar extends Mixin(Foo, Bar) { |
||||
public makeFooBar() { |
||||
return this.makeFoo() + this.makeFoo(); |
||||
} |
||||
} |
||||
processTypes(); |
||||
|
||||
const fooBar = new FooBar(); |
||||
console.log(fooBar.makeFooBar()); |
||||
|
@ -0,0 +1,9 @@ |
||||
interface loadingStatus; |
||||
|
||||
export class LoadingManager { |
||||
private loadingStatus: Record<string, Array<[key: string, promise: Promise<unknown>]>> |
||||
|
||||
public registerProcess(): void { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,72 @@ |
||||
import type { SolidLdoDatasetContext } from "../SolidLdoDatasetContext"; |
||||
import type { FetchableDocument } from "./FetchableDocument"; |
||||
import type { ResourceClass } from "./resource/abstract/AbstractResource"; |
||||
import type { ContainerClass } from "./resource/abstract/container/Container"; |
||||
import type { LeafClass } from "./resource/abstract/leaf/Leaf"; |
||||
import { UnfetchedContainer } from "./resource/concrete/UnfetchedContainer"; |
||||
import { UnfetchedLeaf } from "./resource/concrete/UnfetchedLeaf"; |
||||
import { ContainerUri, LeafUri, isContainerUri } from "./uriTypes"; |
||||
|
||||
export interface ResourceGetterOptions { |
||||
autoLoad?: boolean; |
||||
} |
||||
|
||||
export class ResourceStore { |
||||
protected resourceMap: Map<string, ResourceClass>; |
||||
protected context: SolidLdoDatasetContext; |
||||
|
||||
constructor(context: SolidLdoDatasetContext) { |
||||
this.documentMap = new Map(); |
||||
this.context = context; |
||||
} |
||||
|
||||
get(uri: ContainerUri, options?: ResourceGetterOptions): ContainerClass; |
||||
get(uri: LeafUri, options?: ResourceGetterOptions): LeafClass; |
||||
get(uri: string, options?: ResourceGetterOptions): ResourceClass; |
||||
get(uri: string, options?: ResourceGetterOptions): ResourceClass { |
||||
// Normalize URI by removing hash
|
||||
const url = new URL(uri); |
||||
url.hash = ""; |
||||
const normalizedUri = url.toString(); |
||||
|
||||
// Get the document and return if exists
|
||||
let resource = this.resourceMap.get(normalizedUri); |
||||
if (!resource) { |
||||
if (isContainerUri(normalizedUri)) { |
||||
resource = new UnfetchedContainer(); |
||||
} else { |
||||
resource = new UnfetchedLeaf(); |
||||
} |
||||
this.resourceMap.set(normalizedUri, resource); |
||||
} |
||||
|
||||
if (options?.autoLoad) { |
||||
resource.read(); |
||||
} |
||||
|
||||
return resource; |
||||
|
||||
|
||||
throw new Error("Not Implemented"); |
||||
// const initializer = this.normalizeInitializer(initializerInput);
|
||||
// const document = this.documentMap.get(initializer);
|
||||
// if (document) {
|
||||
// if (options?.autoLoad) {
|
||||
// document.read();
|
||||
// }
|
||||
// return document;
|
||||
// }
|
||||
// const newDocument = this.create(initializer, options);
|
||||
// this.documentMap.set(initializer, newDocument);
|
||||
// return newDocument;
|
||||
} |
||||
} |
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
const resourceStore = new ResourceStore(); |
||||
|
||||
const container = resourceStore.get("https://jackson.com/"); |
||||
const leaf = resourceStore.get("https://jackson.com/item.ttl"); |
||||
const thing: string = "https://jackson.com/"; |
||||
const resource = resourceStore.get(thing); |
@ -1,39 +0,0 @@ |
||||
import type { Absent, FetchedContainer } from "../types"; |
||||
import type { LdoSolidError } from "../types"; |
||||
import { Container } from "./Container"; |
||||
import type { PresentContainerClass } from "./presentContainer/PresentContainer"; |
||||
|
||||
export class AbsentContainer |
||||
extends Container |
||||
implements Absent, FetchedContainer |
||||
{ |
||||
get isBinary(): false { |
||||
return false; |
||||
} |
||||
get isDataResource(): false { |
||||
return false; |
||||
} |
||||
get isPresent(): false { |
||||
return false; |
||||
} |
||||
get isAbsent(): true { |
||||
return true; |
||||
} |
||||
get isUnfetched(): false { |
||||
return false; |
||||
} |
||||
get isRootContainer(): false { |
||||
return false; |
||||
} |
||||
get isBranchContainer(): true { |
||||
return true; |
||||
} |
||||
|
||||
async getIsRootContainer(): Promise<false> { |
||||
return false; |
||||
} |
||||
|
||||
async create(): Promise<PresentContainerClass | LdoSolidError> { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
} |
@ -1,77 +0,0 @@ |
||||
import type { |
||||
FetchedContainerClass, |
||||
LdoSolidError, |
||||
PotentialContainer, |
||||
Resource, |
||||
} from "../types"; |
||||
import type { AbsentContainer } from "./AbsentContainer"; |
||||
import type { UnfetchedContainer } from "./UnfetchedContainer"; |
||||
import type { BranchContainer } from "./presentContainer/BranchContainer"; |
||||
import type { RootContainer } from "./presentContainer/RootContainer"; |
||||
import type { DataLeaf } from "../leaf/presentLeaf/DataLeaf"; |
||||
import type { BinaryLeaf } from "../leaf/presentLeaf/BinaryLeaf"; |
||||
import type { PresentContainerClass } from "./presentContainer/PresentContainer"; |
||||
|
||||
export type ContainerClass = |
||||
| BranchContainer |
||||
| RootContainer |
||||
| AbsentContainer |
||||
| UnfetchedContainer; |
||||
|
||||
export abstract class Container implements Resource, PotentialContainer { |
||||
abstract get isRootContainer(): boolean | undefined; |
||||
abstract get isBranchContainer(): boolean | undefined; |
||||
abstract get isPresent(): boolean; |
||||
abstract get isAbsent(): boolean; |
||||
abstract get isUnfetched(): boolean; |
||||
abstract get isBinary(): boolean | undefined; |
||||
abstract get isDataResource(): boolean | undefined; |
||||
|
||||
uri: string; |
||||
isLoading: boolean; |
||||
|
||||
read(): Promise<FetchedContainerClass | LdoSolidError> { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
reload(): Promise<FetchedContainerClass | LdoSolidError> { |
||||
return this.read(); |
||||
} |
||||
load(): Promise<FetchedContainerClass | LdoSolidError> { |
||||
return this.read(); |
||||
} |
||||
getCurrent(): ContainerClass { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
|
||||
abstract getIsRootContainer(): Promise<boolean>; |
||||
|
||||
createContainerIn( |
||||
_relativeUri: string, |
||||
): Promise<BranchContainer | LdoSolidError> { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
|
||||
createLeafDataResourceIn( |
||||
_relativeUri: string, |
||||
): Promise<DataLeaf | LdoSolidError> { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
|
||||
uploadBinaryIn( |
||||
_relativeUri, |
||||
_blob: Blob, |
||||
): Promise<BinaryLeaf | LdoSolidError> { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
|
||||
clearIfPresent(): Promise<this | LdoSolidError> { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
|
||||
createIfAbsent(): Promise<LdoSolidError | PresentContainerClass> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
createOrOverwrite(): Promise<LdoSolidError | PresentContainerClass> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
} |
@ -1,30 +0,0 @@ |
||||
import type { Unfetched } from "../types"; |
||||
import { Container } from "./Container"; |
||||
|
||||
export class UnfetchedContainer extends Container implements Unfetched { |
||||
get isBinary(): undefined { |
||||
return undefined; |
||||
} |
||||
get isDataResource(): undefined { |
||||
return undefined; |
||||
} |
||||
get isRootContainer(): undefined { |
||||
return undefined; |
||||
} |
||||
get isBranchContainer(): undefined { |
||||
return undefined; |
||||
} |
||||
get isPresent(): false { |
||||
return false; |
||||
} |
||||
get isAbsent(): false { |
||||
return false; |
||||
} |
||||
get isUnfetched(): true { |
||||
return true; |
||||
} |
||||
|
||||
getIsRootContainer(): Promise<boolean> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
} |
@ -1,18 +0,0 @@ |
||||
import { PresentContainer } from "./PresentContainer"; |
||||
|
||||
export class BranchContainer extends PresentContainer { |
||||
get isRootContainer(): false { |
||||
return false; |
||||
} |
||||
get isBranchContainer(): true { |
||||
return true; |
||||
} |
||||
|
||||
async getIsRootContainer(): Promise<false> { |
||||
return false; |
||||
} |
||||
|
||||
getCurrent(): this { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
} |
@ -1,31 +0,0 @@ |
||||
import type { LdoDataset } from "@ldo/ldo"; |
||||
import type { DataResource, FetchedContainer, Present } from "../../types"; |
||||
import { Container } from "../Container"; |
||||
import type { BranchContainer } from "./BranchContainer"; |
||||
import type { RootContainer } from "./RootContainer"; |
||||
|
||||
export type PresentContainerClass = BranchContainer | RootContainer; |
||||
export abstract class PresentContainer |
||||
extends Container |
||||
implements Present, DataResource, FetchedContainer |
||||
{ |
||||
get isPresent(): true { |
||||
return true; |
||||
} |
||||
get isAbsent(): false { |
||||
return false; |
||||
} |
||||
get isUnfetched(): false { |
||||
return false; |
||||
} |
||||
get isDataResource(): true { |
||||
return true; |
||||
} |
||||
get isBinary(): false { |
||||
return false; |
||||
} |
||||
|
||||
get ldoDataset(): LdoDataset { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
} |
@ -1,14 +0,0 @@ |
||||
import { PresentContainer } from "./PresentContainer"; |
||||
|
||||
export class RootContainer extends PresentContainer { |
||||
get isRootContainer(): true { |
||||
return true; |
||||
} |
||||
get isBranchContainer(): false { |
||||
return false; |
||||
} |
||||
|
||||
async getIsRootContainer(): Promise<true> { |
||||
return true; |
||||
} |
||||
} |
@ -1,56 +0,0 @@ |
||||
import type { |
||||
Absent, |
||||
FetchedLeaf, |
||||
LdoSolidError, |
||||
PotentialBinary, |
||||
PotentialData, |
||||
} from "../types"; |
||||
import { Leaf } from "./Leaf"; |
||||
import type { BinaryLeaf } from "./presentLeaf/BinaryLeaf"; |
||||
import type { DataLeaf } from "./presentLeaf/DataLeaf"; |
||||
import type { PresentLeafClass } from "./presentLeaf/PresentLeaf"; |
||||
|
||||
export class AbsentLeaf |
||||
extends Leaf |
||||
implements Absent, PotentialBinary, PotentialData, FetchedLeaf |
||||
{ |
||||
get isBinary(): false { |
||||
return false; |
||||
} |
||||
get isDataResource(): false { |
||||
return false; |
||||
} |
||||
get isPresent(): false { |
||||
return false; |
||||
} |
||||
get isAbsent(): true { |
||||
return true; |
||||
} |
||||
get isUnfetched(): false { |
||||
return false; |
||||
} |
||||
|
||||
async getIsRootContainer(): Promise<false> { |
||||
return false; |
||||
} |
||||
|
||||
async upload(_blob: Blob): Promise<BinaryLeaf | LdoSolidError> { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
uploadIfAbsent(_blob: Blob): Promise<BinaryLeaf | LdoSolidError> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
uploadOrOverwrite(_blob: Blob): Promise<BinaryLeaf | LdoSolidError> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
|
||||
async create(): Promise<DataLeaf | LdoSolidError> { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
createIfAbsent(): Promise<LdoSolidError | PresentLeafClass> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
createOrOverwrite(): Promise<LdoSolidError | DataLeaf> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
} |
@ -1,38 +0,0 @@ |
||||
import type { FetchedLeafClass, LdoSolidError, Resource } from "../types"; |
||||
import type { AbsentLeaf } from "./AbsentLeaf"; |
||||
import type { UnfetchedLeaf } from "./UnfetchedLeaf"; |
||||
import type { BinaryLeaf } from "./presentLeaf/BinaryLeaf"; |
||||
import type { DataLeaf } from "./presentLeaf/DataLeaf"; |
||||
|
||||
export type LeafClass = UnfetchedLeaf | AbsentLeaf | BinaryLeaf | DataLeaf; |
||||
|
||||
export abstract class Leaf implements Resource { |
||||
abstract get isBinary(): boolean | undefined; |
||||
abstract get isDataResource(): boolean | undefined; |
||||
abstract get isPresent(): boolean; |
||||
abstract get isAbsent(): boolean; |
||||
abstract get isUnfetched(): boolean; |
||||
|
||||
uri: string; |
||||
isLoading: boolean; |
||||
|
||||
read(): Promise<FetchedLeafClass | LdoSolidError> { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
reload(): Promise<FetchedLeafClass | LdoSolidError> { |
||||
return this.read(); |
||||
} |
||||
load(): Promise<FetchedLeafClass | LdoSolidError> { |
||||
return this.read(); |
||||
} |
||||
getCurrent(): LeafClass { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
|
||||
async createOrOverwrite(): Promise<DataLeaf | LdoSolidError> { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
async uploadOrOverwrite(_blob: Blob): Promise<BinaryLeaf | LdoSolidError> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
} |
@ -1,49 +0,0 @@ |
||||
import type { |
||||
LdoSolidError, |
||||
PotentialBinary, |
||||
PotentialData, |
||||
Unfetched, |
||||
} from "../types"; |
||||
import { Leaf } from "./Leaf"; |
||||
import type { BinaryLeaf } from "./presentLeaf/BinaryLeaf"; |
||||
import type { DataLeaf } from "./presentLeaf/DataLeaf"; |
||||
import type { PresentLeaf } from "./presentLeaf/PresentLeaf"; |
||||
|
||||
export class UnfetchedLeaf |
||||
extends Leaf |
||||
implements Unfetched, PotentialBinary, PotentialData |
||||
{ |
||||
get isBinary(): undefined { |
||||
return undefined; |
||||
} |
||||
get isDataResource(): undefined { |
||||
return undefined; |
||||
} |
||||
get isPresent(): false { |
||||
return false; |
||||
} |
||||
get isAbsent(): false { |
||||
return false; |
||||
} |
||||
get isUnfetched(): true { |
||||
return true; |
||||
} |
||||
|
||||
getIsRootContainer(): Promise<boolean> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
|
||||
uploadIfAbsent(_blob: Blob): Promise<LdoSolidError | PresentLeaf> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
uploadOrOverwrite(_blob: Blob): Promise<LdoSolidError | BinaryLeaf> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
|
||||
createIfAbsent(): Promise<PresentLeaf | LdoSolidError> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
createOrOverwrite(): Promise<LdoSolidError | DataLeaf> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
} |
@ -1,15 +0,0 @@ |
||||
import type { LdoSolidError, PotentialBinary } from "../../types"; |
||||
import { PresentLeaf } from "./PresentLeaf"; |
||||
|
||||
export class BinaryLeaf extends PresentLeaf implements PotentialBinary { |
||||
get isBinary(): true { |
||||
return true; |
||||
} |
||||
get isDataResource(): false { |
||||
return false; |
||||
} |
||||
|
||||
uploadIfAbsent(_blob: Blob): Promise<LdoSolidError | BinaryLeaf> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
} |
@ -1,26 +0,0 @@ |
||||
import type { LdoDataset } from "@ldo/ldo"; |
||||
import type { DataResource, LdoSolidError, PotentialData } from "../../types"; |
||||
import { PresentLeaf } from "./PresentLeaf"; |
||||
|
||||
export class DataLeaf |
||||
extends PresentLeaf |
||||
implements DataResource, PotentialData |
||||
{ |
||||
get isBinary(): false { |
||||
return false; |
||||
} |
||||
get isDataResource(): true { |
||||
return true; |
||||
} |
||||
|
||||
get ldoDataset(): LdoDataset { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
|
||||
createIfAbsent(): Promise<DataLeaf | LdoSolidError> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
createOrOverwrite(): Promise<DataLeaf | LdoSolidError> { |
||||
throw new Error("Method not implemented."); |
||||
} |
||||
} |
@ -1,17 +0,0 @@ |
||||
import type { FetchedLeaf, Present } from "../../types"; |
||||
import { Leaf } from "../Leaf"; |
||||
import type { BinaryLeaf } from "./BinaryLeaf"; |
||||
import type { DataLeaf } from "./DataLeaf"; |
||||
|
||||
export type PresentLeafClass = DataLeaf | BinaryLeaf; |
||||
export abstract class PresentLeaf extends Leaf implements Present, FetchedLeaf { |
||||
get isPresent(): true { |
||||
return true; |
||||
} |
||||
get isAbsent(): false { |
||||
return false; |
||||
} |
||||
get isUnfetched(): false { |
||||
return false; |
||||
} |
||||
} |
@ -1,249 +0,0 @@ |
||||
const thing = { |
||||
"RootContainerResource|ContainerResource|ChildDataResource|BinaryResource|AbsentContainerResource|AbsentChildDataResource|AbsentBinaryResource|UnfetchedContainerResource|UnfetchedChildDataResource|UnfetchedBinaryResource|": |
||||
["uri", "isLoading", "didInitialFetch", "read", "reload", "load"], |
||||
"RootContainerResource|ContainerResource|ChildDataResource|": ["ldoDataset"], |
||||
"RootContainerResource|ContainerResource|AbsentContainerResource|UnfetchedContainerResource|": |
||||
[ |
||||
"getIsRootContainer", |
||||
"createContainerIn", |
||||
"createDataResourceIn", |
||||
"uploadBinaryIn", |
||||
"clearIfPresent", |
||||
], |
||||
"RootContainerResource|ContainerResource|ChildDataResource|AbsentContainerResource|AbsentChildDataResource|UnfetchedContainerResource|UnfetchedChildDataResource|UnfetchedBinaryResource|": |
||||
["createOrOverwrite"], |
||||
"RootContainerResource|ContainerResource|": ["clear"], |
||||
"ContainerResource|ChildDataResource|AbsentContainerResource|AbsentChildDataResource|AbsentBinaryResource|UnfetchedChildDataResource|UnfetchedBinaryResource|": |
||||
["parentContainer"], |
||||
"ContainerResource|ChildDataResource|BinaryResource|AbsentContainerResource|AbsentChildDataResource|AbsentBinaryResource|UnfetchedContainerResource|UnfetchedChildDataResource|UnfetchedBinaryResource|": |
||||
["getParentContainer", "getRootContainer"], |
||||
"ContainerResource|": ["childResources"], |
||||
"ContainerResource|ChildDataResource|BinaryResource|": ["delete"], |
||||
"ContainerResource|ChildDataResource|BinaryResource|AbsentContainerResource|AbsentChildDataResource|AbsentBinaryResource|UnfetchedChildDataResource|UnfetchedBinaryResource|": |
||||
["deleteIfPresent"], |
||||
"ChildDataResource|": ["hasData"], |
||||
"BinaryResource|": ["mimeType", "fileExtension"], |
||||
"BinaryResource|AbsentBinaryResource|UnfetchedBinaryResource|": [ |
||||
"uploadOrOverwrite", |
||||
], |
||||
"AbsentContainerResource|AbsentChildDataResource|": ["create"], |
||||
"AbsentContainerResource|AbsentChildDataResource|UnfetchedContainerResource|UnfetchedChildDataResource|": |
||||
["createIfAbsent"], |
||||
"AbsentBinaryResource|": ["upload"], |
||||
"AbsentBinaryResource|UnfetchedBinaryResource|": ["uploadIfAbsent"], |
||||
}; |
||||
|
||||
import { LdoDataset } from "@ldo/ldo"; |
||||
import { Quad } from "@rdfjs/types"; |
||||
import { create } from "domain"; |
||||
import { URL } from "url"; |
||||
import { SolidLdoDataset } from "../SolidLdoDataset"; |
||||
|
||||
export type ResourceStatus = BinaryResourceStatus | DataResourceStatus | ErrorResource | ErrorResourceStatus; |
||||
|
||||
export type BinaryResourceStore; |
||||
|
||||
/** |
||||
* Method and information definitions |
||||
*/ |
||||
export interface IResource { |
||||
id: URL; |
||||
isDataResource: true, |
||||
|
||||
} |
||||
|
||||
/** |
||||
* Abstract Definitions |
||||
*/ |
||||
export interface IDataResource extends IResource { |
||||
isDataResource: true; |
||||
} |
||||
|
||||
export interface IContainerResource extends IResource { |
||||
otherMethod(): void; |
||||
} |
||||
|
||||
/** |
||||
* Concrete Definitions |
||||
*/ |
||||
|
||||
clearIfPresent |
||||
|
||||
export interface BinaryResource { |
||||
uri: string; |
||||
isLoading: boolean; |
||||
didInitialFetch: true; |
||||
mimeType: string; |
||||
fileExtension: string; |
||||
getRootContainer(): Promise<RootContainerResource | LdoSolidError>; |
||||
getParentContainer(): Promise<RootContainerResource | ContainerResource | LdoSolidError>; |
||||
uploadOrOverwrite(blob: Blob): Promise<BinaryResource | LdoSolidError>; |
||||
read(): Promise<BinaryResource | LdoSolidError>; |
||||
reload(): Promise<BinaryResource | LdoSolidError>; |
||||
load(): Promise<BinaryResource | LdoSolidError>; |
||||
delete(): Promise<AbsentBinaryResource | LdoSolidError>; |
||||
deleteIfPresent(): Promise<AbsentBinaryResource | LdoSolidError>; |
||||
} |
||||
|
||||
export interface RootContainerResource { |
||||
uri: string; |
||||
isLoading: boolean; |
||||
didInitialFetch: true; |
||||
ldoDataset(): LdoDataset; |
||||
getIsRootContainer(): Promise<boolean>; |
||||
createContainerIn(relativeUri: string): Promise<ContainerResource | LdoSolidError>; |
||||
createDataResourceIn(relativeUri: string): Promise<DataResource | LdoSolidError>; |
||||
uploadBinaryIn(relativeUri, blob: Blob): Promise<BinaryResource | LdoSolidError>; |
||||
createOrOverwrite(): Promise<RootContainerResource | LdoSolidError>; |
||||
read(): Promise<RootContainerResource | LdoSolidError>; |
||||
reload(): Promise<RootContainerResource | LdoSolidError>; |
||||
load(): Promise<RootContainerResource | LdoSolidError>; |
||||
clear(): Promise<RootContainerResource | LdoSolidError>; |
||||
clearIfPresent(): Promise<RootContainerResource | LdoSolidError>; |
||||
} |
||||
|
||||
export interface ContainerResource { |
||||
uri: string; |
||||
isLoading: boolean; |
||||
didInitialFetch: true; |
||||
parentContainer: ContainerResource | RootContainerResource; |
||||
getIsRootContainer(): Promise<boolean>; |
||||
getParentContainer(): Promise<RootContainerResource | ContainerResource | LdoSolidError>; |
||||
childResources: ContainerResource | DataResource | BinaryResource | UnfetchedContainerResource | UnfetchedDataResource | UnfetchedBinaryResource; |
||||
getRootContainer(): Promise<RootContainerResource | LdoSolidError>; |
||||
createContainerIn(relativeUri: string): Promise<ContainerResource | LdoSolidError>; |
||||
createDataResourceIn(relativeUri: string): Promise<DataResource | LdoSolidError>; |
||||
uploadBinaryIn(relativeUri, blob: Blob): Promise<BinaryResource | LdoSolidError>; |
||||
ldoDataset(): LdoDataset; |
||||
createOrOverwrite(): Promise<ContainerResource | LdoSolidError>; |
||||
read(): Promise<ContainerResource | LdoSolidError>; |
||||
reload(): Promise<ContainerResource | LdoSolidError>; |
||||
load(): Promise<ContainerResource | LdoSolidError>; |
||||
delete(): Promise<AbsentContainerResource | LdoSolidError>; |
||||
deleteIfPresent(): Promise<ContainerResource | LdoSolidError>; |
||||
clear(): Promise<ContainerResource | LdoSolidError>; |
||||
clearIfPresent(): Promise<ContainerResource | LdoSolidError>; |
||||
} |
||||
|
||||
export interface DataResource { |
||||
uri: string; |
||||
isLoading: boolean; |
||||
didInitialFetch: true; |
||||
parentContainer: ContainerResource | RootContainerResource; |
||||
getParentContainer(): Promise<RootContainerResource | ContainerResource | LdoSolidError>; |
||||
hasData(): boolean; |
||||
ldoDataset(): LdoDataset; |
||||
getRootContainer(): Promise<RootContainerResource | LdoSolidError>; |
||||
createOrOverwrite(): Promise<DataResource | LdoSolidError>; |
||||
read(): Promise<DataResource | LdoSolidError>; |
||||
reload(): Promise<DataResource | LdoSolidError>; |
||||
load(): Promise<DataResource | LdoSolidError>; |
||||
delete(): Promise<AbsentDataResource | LdoSolidError>; |
||||
deleteIfPresent(): Promise<AbsentBinaryResource | LdoSolidError>; |
||||
} |
||||
|
||||
export interface AbsentDataResource { |
||||
uri: string; |
||||
isLoading: boolean; |
||||
didInitialFetch: true; |
||||
parentContainer: ContainerResource | RootContainerResource; |
||||
getParentContainer(): Promise<RootContainerResource | ContainerResource | LdoSolidError>; |
||||
getRootContainer(): Promise<RootContainerResource | LdoSolidError>; |
||||
createOrOverwrite(): Promise<DataResource | LdoSolidError>; |
||||
create(): Promise<DataResource | LdoSolidError>; |
||||
createIfAbsent(): Promise<DataResource | LdoSolidError>; |
||||
read(): Promise<DataResource | LdoSolidError>; |
||||
reload(): Promise<DataResource | LdoSolidError>; |
||||
load(): Promise<DataResource | LdoSolidError>; |
||||
deleteIfPresent(): Promise<AbsentBinaryResource | LdoSolidError>; |
||||
} |
||||
|
||||
export interface AbsentBinaryResource { |
||||
uri: string; |
||||
isLoading: boolean; |
||||
didInitialFetch: true; |
||||
parentContainer: ContainerResource | RootContainerResource; |
||||
getParentContainer(): Promise<RootContainerResource | ContainerResource | LdoSolidError>; |
||||
getRootContainer(): Promise<RootContainerResource | LdoSolidError>; |
||||
uploadOrOverwrite(blob: Blob): Promise<BinaryResource | LdoSolidError>; |
||||
upload(blob: Blob): Promise<BinaryResource | LdoSolidError>; |
||||
uploadIfAbsent(blob: Blob): Promise<BinaryResource | BinaryResource>; |
||||
read(): Promise<BinaryResource | LdoSolidError>; |
||||
reload(): Promise<BinaryResource | LdoSolidError>; |
||||
load(): Promise<BinaryResource | LdoSolidError>; |
||||
deleteIfPresent(): Promise<AbsentBinaryResource | LdoSolidError>; |
||||
} |
||||
|
||||
export interface AbsentContainerResource { |
||||
uri: string; |
||||
isLoading: boolean; |
||||
didInitialFetch: true; |
||||
parentContainer: ContainerResource | RootContainerResource; |
||||
getIsRootContainer(): Promise<boolean>; |
||||
getParentContainer(): Promise<RootContainerResource | ContainerResource | LdoSolidError>; |
||||
getRootContainer(): Promise<RootContainerResource | LdoSolidError>; |
||||
createContainerIn(relativeUri: string): Promise<ContainerResource | LdoSolidError>; |
||||
createDataResourceIn(relativeUri: string): Promise<DataResource | LdoSolidError>; |
||||
uploadBinaryIn(relativeUri, blob: Blob): Promise<BinaryResource | LdoSolidError>; |
||||
createOrOverwrite(): Promise<ContainerResource | LdoSolidError>; |
||||
create(): Promise<ContainerResource | LdoSolidError>; |
||||
createIfAbsent(): Promise<ContainerResource | LdoSolidError>; |
||||
read(): Promise<ContainerResource | LdoSolidError>; |
||||
reload(): Promise<ContainerResource | LdoSolidError>; |
||||
load(): Promise<ContainerResource | LdoSolidError>; |
||||
deleteIfPresent(): Promise<AbsentContainerResource | LdoSolidError>; |
||||
clearIfPresent(): Promise<AbsentContainerResource | LdoSolidError>; |
||||
} |
||||
|
||||
export interface UnfetchedDataResource { |
||||
parentContainer: ContainerResource | RootContainerResource; |
||||
getParentContainer(): Promise<RootContainerResource | ContainerResource | LdoSolidError>; |
||||
uri: string; |
||||
isLoading: boolean; |
||||
didInitialFetch: false; |
||||
getRootContainer(): Promise<RootContainerResource | LdoSolidError>; |
||||
createOrOverwrite(): Promise<DataResource | LdoSolidError>; |
||||
createIfAbsent(): Promise<DataResource | LdoSolidError>; |
||||
read(): Promise<BinaryResource | LdoSolidError>; |
||||
reload(): Promise<BinaryResource | LdoSolidError>; |
||||
load(): Promise<BinaryResource | LdoSolidError>; |
||||
deleteIfPresent(): Promise<AbsentBinaryResource | LdoSolidError>; |
||||
} |
||||
|
||||
export interface UnfetchedBinaryResource { |
||||
uri: string; |
||||
isLoading: boolean; |
||||
didInitialFetch: false; |
||||
parentContainer: ContainerResource | RootContainerResource; |
||||
getParentContainer(): Promise<RootContainerResource | ContainerResource | LdoSolidError>; |
||||
getRootContainer(): Promise<RootContainerResource | LdoSolidError>; |
||||
uploadOrOverwrite(blob: Blob): Promise<BinaryResource | LdoSolidError> |
||||
createOrOverwrite(): Promise<BinaryResource | LdoSolidError>; |
||||
uploadIfAbsent(blob: Blob): Promise<BinaryResource | BinaryResource>; |
||||
read(): Promise<BinaryResource | LdoSolidError>; |
||||
reload(): Promise<BinaryResource | LdoSolidError>; |
||||
load(): Promise<BinaryResource | LdoSolidError>; |
||||
deleteIfPresent(): Promise<AbsentBinaryResource | LdoSolidError>; |
||||
} |
||||
|
||||
export interface UnfetchedContainerResource { |
||||
uri: string; |
||||
isLoading: boolean; |
||||
didInitialFetch: false; |
||||
getIsRootContainer(): Promise<boolean>; |
||||
getParentContainer(): Promise<RootContainerResource | ContainerResource | LdoSolidError | undefined>; |
||||
getRootContainer(): Promise<RootContainerResource | LdoSolidError>; |
||||
createContainerIn(relativeUri: string): Promise<ContainerResource | LdoSolidError>; |
||||
createDataResourceIn(relativeUri: string): Promise<DataResource | LdoSolidError>; |
||||
uploadBinaryIn(relativeUri, blob: Blob): Promise<BinaryResource | LdoSolidError>; |
||||
createOrOverwrite(): Promise<ContainerResource | LdoSolidError>; |
||||
createIfAbsent(): Promise<ContainerResource | LdoSolidError>; |
||||
read(): Promise<ContainerResource | RootContainerResource | LdoSolidError>; |
||||
reload(): Promise<ContainerResource | RootContainerResource | LdoSolidError>; |
||||
load(): Promise<ContainerResource | RootContainerResource | LdoSolidError>; |
||||
clearIfPresent(): Promise<ContainerResource | AbsentContainerResource | LdoSolidError>; |
||||
} |
||||
|
||||
export interface LdoSolidError extends Error { |
||||
forResource: unknown // Some Kind of Resource
|
||||
} |
@ -1,97 +0,0 @@ |
||||
import type { LdoDataset } from "@ldo/ldo"; |
||||
import type { AbsentLeaf } from "./leaf/AbsentLeaf"; |
||||
import type { UnfetchedLeaf } from "./leaf/UnfetchedLeaf"; |
||||
import type { BinaryLeaf } from "./leaf/presentLeaf/BinaryLeaf"; |
||||
import type { BranchContainer } from "./container/presentContainer/BranchContainer"; |
||||
import type { RootContainer } from "./container/presentContainer/RootContainer"; |
||||
import type { DataLeaf } from "./leaf/presentLeaf/DataLeaf"; |
||||
import type { AbsentContainer } from "./container/AbsentContainer"; |
||||
import type { UnfetchedContainer } from "./container/UnfetchedContainer"; |
||||
import type { PresentContainerClass } from "./container/presentContainer/PresentContainer"; |
||||
import type { PresentLeaf } from "./leaf/presentLeaf/PresentLeaf"; |
||||
|
||||
export interface LdoSolidError extends Error {} |
||||
|
||||
export type ResouceClass = |
||||
| RootContainer |
||||
| BranchContainer |
||||
| DataLeaf |
||||
| BinaryLeaf |
||||
| AbsentContainer |
||||
| AbsentLeaf |
||||
| UnfetchedContainer |
||||
| UnfetchedLeaf; |
||||
export interface Resource { |
||||
uri: string; |
||||
isLoading: boolean; |
||||
isAbsent: boolean; |
||||
isUnfetched: boolean; |
||||
isPresent: boolean; |
||||
isBinary: boolean | undefined; |
||||
isDataResource: boolean | undefined; |
||||
} |
||||
|
||||
export type AbsentClass = AbsentContainer | AbsentLeaf; |
||||
export interface Absent { |
||||
isAbsent: true; |
||||
isUnfetched: false; |
||||
isPresent: false; |
||||
isBinary: false; |
||||
isDataResource: false; |
||||
} |
||||
|
||||
export type UnfetchedClass = UnfetchedContainer | UnfetchedLeaf; |
||||
export interface Unfetched { |
||||
isUnfetched: true; |
||||
isAbsent: false; |
||||
isPresent: false; |
||||
isBinary: undefined; |
||||
isDataResource: undefined; |
||||
} |
||||
|
||||
export type PresentClass = |
||||
| RootContainer |
||||
| BranchContainer |
||||
| DataLeaf |
||||
| BinaryLeaf; |
||||
export interface Present { |
||||
isPresent: true; |
||||
isAbsent: false; |
||||
isUnfetched: false; |
||||
} |
||||
|
||||
export type DataResourceClass = BranchContainer | RootContainer; |
||||
export interface DataResource { |
||||
isDataResource: true; |
||||
isBinary: false; |
||||
ldoDataset: LdoDataset; |
||||
} |
||||
|
||||
export type PotentialBinaryClass = AbsentLeaf | UnfetchedLeaf | BinaryLeaf; |
||||
export interface PotentialBinary { |
||||
uploadIfAbsent(blob: Blob): Promise<PresentLeaf | LdoSolidError>; |
||||
uploadOrOverwrite(blob: Blob): Promise<BinaryLeaf | LdoSolidError>; |
||||
} |
||||
|
||||
export type PotentialDataClass = AbsentLeaf | UnfetchedLeaf | DataLeaf; |
||||
export interface PotentialData { |
||||
createIfAbsent(): Promise<PresentLeaf | LdoSolidError>; |
||||
} |
||||
|
||||
export type PotentialContainerClass = |
||||
| RootContainer |
||||
| BranchContainer |
||||
| AbsentContainer |
||||
| UnfetchedContainer; |
||||
export interface PotentialContainer { |
||||
createIfAbsent(): Promise<PresentContainerClass | LdoSolidError>; |
||||
} |
||||
|
||||
export type FetchedContainerClass = |
||||
| RootContainer |
||||
| BranchContainer |
||||
| AbsentContainer; |
||||
export interface FetchedContainer {} |
||||
|
||||
export type FetchedLeafClass = DataLeaf | BinaryLeaf | AbsentLeaf; |
||||
export interface FetchedLeaf {} |
@ -0,0 +1,3 @@ |
||||
import { Resource } from "./Resource"; |
||||
|
||||
export class Container extends Resource {} |
@ -0,0 +1,86 @@ |
||||
// import type { LdoDataset } from "@ldo/ldo";
|
||||
// import type { LeafMethodNotAllowedError } from "./error/MethodNotAllowedError";
|
||||
// import type { DatasetChanges } from "@ldo/rdf-utils";
|
||||
// import type { PresentContainer } from "./abstract/container/PresentContainer";
|
||||
import type { SolidLdoDatasetContext } from "../SolidLdoDatasetContext"; |
||||
import type { LeafUri } from "../uriTypes"; |
||||
import { Resource } from "./Resource"; |
||||
|
||||
export interface ConcreteInstance { |
||||
uri: LeafUri; |
||||
context: SolidLdoDatasetContext; |
||||
// methods: typeof AbstractLeaf;
|
||||
} |
||||
|
||||
// REMEMBER: This file should be replaced with non abstract methods
|
||||
export abstract class ConcreteLeaf extends Resource { |
||||
// // All intance variables
|
||||
// private readonly i: SolidLdoDatasetContext;
|
||||
// uri: string;
|
||||
// abstract type(): LeafType["type"];
|
||||
// // Loading Methods
|
||||
// isLoading(): boolean {
|
||||
// return (
|
||||
// this.isCreating() ||
|
||||
// this.isReading() ||
|
||||
// this.isUpdating() ||
|
||||
// this.isDeletinng()
|
||||
// );
|
||||
// }
|
||||
// abstract isCreating(): boolean;
|
||||
// abstract isReading(): boolean;
|
||||
// abstract isUpdating(): boolean;
|
||||
// abstract isDeletinng(): boolean;
|
||||
// isDoingInitialFetch(): boolean {
|
||||
// return this.isReading() && !this.didInitialFetch();
|
||||
// }
|
||||
// // Checkers
|
||||
// abstract didInitialFetch(): boolean;
|
||||
// abstract isFetched(): boolean;
|
||||
// abstract isUnfetched(): boolean;
|
||||
// abstract isBinary: boolean | undefined;
|
||||
// abstract isDataResource(): boolean | undefined;
|
||||
// // Read Methods
|
||||
// abstract read(): Promise<PresentLeafType | LdoSolidError>;
|
||||
// abstract readIfUnfetched(): Promise<PresentLeafType | LdoSolidError>;
|
||||
// // Create Methods
|
||||
// abstract createOrOverwrite(): Promise<DataLeaf | LdoSolidError>;
|
||||
// abstract createOrOverwrite(blob: Blob): Promise<BinaryLeaf | LdoSolidError>;
|
||||
// abstract createIfAbsent(): Promise<LeafType | LdoSolidError>;
|
||||
// abstract createIfAbsent(blob: Blob): Promise<LeafType | LdoSolidError>;
|
||||
// // Delete Method
|
||||
// abstract delete(): Promise<AbsentLeaf | LdoSolidError>;
|
||||
// // Parent Container Methods -- Remember to change for Container
|
||||
// abstract getCachedParentContainer(): ContainerType | LdoSolidError;
|
||||
// abstract getParentContainer(): Promise<PresentContainer | LdoSolidError>;
|
||||
// abstract reloadParentContainer(): Promise<PresentContainer | LdoSolidError>;
|
||||
// abstract getRootContainerFromCache():
|
||||
// | ContainerType
|
||||
// | undefined
|
||||
// | LdoSolidError;
|
||||
// abstract getRootContainer(): Promise<
|
||||
// FetchedContainerType | undefined | LdoSolidError
|
||||
// >;
|
||||
// abstract getRootContainerFromPod(): Promise<
|
||||
// FetchedContainerType | undefined | LdoSolidError
|
||||
// >;
|
||||
// // Exclusing Methods =========================================================
|
||||
// // Data Methods (Data Leaf Only)
|
||||
// abstract getLdoDataset(): LdoDataset | LeafMethodNotAllowedError;
|
||||
// abstract reloadLdoDataset(): Promise<LdoDataset | LeafMethodNotAllowedError>;
|
||||
// abstract hasData(): boolean | LeafMethodNotAllowedError;
|
||||
// abstract reloadHasData(): Promise<boolean | LeafMethodNotAllowedError>;
|
||||
// abstract update(
|
||||
// changes: DatasetChanges,
|
||||
// ): Promise<DataLeaf | LdoSolidError | LeafMethodNotAllowedError>;
|
||||
// // Binary Methods (Binary Only)
|
||||
// abstract getMimeType(): string | LeafMethodNotAllowedError;
|
||||
// abstract reloadMimeType(): Promise<string | LeafMethodNotAllowedError>;
|
||||
// // Create Methods (AbsentLeaf Only)
|
||||
// abstract create(): Promise<
|
||||
// DataLeaf | LdoSolidError | LeafMethodNotAllowedError
|
||||
// >;
|
||||
// abstract create(
|
||||
// blob: Blob,
|
||||
// ): Promise<BinaryLeaf | LdoSolidError | LeafMethodNotAllowedError>;
|
||||
} |
@ -0,0 +1 @@ |
||||
export class Resource {} |
@ -0,0 +1 @@ |
||||
export abstract class AbstractResource {} |
@ -1,36 +0,0 @@ |
||||
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; |
||||
} |
@ -0,0 +1,5 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { PresentContainer } from "./PresentContainer"; |
||||
import { Absent } from "../fetchStatus/Absent"; |
||||
|
||||
export class AbsentContainer extends Mixin(PresentContainer, Absent) {} |
@ -0,0 +1,3 @@ |
||||
import { AbstractResource } from "../AbstractResource"; |
||||
|
||||
export abstract class AbstractContainer extends AbstractResource {} |
@ -1,13 +0,0 @@ |
||||
import { SolidLdoError } from "../../error/SolidLdoError"; |
||||
import { PotentialDataResource } from "../dataResource/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,8 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { AbstractContainer } from "./AbstractContainer"; |
||||
import { Fetched } from "../fetchStatus/Fetched"; |
||||
|
||||
export abstract class FetchedContainer extends Mixin( |
||||
AbstractContainer, |
||||
Fetched, |
||||
) {} |
@ -1,9 +1,8 @@ |
||||
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 { FetchedContainer } from "./FetchedContainer"; |
||||
import { Present } from "../fetchStatus/Present"; |
||||
|
||||
export type PresentContainerClass = RootContainer | BranchContainer; |
||||
export class PresentContainer extends Mixin(Container, Present, DataResource) {} |
||||
export abstract class PresentContainer extends Mixin( |
||||
FetchedContainer, |
||||
Present, |
||||
) {} |
||||
|
@ -0,0 +1,5 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { AbstractContainer } from "./AbstractContainer"; |
||||
import { Unfetched } from "../fetchStatus/Unfetched"; |
||||
|
||||
export class UnfetchedContainer extends Mixin(AbstractContainer, Unfetched) {} |
@ -1,7 +0,0 @@ |
||||
import type { BranchContainer } from "../../concrete/BranchContainer"; |
||||
import type { DataLeaf } from "../../concrete/DataLeaf"; |
||||
import type { RootContainer } from "../../concrete/RootContainer"; |
||||
import { PotentialDataResource } from "./potentialDataResource"; |
||||
|
||||
export type DataResourceClass = RootContainer | BranchContainer | DataLeaf; |
||||
export class DataResource extends PotentialDataResource {} |
@ -1,26 +0,0 @@ |
||||
import type { AbsentContainer } from "../../concrete/AbsentContainer"; |
||||
import type { AbsentLeaf } from "../../concrete/AbsentLeaf"; |
||||
import type { BranchContainer } from "../../concrete/BranchContainer"; |
||||
import type { RootContainer } from "../../concrete/RootContainer"; |
||||
import type { UnfetchedContainer } from "../../concrete/UnfetchedContainer"; |
||||
import type { UnfetchedLeaf } from "../../concrete/UnfetchedLeaf"; |
||||
import type { SolidLdoError } from "../../error/SolidLdoError"; |
||||
import type { ResourceClass } from "../Resource"; |
||||
import { Resource } from "../Resource"; |
||||
import type { DataResource } from "./DataResource"; |
||||
|
||||
export type PotentialDataResourceClass = |
||||
| RootContainer |
||||
| BranchContainer |
||||
| DataResource |
||||
| AbsentContainer |
||||
| AbsentLeaf |
||||
| UnfetchedContainer |
||||
| UnfetchedLeaf; |
||||
export abstract class PotentialDataResource extends Resource< |
||||
ResourceClass, |
||||
SolidLdoError |
||||
> { |
||||
|
||||
abstract
|
||||
} |
@ -1,17 +1,3 @@ |
||||
import type { AbsentContainer } from "../../concrete/AbsentContainer"; |
||||
import type { AbsentLeaf } from "../../concrete/AbsentLeaf"; |
||||
import type { SolidLdoError } from "../../error/SolidLdoError"; |
||||
import { Fetched } from "./Fetched"; |
||||
import type { PresentClass } from "./Present"; |
||||
|
||||
export type AbsentClass = AbsentContainer | AbsentLeaf; |
||||
export abstract class Absent extends Fetched { |
||||
public get isAbsent(): true { |
||||
return true; |
||||
} |
||||
public get isPresent(): false { |
||||
return false; |
||||
} |
||||
|
||||
abstract create(...args: unknown[]): Promise<PresentClass | SolidLdoError>; |
||||
} |
||||
export abstract class Absent extends Fetched {} |
||||
|
@ -1,7 +0,0 @@ |
||||
import { Resource } from "../Resource"; |
||||
|
||||
export abstract class FetchStatus extends Resource { |
||||
public abstract get didInitialFetch(): boolean; |
||||
public abstract get isAbsent(): boolean | undefined; |
||||
public abstract get isPresent(): boolean | undefined; |
||||
} |
@ -1,24 +1 @@ |
||||
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 { FetchStatus } from "./FetchStatus"; |
||||
|
||||
export type FetchedClass = |
||||
| RootContainer |
||||
| BranchContainer |
||||
| DataLeaf |
||||
| BinaryLeaf |
||||
| AbsentContainer |
||||
| AbsentLeaf; |
||||
export abstract class Fetched extends FetchStatus { |
||||
public get didInitialFetch(): true { |
||||
return true; |
||||
} |
||||
|
||||
async readIfUnfetched(): Promise<this> { |
||||
return this; |
||||
} |
||||
} |
||||
export abstract class Fetched {} |
||||
|
@ -1,19 +1,3 @@ |
||||
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 { Fetched } from "./Fetched"; |
||||
|
||||
export type PresentClass = |
||||
| RootContainer |
||||
| BranchContainer |
||||
| DataLeaf |
||||
| BinaryLeaf; |
||||
export abstract class Present extends Fetched { |
||||
public get isAbsent(): false { |
||||
return false; |
||||
} |
||||
public get isPresent(): true { |
||||
return true; |
||||
} |
||||
} |
||||
export abstract class Present extends Fetched {} |
||||
|
@ -1,26 +1 @@ |
||||
import type { UnfetchedContainer } from "../../concrete/UnfetchedContainer"; |
||||
import type { UnfetchedLeaf } from "../../concrete/UnfetchedLeaf"; |
||||
import type { SolidLdoError } from "../../error/SolidLdoError"; |
||||
import { FetchStatus } from "./FetchStatus"; |
||||
import type { FetchedClass } from "./Fetched"; |
||||
|
||||
export type UnfetchedClass = UnfetchedContainer | UnfetchedLeaf; |
||||
export abstract class Unfetched< |
||||
ReadReturn extends FetchedClass, |
||||
ReadError extends SolidLdoError, |
||||
> extends FetchStatus { |
||||
public get didInitialFetch(): false { |
||||
return false; |
||||
} |
||||
public get isAbsent(): undefined { |
||||
return undefined; |
||||
} |
||||
public get isPresent(): undefined { |
||||
return undefined; |
||||
} |
||||
|
||||
async readIfUnfetched(): Promise<ReadReturn | ReadError> { |
||||
return this.read(); |
||||
} |
||||
abstract read(): Promise<ReadReturn | ReadError>; |
||||
} |
||||
export abstract class Unfetched {} |
||||
|
@ -0,0 +1,5 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { Absent } from "../fetchStatus/Absent"; |
||||
import { FetchedLeaf } from "./FetchedLeaf"; |
||||
|
||||
export class AbsentLeaf extends Mixin(FetchedLeaf, Absent) {} |
@ -0,0 +1,3 @@ |
||||
import { AbstractResource } from "../AbstractResource"; |
||||
|
||||
export abstract class AbstractLeaf extends AbstractResource {} |
@ -0,0 +1,3 @@ |
||||
import { PresentLeaf } from "./PresentLeaf"; |
||||
|
||||
export class BinaryLeaf extends PresentLeaf {} |
@ -0,0 +1,3 @@ |
||||
import { PresentLeaf } from "./PresentLeaf"; |
||||
|
||||
export class DataLeaf extends PresentLeaf {} |
@ -1,9 +1,5 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { Leaf } from "./Leaf"; |
||||
import { AbstractLeaf } from "./AbstractLeaf"; |
||||
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) {} |
||||
export abstract class FetchedLeaf extends Mixin(AbstractLeaf, Fetched) {} |
||||
|
@ -1,33 +0,0 @@ |
||||
import type { AbsentLeaf } from "../../concrete/AbsentLeaf"; |
||||
import type { BinaryLeaf } from "../../concrete/BinaryLeaf"; |
||||
import type { DataLeaf } from "../../concrete/DataLeaf"; |
||||
import type { UnfetchedLeaf } from "../../concrete/UnfetchedLeaf"; |
||||
import { SolidLdoError } from "../../error/SolidLdoError"; |
||||
import { Resource, ResourceClass } from "../Resource"; |
||||
import { FetchedClass } from "../fetchStatus/Fetched"; |
||||
import { PresentClass } from "../fetchStatus/Present"; |
||||
import type { FetchedLeafClass } from "./FetchedLeaf"; |
||||
import { PresentLeafClass } from "./PresentLeaf"; |
||||
|
||||
export type LeafClass = DataLeaf | BinaryLeaf | AbsentLeaf | UnfetchedLeaf; |
||||
export abstract class Leaf extends Resource { |
||||
async read(): Promise<FetchedLeafClass | SolidLdoError> { |
||||
// Make query
|
||||
// Select the Kind of Leaf
|
||||
// Create it
|
||||
|
||||
// Post Processing
|
||||
throw new Error("Not Implemented"); |
||||
} |
||||
|
||||
async createIfAbsent(): Promise<DataLeaf | SolidLdoError>; |
||||
async createIfAbsent(blob: Blob): Promise<BinaryLeaf | SolidLdoError>; |
||||
async createIfAbsent(_blob?: Blob): Promise<PresentLeafClass | SolidLdoError> { |
||||
|
||||
return new SolidLdoError(); |
||||
} |
||||
|
||||
getCurrent(): LeafClass { |
||||
throw new Error("Not Implemented"); |
||||
} |
||||
} |
@ -1,8 +1,5 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { FetchedLeaf } from "./FetchedLeaf"; |
||||
import { Present } from "../fetchStatus/Present"; |
||||
import type { DataLeaf } from "../../concrete/DataLeaf"; |
||||
import type { BinaryLeaf } from "../../concrete/BinaryLeaf"; |
||||
|
||||
export type PresentLeafClass = DataLeaf | BinaryLeaf; |
||||
export abstract class PresentLeaf extends Mixin(FetchedLeaf, Present) {} |
||||
|
@ -0,0 +1,5 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { AbstractLeaf } from "./AbstractLeaf"; |
||||
import { Unfetched } from "../fetchStatus/Unfetched"; |
||||
|
||||
export class UnfetchedLeaf extends Mixin(AbstractLeaf, Unfetched) {} |
@ -1,5 +0,0 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { Absent } from "../abstract/fetchStatus/Absent"; |
||||
import { Container } from "../abstract/container/Container"; |
||||
|
||||
export class AbsentContainer extends Mixin(Absent, Container) {} |
@ -1,21 +0,0 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { Absent, AbsentClass } from "../abstract/fetchStatus/Absent"; |
||||
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, 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,5 +0,0 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { PresentLeaf } from "../abstract/leaf/PresentLeaf"; |
||||
import { PotentialBinaryLeaf } from "../abstract/leaf/PotentialBinaryLeaf"; |
||||
|
||||
export class BinaryLeaf extends Mixin(PresentLeaf, PotentialBinaryLeaf) {} |
@ -1,3 +0,0 @@ |
||||
import { PresentContainer } from "../abstract/container/PresentContainer"; |
||||
|
||||
export class BranchContainer extends PresentContainer {} |
@ -1,5 +0,0 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { PresentLeaf } from "../abstract/leaf/PresentLeaf"; |
||||
import { PotentialDataLeaf } from "../abstract/leaf/PotentialDataLeaf"; |
||||
|
||||
export class DataLeaf extends Mixin(PresentLeaf, PotentialDataLeaf) {} |
@ -1,3 +0,0 @@ |
||||
import { PresentContainer } from "../abstract/container/PresentContainer"; |
||||
|
||||
export class RootContainer extends PresentContainer {} |
@ -1,5 +0,0 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { Container } from "../abstract/container/Container"; |
||||
import { Unfetched } from "../abstract/fetchStatus/Unfetched"; |
||||
|
||||
export class UnfetchedContainer extends Mixin(Container, Unfetched) {} |
@ -1,10 +0,0 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
import { Unfetched } from "../abstract/fetchStatus/Unfetched"; |
||||
import { PotentialBinaryLeaf } from "../abstract/leaf/PotentialBinaryLeaf"; |
||||
import { PotentialDataLeaf } from "../abstract/leaf/PotentialDataLeaf"; |
||||
|
||||
export class UnfetchedLeaf extends Mixin( |
||||
Unfetched, |
||||
PotentialBinaryLeaf, |
||||
PotentialDataLeaf, |
||||
) {} |
@ -0,0 +1,14 @@ |
||||
import type { ResourceType } from "../abstract/AbstractResource"; |
||||
import type { LeafType } from "../abstract/leaf/Leaf"; |
||||
import { ResourceError } from "./ResourceError"; |
||||
|
||||
export class MethodNotAllowedError< |
||||
rType extends ResourceType, |
||||
> extends ResourceError { |
||||
type: "MethodNotAllowed"; |
||||
methodName: string; |
||||
currentResource: rType; |
||||
} |
||||
|
||||
export class LeafMethodNotAllowedError extends MethodNotAllowedError<LeafType> {} |
||||
export class ContainerMethodNotAllowedError extends MethodNotAllowedError<LeafType> {} |
@ -0,0 +1,6 @@ |
||||
import type { ResourceType } from "../abstract/AbstractResource"; |
||||
|
||||
export abstract class ResourceError extends Error { |
||||
public abstract readonly currentResource: ResourceType; |
||||
public abstract readonly type: string; |
||||
} |
@ -1 +0,0 @@ |
||||
export class SolidLdoError extends Error {} |
@ -0,0 +1,21 @@ |
||||
import { Mixin } from "ts-mixer"; |
||||
|
||||
class Foo { |
||||
protected makeFoo() { |
||||
return "foo"; |
||||
} |
||||
} |
||||
|
||||
class Bar { |
||||
protected makeBar() { |
||||
return "bar"; |
||||
} |
||||
} |
||||
|
||||
class FooBar extends Mixin(Foo, Bar) { |
||||
public makeFooBar() { |
||||
return this.makeFoo() + this.makeBar(); |
||||
} |
||||
} |
||||
|
||||
const fooBar = new FooBar(); |
@ -0,0 +1,96 @@ |
||||
export type ContainerUri = `${string}/${NonPathnameEnding}`; |
||||
export type LeafUri = |
||||
`${string}${EveryLegalPathnameCharacterOtherThanSlash}${NonPathnameEnding}`; |
||||
|
||||
export function isContainerUri(uri: string): uri is ContainerUri { |
||||
const url = new URL(uri); |
||||
return url.pathname.endsWith("/"); |
||||
} |
||||
|
||||
export function isLeafUri(uri: string): uri is LeafUri { |
||||
return !isContainerUri; |
||||
} |
||||
|
||||
type NonPathnameEnding = "" | `?${string}` | `#${string}`; |
||||
type EveryLegalPathnameCharacterOtherThanSlash = |
||||
| "A" |
||||
| "B" |
||||
| "C" |
||||
| "D" |
||||
| "E" |
||||
| "F" |
||||
| "G" |
||||
| "H" |
||||
| "I" |
||||
| "J" |
||||
| "K" |
||||
| "L" |
||||
| "M" |
||||
| "N" |
||||
| "O" |
||||
| "P" |
||||
| "Q" |
||||
| "R" |
||||
| "S" |
||||
| "T" |
||||
| "U" |
||||
| "V" |
||||
| "W" |
||||
| "X" |
||||
| "Y" |
||||
| "Z" |
||||
| "a" |
||||
| "b" |
||||
| "c" |
||||
| "d" |
||||
| "e" |
||||
| "f" |
||||
| "g" |
||||
| "h" |
||||
| "i" |
||||
| "j" |
||||
| "k" |
||||
| "l" |
||||
| "m" |
||||
| "n" |
||||
| "o" |
||||
| "p" |
||||
| "q" |
||||
| "r" |
||||
| "s" |
||||
| "t" |
||||
| "u" |
||||
| "v" |
||||
| "w" |
||||
| "x" |
||||
| "y" |
||||
| "z" |
||||
| "1" |
||||
| "2" |
||||
| "3" |
||||
| "4" |
||||
| "5" |
||||
| "6" |
||||
| "7" |
||||
| "8" |
||||
| "9" |
||||
| "0" |
||||
| "-" |
||||
| "." |
||||
| "_" |
||||
| "~" |
||||
| ":" |
||||
| "[" |
||||
| "]" |
||||
| "@" |
||||
| "!" |
||||
| "$" |
||||
| "&" |
||||
| "'" |
||||
| "(" |
||||
| ")" |
||||
| "*" |
||||
| "+" |
||||
| "," |
||||
| ";" |
||||
| "="; |
Loading…
Reference in new issue