ldkit 0.0.3 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/esm/library/engine.js +1 -1
- package/esm/mod.js +1 -1
- package/esm/namespaces.js +1 -0
- package/esm/rdf.js +1 -0
- package/esm/sparql.js +1 -0
- package/package.json +20 -16
- package/script/library/engine.js +2 -2
- package/script/mod.js +2 -2
- package/script/namespaces.js +17 -0
- package/script/rdf.js +17 -0
- package/script/sparql.js +17 -0
- package/types/library/context.d.ts +9 -0
- package/types/library/decoder.d.ts +6 -0
- package/types/library/encoder.d.ts +6 -0
- package/types/library/engine.d.ts +6 -0
- package/types/library/namespaces/dcterms.d.ts +104 -0
- package/types/library/namespaces/ldkit.d.ts +7 -0
- package/types/library/namespaces/mod.d.ts +7 -0
- package/types/library/namespaces/namespace.d.ts +15 -0
- package/types/library/namespaces/rdf.d.ts +28 -0
- package/types/library/namespaces/schema.d.ts +2697 -0
- package/types/library/namespaces/skos.d.ts +38 -0
- package/types/library/namespaces/xsd.d.ts +56 -0
- package/types/library/rdf.d.ts +14 -0
- package/types/library/resource/mod.d.ts +1 -0
- package/types/library/resource/query_builder.d.ts +22 -0
- package/types/library/resource/query_helper.d.ts +20 -0
- package/types/library/resource/resource.d.ts +24 -0
- package/types/library/resource/types.d.ts +5 -0
- package/types/library/rxjs.d.ts +2 -0
- package/types/library/schema/data_types.d.ts +39 -0
- package/types/library/schema/interface.d.ts +32 -0
- package/types/library/schema/mod.d.ts +3 -0
- package/types/library/schema/schema.d.ts +30 -0
- package/types/library/schema/utils.d.ts +3 -0
- package/types/library/sparql.d.ts +2 -0
- package/types/mod.d.ts +4 -0
- package/types/namespaces.d.ts +1 -0
- package/types/rdf.d.ts +1 -0
- package/types/sparql.d.ts +1 -0
- package/esm/_dnt.shims.js +0 -70
- package/esm/library/comunica/bundle.js +0 -82389
- package/esm/library/comunica/mod.js +0 -1
- package/script/_dnt.shims.js +0 -80
- package/script/library/comunica/bundle.js +0 -82415
- package/script/library/comunica/mod.js +0 -5
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
Collection: "skos:Collection";
|
|
3
|
+
member: "skos:member";
|
|
4
|
+
Concept: "skos:Concept";
|
|
5
|
+
ConceptScheme: "skos:ConceptScheme";
|
|
6
|
+
OrderedCollection: "skos:OrderedCollection";
|
|
7
|
+
altLabel: "skos:altLabel";
|
|
8
|
+
broadMatch: "skos:broadMatch";
|
|
9
|
+
broader: "skos:broader";
|
|
10
|
+
broaderTransitive: "skos:broaderTransitive";
|
|
11
|
+
changeNote: "skos:changeNote";
|
|
12
|
+
closeMatch: "skos:closeMatch";
|
|
13
|
+
definition: "skos:definition";
|
|
14
|
+
editorialNote: "skos:editorialNote";
|
|
15
|
+
exactMatch: "skos:exactMatch";
|
|
16
|
+
example: "skos:example";
|
|
17
|
+
hasTopConcept: "skos:hasTopConcept";
|
|
18
|
+
hiddenLabel: "skos:hiddenLabel";
|
|
19
|
+
historyNote: "skos:historyNote";
|
|
20
|
+
inScheme: "skos:inScheme";
|
|
21
|
+
mappingRelation: "skos:mappingRelation";
|
|
22
|
+
memberList: "skos:memberList";
|
|
23
|
+
narrowMatch: "skos:narrowMatch";
|
|
24
|
+
narrower: "skos:narrower";
|
|
25
|
+
narrowerTransitive: "skos:narrowerTransitive";
|
|
26
|
+
notation: "skos:notation";
|
|
27
|
+
note: "skos:note";
|
|
28
|
+
prefLabel: "skos:prefLabel";
|
|
29
|
+
related: "skos:related";
|
|
30
|
+
relatedMatch: "skos:relatedMatch";
|
|
31
|
+
scopeNote: "skos:scopeNote";
|
|
32
|
+
semanticRelation: "skos:semanticRelation";
|
|
33
|
+
topConceptOf: "skos:topConceptOf";
|
|
34
|
+
} & {
|
|
35
|
+
$prefix: "skos:";
|
|
36
|
+
$iri: "http://www.w3.org/2004/02/skos/core#";
|
|
37
|
+
};
|
|
38
|
+
export default _default;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
string: "xsd:string";
|
|
3
|
+
boolean: "xsd:boolean";
|
|
4
|
+
language: "xsd:language";
|
|
5
|
+
date: "xsd:date";
|
|
6
|
+
duration: "xsd:duration";
|
|
7
|
+
ENTITIES: "xsd:ENTITIES";
|
|
8
|
+
ENTITY: "xsd:ENTITY";
|
|
9
|
+
ID: "xsd:ID";
|
|
10
|
+
IDREF: "xsd:IDREF";
|
|
11
|
+
IDREFS: "xsd:IDREFS";
|
|
12
|
+
NCName: "xsd:NCName";
|
|
13
|
+
NMTOKEN: "xsd:NMTOKEN";
|
|
14
|
+
NMTOKENS: "xsd:NMTOKENS";
|
|
15
|
+
NOTATION: "xsd:NOTATION";
|
|
16
|
+
Name: "xsd:Name";
|
|
17
|
+
QName: "xsd:QName";
|
|
18
|
+
anyAtomicType: "xsd:anyAtomicType";
|
|
19
|
+
anySimpleType: "xsd:anySimpleType";
|
|
20
|
+
anyType: "xsd:anyType";
|
|
21
|
+
anyURI: "xsd:anyURI";
|
|
22
|
+
base64Binary: "xsd:base64Binary";
|
|
23
|
+
byte: "xsd:byte";
|
|
24
|
+
dateTime: "xsd:dateTime";
|
|
25
|
+
dateTimeStamp: "xsd:dateTimeStamp";
|
|
26
|
+
dayTimeDuration: "xsd:dayTimeDuration";
|
|
27
|
+
decimal: "xsd:decimal";
|
|
28
|
+
double: "xsd:double";
|
|
29
|
+
float: "xsd:float";
|
|
30
|
+
gDay: "xsd:gDay";
|
|
31
|
+
gMonth: "xsd:gMonth";
|
|
32
|
+
gMonthDay: "xsd:gMonthDay";
|
|
33
|
+
gYear: "xsd:gYear";
|
|
34
|
+
gYearMonth: "xsd:gYearMonth";
|
|
35
|
+
hexBinary: "xsd:hexBinary";
|
|
36
|
+
int: "xsd:int";
|
|
37
|
+
integer: "xsd:integer";
|
|
38
|
+
long: "xsd:long";
|
|
39
|
+
negativeInteger: "xsd:negativeInteger";
|
|
40
|
+
nonNegativeInteger: "xsd:nonNegativeInteger";
|
|
41
|
+
nonPositiveInteger: "xsd:nonPositiveInteger";
|
|
42
|
+
normalizedString: "xsd:normalizedString";
|
|
43
|
+
positiveInteger: "xsd:positiveInteger";
|
|
44
|
+
short: "xsd:short";
|
|
45
|
+
time: "xsd:time";
|
|
46
|
+
token: "xsd:token";
|
|
47
|
+
unsignedByte: "xsd:unsignedByte";
|
|
48
|
+
unsignedInt: "xsd:unsignedInt";
|
|
49
|
+
unsignedLong: "xsd:unsignedLong";
|
|
50
|
+
unsignedShort: "xsd:unsignedShort";
|
|
51
|
+
yearMonthDuration: "xsd:yearMonthDuration";
|
|
52
|
+
} & {
|
|
53
|
+
$prefix: "xsd:";
|
|
54
|
+
$iri: "http://www.w3.org/2001/XMLSchema#";
|
|
55
|
+
};
|
|
56
|
+
export default _default;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { NamedNode, BlankNode, Literal, Variable, Quad, Term, Bindings } from "rdf-js";
|
|
2
|
+
export type { NamedNode, BlankNode, Literal, Variable, Quad, Term, Bindings };
|
|
3
|
+
export { fromRdf, toRdf } from "rdf-literal";
|
|
4
|
+
import * as DataFactory from "rdf-data-factory";
|
|
5
|
+
export { DataFactory } from "rdf-data-factory";
|
|
6
|
+
export declare type Iri = string;
|
|
7
|
+
export declare type Node = Map<Iri, Term[]>;
|
|
8
|
+
export declare type Graph = Map<Iri, Node>;
|
|
9
|
+
export declare const namedNode: <Iri_1 extends string = string>(value: Iri_1) => NamedNode<Iri_1>;
|
|
10
|
+
export declare const blankNode: (value: string) => DataFactory.BlankNode;
|
|
11
|
+
export declare const literal: (value: string, languageOrDatatype?: string | NamedNode) => Literal;
|
|
12
|
+
export declare const quad: (subject: Quad["subject"], predicate: Quad["predicate"], object: Quad["object"], graph?: Quad["graph"]) => Quad;
|
|
13
|
+
export declare const variable: (value: string) => Variable;
|
|
14
|
+
export declare const quadsToGraph: (quads: Quad[]) => Graph;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createResource, Resource } from "./resource.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Schema } from "../schema/mod.js";
|
|
2
|
+
import { Quad, Iri } from "../rdf.js";
|
|
3
|
+
import type { Context } from "../context.js";
|
|
4
|
+
import type { Entity } from "./types.js";
|
|
5
|
+
export declare class QueryBuilder {
|
|
6
|
+
private readonly schema;
|
|
7
|
+
private readonly schemaProperties;
|
|
8
|
+
private readonly context;
|
|
9
|
+
constructor(schema: Schema, context: Context);
|
|
10
|
+
private getResourceSignature;
|
|
11
|
+
private getTypesSignature;
|
|
12
|
+
private entitiesToQuads;
|
|
13
|
+
private getShape;
|
|
14
|
+
countQuery(): string;
|
|
15
|
+
getQuery(where?: string | Quad[], limit?: number): string;
|
|
16
|
+
getByIrisQuery(iris: Iri[]): string;
|
|
17
|
+
insertQuery(entities: Entity[]): string;
|
|
18
|
+
insertDataQuery(quads: Quad[]): string;
|
|
19
|
+
deleteQuery: (iris: Iri[]) => string;
|
|
20
|
+
deleteDataQuery(quads: Quad[]): string;
|
|
21
|
+
updateQuery(entities: Entity[]): string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Context } from "../context.js";
|
|
2
|
+
import type { Schema } from "../schema/mod.js";
|
|
3
|
+
import type { Quad } from "../rdf.js";
|
|
4
|
+
import type { Entity } from "./types.js";
|
|
5
|
+
export declare class QueryHelper {
|
|
6
|
+
private readonly entity;
|
|
7
|
+
private readonly schema;
|
|
8
|
+
private readonly context;
|
|
9
|
+
private readonly variableInitCounter;
|
|
10
|
+
private quads?;
|
|
11
|
+
private variableQuads?;
|
|
12
|
+
constructor(entity: Entity, schema: Schema, context: Context, variableInitCounter?: number);
|
|
13
|
+
getQuads(): Quad[];
|
|
14
|
+
getVariableQuads(): Quad[];
|
|
15
|
+
getDeleteQuads(): Quad[];
|
|
16
|
+
getInsertQuads(): Quad[];
|
|
17
|
+
getWhereQuads(): Quad[];
|
|
18
|
+
private getEntityWithReplacedVariables;
|
|
19
|
+
private replaceVariables;
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Iri, Quad } from "../rdf.js";
|
|
2
|
+
import { type Context } from "../context.js";
|
|
3
|
+
import { type SchemaPrototype, type SchemaInterface, type SchemaInterfaceIdentity } from "../schema/mod.js";
|
|
4
|
+
import type { Entity } from "./types.js";
|
|
5
|
+
export declare const createResource: <T extends SchemaPrototype>(spec: T, context?: Context) => Resource<T, SchemaInterface<T>>;
|
|
6
|
+
export declare class Resource<S extends SchemaPrototype, I = SchemaInterface<S>> {
|
|
7
|
+
private readonly schema;
|
|
8
|
+
private readonly context;
|
|
9
|
+
private readonly queryBuilder;
|
|
10
|
+
private readonly $trigger;
|
|
11
|
+
constructor(schema: S, context?: Context);
|
|
12
|
+
private decode;
|
|
13
|
+
count(): import("rxjs/internal/Observable").Observable<number>;
|
|
14
|
+
query(sparqlConstructQuery: string): import("rxjs/internal/Observable").Observable<I[]>;
|
|
15
|
+
find(where?: string | Quad[], limit?: number): import("rxjs/internal/Observable").Observable<I[]>;
|
|
16
|
+
findByIri(iri: Iri): import("rxjs/internal/Observable").Observable<I | undefined>;
|
|
17
|
+
findByIris(iris: Iri[]): import("rxjs/internal/Observable").Observable<I[]>;
|
|
18
|
+
private updateQuery;
|
|
19
|
+
insert(...entities: Entity<I>[]): import("rxjs/internal/Observable").Observable<void>;
|
|
20
|
+
insertData(...quads: Quad[]): import("rxjs/internal/Observable").Observable<void>;
|
|
21
|
+
update(...entities: Entity<I>[]): import("rxjs/internal/Observable").Observable<void>;
|
|
22
|
+
delete(...identities: SchemaInterfaceIdentity[] | Iri[]): import("rxjs/internal/Observable").Observable<void>;
|
|
23
|
+
deleteData(...quads: Quad[]): import("rxjs/internal/Observable").Observable<void>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SchemaInterfaceIdentity } from "../schema/mod.js";
|
|
2
|
+
export declare type Entity<T extends any = Record<string, any>> = DeepPartial<T> & SchemaInterfaceIdentity;
|
|
3
|
+
export declare type DeepPartial<T> = T extends Function ? T : T extends object ? {
|
|
4
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
5
|
+
} : T;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare const SupportedDataTypesPrototype: {
|
|
2
|
+
"xsd:dateTime": Date;
|
|
3
|
+
"xsd:date": Date;
|
|
4
|
+
"xsd:gDay": Date;
|
|
5
|
+
"xsd:gMonthDay": Date;
|
|
6
|
+
"xsd:gYear": Date;
|
|
7
|
+
"xsd:gYearMonth": Date;
|
|
8
|
+
"xsd:boolean": boolean;
|
|
9
|
+
"xsd:double": number;
|
|
10
|
+
"xsd:decimal": number;
|
|
11
|
+
"xsd:float": number;
|
|
12
|
+
"xsd:integer": number;
|
|
13
|
+
"xsd:long": number;
|
|
14
|
+
"xsd:int": number;
|
|
15
|
+
"xsd:byte": number;
|
|
16
|
+
"xsd:short": number;
|
|
17
|
+
"xsd:negativeInteger": number;
|
|
18
|
+
"xsd:nonNegativeInteger": number;
|
|
19
|
+
"xsd:nonPositiveInteger": number;
|
|
20
|
+
"xsd:positiveInteger": number;
|
|
21
|
+
"xsd:unsignedByte": number;
|
|
22
|
+
"xsd:unsignedInt": number;
|
|
23
|
+
"xsd:unsignedLong": number;
|
|
24
|
+
"xsd:unsignedShort": number;
|
|
25
|
+
"xsd:string": string;
|
|
26
|
+
"xsd:normalizedString": string;
|
|
27
|
+
"xsd:anyURI": string;
|
|
28
|
+
"xsd:base64Binary": string;
|
|
29
|
+
"xsd:language": string;
|
|
30
|
+
"xsd:Name": string;
|
|
31
|
+
"xsd:NCName": string;
|
|
32
|
+
"xsd:NMTOKEN": string;
|
|
33
|
+
"xsd:token": string;
|
|
34
|
+
"xsd:hexBinary": string;
|
|
35
|
+
"rdf:langString": string;
|
|
36
|
+
};
|
|
37
|
+
export declare type SupportedDataTypes = typeof SupportedDataTypesPrototype;
|
|
38
|
+
export declare type SupportedNativeTypes = SupportedDataTypes[keyof SupportedDataTypes];
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SupportedDataTypes } from "./data_types.js";
|
|
2
|
+
import type { SchemaPrototype, PropertyPrototype } from "./schema.js";
|
|
3
|
+
declare type IsOptional<Property extends PropertyPrototype> = Property extends {
|
|
4
|
+
"@optional": true;
|
|
5
|
+
} ? true : false;
|
|
6
|
+
declare type IsArray<Property extends PropertyPrototype> = Property extends {
|
|
7
|
+
"@array": true;
|
|
8
|
+
} ? true : false;
|
|
9
|
+
declare type IsMultilang<Property extends PropertyPrototype> = Property extends {
|
|
10
|
+
"@multilang": true;
|
|
11
|
+
} ? true : false;
|
|
12
|
+
declare type ValidPropertyDefinition = PropertyPrototype | string;
|
|
13
|
+
declare type ConvertPropertyType<T extends PropertyPrototype> = T extends {
|
|
14
|
+
"@context": SchemaPrototype;
|
|
15
|
+
} ? SchemaInterface<T["@context"]> : T extends {
|
|
16
|
+
"@type": any;
|
|
17
|
+
} ? T["@type"] extends keyof SupportedDataTypes ? SupportedDataTypes[T["@type"]] : never : string;
|
|
18
|
+
declare type ConvertPropertyOptional<T extends PropertyPrototype> = IsOptional<T> extends true ? ConvertPropertyType<T> | undefined : ConvertPropertyType<T>;
|
|
19
|
+
declare type ConvertPropertyArray<T extends PropertyPrototype> = IsArray<T> extends true ? ConvertPropertyType<T>[] : ConvertPropertyOptional<T>;
|
|
20
|
+
declare type ConvertPropertyMultilang<T extends PropertyPrototype> = IsMultilang<T> extends true ? IsArray<T> extends true ? Record<string, ConvertPropertyType<T>[]> : Record<string, ConvertPropertyType<T>> : ConvertPropertyArray<T>;
|
|
21
|
+
declare type ConvertPropertyObject<T extends PropertyPrototype> = ConvertPropertyMultilang<T>;
|
|
22
|
+
declare type ConvertProperty<T extends ValidPropertyDefinition> = T extends PropertyPrototype ? ConvertPropertyObject<T> : string;
|
|
23
|
+
export declare type SchemaInterfaceIdentity = {
|
|
24
|
+
$id: string;
|
|
25
|
+
};
|
|
26
|
+
export declare type SchemaInterfaceType = {
|
|
27
|
+
$type: string[];
|
|
28
|
+
};
|
|
29
|
+
export declare type SchemaInterface<T extends SchemaPrototype> = {
|
|
30
|
+
[X in Exclude<keyof T, "@type">]: T[X] extends ValidPropertyDefinition ? ConvertProperty<T[X]> : never;
|
|
31
|
+
} & SchemaInterfaceIdentity & SchemaInterfaceType;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SupportedDataTypes } from "./data_types.js";
|
|
2
|
+
declare type PropertyType = keyof SupportedDataTypes;
|
|
3
|
+
export declare type PropertyPrototype = {
|
|
4
|
+
"@id": string;
|
|
5
|
+
"@type"?: PropertyType;
|
|
6
|
+
"@context"?: SchemaPrototype;
|
|
7
|
+
"@optional"?: true;
|
|
8
|
+
"@array"?: true;
|
|
9
|
+
"@multilang"?: true;
|
|
10
|
+
};
|
|
11
|
+
export declare type SchemaPrototypeProperties = {
|
|
12
|
+
[key: string]: PropertyPrototype | string | readonly string[];
|
|
13
|
+
};
|
|
14
|
+
export declare type SchemaPrototypeType = {
|
|
15
|
+
"@type": string | readonly string[];
|
|
16
|
+
};
|
|
17
|
+
export declare type SchemaPrototype = SchemaPrototypeProperties & SchemaPrototypeType;
|
|
18
|
+
export declare type Property = {
|
|
19
|
+
"@id": string;
|
|
20
|
+
"@type"?: PropertyType;
|
|
21
|
+
"@context"?: Schema;
|
|
22
|
+
"@optional"?: true;
|
|
23
|
+
"@array"?: true;
|
|
24
|
+
"@multilang"?: true;
|
|
25
|
+
};
|
|
26
|
+
export declare type Schema = {
|
|
27
|
+
[key: string]: Property | string[];
|
|
28
|
+
"@type": string[];
|
|
29
|
+
};
|
|
30
|
+
export {};
|
package/types/mod.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { type SchemaInterface } from "./library/schema/mod.js";
|
|
2
|
+
export { createResource, type Resource } from "./library/resource/mod.js";
|
|
3
|
+
export { createNamespace } from "./library/namespaces/namespace.js";
|
|
4
|
+
export { type Context, createContext, createDefaultContext, } from "./library/context.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./library/namespaces/mod.js";
|
package/types/rdf.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./library/rdf.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./library/sparql.js";
|
package/esm/_dnt.shims.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { Deno } from "@deno/shim-deno";
|
|
2
|
-
export { Deno } from "@deno/shim-deno";
|
|
3
|
-
import { fetch, File, FormData, Headers, Request, Response } from "undici";
|
|
4
|
-
export { fetch, File, FormData, Headers, Request, Response } from "undici";
|
|
5
|
-
const dntGlobals = {
|
|
6
|
-
Deno,
|
|
7
|
-
fetch,
|
|
8
|
-
File,
|
|
9
|
-
FormData,
|
|
10
|
-
Headers,
|
|
11
|
-
Request,
|
|
12
|
-
Response,
|
|
13
|
-
};
|
|
14
|
-
export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
15
|
-
// deno-lint-ignore ban-types
|
|
16
|
-
function createMergeProxy(baseObj, extObj) {
|
|
17
|
-
return new Proxy(baseObj, {
|
|
18
|
-
get(_target, prop, _receiver) {
|
|
19
|
-
if (prop in extObj) {
|
|
20
|
-
return extObj[prop];
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
return baseObj[prop];
|
|
24
|
-
}
|
|
25
|
-
},
|
|
26
|
-
set(_target, prop, value) {
|
|
27
|
-
if (prop in extObj) {
|
|
28
|
-
delete extObj[prop];
|
|
29
|
-
}
|
|
30
|
-
baseObj[prop] = value;
|
|
31
|
-
return true;
|
|
32
|
-
},
|
|
33
|
-
deleteProperty(_target, prop) {
|
|
34
|
-
let success = false;
|
|
35
|
-
if (prop in extObj) {
|
|
36
|
-
delete extObj[prop];
|
|
37
|
-
success = true;
|
|
38
|
-
}
|
|
39
|
-
if (prop in baseObj) {
|
|
40
|
-
delete baseObj[prop];
|
|
41
|
-
success = true;
|
|
42
|
-
}
|
|
43
|
-
return success;
|
|
44
|
-
},
|
|
45
|
-
ownKeys(_target) {
|
|
46
|
-
const baseKeys = Reflect.ownKeys(baseObj);
|
|
47
|
-
const extKeys = Reflect.ownKeys(extObj);
|
|
48
|
-
const extKeysSet = new Set(extKeys);
|
|
49
|
-
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
50
|
-
},
|
|
51
|
-
defineProperty(_target, prop, desc) {
|
|
52
|
-
if (prop in extObj) {
|
|
53
|
-
delete extObj[prop];
|
|
54
|
-
}
|
|
55
|
-
Reflect.defineProperty(baseObj, prop, desc);
|
|
56
|
-
return true;
|
|
57
|
-
},
|
|
58
|
-
getOwnPropertyDescriptor(_target, prop) {
|
|
59
|
-
if (prop in extObj) {
|
|
60
|
-
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
has(_target, prop) {
|
|
67
|
-
return prop in extObj || prop in baseObj;
|
|
68
|
-
},
|
|
69
|
-
});
|
|
70
|
-
}
|