rdfjs-wrapper 0.8.0 → 0.9.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.
@@ -0,0 +1,5 @@
1
+ export declare enum GetterArity {
2
+ Singular = 0,
3
+ Objects = 1
4
+ }
5
+ //# sourceMappingURL=GetterArity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetterArity.d.ts","sourceRoot":"","sources":["../../src/decorators/GetterArity.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACnB,QAAQ,IAAA;IACR,OAAO,IAAA;CACV"}
@@ -0,0 +1,6 @@
1
+ export var GetterArity;
2
+ (function (GetterArity) {
3
+ GetterArity[GetterArity["Singular"] = 0] = "Singular";
4
+ GetterArity[GetterArity["Objects"] = 1] = "Objects";
5
+ })(GetterArity || (GetterArity = {}));
6
+ //# sourceMappingURL=GetterArity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GetterArity.js","sourceRoot":"","sources":["../../src/decorators/GetterArity.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,qDAAQ,CAAA;IACR,mDAAO,CAAA;AACX,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB"}
@@ -0,0 +1,5 @@
1
+ import { GetterArity } from "./GetterArity.js";
2
+ import type { ValueMapping } from "../ValueMapping.js";
3
+ import type { TermMapping } from "../TermMapping.js";
4
+ export declare function getter(predicate: string, getterArity: GetterArity, valueMapping: ValueMapping<any>, termMapping?: TermMapping<any>): any;
5
+ //# sourceMappingURL=getter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getter.d.ts","sourceRoot":"","sources":["../../src/decorators/getter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAC5C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAA;AAIlD,wBAAgB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,WAAW,GAAE,WAAW,CAAC,GAAG,CAAgC,GAAG,GAAG,CAatK"}
@@ -0,0 +1,16 @@
1
+ import { GetterArity } from "./GetterArity.js";
2
+ import { TermMappings } from "../TermMappings.js";
3
+ export function getter(predicate, getterArity, valueMapping, termMapping = TermMappings.StringToLiteral) {
4
+ return function (target, context) {
5
+ return function () {
6
+ const p = this.factory.namedNode(predicate);
7
+ switch (getterArity) {
8
+ case GetterArity.Singular:
9
+ return this.singular(p, valueMapping);
10
+ case GetterArity.Objects:
11
+ return this.objects(p, valueMapping, termMapping);
12
+ }
13
+ };
14
+ };
15
+ }
16
+ //# sourceMappingURL=getter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getter.js","sourceRoot":"","sources":["../../src/decorators/getter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAG5C,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAA;AAG/C,MAAM,UAAU,MAAM,CAAC,SAAiB,EAAE,WAAwB,EAAE,YAA+B,EAAE,cAAgC,YAAY,CAAC,eAAe;IAC7J,OAAO,UAAU,MAAW,EAAE,OAAoC;QAC9D,OAAO;YACH,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;YAE3C,QAAQ,WAAW,EAAE,CAAC;gBAClB,KAAK,WAAW,CAAC,QAAQ;oBACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,YAAY,CAAC,CAAA;gBACzC,KAAK,WAAW,CAAC,OAAO;oBACpB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,YAAY,EAAE,WAAW,CAAC,CAAA;YACzD,CAAC;QACL,CAAC,CAAA;IACL,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { SetterArity } from "./setterArity.js";
2
+ import type { TermMapping } from "../TermMapping.js";
3
+ export declare function setter(predicate: string, setterArity: SetterArity, termMapping: TermMapping<any>): any;
4
+ //# sourceMappingURL=setter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setter.d.ts","sourceRoot":"","sources":["../../src/decorators/setter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAC5C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAA;AAGlD,wBAAgB,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,GAAG,GAAG,CAetG"}
@@ -0,0 +1,17 @@
1
+ import { SetterArity } from "./setterArity.js";
2
+ export function setter(predicate, setterArity, termMapping) {
3
+ return function (target, context) {
4
+ return function (value) {
5
+ const p = this.factory.namedNode(predicate);
6
+ switch (setterArity) {
7
+ case SetterArity.Overwrite:
8
+ this.overwrite(p, value, termMapping);
9
+ break;
10
+ case SetterArity.OverwriteNullable:
11
+ this.overwriteNullable(p, value, termMapping);
12
+ break;
13
+ }
14
+ };
15
+ };
16
+ }
17
+ //# sourceMappingURL=setter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setter.js","sourceRoot":"","sources":["../../src/decorators/setter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAI5C,MAAM,UAAU,MAAM,CAAC,SAAiB,EAAE,WAAwB,EAAE,WAA6B;IAC7F,OAAO,UAAU,MAAW,EAAE,OAAoC;QAC9D,OAAO,UAAyB,KAAU;YACtC,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;YAE3C,QAAQ,WAAW,EAAE,CAAC;gBAClB,KAAK,WAAW,CAAC,SAAS;oBACtB,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAA;oBACrC,MAAK;gBACT,KAAK,WAAW,CAAC,iBAAiB;oBAC9B,IAAI,CAAC,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,CAAC,CAAA;oBAC7C,MAAK;YACb,CAAC;QACL,CAAC,CAAA;IACL,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare enum SetterArity {
2
+ Overwrite = 0,
3
+ OverwriteNullable = 1
4
+ }
5
+ //# sourceMappingURL=setterArity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setterArity.d.ts","sourceRoot":"","sources":["../../src/decorators/setterArity.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACnB,SAAS,IAAA;IACT,iBAAiB,IAAA;CACpB"}
@@ -0,0 +1,6 @@
1
+ export var SetterArity;
2
+ (function (SetterArity) {
3
+ SetterArity[SetterArity["Overwrite"] = 0] = "Overwrite";
4
+ SetterArity[SetterArity["OverwriteNullable"] = 1] = "OverwriteNullable";
5
+ })(SetterArity || (SetterArity = {}));
6
+ //# sourceMappingURL=setterArity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setterArity.js","sourceRoot":"","sources":["../../src/decorators/setterArity.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,uDAAS,CAAA;IACT,uEAAiB,CAAA;AACrB,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB"}
package/dist/mod.d.ts CHANGED
@@ -4,4 +4,8 @@ export * from "./ValueMapping.js";
4
4
  export * from "./ValueMappings.js";
5
5
  export * from "./Wrapper.js";
6
6
  export * from "./WrappingSet.js";
7
+ export * from "./decorators/GetterArity.js";
8
+ export * from "./decorators/setterArity.js";
9
+ export * from "./decorators/getter.js";
10
+ export * from "./decorators/setter.js";
7
11
  //# sourceMappingURL=mod.d.ts.map
package/dist/mod.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA"}
package/dist/mod.js CHANGED
@@ -4,4 +4,8 @@ export * from "./ValueMapping.js";
4
4
  export * from "./ValueMappings.js";
5
5
  export * from "./Wrapper.js";
6
6
  export * from "./WrappingSet.js";
7
+ export * from "./decorators/GetterArity.js";
8
+ export * from "./decorators/setterArity.js";
9
+ export * from "./decorators/getter.js";
10
+ export * from "./decorators/setter.js";
7
11
  //# sourceMappingURL=mod.js.map
package/dist/mod.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA"}
1
+ {"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,kBAAkB,CAAA;AAChC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,wBAAwB,CAAA;AACtC,cAAc,wBAAwB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rdfjs-wrapper",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "RDF/JS object mapping library",
5
5
  "main": "dist/mod.js",
6
6
  "type": "module",
@@ -1,10 +0,0 @@
1
- declare class x {
2
- p: string;
3
- get p1(): string;
4
- set p1(value: string);
5
- }
6
- declare function property(predicate: string): any;
7
- declare function node(target: any, context: ClassDecoratorContext): any;
8
- declare const xx: x;
9
- declare const xxp1: string;
10
- //# sourceMappingURL=decorators.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../../src/stuff/decorators.ts"],"names":[],"mappings":"AAEA,cACM,CAAC;IACH,CAAC,SAAM;IAEP,IACI,EAAE,IAAI,MAAM,CAAoB;IAEpC,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,EAAK;CAC5B;AAED,iBAAS,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG,CAoBxC;AACD,iBAAS,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,qBAAqB,GAAG,GAAG,CAiB9D;AAGD,QAAA,MAAM,EAAE,GAAQ,CAAA;AAGhB,QAAA,MAAM,IAAI,QAAQ,CAAA"}
@@ -1,99 +0,0 @@
1
- "use strict";
2
- // TODO: Remove or implement
3
- var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
4
- var useValue = arguments.length > 2;
5
- for (var i = 0; i < initializers.length; i++) {
6
- value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
7
- }
8
- return useValue ? value : void 0;
9
- };
10
- var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
11
- function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
12
- var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
13
- var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
14
- var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
15
- var _, done = false;
16
- for (var i = decorators.length - 1; i >= 0; i--) {
17
- var context = {};
18
- for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
19
- for (var p in contextIn.access) context.access[p] = contextIn.access[p];
20
- context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
21
- var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
22
- if (kind === "accessor") {
23
- if (result === void 0) continue;
24
- if (result === null || typeof result !== "object") throw new TypeError("Object expected");
25
- if (_ = accept(result.get)) descriptor.get = _;
26
- if (_ = accept(result.set)) descriptor.set = _;
27
- if (_ = accept(result.init)) initializers.unshift(_);
28
- }
29
- else if (_ = accept(result)) {
30
- if (kind === "field") initializers.unshift(_);
31
- else descriptor[key] = _;
32
- }
33
- }
34
- if (target) Object.defineProperty(target, contextIn.name, descriptor);
35
- done = true;
36
- };
37
- let x = (() => {
38
- let _classDecorators = [node];
39
- let _classDescriptor;
40
- let _classExtraInitializers = [];
41
- let _classThis;
42
- let _instanceExtraInitializers = [];
43
- let _get_p1_decorators;
44
- var x = class {
45
- static { _classThis = this; }
46
- static {
47
- const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
48
- _get_p1_decorators = [property("sss")];
49
- __esDecorate(this, null, _get_p1_decorators, { kind: "getter", name: "p1", static: false, private: false, access: { has: obj => "p1" in obj, get: obj => obj.p1 }, metadata: _metadata }, null, _instanceExtraInitializers);
50
- __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
51
- x = _classThis = _classDescriptor.value;
52
- if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
53
- __runInitializers(_classThis, _classExtraInitializers);
54
- }
55
- p = (__runInitializers(this, _instanceExtraInitializers), "v");
56
- get p1() { throw new Error; }
57
- set p1(value) { }
58
- };
59
- return x = _classThis;
60
- })();
61
- function property(predicate) {
62
- console.log("property annotation", predicate);
63
- return function (target, context) {
64
- console.log("property factory");
65
- console.log(target);
66
- console.log(context);
67
- context.addInitializer(function () {
68
- console.log("property initializer", this instanceof Object /*GraphWrapperNode*/);
69
- });
70
- return function () {
71
- console.log("property replacer");
72
- return "replaced value";
73
- };
74
- };
75
- }
76
- function node(target, context) {
77
- console.log("node factory");
78
- console.log(target);
79
- console.log(context);
80
- target.wrap = function () { };
81
- context.addInitializer(function () {
82
- console.log("node initializer", this);
83
- });
84
- return function () {
85
- console.log("node replacer");
86
- const a = new target;
87
- a.prototype = 0;
88
- a.xxx = "yyy";
89
- return a;
90
- };
91
- }
92
- console.log("before instantiation");
93
- const xx = new x;
94
- console.log("after instantiation, before invocation");
95
- console.log(xx);
96
- const xxp1 = xx.p1;
97
- console.log("after invocation");
98
- console.log(xxp1);
99
- //# sourceMappingURL=decorators.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/stuff/decorators.ts"],"names":[],"mappings":";AAAA,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAGtB,CAAC;4BADN,IAAI;;;;;;;;;;kCAIA,QAAQ,CAAC,KAAK,CAAC;YAChB,6JAAI,EAAE,6DAA8B;YAJxC,6KAOC;;;YAPK,uDAAC;;QACH,CAAC,IADC,mDAAC,EACC,GAAG,EAAA;Q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