@xylabs/creatable 4.13.15 → 4.13.17
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 +33 -42
- package/dist/neutral/index.d.ts +5 -110
- package/dist/neutral/spec/TestCreatable.spec.d.ts +13 -0
- package/dist/neutral/spec/TestCreatable.spec.d.ts.map +1 -0
- package/dist/neutral/spec/TestCreatable2.spec.d.ts +2 -0
- package/dist/neutral/spec/TestCreatable2.spec.d.ts.map +1 -0
- package/package.json +9 -9
- package/build/neutral/index.d.ts +0 -5
- /package/{build → dist}/neutral/AbstractCreatable.d.ts +0 -0
- /package/{build → dist}/neutral/AbstractCreatable.d.ts.map +0 -0
- /package/{build → dist}/neutral/Creatable.d.ts +0 -0
- /package/{build → dist}/neutral/Creatable.d.ts.map +0 -0
- /package/{build → dist}/neutral/Factory.d.ts +0 -0
- /package/{build → dist}/neutral/Factory.d.ts.map +0 -0
- /package/{build → dist}/neutral/index.d.ts.map +0 -0
- /package/{build → dist}/neutral/lib/getFunctionName.d.ts +0 -0
- /package/{build → dist}/neutral/lib/getFunctionName.d.ts.map +0 -0
- /package/{build → dist}/neutral/lib/getRootFunction.d.ts +0 -0
- /package/{build → dist}/neutral/lib/getRootFunction.d.ts.map +0 -0
- /package/{build → dist}/neutral/lib/index.d.ts +0 -0
- /package/{build → dist}/neutral/lib/index.d.ts.map +0 -0
- /package/{build → dist}/neutral/model/CreatableInstance.d.ts +0 -0
- /package/{build → dist}/neutral/model/CreatableInstance.d.ts.map +0 -0
- /package/{build → dist}/neutral/model/CreatableParams.d.ts +0 -0
- /package/{build → dist}/neutral/model/CreatableParams.d.ts.map +0 -0
- /package/{build → dist}/neutral/model/CreatableStatusReporter.d.ts +0 -0
- /package/{build → dist}/neutral/model/CreatableStatusReporter.d.ts.map +0 -0
- /package/{build → dist}/neutral/model/Labels.d.ts +0 -0
- /package/{build → dist}/neutral/model/Labels.d.ts.map +0 -0
- /package/{build → dist}/neutral/model/index.d.ts +0 -0
- /package/{build → dist}/neutral/model/index.d.ts.map +0 -0
package/README.md
CHANGED
|
@@ -1,69 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
# @xylabs/creatable
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[![logo][]](https://xylabs.com)
|
|
4
4
|
|
|
5
|
+
[![main-build][]][main-build-link]
|
|
5
6
|
[![npm-badge][]][npm-link]
|
|
6
7
|
[![npm-downloads-badge][]][npm-link]
|
|
7
8
|
[![jsdelivr-badge][]][jsdelivr-link]
|
|
8
9
|
[![npm-license-badge][]](LICENSE)
|
|
10
|
+
[![codacy-badge][]][codacy-link]
|
|
11
|
+
[![codeclimate-badge][]][codeclimate-link]
|
|
12
|
+
[![snyk-badge][]][snyk-link]
|
|
9
13
|
[![socket-badge][]][socket-link]
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Table of Contents
|
|
14
|
-
|
|
15
|
-
- [Description](#description)
|
|
16
|
-
- [Install](#install)
|
|
17
|
-
- [Maintainers](#maintainers)
|
|
18
|
-
- [License](#license)
|
|
19
|
-
- [Credits](#credits)
|
|
20
|
-
|
|
21
|
-
## Description
|
|
22
|
-
|
|
23
|
-
Common Javascript code that is used throughout XYO projects that use React.
|
|
24
|
-
|
|
25
|
-
## Install
|
|
26
|
-
|
|
27
|
-
Using npm:
|
|
15
|
+
Version: 4.13.15
|
|
28
16
|
|
|
29
|
-
|
|
30
|
-
npm i --save @xylabs/base
|
|
31
|
-
```
|
|
17
|
+
Primary SDK for using XYO Protocol 2.0
|
|
32
18
|
|
|
33
|
-
|
|
19
|
+
## Documentation
|
|
34
20
|
|
|
35
|
-
|
|
36
|
-
yarn add @xylabs/base
|
|
37
|
-
```
|
|
21
|
+
Coming Soon!
|
|
38
22
|
|
|
39
|
-
|
|
40
|
-
[Developer Reference](https://xylabs.github.io/sdk-js)
|
|
23
|
+
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
41
24
|
|
|
42
25
|
## Maintainers
|
|
43
26
|
|
|
44
27
|
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
45
|
-
- [Joel Carter](https://github.com/JoelBCarter)
|
|
46
28
|
- [Matt Jones](https://github.com/jonesmac)
|
|
29
|
+
- [Joel Carter](https://github.com/JoelBCarter)
|
|
47
30
|
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
48
31
|
|
|
49
32
|
## License
|
|
50
33
|
|
|
51
|
-
See the [LICENSE](LICENSE) file for license details
|
|
34
|
+
> See the [LICENSE](LICENSE) file for license details
|
|
52
35
|
|
|
53
36
|
## Credits
|
|
54
37
|
|
|
55
|
-
[Made with 🔥and ❄️ by
|
|
38
|
+
[Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
|
|
56
39
|
|
|
57
40
|
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
|
|
58
41
|
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
|
|
62
|
-
[npm-
|
|
63
|
-
[
|
|
64
|
-
|
|
65
|
-
[
|
|
66
|
-
[
|
|
67
|
-
|
|
68
|
-
[
|
|
69
|
-
|
|
42
|
+
[main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
|
|
43
|
+
[main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
|
|
44
|
+
[npm-badge]: https://img.shields.io/npm/v/@xylabs/creatable.svg
|
|
45
|
+
[npm-link]: https://www.npmjs.com/package/@xylabs/creatable
|
|
46
|
+
[codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
|
|
47
|
+
[codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
|
|
48
|
+
[codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
|
|
49
|
+
[codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
|
|
50
|
+
[snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
|
|
51
|
+
[snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
|
|
52
|
+
|
|
53
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/creatable
|
|
54
|
+
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/creatable
|
|
55
|
+
|
|
56
|
+
[jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/creatable/badge
|
|
57
|
+
[jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/creatable
|
|
58
|
+
|
|
59
|
+
[socket-badge]: https://socket.dev/api/badge/npm/package/@xylabs/creatable
|
|
60
|
+
[socket-link]: https://socket.dev/npm/package/@xylabs/creatable
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,110 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type CreatableStatus = 'creating' | 'created' | 'starting' | 'started' | 'stopping' | 'stopped' | 'error';
|
|
7
|
-
interface CreatableStatusReporter<T extends void | string = void> {
|
|
8
|
-
report(name: BaseClassName, status: Exclude<T extends void ? CreatableStatus : CreatableStatus | T, 'error'>, progress?: number): void;
|
|
9
|
-
report(name: BaseClassName, status: Extract<T extends void ? CreatableStatus : CreatableStatus | T, 'error'>, error?: Error): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type CreatableName = Exclude<string, 'creatable-name-reserved-32546239486'> & BaseClassName;
|
|
13
|
-
interface CreatableParams extends BaseEmitterParams {
|
|
14
|
-
name?: CreatableName;
|
|
15
|
-
statusReporter?: CreatableStatusReporter;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface CreatableInstance<TParams extends CreatableParams = CreatableParams, TEventData extends EventData = EventData> extends EventEmitter<TEventData> {
|
|
19
|
-
eventData: TEventData;
|
|
20
|
-
name: CreatableName;
|
|
21
|
-
params: TParams;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Object used to represent labels identifying a resource.
|
|
26
|
-
*/
|
|
27
|
-
interface Labels {
|
|
28
|
-
[key: string]: string | undefined;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Interface for objects that have labels.
|
|
32
|
-
*/
|
|
33
|
-
interface WithLabels<T extends Labels = Labels> {
|
|
34
|
-
labels: T;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Interface for objects that have labels.
|
|
38
|
-
*/
|
|
39
|
-
interface WithOptionalLabels<T extends Labels = Labels> {
|
|
40
|
-
labels?: T;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Returns true if the source object has all the labels from the required set
|
|
44
|
-
* @param source Source object to check against
|
|
45
|
-
* @param required Set of labels to check for in source
|
|
46
|
-
* @returns True of the source object has all the labels from the required set
|
|
47
|
-
*/
|
|
48
|
-
declare const hasAllLabels: (source?: Labels, required?: Labels) => boolean;
|
|
49
|
-
|
|
50
|
-
interface CreatableFactory<T extends CreatableInstance = CreatableInstance> extends Omit<Creatable<T>, 'create' | 'createHandler' | 'paramsHandler' | 'defaultLogger' | 'factory'> {
|
|
51
|
-
create(this: CreatableFactory<T>, params?: Partial<T['params']>): Promise<T>;
|
|
52
|
-
}
|
|
53
|
-
interface Creatable<T extends CreatableInstance = CreatableInstance> {
|
|
54
|
-
defaultLogger?: Logger;
|
|
55
|
-
new (key: unknown, params: Partial<CreatableParams>): T & AbstractCreatable<T['params']>;
|
|
56
|
-
create<T extends CreatableInstance>(this: Creatable<T>, params?: Partial<T['params']>): Promise<T>;
|
|
57
|
-
createHandler<T extends CreatableInstance>(this: Creatable<T>, instance: T): Promisable<T>;
|
|
58
|
-
paramsHandler<T extends CreatableInstance>(this: Creatable<T>, params?: Partial<T['params']>): Promisable<T['params']>;
|
|
59
|
-
}
|
|
60
|
-
interface CreatableWithFactory<T extends CreatableInstance = CreatableInstance> extends Creatable<T> {
|
|
61
|
-
factory<T extends CreatableInstance>(this: Creatable<T>, params?: Partial<T['params']>, labels?: Labels): CreatableFactory<T>;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Class annotation to be used to decorate Modules which support
|
|
65
|
-
* an asynchronous creation pattern
|
|
66
|
-
* @returns The decorated Module requiring it implement the members
|
|
67
|
-
* of the CreatableModule as statics properties/methods
|
|
68
|
-
*/
|
|
69
|
-
declare function creatable<T extends CreatableInstance>(): <U extends Creatable<T>>(constructor: U) => void;
|
|
70
|
-
/**
|
|
71
|
-
* Class annotation to be used to decorate Modules which support
|
|
72
|
-
* an asynchronous creation factory pattern
|
|
73
|
-
* @returns The decorated Module requiring it implement the members
|
|
74
|
-
* of the CreatableModule as statics properties/methods
|
|
75
|
-
*/
|
|
76
|
-
declare function creatableFactory(): <U extends CreatableFactory>(constructor: U) => void;
|
|
77
|
-
|
|
78
|
-
declare class AbstractCreatable<TParams extends CreatableParams = CreatableParams, TEventData extends EventData = EventData> extends BaseEmitter<Partial<TParams>, TEventData> {
|
|
79
|
-
defaultLogger?: Logger;
|
|
80
|
-
private _validatedParams?;
|
|
81
|
-
constructor(key: unknown, params: Partial<TParams>);
|
|
82
|
-
get name(): CreatableName;
|
|
83
|
-
get params(): TParams;
|
|
84
|
-
get statusReporter(): CreatableStatusReporter<void> | undefined;
|
|
85
|
-
static create<T extends CreatableInstance>(this: Creatable<T>, inParams?: Partial<T['params']>): Promise<T>;
|
|
86
|
-
static createHandler<T extends CreatableInstance>(this: Creatable<T>, instance: T): Promisable<T>;
|
|
87
|
-
static paramsHandler<T extends CreatableInstance>(this: Creatable<T>, params?: Partial<T['params']>): Promisable<T['params']>;
|
|
88
|
-
createHandler(): Promisable<void>;
|
|
89
|
-
paramsValidator(params: Partial<TParams>): TParams;
|
|
90
|
-
start(): Promise<boolean>;
|
|
91
|
-
stop(): Promise<boolean>;
|
|
92
|
-
protected _noOverride(functionName?: string): void;
|
|
93
|
-
protected startHandler(): Promisable<void>;
|
|
94
|
-
protected stopHandler(): Promisable<void>;
|
|
95
|
-
}
|
|
96
|
-
declare class AbstractCreatableWithFactory<TParams extends CreatableParams = CreatableParams, TEventData extends EventData = EventData> extends AbstractCreatable<TParams, TEventData> {
|
|
97
|
-
static factory<T extends CreatableInstance>(this: Creatable<T>, params?: Partial<T['params']>, labels?: Labels): CreatableFactory<T>;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
declare class Factory<T extends CreatableInstance = CreatableInstance> implements CreatableFactory<T> {
|
|
101
|
-
creatable: Creatable<T>;
|
|
102
|
-
defaultParams?: Partial<T['params']>;
|
|
103
|
-
labels?: Labels;
|
|
104
|
-
constructor(creatable: Creatable<T>, params?: Partial<T['params']>, labels?: Labels);
|
|
105
|
-
static withParams<T extends CreatableInstance>(creatableModule: Creatable<T>, params?: Partial<T['params']>, labels?: Labels): Factory<T>;
|
|
106
|
-
create(params?: Partial<T['params']>): Promise<T>;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
export { AbstractCreatable, AbstractCreatableWithFactory, Factory, creatable, creatableFactory, hasAllLabels };
|
|
110
|
-
export type { Creatable, CreatableFactory, CreatableInstance, CreatableName, CreatableParams, CreatableStatus, CreatableStatusReporter, CreatableWithFactory, Labels, WithLabels, WithOptionalLabels };
|
|
1
|
+
export * from './AbstractCreatable.ts';
|
|
2
|
+
export * from './Creatable.ts';
|
|
3
|
+
export * from './Factory.ts';
|
|
4
|
+
export * from './model/index.ts';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { 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
|
+
}
|
|
13
|
+
//# sourceMappingURL=TestCreatable.spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestCreatable.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/TestCreatable.spec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAK5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,SAAS,EAAa,MAAM,iBAAiB,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAEtE,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,qBACa,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.spec.d.ts","sourceRoot":"","sources":["../../../src/spec/TestCreatable2.spec.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/creatable",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.17",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"module": "dist/neutral/index.mjs",
|
|
30
30
|
"types": "dist/neutral/index.d.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@xylabs/assert": "^4.13.
|
|
33
|
-
"@xylabs/base": "^4.13.
|
|
34
|
-
"@xylabs/events": "^4.13.
|
|
35
|
-
"@xylabs/logger": "^4.13.
|
|
36
|
-
"@xylabs/promise": "^4.13.
|
|
37
|
-
"@xylabs/typeof": "^4.13.
|
|
32
|
+
"@xylabs/assert": "^4.13.17",
|
|
33
|
+
"@xylabs/base": "^4.13.17",
|
|
34
|
+
"@xylabs/events": "^4.13.17",
|
|
35
|
+
"@xylabs/logger": "^4.13.17",
|
|
36
|
+
"@xylabs/promise": "^4.13.17",
|
|
37
|
+
"@xylabs/typeof": "^4.13.17"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.
|
|
41
|
-
"@xylabs/tsconfig": "^7.0.0-rc.
|
|
40
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.27",
|
|
41
|
+
"@xylabs/tsconfig": "^7.0.0-rc.27",
|
|
42
42
|
"tslib": "^2.8.1",
|
|
43
43
|
"typescript": "^5.8.3",
|
|
44
44
|
"vitest": "^3.2.4"
|
package/build/neutral/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|