@treenity/core 1.0.33 → 1.0.34
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/CHANGELOG.md +8 -0
- package/dist/meta-type.d.ts +19 -4
- package/dist/meta-type.mjs +1 -1
- package/dist/node/types.d.ts +7 -2
- package/package.json +3 -3
- package/dist/test/proxy-chain.test.d.ts +0 -1
package/CHANGELOG.md
CHANGED
package/dist/meta-type.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ export declare class MetaTypeImpl<T> implements MetaType<T>, Typed {
|
|
|
8
8
|
$item?: T;
|
|
9
9
|
$loc: string;
|
|
10
10
|
constructor(type: string, context: string);
|
|
11
|
+
toJSON(): {
|
|
12
|
+
$type: string;
|
|
13
|
+
$context: string;
|
|
14
|
+
};
|
|
11
15
|
get $id(): string;
|
|
12
16
|
get server(): MetaType<T>;
|
|
13
17
|
get client(): MetaType<T>;
|
|
@@ -16,8 +20,20 @@ export declare class MetaTypeImpl<T> implements MetaType<T>, Typed {
|
|
|
16
20
|
toString(): string;
|
|
17
21
|
isEqual(other: MetaName<any>, context?: string | boolean): boolean;
|
|
18
22
|
}
|
|
19
|
-
type
|
|
20
|
-
|
|
23
|
+
export type MetaType<T> = {
|
|
24
|
+
$type: string;
|
|
25
|
+
$context: string;
|
|
26
|
+
$item?: T;
|
|
27
|
+
$loc: string;
|
|
28
|
+
toJSON(): any;
|
|
29
|
+
$id: string;
|
|
30
|
+
server: MetaType<T>;
|
|
31
|
+
client: MetaType<T>;
|
|
32
|
+
empty: MetaType<T>;
|
|
33
|
+
inContext<T1 = T>(this: MetaType<any>, context: string): MetaType<T1>;
|
|
34
|
+
toString(): string;
|
|
35
|
+
isEqual(other: MetaName<any>, context?: string | boolean): boolean;
|
|
36
|
+
};
|
|
21
37
|
export type MetaName<T> = MetaType<T> | string;
|
|
22
38
|
export type MetaPath = Link | string;
|
|
23
39
|
export type FromMetaType<T> = T extends MetaType<infer U> ? U : never;
|
|
@@ -32,5 +48,4 @@ export declare class AntTypeImpl extends MetaTypeImpl<any> {
|
|
|
32
48
|
isEqual(other: MetaName<any>, context?: string | boolean): boolean;
|
|
33
49
|
inContext<T1 = any>(context: string): MetaType<any>;
|
|
34
50
|
}
|
|
35
|
-
export declare const AnyType:
|
|
36
|
-
export {};
|
|
51
|
+
export declare const AnyType: MetaType<any>;
|
package/dist/meta-type.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getFileFromStack as t}from"@treenity/js-shared/utils";import{getTypeName as e}from"./meta.mjs";function n(t,e){return e?`${e}:${t}`:t}class r{$type;$context;$item;$loc="unknown";constructor(t,e){this.$type=t,this.$context=e}get $id(){return n(this.$type,this.$context)}get server(){return"server"===this.$context?this:this.inContext("server")}get client(){return"client"===this.$context?this:this.inContext("client")}get empty(){return this.$context?this.inContext(""):this}inContext(t){return
|
|
1
|
+
import{getFileFromStack as t}from"@treenity/js-shared/utils";import{getTypeName as e}from"./meta.mjs";function n(t,e){return e?`${e}:${t}`:t}class r{$type;$context;$item;$loc="unknown";constructor(t,e){this.$type=t,this.$context=e}toJSON(){return{$type:this.$type,$context:this.$context}}get $id(){return n(this.$type,this.$context)}get server(){return"server"===this.$context?this:this.inContext("server")}get client(){return"client"===this.$context?this:this.inContext("client")}get empty(){return this.$context?this.inContext(""):this}inContext(t){return o(this,t)}toString(){return`[${this.$id}]`}isEqual(t,e){return"boolean"==typeof e?(t=o(t),this.$type===t.$type&&(!e||this.$context===t.$context)):(t=o(t,e),this.$type===t.$type&&this.$context===t.$context)}}function i(t){return"string"==typeof t?t:t.toString()}function o(i,o){o??="string"==typeof i?"":i.$context,i=e(i);const s=c[n(i,o)];if(s)return s;const $=new r(i,o);return $.$loc=t(3),c[n(i,o)]=Object.freeze($),$}class s extends r{constructor(){super("any","")}isEqual(t,e){return!0}inContext(t){return this}}const c={any:new s},$=o("any");export{s as AntTypeImpl,$ as AnyType,r as MetaTypeImpl,n as makeTypeId,o as metaType,i as pathToString};
|
package/dist/node/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Raw } from '@treenity/js-shared/utils';
|
|
2
|
+
import { CallChain } from '@treenity/call-chain';
|
|
2
3
|
import { Meta, MetaRaw } from '../meta';
|
|
3
4
|
import { MetaName, MetaPath } from '../meta-type';
|
|
4
5
|
export interface NodeRef {
|
|
@@ -25,7 +26,11 @@ export interface Node extends NodeData {
|
|
|
25
26
|
allRaw(): MetaRaw[];
|
|
26
27
|
raw<T>(type: MetaName<T>, path?: MetaPath): T | undefined;
|
|
27
28
|
get<T>(type: MetaName<T>, path?: MetaPath): Promise<T>;
|
|
28
|
-
|
|
29
|
+
/**
|
|
30
|
+
* use `$get(metaName, name)` instead of `get()` to get promise with type definitions, for now it is
|
|
31
|
+
* the limitations of TS lang.
|
|
32
|
+
*/
|
|
33
|
+
$$: CallChain<Node>;
|
|
29
34
|
add<T>(type: MetaName<T>, meta: Raw<T>, name?: string): Promise<T>;
|
|
30
35
|
remove(meta: string | any): Promise<boolean>;
|
|
31
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treenity/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.34",
|
|
4
4
|
"description": "treenity core",
|
|
5
5
|
"author": "Treenity",
|
|
6
6
|
"license": "ISC",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@treenity/js-shared": "1.0.
|
|
17
|
+
"@treenity/js-shared": "1.0.27",
|
|
18
18
|
"json-schema": "^0.4.0",
|
|
19
19
|
"json-schema-to-ts": "3.1.0",
|
|
20
20
|
"synchronous-promise": "2.0.17",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@testing-library/dom": "^8.17.1",
|
|
28
28
|
"@testing-library/jest-dom": "6.4.5",
|
|
29
|
-
"@treenity/build-utils": "1.1.
|
|
29
|
+
"@treenity/build-utils": "1.1.22",
|
|
30
30
|
"@treenity/tsconfig": "1.0.10",
|
|
31
31
|
"@types/jest": "29.5.12",
|
|
32
32
|
"@types/json-schema": "^7.0.15",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|