@xylabs/creatable 4.12.24 → 4.12.25
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/dist/types/TestCreatable.d.ts +12 -1
- package/dist/types/TestCreatable.d.ts.map +1 -1
- package/dist/types/TestCreatable2.d.ts +2 -0
- package/dist/types/TestCreatable2.d.ts.map +1 -0
- package/dist/types/model/CreatableParams.d.ts +2 -1
- package/dist/types/model/CreatableParams.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/TestCreatable.ts +3 -3
- package/src/TestCreatable2.ts +30 -0
- package/src/model/CreatableParams.ts +2 -1
|
@@ -1,2 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import type { EventData } from '@xylabs/events';
|
|
2
|
+
import { Promisable } from '@xylabs/promise';
|
|
3
|
+
import { AbstractCreatable } from './AbstractCreatable.ts';
|
|
4
|
+
import { Creatable } from './Creatable.ts';
|
|
5
|
+
import type { CreatableInstance, CreatableParams } from './model/index.ts';
|
|
6
|
+
export interface TestCreatableParams extends CreatableParams {
|
|
7
|
+
testParam: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class TestCreatable<TParams extends TestCreatableParams = TestCreatableParams, TEventData extends EventData = EventData> extends AbstractCreatable<TParams, TEventData> {
|
|
10
|
+
static createHandler<T extends CreatableInstance>(this: Creatable<T>, instance: T): Promisable<T>;
|
|
11
|
+
paramsValidator(params?: Partial<TParams>): TParams;
|
|
12
|
+
}
|
|
2
13
|
//# sourceMappingURL=TestCreatable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestCreatable.d.ts","sourceRoot":"","sources":["../../src/TestCreatable.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"TestCreatable.d.ts","sourceRoot":"","sources":["../../src/TestCreatable.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAa,MAAM,gBAAgB,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAE1E,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,SAAS,EAAE,MAAM,CAAA;CAClB;AAGD,qBAEa,aAAa,CAAC,OAAO,SAAS,mBAAmB,GAAG,mBAAmB,EAAE,UAAU,SAAS,SAAS,GAAG,SAAS,CAC5H,SAAQ,iBAAiB,CAAC,OAAO,EAAE,UAAU,CAAC;WAC9B,aAAa,CAAC,CAAC,SAAS,iBAAiB,EACvD,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,EAClB,QAAQ,EAAE,CAAC,GACV,UAAU,CAAC,CAAC,CAAC;IAIP,eAAe,CAAC,MAAM,GAAE,OAAO,CAAC,OAAO,CAAM,GAAG,OAAO;CAMjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestCreatable2.d.ts","sourceRoot":"","sources":["../../src/TestCreatable2.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { BaseClassName } from '@xylabs/base';
|
|
2
|
+
import type { BaseEmitterParams } from '@xylabs/events';
|
|
2
3
|
import type { CreatableStatusReporter } from './CreatableStatusReporter.ts';
|
|
3
4
|
export type CreatableName = Exclude<string, 'creatable-name-reserved-32546239486'> & BaseClassName;
|
|
4
|
-
export interface CreatableParams {
|
|
5
|
+
export interface CreatableParams extends BaseEmitterParams {
|
|
5
6
|
name: CreatableName;
|
|
6
7
|
statusReporter?: CreatableStatusReporter;
|
|
7
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreatableParams.d.ts","sourceRoot":"","sources":["../../../src/model/CreatableParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"CreatableParams.d.ts","sourceRoot":"","sources":["../../../src/model/CreatableParams.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAEvD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AAE3E,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,qCAAqC,CAAC,GAAG,aAAa,CAAA;AAElG,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD,IAAI,EAAE,aAAa,CAAA;IACnB,cAAc,CAAC,EAAE,uBAAuB,CAAA;CACzC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/creatable",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.25",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -29,13 +29,13 @@
|
|
|
29
29
|
"module": "dist/neutral/index.mjs",
|
|
30
30
|
"types": "dist/types/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xylabs/assert": "^4.12.
|
|
33
|
-
"@xylabs/base": "^4.12.
|
|
34
|
-
"@xylabs/events": "^4.12.
|
|
35
|
-
"@xylabs/logger": "^4.12.
|
|
36
|
-
"@xylabs/object": "^4.12.
|
|
37
|
-
"@xylabs/promise": "^4.12.
|
|
38
|
-
"@xylabs/typeof": "^4.12.
|
|
32
|
+
"@xylabs/assert": "^4.12.25",
|
|
33
|
+
"@xylabs/base": "^4.12.25",
|
|
34
|
+
"@xylabs/events": "^4.12.25",
|
|
35
|
+
"@xylabs/logger": "^4.12.25",
|
|
36
|
+
"@xylabs/object": "^4.12.25",
|
|
37
|
+
"@xylabs/promise": "^4.12.25",
|
|
38
|
+
"@xylabs/typeof": "^4.12.25"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@xylabs/ts-scripts-yarn3": "^6.5.9",
|
package/src/TestCreatable.ts
CHANGED
|
@@ -5,14 +5,14 @@ import { AbstractCreatable } from './AbstractCreatable.ts'
|
|
|
5
5
|
import { Creatable, creatable } from './Creatable.ts'
|
|
6
6
|
import type { CreatableInstance, CreatableParams } from './model/index.ts'
|
|
7
7
|
|
|
8
|
-
interface TestCreatableParams extends CreatableParams {
|
|
8
|
+
export interface TestCreatableParams extends CreatableParams {
|
|
9
9
|
testParam: string
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
// This is here to check types
|
|
13
13
|
@creatable()
|
|
14
|
-
|
|
15
|
-
class TestCreatable<TParams extends TestCreatableParams = TestCreatableParams, TEventData extends EventData = EventData>
|
|
14
|
+
|
|
15
|
+
export class TestCreatable<TParams extends TestCreatableParams = TestCreatableParams, TEventData extends EventData = EventData>
|
|
16
16
|
extends AbstractCreatable<TParams, TEventData> {
|
|
17
17
|
static override createHandler<T extends CreatableInstance>(
|
|
18
18
|
this: Creatable<T>,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { EventData } from '@xylabs/events'
|
|
2
|
+
import { Promisable } from '@xylabs/promise'
|
|
3
|
+
|
|
4
|
+
import { Creatable, creatable } from './Creatable.ts'
|
|
5
|
+
import type { CreatableInstance } from './model/index.ts'
|
|
6
|
+
import { TestCreatable, TestCreatableParams } from './TestCreatable.ts'
|
|
7
|
+
|
|
8
|
+
interface TestCreatableParams2 extends TestCreatableParams {
|
|
9
|
+
testParam2: number
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// This is here to check types
|
|
13
|
+
@creatable()
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
15
|
+
class TestCreatable2<TParams extends TestCreatableParams2 = TestCreatableParams2, TEventData extends EventData = EventData>
|
|
16
|
+
extends TestCreatable<TParams, TEventData> {
|
|
17
|
+
static override createHandler<T extends CreatableInstance>(
|
|
18
|
+
this: Creatable<T>,
|
|
19
|
+
instance: T,
|
|
20
|
+
): Promisable<T> {
|
|
21
|
+
return instance
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
override paramsValidator(params: Partial<TParams> = {}): TParams {
|
|
25
|
+
const result: TestCreatableParams = {
|
|
26
|
+
...params, name: params.name ?? this.constructor.name, testParam: 'yo',
|
|
27
|
+
}
|
|
28
|
+
return result as TParams
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { BaseClassName } from '@xylabs/base'
|
|
2
|
+
import type { BaseEmitterParams } from '@xylabs/events'
|
|
2
3
|
|
|
3
4
|
import type { CreatableStatusReporter } from './CreatableStatusReporter.ts'
|
|
4
5
|
|
|
5
6
|
export type CreatableName = Exclude<string, 'creatable-name-reserved-32546239486'> & BaseClassName
|
|
6
7
|
|
|
7
|
-
export interface CreatableParams {
|
|
8
|
+
export interface CreatableParams extends BaseEmitterParams {
|
|
8
9
|
name: CreatableName
|
|
9
10
|
statusReporter?: CreatableStatusReporter
|
|
10
11
|
}
|