@delight-rpc/piscina 0.2.3 → 0.3.2
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 +17 -6
- package/lib/client.d.ts +9 -2
- package/lib/client.js +11 -4
- package/lib/client.js.map +1 -1
- package/lib/server.d.ts +6 -1
- package/lib/server.js +11 -3
- package/lib/server.js.map +1 -1
- package/package.json +16 -12
package/README.md
CHANGED
|
@@ -40,8 +40,11 @@ await client.echo('hello world')
|
|
|
40
40
|
```ts
|
|
41
41
|
function createClient<IAPI extends object>(
|
|
42
42
|
piscina: Piscina
|
|
43
|
-
,
|
|
44
|
-
|
|
43
|
+
, options?: {
|
|
44
|
+
parameterValidators?: DelightRPC.ParameterValidators<IAPI>
|
|
45
|
+
expectedVersion?: `${number}.${number}.${number}`
|
|
46
|
+
channel?: string
|
|
47
|
+
}
|
|
45
48
|
): DelightRPC.ClientProxy<IAPI>
|
|
46
49
|
```
|
|
47
50
|
|
|
@@ -49,7 +52,10 @@ function createClient<IAPI extends object>(
|
|
|
49
52
|
```ts
|
|
50
53
|
function createBatchClient(
|
|
51
54
|
piscina: Piscina
|
|
52
|
-
,
|
|
55
|
+
, options?: {
|
|
56
|
+
expectedVersion?: `${number}.${number}.${number}`
|
|
57
|
+
channel?: string
|
|
58
|
+
}
|
|
53
59
|
): DelightRPC.BatchClient
|
|
54
60
|
```
|
|
55
61
|
|
|
@@ -57,7 +63,12 @@ function createBatchClient(
|
|
|
57
63
|
```ts
|
|
58
64
|
function createServer<IAPI extends object>(
|
|
59
65
|
api: DelightRPC.ImplementationOf<IAPI>
|
|
60
|
-
,
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
, options?: {
|
|
67
|
+
parameterValidators?: DelightRPC.ParameterValidators<IAPI>
|
|
68
|
+
version?: `${number}.${number}.${number}`
|
|
69
|
+
channel?: string
|
|
70
|
+
ownPropsOnly?: boolean
|
|
71
|
+
channel?: string | RegExp | AnyChannel
|
|
72
|
+
}
|
|
73
|
+
): (req: unknown) => Promise<unknown>
|
|
63
74
|
```
|
package/lib/client.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import * as DelightRPC from 'delight-rpc';
|
|
2
2
|
import Piscina from 'piscina';
|
|
3
|
-
export declare function createClient<IAPI extends object>(piscina: Piscina, parameterValidators
|
|
4
|
-
|
|
3
|
+
export declare function createClient<IAPI extends object>(piscina: Piscina, { parameterValidators, expectedVersion, channel }?: {
|
|
4
|
+
parameterValidators?: DelightRPC.ParameterValidators<IAPI>;
|
|
5
|
+
expectedVersion?: `${number}.${number}.${number}`;
|
|
6
|
+
channel?: string;
|
|
7
|
+
}): DelightRPC.ClientProxy<IAPI>;
|
|
8
|
+
export declare function createBatchClient(piscina: Piscina, { expectedVersion, channel }?: {
|
|
9
|
+
expectedVersion?: `${number}.${number}.${number}`;
|
|
10
|
+
channel?: string;
|
|
11
|
+
}): DelightRPC.BatchClient;
|
package/lib/client.js
CHANGED
|
@@ -25,13 +25,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.createBatchClient = exports.createClient = void 0;
|
|
27
27
|
const DelightRPC = __importStar(require("delight-rpc"));
|
|
28
|
-
function createClient(piscina, parameterValidators, expectedVersion) {
|
|
29
|
-
const client = DelightRPC.createClient(createSend(piscina),
|
|
28
|
+
function createClient(piscina, { parameterValidators, expectedVersion, channel } = {}) {
|
|
29
|
+
const client = DelightRPC.createClient(createSend(piscina), {
|
|
30
|
+
parameterValidators,
|
|
31
|
+
expectedVersion,
|
|
32
|
+
channel
|
|
33
|
+
});
|
|
30
34
|
return client;
|
|
31
35
|
}
|
|
32
36
|
exports.createClient = createClient;
|
|
33
|
-
function createBatchClient(piscina, expectedVersion) {
|
|
34
|
-
const client = new DelightRPC.BatchClient(createSend(piscina),
|
|
37
|
+
function createBatchClient(piscina, { expectedVersion, channel } = {}) {
|
|
38
|
+
const client = new DelightRPC.BatchClient(createSend(piscina), {
|
|
39
|
+
expectedVersion,
|
|
40
|
+
channel
|
|
41
|
+
});
|
|
35
42
|
return client;
|
|
36
43
|
}
|
|
37
44
|
exports.createBatchClient = createBatchClient;
|
package/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAyC;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAyC;AAIzC,SAAgB,YAAY,CAC1B,OAAgB,EAChB,EAAE,mBAAmB,EAAE,eAAe,EAAE,OAAO,KAI3C,EAAE;IAEN,MAAM,MAAM,GAAG,UAAU,CAAC,YAAY,CACpC,UAAU,CAAC,OAAO,CAAC,EACnB;QACE,mBAAmB;QACnB,eAAe;QACf,OAAO;KACR,CACF,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAlBD,oCAkBC;AAED,SAAgB,iBAAiB,CAC/B,OAAgB,EAChB,EAAE,eAAe,EAAE,OAAO,KAGtB,EAAE;IAEN,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,WAAW,CACvC,UAAU,CAAC,OAAO,CAAC,EACnB;QACE,eAAe;QACf,OAAO;KACR,CACF,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAhBD,8CAgBC;AAED,SAAS,UAAU,CAAI,OAAgB;IACrC,OAAO,KAAK,WACV,OAAmD;QAEnD,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAM,CAAA;IACxC,CAAC,CAAA;AACH,CAAC"}
|
package/lib/server.d.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import * as DelightRPC from 'delight-rpc';
|
|
2
|
-
export declare function createServer<IAPI extends object>(api: DelightRPC.ImplementationOf<IAPI>, parameterValidators
|
|
2
|
+
export declare function createServer<IAPI extends object>(api: DelightRPC.ImplementationOf<IAPI>, { parameterValidators, version, channel, ownPropsOnly }?: {
|
|
3
|
+
parameterValidators?: DelightRPC.ParameterValidators<IAPI>;
|
|
4
|
+
version?: `${number}.${number}.${number}`;
|
|
5
|
+
channel?: string | RegExp | typeof DelightRPC.AnyChannel;
|
|
6
|
+
ownPropsOnly?: boolean;
|
|
7
|
+
}): (req: unknown) => Promise<unknown>;
|
package/lib/server.js
CHANGED
|
@@ -25,11 +25,19 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.createServer = void 0;
|
|
27
27
|
const DelightRPC = __importStar(require("delight-rpc"));
|
|
28
|
-
|
|
28
|
+
const prelude_1 = require("@blackglory/prelude");
|
|
29
|
+
function createServer(api, { parameterValidators, version, channel, ownPropsOnly } = {}) {
|
|
29
30
|
return async function handler(req) {
|
|
30
31
|
if (DelightRPC.isRequest(req) || DelightRPC.isBatchRequest(req)) {
|
|
31
|
-
const
|
|
32
|
-
|
|
32
|
+
const response = await DelightRPC.createResponse(api, req, {
|
|
33
|
+
parameterValidators,
|
|
34
|
+
version,
|
|
35
|
+
channel,
|
|
36
|
+
ownPropsOnly
|
|
37
|
+
});
|
|
38
|
+
if ((0, prelude_1.isntNull)(response)) {
|
|
39
|
+
return response;
|
|
40
|
+
}
|
|
33
41
|
}
|
|
34
42
|
};
|
|
35
43
|
}
|
package/lib/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAyC;
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wDAAyC;AACzC,iDAA8C;AAE9C,SAAgB,YAAY,CAC1B,GAAsC,EACtC,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,KAKjD,EAAE;IAEN,OAAO,KAAK,UAAU,OAAO,CAAC,GAAY;QACxC,IAAI,UAAU,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE;YAC/D,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,cAAc,CAC9C,GAAG,EACH,GAAG,EACH;gBACE,mBAAmB;gBACnB,OAAO;gBACP,OAAO;gBACP,YAAY;aACb,CACF,CAAA;YAED,IAAI,IAAA,kBAAQ,EAAC,QAAQ,CAAC,EAAE;gBACtB,OAAO,QAAQ,CAAA;aAChB;SACF;IACH,CAAC,CAAA;AACH,CAAC;AA3BD,oCA2BC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@delight-rpc/piscina",
|
|
3
|
-
"version": "0.2
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"files": [
|
|
@@ -30,30 +30,34 @@
|
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@blackglory/jest-matchers": "^0.3.1",
|
|
33
|
-
"@commitlint/cli": "^
|
|
34
|
-
"@commitlint/config-conventional": "^
|
|
35
|
-
"@types/jest": "^27.
|
|
33
|
+
"@commitlint/cli": "^17.0.2",
|
|
34
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
35
|
+
"@types/jest": "^27.5.1",
|
|
36
36
|
"@types/node": "14",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
38
|
-
"@typescript-eslint/parser": "^5.
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^5.29.0",
|
|
38
|
+
"@typescript-eslint/parser": "^5.29.0",
|
|
39
39
|
"cross-env": "^7.0.3",
|
|
40
|
-
"delight-rpc": "^2.1
|
|
41
|
-
"eslint": "8.
|
|
40
|
+
"delight-rpc": "^4.2.1",
|
|
41
|
+
"eslint": "8.18.0",
|
|
42
42
|
"husky": "4",
|
|
43
43
|
"jest": "^27.5.1",
|
|
44
44
|
"npm-run-all": "^4.1.5",
|
|
45
45
|
"piscina": "^3.2.0",
|
|
46
46
|
"return-style": "^1.0.0",
|
|
47
47
|
"rimraf": "^3.0.2",
|
|
48
|
-
"standard-version": "^9.
|
|
48
|
+
"standard-version": "^9.5.0",
|
|
49
49
|
"ts-jest": "^27.1.4",
|
|
50
|
-
"ts-node": "^10.
|
|
50
|
+
"ts-node": "^10.8.1",
|
|
51
51
|
"ts-patch": "^2.0.1",
|
|
52
|
-
"typescript": "^4.
|
|
52
|
+
"typescript": "^4.7.4",
|
|
53
53
|
"typescript-transform-paths": "^3.3.1"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"delight-rpc": "^2.1
|
|
56
|
+
"delight-rpc": "^4.2.1",
|
|
57
57
|
"piscina": "^3.2.0"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@blackglory/prelude": "^0.1.2",
|
|
61
|
+
"@delight-rpc/protocol": "^2.2.0"
|
|
58
62
|
}
|
|
59
63
|
}
|