@webpieces/http-routing 0.4.879 → 0.4.880
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/package.json +7 -7
- package/src/Binder.js +4 -1
- package/src/Binder.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/http-routing",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.880",
|
|
4
4
|
"description": "Decorator-based routing with auto-wiring for WebPieces",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@inversifyjs/binding-decorators": "1.1.5",
|
|
25
|
-
"@webpieces/core-context": "0.4.
|
|
26
|
-
"@webpieces/core-util": "0.4.
|
|
27
|
-
"@webpieces/gcp-identity": "0.4.
|
|
25
|
+
"@webpieces/core-context": "0.4.880",
|
|
26
|
+
"@webpieces/core-util": "0.4.880",
|
|
27
|
+
"@webpieces/gcp-identity": "0.4.880",
|
|
28
28
|
"inversify": "7.10.4",
|
|
29
29
|
"jsonwebtoken": "9.0.2",
|
|
30
30
|
"minimatch": "10.0.1",
|
|
31
|
-
"@webpieces/http-client-core": "0.4.
|
|
32
|
-
"@webpieces/http-client-node": "0.4.
|
|
33
|
-
"@webpieces/cloudtasks-client": "0.4.
|
|
31
|
+
"@webpieces/http-client-core": "0.4.880",
|
|
32
|
+
"@webpieces/http-client-node": "0.4.880",
|
|
33
|
+
"@webpieces/cloudtasks-client": "0.4.880"
|
|
34
34
|
}
|
|
35
35
|
}
|
package/src/Binder.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ContainerBinder = exports.PubSubBindOptions = exports.ClientBindOptions = void 0;
|
|
4
4
|
const http_client_node_1 = require("@webpieces/http-client-node");
|
|
5
5
|
const cloudtasks_client_1 = require("@webpieces/cloudtasks-client");
|
|
6
|
+
const core_util_1 = require("@webpieces/core-util");
|
|
6
7
|
/**
|
|
7
8
|
* Options for {@link Binder.createRpcClientAndBind}. Both are optional.
|
|
8
9
|
*
|
|
@@ -45,7 +46,9 @@ class ContainerBinder {
|
|
|
45
46
|
.bind(options?.token ?? api)
|
|
46
47
|
.toDynamicValue((context) => context
|
|
47
48
|
.get(http_client_node_1.ClientHttpFactory)
|
|
48
|
-
|
|
49
|
+
// This Binder is a webpieces SERVER's DI: its clients present the server's own
|
|
50
|
+
// credentials, so a 401 they receive is this service's bug (#1173).
|
|
51
|
+
.createRpcClient(api, new http_client_node_1.ClientConfig(deployment, core_util_1.ClientRole.SERVER), filters))
|
|
49
52
|
.inSingletonScope();
|
|
50
53
|
}
|
|
51
54
|
createPubSubClientAndBind(api, deployment, options) {
|
package/src/Binder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Binder.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/Binder.ts"],"names":[],"mappings":";;;AAQA,kEAA8E;AAC9E,oEAAyF;
|
|
1
|
+
{"version":3,"file":"Binder.js","sourceRoot":"","sources":["../../../../../packages/http/http-routing/src/Binder.ts"],"names":[],"mappings":";;;AAQA,kEAA8E;AAC9E,oEAAyF;AACzF,oDAAkD;AAElD;;;;;;GAMG;AACH,MAAa,iBAAiB;IAEN;IACA;IAFpB,YACoB,KAA4B,EAC5B,OAA2C;QAD3C,UAAK,GAAL,KAAK,CAAuB;QAC5B,YAAO,GAAP,OAAO,CAAoC;IAC5D,CAAC;CACP;AALD,8CAKC;AAED;;;GAGG;AACH,MAAa,iBAAiB;IACE;IAA5B,YAA4B,KAA4B;QAA5B,UAAK,GAAL,KAAK,CAAuB;IAAG,CAAC;CAC/D;AAFD,8CAEC;AAyBD,oGAAoG;AACpG,MAAa,eAAe;IACK;IAA7B,YAA6B,OAAmC;QAAnC,YAAO,GAAP,OAAO,CAA4B;IAAG,CAAC;IAEpE,IAAI,CAAI,KAA2B;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAI,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,sBAAsB,CAClB,GAAoB,EACpB,UAAkB,EAClB,OAAuC;QAEvC,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,CAAC;QACjC,IAAI,CAAC,OAAO;aACP,IAAI,CAAI,OAAO,EAAE,KAAK,IAAI,GAAG,CAAC;aAC9B,cAAc,CAAC,CAAC,OAA0B,EAAE,EAAE,CAC3C,OAAO;aACF,GAAG,CAAC,oCAAiB,CAAC;YACvB,+EAA+E;YAC/E,oEAAoE;aACnE,eAAe,CAAC,GAAG,EAAE,IAAI,+BAAY,CAAC,UAAU,EAAE,sBAAU,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CACtF;aACA,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAED,yBAAyB,CACrB,GAAoB,EACpB,UAAkB,EAClB,OAAuC;QAEvC,IAAI,CAAC,OAAO;aACP,IAAI,CAAI,OAAO,EAAE,KAAK,IAAI,GAAG,CAAC;aAC9B,cAAc,CAAC,CAAC,OAA0B,EAAE,EAAE,CAC3C,OAAO;aACF,GAAG,CAAC,2CAAuB,CAAC;aAC5B,kBAAkB,CAAC,GAAG,EAAE,IAAI,oCAAgB,CAAC,UAAU,CAAC,CAAC,CACjE;aACA,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAED,YAAY,CAAmB,GAAoB,EAAE,IAAyB;QAC1E,IAAI,CAAC,OAAO,CAAC,IAAI,CAAI,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC1D,CAAC;CACJ;AA3CD,0CA2CC","sourcesContent":["import type {\n BindToFluentSyntax,\n ContainerModuleLoadOptions,\n Newable,\n ResolutionContext,\n ServiceIdentifier,\n} from 'inversify';\nimport type { ApiPrototype, ClientFilterDefinition } from '@webpieces/http-client-core';\nimport { ClientConfig, ClientHttpFactory } from '@webpieces/http-client-node';\nimport { ClientCloudTasksFactory, TaskClientConfig } from '@webpieces/cloudtasks-client';\nimport { ClientRole } from '@webpieces/core-util';\n\n/**\n * Options for {@link Binder.createRpcClientAndBind}. Both are optional.\n *\n * `token` is an EXTRA identity, needed only when two clients of the SAME api must coexist (e.g. one\n * per deployment). Omitted, the API class itself is the DI token. `filters` are this client's own\n * outbound filters, exactly as ClientHttpFactory.createRpcClient takes them.\n */\nexport class ClientBindOptions<T> {\n constructor(\n public readonly token?: ServiceIdentifier<T>,\n public readonly filters?: readonly ClientFilterDefinition[],\n ) {}\n}\n\n/**\n * Options for {@link Binder.createPubSubClientAndBind}. A Cloud Tasks client has no outbound filter\n * chain, so its options carry the extra `token` only; omitted, the API class is the DI token.\n */\nexport class PubSubBindOptions<T> {\n constructor(public readonly token?: ServiceIdentifier<T>) {}\n}\n\n/**\n * The Node host's binder, handed to every {@link BindModule}.configure. One object per load:\n * plain Inversify DI plus the three framework registrations that must stay visible in wiring.ts.\n */\nexport interface Binder {\n /** Plain DI, unchanged Inversify fluent syntax. */\n bind<T>(token: ServiceIdentifier<T>): BindToFluentSyntax<T>;\n /** Creates the RPC client lazily from the already-bound ClientHttpFactory and binds it (singleton). */\n createRpcClientAndBind<T extends object>(\n api: ApiPrototype<T>,\n deployment: string,\n options?: ClientBindOptions<NoInfer<T>>,\n ): void;\n /** Creates the Cloud Tasks client lazily from the already-bound ClientCloudTasksFactory and binds it (singleton). */\n createPubSubClientAndBind<T extends object>(\n api: ApiPrototype<T>,\n deployment: string,\n options?: PubSubBindOptions<NoInfer<T>>,\n ): void;\n /** Binds a vendor implementation of an external contract AND records the external-contract graph edge. */\n bindExternal<T extends object>(api: ApiPrototype<T>, impl: Newable<NoInfer<T>>): void;\n}\n\n/** The one Node {@link Binder}: wraps the Inversify load setupRuntime opens for each BindModule. */\nexport class ContainerBinder implements Binder {\n constructor(private readonly options: ContainerModuleLoadOptions) {}\n\n bind<T>(token: ServiceIdentifier<T>): BindToFluentSyntax<T> {\n return this.options.bind<T>(token);\n }\n\n createRpcClientAndBind<T extends object>(\n api: ApiPrototype<T>,\n deployment: string,\n options?: ClientBindOptions<NoInfer<T>>,\n ): void {\n const filters = options?.filters;\n this.options\n .bind<T>(options?.token ?? api)\n .toDynamicValue((context: ResolutionContext) =>\n context\n .get(ClientHttpFactory)\n // This Binder is a webpieces SERVER's DI: its clients present the server's own\n // credentials, so a 401 they receive is this service's bug (#1173).\n .createRpcClient(api, new ClientConfig(deployment, ClientRole.SERVER), filters),\n )\n .inSingletonScope();\n }\n\n createPubSubClientAndBind<T extends object>(\n api: ApiPrototype<T>,\n deployment: string,\n options?: PubSubBindOptions<NoInfer<T>>,\n ): void {\n this.options\n .bind<T>(options?.token ?? api)\n .toDynamicValue((context: ResolutionContext) =>\n context\n .get(ClientCloudTasksFactory)\n .createPubSubClient(api, new TaskClientConfig(deployment)),\n )\n .inSingletonScope();\n }\n\n bindExternal<T extends object>(api: ApiPrototype<T>, impl: Newable<NoInfer<T>>): void {\n this.options.bind<T>(api).to(impl).inSingletonScope();\n }\n}\n"]}
|