@praxisjs/concurrent 0.2.3 → 1.0.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/CHANGELOG.md +49 -0
- package/dist/decorators.d.ts +3 -3
- package/dist/decorators.d.ts.map +1 -1
- package/dist/decorators.js +36 -34
- package/dist/decorators.js.map +1 -1
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/src/decorators.ts +37 -46
- package/src/index.ts +0 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,54 @@
|
|
|
1
1
|
# @praxisjs/concurrent
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 3372878: Migrate all packages from functional APIs to a decorator-first design.
|
|
8
|
+
|
|
9
|
+
**`@praxisjs/core`**
|
|
10
|
+
|
|
11
|
+
- Added `Composable` abstract base class for building class-based composables
|
|
12
|
+
- Removed `resource`, `createResource`, `Resource`, `ResourceStatus`, `ResourceOptions` from public exports — use `@Resource` from `@praxisjs/decorators` instead
|
|
13
|
+
|
|
14
|
+
**`@praxisjs/motion`**
|
|
15
|
+
|
|
16
|
+
- Replaced `useMotion`, `tween`, `spring`, `createTransition`, `Animate`, `easings`, `resolveEasing` with `@Tween` and `@Spring` decorators
|
|
17
|
+
|
|
18
|
+
**`@praxisjs/di`**
|
|
19
|
+
|
|
20
|
+
- Replaced `useService` and `createScope` with a `@Scope` decorator
|
|
21
|
+
- Renamed exported type `Scope` to `ScopeType` to free the name for the new decorator
|
|
22
|
+
|
|
23
|
+
**`@praxisjs/fsm`**
|
|
24
|
+
|
|
25
|
+
- Removed `createMachine` — use the `@StateMachine` and `@Transition` decorators directly
|
|
26
|
+
|
|
27
|
+
**`@praxisjs/router`**
|
|
28
|
+
|
|
29
|
+
- Removed `createRouter`, `lazy`, `useRouter`, `useParams`, `useQuery`, `useLocation`
|
|
30
|
+
- Added `@RouterConfig`, `@Lazy`, `@InjectRouter`, `@Params`, `@Query`, `@Location` decorators
|
|
31
|
+
|
|
32
|
+
**`@praxisjs/store`**
|
|
33
|
+
|
|
34
|
+
- Removed `createStore` — use the `@Store` and `@UseStore` decorators directly
|
|
35
|
+
|
|
36
|
+
**`@praxisjs/composables`**
|
|
37
|
+
|
|
38
|
+
- Replaced all `use*` composable functions with class-based composables extending `Composable`:
|
|
39
|
+
`WindowSize`, `ScrollPosition`, `ElementSize`, `Intersection`, `Focus`, `MediaQuery`, `ColorScheme`, `Mouse`, `KeyCombo`, `Idle`, `Clipboard`, `Geolocation`, `TimeAgo`, `Pagination`
|
|
40
|
+
|
|
41
|
+
**`@praxisjs/concurrent`**
|
|
42
|
+
|
|
43
|
+
- Removed `task`, `queue`, `pool` and their instance types — use `@Task`, `@Queue`, `@Pool` decorators instead
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [3372878]
|
|
48
|
+
- Updated dependencies [feaa478]
|
|
49
|
+
- @praxisjs/core@1.0.0
|
|
50
|
+
- @praxisjs/decorators@0.5.0
|
|
51
|
+
|
|
3
52
|
## 0.2.3
|
|
4
53
|
|
|
5
54
|
### Patch Changes
|
package/dist/decorators.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare function Task(): (value: (...args: unknown[]) => Promise<unknown>, context: ClassMethodDecoratorContext) => void;
|
|
2
|
-
export declare function Queue(): (value: (...args: unknown[]) => Promise<unknown>, context: ClassMethodDecoratorContext) => void;
|
|
3
|
-
export declare function Pool(concurrency: number): (value: (...args: unknown[]) => Promise<unknown>, context: ClassMethodDecoratorContext) => void;
|
|
1
|
+
export declare function Task(): (value: (...args: unknown[]) => Promise<unknown>, context: ClassMethodDecoratorContext<any>) => void;
|
|
2
|
+
export declare function Queue(): (value: (...args: unknown[]) => Promise<unknown>, context: ClassMethodDecoratorContext<any>) => void;
|
|
3
|
+
export declare function Pool(concurrency: number): (value: (...args: unknown[]) => Promise<unknown>, context: ClassMethodDecoratorContext<any>) => void;
|
|
4
4
|
//# sourceMappingURL=decorators.d.ts.map
|
package/dist/decorators.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAMA,wBAAgB,IAAI,IAYD,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,2BAA2B,CAAC,GAAG,CAAC,KAAK,IAAI,CACtH;AAED,wBAAgB,KAAK,IAWF,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,2BAA2B,CAAC,GAAG,CAAC,KAAK,IAAI,CACtH;AAED,wBAAgB,IAAI,CAAC,WAAW,EAAE,MAAM,GAYrB,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,2BAA2B,CAAC,GAAG,CAAC,KAAK,IAAI,CACtH"}
|
package/dist/decorators.js
CHANGED
|
@@ -1,44 +1,46 @@
|
|
|
1
|
+
import { createMethodDecorator } from "@praxisjs/decorators";
|
|
1
2
|
import { pool } from "./pool";
|
|
2
3
|
import { queue } from "./queue";
|
|
3
4
|
import { task } from "./task";
|
|
4
5
|
export function Task() {
|
|
5
|
-
return
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
self[`${
|
|
11
|
-
self[`${
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
return createMethodDecorator({
|
|
7
|
+
wrap(original, instance, name) {
|
|
8
|
+
const self = instance;
|
|
9
|
+
const t = task(original.bind(instance));
|
|
10
|
+
self[`${name}_loading`] = t.loading;
|
|
11
|
+
self[`${name}_error`] = t.error;
|
|
12
|
+
self[`${name}_lastResult`] = t.lastResult;
|
|
13
|
+
return (...args) => t(...args);
|
|
14
|
+
},
|
|
15
|
+
// Concurrent decorators work on any class, not just StatefulComponent
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
});
|
|
16
18
|
}
|
|
17
19
|
export function Queue() {
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
self[`${
|
|
24
|
-
self[`${
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
20
|
+
return createMethodDecorator({
|
|
21
|
+
wrap(original, instance, name) {
|
|
22
|
+
const self = instance;
|
|
23
|
+
const q = queue(original.bind(instance));
|
|
24
|
+
self[`${name}_loading`] = q.loading;
|
|
25
|
+
self[`${name}_pending`] = q.pending;
|
|
26
|
+
self[`${name}_error`] = q.error;
|
|
27
|
+
return (...args) => q(...args);
|
|
28
|
+
},
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
});
|
|
29
31
|
}
|
|
30
32
|
export function Pool(concurrency) {
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
self[`${
|
|
37
|
-
self[`${
|
|
38
|
-
self[`${
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
};
|
|
33
|
+
return createMethodDecorator({
|
|
34
|
+
wrap(original, instance, name) {
|
|
35
|
+
const self = instance;
|
|
36
|
+
const p = pool(concurrency, original.bind(instance));
|
|
37
|
+
self[`${name}_loading`] = p.loading;
|
|
38
|
+
self[`${name}_active`] = p.active;
|
|
39
|
+
self[`${name}_pending`] = p.pending;
|
|
40
|
+
self[`${name}_error`] = p.error;
|
|
41
|
+
return (...args) => p(...args);
|
|
42
|
+
},
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
});
|
|
43
45
|
}
|
|
44
46
|
//# sourceMappingURL=decorators.js.map
|
package/dist/decorators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,UAAU,IAAI;IAClB,OAAO,
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,UAAU,IAAI;IAClB,OAAO,qBAAqB,CAAC;QAC3B,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI;YAC3B,MAAM,IAAI,GAAG,QAAmC,CAAC;YACjD,MAAM,CAAC,GAAG,IAAI,CAAE,QAAqD,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;YACtF,IAAI,CAAC,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;YACpC,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;YAChC,IAAI,CAAC,GAAG,IAAI,aAAa,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC;YA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AG,IAAI,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;YAChC,OAAO,CAAC,GAAG,IAAe,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5C,CAAC;QACH,8DAA8D;KAC7D,CAAoH,CAAC;AACxH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
export { task } from "./task";
|
|
2
|
-
export type { TaskInstance } from "./task";
|
|
3
|
-
export { queue } from "./queue";
|
|
4
|
-
export type { QueueInstance } from "./queue";
|
|
5
|
-
export { pool } from "./pool";
|
|
6
|
-
export type { PoolInstance } from "./pool";
|
|
7
1
|
export { Task, Queue, Pool } from "./decorators";
|
|
8
2
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxisjs/concurrent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
"typescript": "^5.9.3"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@praxisjs/
|
|
18
|
-
"@praxisjs/shared": "0.2.0"
|
|
17
|
+
"@praxisjs/decorators": "0.5.0",
|
|
18
|
+
"@praxisjs/shared": "0.2.0",
|
|
19
|
+
"@praxisjs/core": "1.0.0"
|
|
19
20
|
},
|
|
20
21
|
"scripts": {
|
|
21
22
|
"build": "tsc",
|
package/src/decorators.ts
CHANGED
|
@@ -1,58 +1,49 @@
|
|
|
1
|
+
import { createMethodDecorator } from "@praxisjs/decorators";
|
|
2
|
+
|
|
1
3
|
import { pool } from "./pool";
|
|
2
4
|
import { queue } from "./queue";
|
|
3
5
|
import { task } from "./task";
|
|
4
6
|
|
|
5
7
|
export function Task() {
|
|
6
|
-
return
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
self[methodKey] = (...args: unknown[]) => t(...args);
|
|
19
|
-
});
|
|
20
|
-
};
|
|
8
|
+
return createMethodDecorator({
|
|
9
|
+
wrap(original, instance, name) {
|
|
10
|
+
const self = instance as Record<string, unknown>;
|
|
11
|
+
const t = task((original as (...args: unknown[]) => Promise<unknown>).bind(instance));
|
|
12
|
+
self[`${name}_loading`] = t.loading;
|
|
13
|
+
self[`${name}_error`] = t.error;
|
|
14
|
+
self[`${name}_lastResult`] = t.lastResult;
|
|
15
|
+
return (...args: unknown[]) => t(...args);
|
|
16
|
+
},
|
|
17
|
+
// Concurrent decorators work on any class, not just StatefulComponent
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
}) as unknown as (value: (...args: unknown[]) => Promise<unknown>, context: ClassMethodDecoratorContext<any>) => void;
|
|
21
20
|
}
|
|
22
21
|
|
|
23
22
|
export function Queue() {
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
self[`${methodKey}_error`] = q.error;
|
|
36
|
-
self[methodKey] = (...args: unknown[]) => q(...args);
|
|
37
|
-
});
|
|
38
|
-
};
|
|
23
|
+
return createMethodDecorator({
|
|
24
|
+
wrap(original, instance, name) {
|
|
25
|
+
const self = instance as Record<string, unknown>;
|
|
26
|
+
const q = queue((original as (...args: unknown[]) => Promise<unknown>).bind(instance));
|
|
27
|
+
self[`${name}_loading`] = q.loading;
|
|
28
|
+
self[`${name}_pending`] = q.pending;
|
|
29
|
+
self[`${name}_error`] = q.error;
|
|
30
|
+
return (...args: unknown[]) => q(...args);
|
|
31
|
+
},
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
+
}) as unknown as (value: (...args: unknown[]) => Promise<unknown>, context: ClassMethodDecoratorContext<any>) => void;
|
|
39
34
|
}
|
|
40
35
|
|
|
41
36
|
export function Pool(concurrency: number) {
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
self[`${methodKey}_error`] = p.error;
|
|
55
|
-
self[methodKey] = (...args: unknown[]) => p(...args);
|
|
56
|
-
});
|
|
57
|
-
};
|
|
37
|
+
return createMethodDecorator({
|
|
38
|
+
wrap(original, instance, name) {
|
|
39
|
+
const self = instance as Record<string, unknown>;
|
|
40
|
+
const p = pool(concurrency, (original as (...args: unknown[]) => Promise<unknown>).bind(instance));
|
|
41
|
+
self[`${name}_loading`] = p.loading;
|
|
42
|
+
self[`${name}_active`] = p.active;
|
|
43
|
+
self[`${name}_pending`] = p.pending;
|
|
44
|
+
self[`${name}_error`] = p.error;
|
|
45
|
+
return (...args: unknown[]) => p(...args);
|
|
46
|
+
},
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
}) as unknown as (value: (...args: unknown[]) => Promise<unknown>, context: ClassMethodDecoratorContext<any>) => void;
|
|
58
49
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
export { task } from "./task";
|
|
2
|
-
export type { TaskInstance } from "./task";
|
|
3
|
-
|
|
4
|
-
export { queue } from "./queue";
|
|
5
|
-
export type { QueueInstance } from "./queue";
|
|
6
|
-
|
|
7
|
-
export { pool } from "./pool";
|
|
8
|
-
export type { PoolInstance } from "./pool";
|
|
9
|
-
|
|
10
1
|
export { Task, Queue, Pool } from "./decorators";
|