You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

trpc-nestjs-adapter

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trpc-nestjs-adapter - npm Package Compare versions

Comparing version

to
1.0.0-alpha.11

7

dist/build-nest-resolver.d.ts

@@ -24,4 +24,11 @@ import { ModuleRef } from '@nestjs/core';

};
/**
*
* "resets" the DI subtree from which dependencies will be resolved.
*
* All subsequent calls to `resolveNestDependency` will resolve dependencies from the new subtree and even `REQUEST` scoped dependencies will be re-created.
*/
resetDiSubtree: () => void;
attachToReqObject: (_trpc_nest_adapter_meta: Record<string, any>) => void;
};
//# sourceMappingURL=build-nest-resolver.d.ts.map

16

dist/build-nest-resolver.js

@@ -7,6 +7,8 @@ "use strict";

// Retrieve the contextId specific to this request
const contextId = core_1.ContextIdFactory.getByRequest(req);
let contextId = core_1.ContextIdFactory.getByRequest(req);
// Effectively a provider for the `REQUEST` token
moduleRef.registerRequestByContextId(req, contextId);
const resolveNestDependency = (typeOrToken) => moduleRef.resolve(typeOrToken, contextId, { strict: false });
const resolveNestDependency = (typeOrToken) => {
return moduleRef.resolve(typeOrToken, contextId, { strict: false });
};
// API Candidates

@@ -21,2 +23,12 @@ // const requestScopedService = await ctx.nestResolver.resolve(RequestScopedService);

resolveNestDependency,
/**
*
* "resets" the DI subtree from which dependencies will be resolved.
*
* All subsequent calls to `resolveNestDependency` will resolve dependencies from the new subtree and even `REQUEST` scoped dependencies will be re-created.
*/
resetDiSubtree: () => {
contextId = core_1.ContextIdFactory.create();
moduleRef.registerRequestByContextId(req, contextId);
},
attachToReqObject: (_trpc_nest_adapter_meta) => {

@@ -23,0 +35,0 @@ req._trpc_nest_adapter_meta = _trpc_nest_adapter_meta;

7

dist/build-trpc-nest-middleware.js

@@ -20,6 +20,6 @@ "use strict";

return function trpcNestMiddleware(req, res) {
const { resolveNestDependency, attachToReqObject } = (0, build_nest_resolver_1.buildNestResolver)(req, moduleRef);
const { resolveNestDependency, attachToReqObject, resetDiSubtree } = (0, build_nest_resolver_1.buildNestResolver)(req, moduleRef);
return (0, standalone_1.createHTTPHandler)({
router,
createContext: ({ req, res, }) => {
createContext: () => {
const userProvidedContext = createContext();

@@ -29,3 +29,4 @@ return {

resolveNestDependency,
attachToReqObject
attachToReqObject,
resetDiSubtree
};

@@ -32,0 +33,0 @@ },

@@ -14,4 +14,5 @@ interface Type<T = any> extends Function {

attachToReqObject: (anything: Record<string, any>) => void;
resetDiSubtree: () => void;
}
export {};
//# sourceMappingURL=nest-resolver.type.d.ts.map
{
"name": "trpc-nestjs-adapter",
"version": "1.0.0-alpha.10",
"description": "TRPC adapter for NestJS",
"keywords": [
"nestjs",
"nest",
"trpc",
"adapter"
],
"author": {
"name": "Darko Stojkovski",
"email": "dar3.st@gmail.com"
},
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.js"
"name": "trpc-nestjs-adapter",
"version": "1.0.0-alpha.11",
"description": "TRPC adapter for NestJS",
"keywords": [
"nestjs",
"nest",
"trpc",
"adapter"
],
"author": {
"name": "Darko Stojkovski",
"email": "dar3.st@gmail.com"
},
"./package.json": "./package.json"
},
"scripts": {
"build": "tsc",
"dev": "tsc -w",
"lint": "eslint --ext .ts src/"
},
"peerDependencies": {
"@nestjs/common": "^9.2.1",
"@nestjs/core": "^9.2.1",
"@nestjs/platform-express": "^9.2.1",
"@trpc/server": "~10.14.0",
"reflect-metadata": "^0.1.12",
"rxjs": "^7.1.0"
},
"dependencies": {},
"devDependencies": {
"@types/node": "^16.0.0",
"@typescript-eslint/eslint-plugin": "^5.48.2",
"@typescript-eslint/parser": "^5.48.2",
"eslint": "^8.2.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "^2.25.2",
"nodemon": "^2.0.20",
"typescript": "^4.9.4",
"@nestjs/common": "^9.2.1",
"@nestjs/core": "^9.2.1",
"@nestjs/platform-express": "^9.2.1",
"@trpc/server": "~10.14.0",
"reflect-metadata": "^0.1.12",
"rxjs": "^7.1.0"
},
"files": [
"dist"
]
"license": "MIT",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"exports": {
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.js",
"require": "./dist/index.js"
},
"./package.json": "./package.json"
},
"scripts": {
"build": "tsc",
"dev": "tsc -w",
"lint": "eslint --ext .ts src/"
},
"peerDependencies": {
"@nestjs/common": "^9.2.1",
"@nestjs/core": "^9.2.1",
"@nestjs/platform-express": "^9.2.1",
"@trpc/server": "~10.14.0",
"reflect-metadata": "^0.1.12",
"rxjs": "^7.1.0"
},
"dependencies": {},
"devDependencies": {
"@nestjs/common": "^9.2.1",
"@nestjs/core": "^9.2.1",
"@nestjs/platform-express": "^9.2.1",
"@trpc/server": "~10.14.0",
"@types/node": "^16.0.0",
"@typescript-eslint/eslint-plugin": "^5.48.2",
"@typescript-eslint/parser": "^5.48.2",
"eslint": "^8.2.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "^2.25.2",
"nodemon": "^2.0.20",
"reflect-metadata": "^0.1.12",
"rxjs": "^7.1.0",
"typescript": "^4.9.4"
},
"files": [
"dist"
]
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet