ldkit 0.0.5 → 0.5.0
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/decoder.js +5 -0
- package/esm/library/encoder.js +5 -5
- package/esm/library/engine/mod.js +2 -0
- package/esm/library/engine/query_engine.js +75 -0
- package/esm/library/engine/query_engine_proxy.js +35 -0
- package/esm/library/global.js +25 -0
- package/esm/library/namespaces/mod.js +1 -0
- package/esm/library/namespaces/rdfs.js +22 -0
- package/esm/library/rdf.js +78 -6
- package/esm/library/resource/query_builder.js +44 -37
- package/esm/library/resource/resource.js +19 -10
- package/esm/library/rxjs.js +2 -2
- 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/namespaces/package.json +1 -0
- package/package.json +17 -11
- package/rdf/package.json +1 -0
- package/script/library/decoder.js +5 -0
- package/script/library/encoder.js +4 -4
- package/script/library/engine/mod.js +7 -0
- package/script/library/engine/query_engine.js +79 -0
- package/script/library/engine/query_engine_proxy.js +39 -0
- package/script/library/global.js +32 -0
- package/script/library/namespaces/mod.js +3 -1
- package/script/library/namespaces/rdfs.js +24 -0
- package/script/library/rdf.js +84 -37
- package/script/library/resource/query_builder.js +41 -34
- package/script/library/resource/resource.js +19 -10
- package/script/library/rxjs.js +6 -3
- package/script/mod.js +4 -4
- package/script/namespaces.js +17 -0
- package/script/rdf.js +17 -0
- package/script/sparql.js +17 -0
- package/sparql/package.json +1 -0
- package/types/library/decoder.d.ts +2 -3
- package/types/library/encoder.d.ts +2 -3
- package/types/library/engine/mod.d.ts +2 -0
- package/types/library/engine/query_engine.d.ts +10 -0
- package/types/library/engine/query_engine_proxy.d.ts +10 -0
- package/types/library/global.d.ts +5 -0
- package/types/library/namespaces/dcterms.d.ts +1 -1
- package/types/library/namespaces/mod.d.ts +1 -0
- package/types/library/namespaces/rdf.d.ts +4 -4
- package/types/library/namespaces/rdfs.d.ts +21 -0
- package/types/library/namespaces/schema.d.ts +5 -5
- package/types/library/namespaces/skos.d.ts +1 -1
- package/types/library/rdf.d.ts +47 -8
- package/types/library/resource/query_builder.d.ts +5 -5
- package/types/library/resource/query_helper.d.ts +6 -7
- package/types/library/resource/resource.d.ts +8 -8
- package/types/library/rxjs.d.ts +2 -2
- package/types/mod.d.ts +3 -2
- 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 -58
- package/esm/library/comunica/bundle.js +0 -82389
- package/esm/library/comunica/mod.js +0 -1
- package/esm/library/context.js +0 -13
- package/esm/library/engine.js +0 -9
- package/script/_dnt.shims.js +0 -61
- package/script/library/comunica/bundle.js +0 -82415
- package/script/library/comunica/mod.js +0 -5
- package/script/library/context.js +0 -19
- package/script/library/engine.js +0 -16
- package/types/_dnt.shims.d.ts +0 -1
- package/types/library/comunica/bundle.d.ts +0 -2
- package/types/library/comunica/mod.d.ts +0 -3
- package/types/library/context.d.ts +0 -9
- package/types/library/engine.d.ts +0 -6
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Context, type IQueryEngine, type RDF } from "../rdf.js";
|
|
2
|
+
export declare class QueryEngine implements IQueryEngine {
|
|
3
|
+
protected getSparqlEndpoint(context?: Context): string;
|
|
4
|
+
protected getFetch(context?: Context): typeof fetch;
|
|
5
|
+
query(query: string, context?: Context): Promise<Response>;
|
|
6
|
+
queryBindings(query: string, context?: Context): Promise<RDF.ResultStream<RDF.Bindings>>;
|
|
7
|
+
queryBoolean(query: string, context?: Context): Promise<boolean>;
|
|
8
|
+
queryQuads(query: string, context?: Context): Promise<RDF.ResultStream<RDF.Quad>>;
|
|
9
|
+
queryVoid(query: string, context?: Context): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Context, IQueryEngine, type RDF } from "../rdf.js";
|
|
2
|
+
export declare class QueryEngineProxy {
|
|
3
|
+
private readonly context;
|
|
4
|
+
private readonly engine;
|
|
5
|
+
constructor(context?: Context, engine?: IQueryEngine);
|
|
6
|
+
queryBoolean(query: string): import("rxjs/internal/Observable").Observable<boolean>;
|
|
7
|
+
queryBindings(query: string): import("rxjs/internal/Observable").Observable<RDF.Bindings[]>;
|
|
8
|
+
queryGraph(query: string): import("rxjs/internal/Observable").Observable<import("../rdf.js").Graph>;
|
|
9
|
+
queryVoid(query: string): import("rxjs/internal/Observable").Observable<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Context, IQueryEngine } from "./rdf.js";
|
|
2
|
+
export declare const setDefaultContext: (context: Context) => void;
|
|
3
|
+
export declare const resolveContext: (context?: Context) => Context;
|
|
4
|
+
export declare const setDefaultEngine: (engine: IQueryEngine) => void;
|
|
5
|
+
export declare const resolveEngine: (engine?: IQueryEngine) => IQueryEngine;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
object: "rdf:object";
|
|
3
|
+
subject: "rdf:subject";
|
|
4
|
+
predicate: "rdf:predicate";
|
|
5
|
+
value: "rdf:value";
|
|
6
|
+
type: "rdf:type";
|
|
3
7
|
Alt: "rdf:Alt";
|
|
4
8
|
Bag: "rdf:Bag";
|
|
5
9
|
CompoundLiteral: "rdf:CompoundLiteral";
|
|
@@ -16,11 +20,7 @@ declare const _default: {
|
|
|
16
20
|
langString: "rdf:langString";
|
|
17
21
|
language: "rdf:language";
|
|
18
22
|
nil: "rdf:nil";
|
|
19
|
-
predicate: "rdf:predicate";
|
|
20
23
|
rest: "rdf:rest";
|
|
21
|
-
subject: "rdf:subject";
|
|
22
|
-
type: "rdf:type";
|
|
23
|
-
value: "rdf:value";
|
|
24
24
|
} & {
|
|
25
25
|
$prefix: "rdf:";
|
|
26
26
|
$iri: "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
Literal: "rdfs:Literal";
|
|
3
|
+
Class: "rdfs:Class";
|
|
4
|
+
Container: "rdfs:Container";
|
|
5
|
+
ContainerMembershipProperty: "rdfs:ContainerMembershipProperty";
|
|
6
|
+
Datatype: "rdfs:Datatype";
|
|
7
|
+
Resource: "rdfs:Resource";
|
|
8
|
+
comment: "rdfs:comment";
|
|
9
|
+
domain: "rdfs:domain";
|
|
10
|
+
isDefinedBy: "rdfs:isDefinedBy";
|
|
11
|
+
label: "rdfs:label";
|
|
12
|
+
member: "rdfs:member";
|
|
13
|
+
range: "rdfs:range";
|
|
14
|
+
seeAlso: "rdfs:seeAlso";
|
|
15
|
+
subClassOf: "rdfs:subClassOf";
|
|
16
|
+
subPropertyOf: "rdfs:subPropertyOf";
|
|
17
|
+
} & {
|
|
18
|
+
$prefix: "rdfs:";
|
|
19
|
+
$iri: "http://www.w3.org/2000/01/rdf-schema#";
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
declare const _default: {
|
|
2
2
|
object: "schema:object";
|
|
3
|
+
value: "schema:value";
|
|
4
|
+
error: "schema:error";
|
|
3
5
|
map: "schema:map";
|
|
4
6
|
Property: "schema:Property";
|
|
5
7
|
language: "schema:language";
|
|
6
|
-
|
|
8
|
+
Class: "schema:Class";
|
|
9
|
+
comment: "schema:comment";
|
|
10
|
+
member: "schema:member";
|
|
7
11
|
abstract: "schema:abstract";
|
|
8
12
|
audience: "schema:audience";
|
|
9
13
|
contributor: "schema:contributor";
|
|
@@ -200,7 +204,6 @@ declare const _default: {
|
|
|
200
204
|
CivicStructure: "schema:CivicStructure";
|
|
201
205
|
Claim: "schema:Claim";
|
|
202
206
|
ClaimReview: "schema:ClaimReview";
|
|
203
|
-
Class: "schema:Class";
|
|
204
207
|
CleaningFee: "schema:CleaningFee";
|
|
205
208
|
Clinician: "schema:Clinician";
|
|
206
209
|
Clip: "schema:Clip";
|
|
@@ -1563,7 +1566,6 @@ declare const _default: {
|
|
|
1563
1566
|
collectionSize: "schema:collectionSize";
|
|
1564
1567
|
color: "schema:color";
|
|
1565
1568
|
colorist: "schema:colorist";
|
|
1566
|
-
comment: "schema:comment";
|
|
1567
1569
|
commentCount: "schema:commentCount";
|
|
1568
1570
|
commentText: "schema:commentText";
|
|
1569
1571
|
commentTime: "schema:commentTime";
|
|
@@ -1766,7 +1768,6 @@ declare const _default: {
|
|
|
1766
1768
|
episodeNumber: "schema:episodeNumber";
|
|
1767
1769
|
episodes: "schema:episodes";
|
|
1768
1770
|
equal: "schema:equal";
|
|
1769
|
-
error: "schema:error";
|
|
1770
1771
|
estimatedCost: "schema:estimatedCost";
|
|
1771
1772
|
estimatedFlightDuration: "schema:estimatedFlightDuration";
|
|
1772
1773
|
estimatedSalary: "schema:estimatedSalary";
|
|
@@ -2093,7 +2094,6 @@ declare const _default: {
|
|
|
2093
2094
|
medicalSpecialty: "schema:medicalSpecialty";
|
|
2094
2095
|
medicineSystem: "schema:medicineSystem";
|
|
2095
2096
|
meetsEmissionStandard: "schema:meetsEmissionStandard";
|
|
2096
|
-
member: "schema:member";
|
|
2097
2097
|
memberOf: "schema:memberOf";
|
|
2098
2098
|
members: "schema:members";
|
|
2099
2099
|
membershipNumber: "schema:membershipNumber";
|
package/types/library/rdf.d.ts
CHANGED
|
@@ -1,14 +1,53 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export type {
|
|
1
|
+
import type { Bindings, BlankNode, Literal, NamedNode, Quad, Term, Variable } from "rdf-js";
|
|
2
|
+
export type { Bindings, BlankNode, Literal, NamedNode, Quad, Term, Variable };
|
|
3
|
+
import type * as RDF from "rdf-js";
|
|
4
|
+
export type { RDF };
|
|
3
5
|
export { fromRdf, toRdf } from "rdf-literal";
|
|
4
|
-
import * as DataFactory from "rdf-data-factory";
|
|
5
6
|
export { DataFactory } from "rdf-data-factory";
|
|
7
|
+
import { BindingsFactory as ComunicaBindingsFactory } from "@comunica/bindings-factory";
|
|
8
|
+
import type { IDataSource, IQueryContextCommon } from "@comunica/types";
|
|
9
|
+
export declare type LDkitContext = {
|
|
10
|
+
graph?: string;
|
|
11
|
+
language?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare type Context = LDkitContext & RDF.QueryStringContext & RDF.QuerySourceContext<IDataSource> & IQueryContextCommon;
|
|
14
|
+
export declare type IQueryEngine = RDF.StringSparqlQueryable<RDF.SparqlResultSupport, Context>;
|
|
6
15
|
export declare type Iri = string;
|
|
7
16
|
export declare type Node = Map<Iri, Term[]>;
|
|
8
17
|
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
18
|
export declare const quadsToGraph: (quads: Quad[]) => Graph;
|
|
19
|
+
export declare namespace RDFJSON {
|
|
20
|
+
type Term = {
|
|
21
|
+
type: "uri" | "literal" | "bnode";
|
|
22
|
+
value: string;
|
|
23
|
+
"xml:lang"?: string;
|
|
24
|
+
datatype?: string;
|
|
25
|
+
};
|
|
26
|
+
type Bindings = Record<string, Term>;
|
|
27
|
+
interface TermFactory {
|
|
28
|
+
fromJson(jsonTerm: Term): RDF.Term;
|
|
29
|
+
}
|
|
30
|
+
interface BindingsFactory {
|
|
31
|
+
fromJson(jsonBindings: Bindings): RDF.Bindings;
|
|
32
|
+
}
|
|
33
|
+
interface QuadFactory {
|
|
34
|
+
fromJson(jsonBindings: Bindings): RDF.Quad;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export declare class TermFactory implements RDFJSON.TermFactory {
|
|
38
|
+
protected readonly dataFactory: RDF.DataFactory;
|
|
39
|
+
constructor(dataFactory?: RDF.DataFactory);
|
|
40
|
+
fromJson(jsonTerm: RDFJSON.Term): BlankNode | Literal | NamedNode<string>;
|
|
41
|
+
}
|
|
42
|
+
export declare class BindingsFactory extends ComunicaBindingsFactory implements RDFJSON.BindingsFactory {
|
|
43
|
+
protected readonly localDataFactory: RDF.DataFactory;
|
|
44
|
+
protected readonly termFactory: RDFJSON.TermFactory;
|
|
45
|
+
constructor(dataFactory?: RDF.DataFactory, termFactory?: RDFJSON.TermFactory);
|
|
46
|
+
fromJson(jsonBindings: RDFJSON.Bindings): Bindings;
|
|
47
|
+
}
|
|
48
|
+
export declare class QuadFactory implements RDFJSON.QuadFactory {
|
|
49
|
+
protected readonly dataFactory: RDF.DataFactory;
|
|
50
|
+
protected readonly bindingsFactory: RDFJSON.BindingsFactory;
|
|
51
|
+
constructor(dataFactory?: RDF.DataFactory, bindingsFactory?: RDFJSON.BindingsFactory);
|
|
52
|
+
fromJson(jsonBindings: RDFJSON.Bindings): Quad;
|
|
53
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import type { Schema } from "../schema/mod.js";
|
|
2
|
-
import {
|
|
3
|
-
import type { Context } from "../context.js";
|
|
2
|
+
import { type Context, type Iri, type RDF } from "../rdf.js";
|
|
4
3
|
import type { Entity } from "./types.js";
|
|
5
4
|
export declare class QueryBuilder {
|
|
6
5
|
private readonly schema;
|
|
7
6
|
private readonly schemaProperties;
|
|
8
7
|
private readonly context;
|
|
8
|
+
private readonly df;
|
|
9
9
|
constructor(schema: Schema, context: Context);
|
|
10
10
|
private getResourceSignature;
|
|
11
11
|
private getTypesSignature;
|
|
12
12
|
private entitiesToQuads;
|
|
13
13
|
private getShape;
|
|
14
14
|
countQuery(): string;
|
|
15
|
-
getQuery(where?: string | Quad[], limit?: number): string;
|
|
15
|
+
getQuery(where?: string | RDF.Quad[], limit?: number): string;
|
|
16
16
|
getByIrisQuery(iris: Iri[]): string;
|
|
17
17
|
insertQuery(entities: Entity[]): string;
|
|
18
|
-
insertDataQuery(quads: Quad[]): string;
|
|
18
|
+
insertDataQuery(quads: RDF.Quad[]): string;
|
|
19
19
|
deleteQuery: (iris: Iri[]) => string;
|
|
20
|
-
deleteDataQuery(quads: Quad[]): string;
|
|
20
|
+
deleteDataQuery(quads: RDF.Quad[]): string;
|
|
21
21
|
updateQuery(entities: Entity[]): string;
|
|
22
22
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { Context } from "../
|
|
1
|
+
import type { Context, RDF } from "../rdf.js";
|
|
2
2
|
import type { Schema } from "../schema/mod.js";
|
|
3
|
-
import type { Quad } from "../rdf.js";
|
|
4
3
|
import type { Entity } from "./types.js";
|
|
5
4
|
export declare class QueryHelper {
|
|
6
5
|
private readonly entity;
|
|
@@ -10,11 +9,11 @@ export declare class QueryHelper {
|
|
|
10
9
|
private quads?;
|
|
11
10
|
private variableQuads?;
|
|
12
11
|
constructor(entity: Entity, schema: Schema, context: Context, variableInitCounter?: number);
|
|
13
|
-
getQuads(): Quad[];
|
|
14
|
-
getVariableQuads(): Quad[];
|
|
15
|
-
getDeleteQuads(): Quad[];
|
|
16
|
-
getInsertQuads(): Quad[];
|
|
17
|
-
getWhereQuads(): Quad[];
|
|
12
|
+
getQuads(): RDF.Quad[];
|
|
13
|
+
getVariableQuads(): RDF.Quad[];
|
|
14
|
+
getDeleteQuads(): RDF.Quad[];
|
|
15
|
+
getInsertQuads(): RDF.Quad[];
|
|
16
|
+
getWhereQuads(): RDF.Quad[];
|
|
18
17
|
private getEntityWithReplacedVariables;
|
|
19
18
|
private replaceVariables;
|
|
20
19
|
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import type { Iri,
|
|
2
|
-
import { type
|
|
3
|
-
import { type SchemaPrototype, type SchemaInterface, type SchemaInterfaceIdentity } from "../schema/mod.js";
|
|
1
|
+
import type { Context, IQueryEngine, Iri, RDF } from "../rdf.js";
|
|
2
|
+
import { type SchemaInterface, type SchemaInterfaceIdentity, type SchemaPrototype } from "../schema/mod.js";
|
|
4
3
|
import type { Entity } from "./types.js";
|
|
5
|
-
export declare const createResource: <T extends SchemaPrototype>(spec: T, context?: Context) => Resource<T, SchemaInterface<T>>;
|
|
4
|
+
export declare const createResource: <T extends SchemaPrototype>(spec: T, context?: Context, engine?: IQueryEngine) => Resource<T, SchemaInterface<T>>;
|
|
6
5
|
export declare class Resource<S extends SchemaPrototype, I = SchemaInterface<S>> {
|
|
7
6
|
private readonly schema;
|
|
8
7
|
private readonly context;
|
|
8
|
+
private readonly engine;
|
|
9
9
|
private readonly queryBuilder;
|
|
10
10
|
private readonly $trigger;
|
|
11
|
-
constructor(schema: S, context?: Context);
|
|
11
|
+
constructor(schema: S, context?: Context, engine?: IQueryEngine);
|
|
12
12
|
private decode;
|
|
13
13
|
count(): import("rxjs/internal/Observable").Observable<number>;
|
|
14
14
|
query(sparqlConstructQuery: string): import("rxjs/internal/Observable").Observable<I[]>;
|
|
15
|
-
find(where?: string | Quad[], limit?: number): import("rxjs/internal/Observable").Observable<I[]>;
|
|
15
|
+
find(where?: string | RDF.Quad[], limit?: number): import("rxjs/internal/Observable").Observable<I[]>;
|
|
16
16
|
findByIri(iri: Iri): import("rxjs/internal/Observable").Observable<I | undefined>;
|
|
17
17
|
findByIris(iris: Iri[]): import("rxjs/internal/Observable").Observable<I[]>;
|
|
18
18
|
private updateQuery;
|
|
19
19
|
insert(...entities: Entity<I>[]): import("rxjs/internal/Observable").Observable<void>;
|
|
20
|
-
insertData(...quads: Quad[]): import("rxjs/internal/Observable").Observable<void>;
|
|
20
|
+
insertData(...quads: RDF.Quad[]): import("rxjs/internal/Observable").Observable<void>;
|
|
21
21
|
update(...entities: Entity<I>[]): import("rxjs/internal/Observable").Observable<void>;
|
|
22
22
|
delete(...identities: SchemaInterfaceIdentity[] | Iri[]): import("rxjs/internal/Observable").Observable<void>;
|
|
23
|
-
deleteData(...quads: Quad[]): import("rxjs/internal/Observable").Observable<void>;
|
|
23
|
+
deleteData(...quads: RDF.Quad[]): import("rxjs/internal/Observable").Observable<void>;
|
|
24
24
|
}
|
package/types/library/rxjs.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { map, switchMap, tap,
|
|
1
|
+
export { BehaviorSubject, firstValueFrom, from, lastValueFrom, type Observable, of, } from "rxjs";
|
|
2
|
+
export { map, share, switchMap, tap, } from "rxjs/operators";
|
package/types/mod.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
export { type Context, type IQueryEngine } from "./library/rdf.js";
|
|
2
|
+
export { setDefaultContext, setDefaultEngine } from "./library/global.js";
|
|
1
3
|
export { type SchemaInterface } from "./library/schema/mod.js";
|
|
2
|
-
export { type Resource
|
|
4
|
+
export { createResource, type Resource } from "./library/resource/mod.js";
|
|
3
5
|
export { createNamespace } from "./library/namespaces/namespace.js";
|
|
4
|
-
export { createDefaultContext, createContext } 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,58 +0,0 @@
|
|
|
1
|
-
const dntGlobals = {};
|
|
2
|
-
export const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
|
|
3
|
-
// deno-lint-ignore ban-types
|
|
4
|
-
function createMergeProxy(baseObj, extObj) {
|
|
5
|
-
return new Proxy(baseObj, {
|
|
6
|
-
get(_target, prop, _receiver) {
|
|
7
|
-
if (prop in extObj) {
|
|
8
|
-
return extObj[prop];
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
return baseObj[prop];
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
set(_target, prop, value) {
|
|
15
|
-
if (prop in extObj) {
|
|
16
|
-
delete extObj[prop];
|
|
17
|
-
}
|
|
18
|
-
baseObj[prop] = value;
|
|
19
|
-
return true;
|
|
20
|
-
},
|
|
21
|
-
deleteProperty(_target, prop) {
|
|
22
|
-
let success = false;
|
|
23
|
-
if (prop in extObj) {
|
|
24
|
-
delete extObj[prop];
|
|
25
|
-
success = true;
|
|
26
|
-
}
|
|
27
|
-
if (prop in baseObj) {
|
|
28
|
-
delete baseObj[prop];
|
|
29
|
-
success = true;
|
|
30
|
-
}
|
|
31
|
-
return success;
|
|
32
|
-
},
|
|
33
|
-
ownKeys(_target) {
|
|
34
|
-
const baseKeys = Reflect.ownKeys(baseObj);
|
|
35
|
-
const extKeys = Reflect.ownKeys(extObj);
|
|
36
|
-
const extKeysSet = new Set(extKeys);
|
|
37
|
-
return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];
|
|
38
|
-
},
|
|
39
|
-
defineProperty(_target, prop, desc) {
|
|
40
|
-
if (prop in extObj) {
|
|
41
|
-
delete extObj[prop];
|
|
42
|
-
}
|
|
43
|
-
Reflect.defineProperty(baseObj, prop, desc);
|
|
44
|
-
return true;
|
|
45
|
-
},
|
|
46
|
-
getOwnPropertyDescriptor(_target, prop) {
|
|
47
|
-
if (prop in extObj) {
|
|
48
|
-
return Reflect.getOwnPropertyDescriptor(extObj, prop);
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
return Reflect.getOwnPropertyDescriptor(baseObj, prop);
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
has(_target, prop) {
|
|
55
|
-
return prop in extObj || prop in baseObj;
|
|
56
|
-
},
|
|
57
|
-
});
|
|
58
|
-
}
|