@tsed/platform-middlewares 6.116.4 → 6.117.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.
@@ -33,7 +33,7 @@ function AuthOptions(guardAuth, options = {}) {
33
33
  if (options.responses) {
34
34
  const { responses } = options;
35
35
  store.merge("responses", responses, true);
36
- delete options.responses;
36
+ options.responses = undefined;
37
37
  }
38
38
  if (options.security) {
39
39
  const { security } = options;
@@ -42,7 +42,7 @@ function AuthOptions(guardAuth, options = {}) {
42
42
  entity.operation.addSecurityScopes(name, scopes);
43
43
  });
44
44
  });
45
- delete options.security;
45
+ options.security = undefined;
46
46
  }
47
47
  store.merge(guardAuth, options, true);
48
48
  })(...args);
@@ -1 +1 @@
1
- {"version":3,"file":"authOptions.js","sourceRoot":"","sources":["../../../src/decorators/authOptions.ts"],"names":[],"mappings":";;;AAAA,qCAQoB;AACpB,yCAA0C;AAyB1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,WAAW,CAAC,SAAoB,EAAE,UAAwB,EAAE;IAC1E,OAAO,CAAI,GAAG,IAAyB,EAAqC,EAAE;QAC5E,QAAQ,IAAA,sBAAe,EAAC,IAAI,CAAC,EAAE;YAC7B,KAAK,qBAAc,CAAC,MAAM;gBACxB,OAAO,IAAA,qBAAY,EAAC,CAAC,MAAM,EAAE,EAAE;oBAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;oBAE3B,IAAI,OAAO,CAAC,SAAS,EAAE;wBACrB,MAAM,EAAC,SAAS,EAAC,GAAG,OAAO,CAAC;wBAC5B,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;wBAC1C,OAAO,OAAO,CAAC,SAAS,CAAC;qBAC1B;oBAED,IAAI,OAAO,CAAC,QAAQ,EAAE;wBACpB,MAAM,EAAC,QAAQ,EAAC,GAAG,OAAO,CAAC;wBAC3B,EAAE,CAAC,MAAM,CAAC,QAAe,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;4BAC9C,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAqB,EAAE,EAAE;gCACtE,MAAM,CAAC,SAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;4BACpD,CAAC,CAAC,CAAC;wBACL,CAAC,CAAC,CAAC;wBAEH,OAAO,OAAO,CAAC,QAAQ,CAAC;qBACzB;oBAED,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;gBACxC,CAAC,CAAC,CAAC,GAAI,IAAkC,CAAC,CAAC;YAE7C,KAAK,qBAAc,CAAC,KAAK;gBACvB,IAAA,wBAAiB,EAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5D,MAAM;YAER;gBACE,MAAM,IAAI,+BAAwB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SACzD;IACH,CAAC,CAAC;AACJ,CAAC;AAnCD,kCAmCC","sourcesContent":["import {\n decorateMethodsOf,\n DecoratorMethodParameters,\n DecoratorParameters,\n decoratorTypeOf,\n DecoratorTypes,\n Type,\n UnsupportedDecoratorType\n} from \"@tsed/core\";\nimport {JsonEntityFn} from \"@tsed/schema\";\n\nexport interface IAuthOptions {\n /**\n * @deprecated Since v6. Use @Returns from @tsed/schema\n */\n responses?: {\n [statusCode: string]: {\n description: string;\n };\n };\n /**\n * @deprecated Since v6. Use @Security from @tsed/schema\n */\n security?:\n | {\n [securityName: string]: string[];\n }[]\n | {\n [securityName: string]: string[];\n };\n\n [key: string]: any;\n}\n\n/**\n * Change authentication options.\n *\n * ```typescript\n * @Controller('/mypath')\n * @UseAuth(MyAuthStrategy, {role: ''})\n * class MyCtrl {\n *\n * @Get('/')\n * @AuthOptions(MyAuthStrategy, {role: 'admin'})\n * public getResource(){}\n * }\n * ```\n *\n * @param guardAuth\n * @param options {Object} Object passed to the customer auth strategy\n * @returns {Function}\n * @decorator\n * @decorator\n * @operation\n */\nexport function AuthOptions(guardAuth: Type<any>, options: IAuthOptions = {}): Function {\n return <T>(...args: DecoratorParameters): TypedPropertyDescriptor<T> | void => {\n switch (decoratorTypeOf(args)) {\n case DecoratorTypes.METHOD:\n return JsonEntityFn((entity) => {\n const store = entity.store;\n\n if (options.responses) {\n const {responses} = options;\n store.merge(\"responses\", responses, true);\n delete options.responses;\n }\n\n if (options.security) {\n const {security} = options;\n [].concat(security as any).forEach((security) => {\n Object.entries(security).forEach(([name, scopes]: [string, string[]]) => {\n entity.operation!.addSecurityScopes(name, scopes);\n });\n });\n\n delete options.security;\n }\n\n store.merge(guardAuth, options, true);\n })(...(args as DecoratorMethodParameters));\n\n case DecoratorTypes.CLASS:\n decorateMethodsOf(args[0], AuthOptions(guardAuth, options));\n break;\n\n default:\n throw new UnsupportedDecoratorType(AuthOptions, args);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"authOptions.js","sourceRoot":"","sources":["../../../src/decorators/authOptions.ts"],"names":[],"mappings":";;;AAAA,qCAQoB;AACpB,yCAA0C;AAyB1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,WAAW,CAAC,SAAoB,EAAE,UAAwB,EAAE;IAC1E,OAAO,CAAI,GAAG,IAAyB,EAAqC,EAAE;QAC5E,QAAQ,IAAA,sBAAe,EAAC,IAAI,CAAC,EAAE;YAC7B,KAAK,qBAAc,CAAC,MAAM;gBACxB,OAAO,IAAA,qBAAY,EAAC,CAAC,MAAM,EAAE,EAAE;oBAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;oBAE3B,IAAI,OAAO,CAAC,SAAS,EAAE;wBACrB,MAAM,EAAC,SAAS,EAAC,GAAG,OAAO,CAAC;wBAC5B,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;wBAC1C,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;qBAC/B;oBAED,IAAI,OAAO,CAAC,QAAQ,EAAE;wBACpB,MAAM,EAAC,QAAQ,EAAC,GAAG,OAAO,CAAC;wBAC3B,EAAE,CAAC,MAAM,CAAC,QAAe,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;4BAC9C,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAqB,EAAE,EAAE;gCACtE,MAAM,CAAC,SAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;4BACpD,CAAC,CAAC,CAAC;wBACL,CAAC,CAAC,CAAC;wBAEH,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;qBAC9B;oBAED,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;gBACxC,CAAC,CAAC,CAAC,GAAI,IAAkC,CAAC,CAAC;YAE7C,KAAK,qBAAc,CAAC,KAAK;gBACvB,IAAA,wBAAiB,EAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5D,MAAM;YAER;gBACE,MAAM,IAAI,+BAAwB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SACzD;IACH,CAAC,CAAC;AACJ,CAAC;AAnCD,kCAmCC","sourcesContent":["import {\n decorateMethodsOf,\n DecoratorMethodParameters,\n DecoratorParameters,\n decoratorTypeOf,\n DecoratorTypes,\n Type,\n UnsupportedDecoratorType\n} from \"@tsed/core\";\nimport {JsonEntityFn} from \"@tsed/schema\";\n\nexport interface IAuthOptions {\n /**\n * @deprecated Since v6. Use @Returns from @tsed/schema\n */\n responses?: {\n [statusCode: string]: {\n description: string;\n };\n };\n /**\n * @deprecated Since v6. Use @Security from @tsed/schema\n */\n security?:\n | {\n [securityName: string]: string[];\n }[]\n | {\n [securityName: string]: string[];\n };\n\n [key: string]: any;\n}\n\n/**\n * Change authentication options.\n *\n * ```typescript\n * @Controller('/mypath')\n * @UseAuth(MyAuthStrategy, {role: ''})\n * class MyCtrl {\n *\n * @Get('/')\n * @AuthOptions(MyAuthStrategy, {role: 'admin'})\n * public getResource(){}\n * }\n * ```\n *\n * @param guardAuth\n * @param options {Object} Object passed to the customer auth strategy\n * @returns {Function}\n * @decorator\n * @decorator\n * @operation\n */\nexport function AuthOptions(guardAuth: Type<any>, options: IAuthOptions = {}): Function {\n return <T>(...args: DecoratorParameters): TypedPropertyDescriptor<T> | void => {\n switch (decoratorTypeOf(args)) {\n case DecoratorTypes.METHOD:\n return JsonEntityFn((entity) => {\n const store = entity.store;\n\n if (options.responses) {\n const {responses} = options;\n store.merge(\"responses\", responses, true);\n options.responses = undefined;\n }\n\n if (options.security) {\n const {security} = options;\n [].concat(security as any).forEach((security) => {\n Object.entries(security).forEach(([name, scopes]: [string, string[]]) => {\n entity.operation!.addSecurityScopes(name, scopes);\n });\n });\n\n options.security = undefined;\n }\n\n store.merge(guardAuth, options, true);\n })(...(args as DecoratorMethodParameters));\n\n case DecoratorTypes.CLASS:\n decorateMethodsOf(args[0], AuthOptions(guardAuth, options));\n break;\n\n default:\n throw new UnsupportedDecoratorType(AuthOptions, args);\n }\n };\n}\n"]}
@@ -30,7 +30,7 @@ export function AuthOptions(guardAuth, options = {}) {
30
30
  if (options.responses) {
31
31
  const { responses } = options;
32
32
  store.merge("responses", responses, true);
33
- delete options.responses;
33
+ options.responses = undefined;
34
34
  }
35
35
  if (options.security) {
36
36
  const { security } = options;
@@ -39,7 +39,7 @@ export function AuthOptions(guardAuth, options = {}) {
39
39
  entity.operation.addSecurityScopes(name, scopes);
40
40
  });
41
41
  });
42
- delete options.security;
42
+ options.security = undefined;
43
43
  }
44
44
  store.merge(guardAuth, options, true);
45
45
  })(...args);
@@ -1 +1 @@
1
- {"version":3,"file":"auth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IAAI,CAAC,CAAC;gBACxC,CAAC,CAAC,CAAC,GAAI,IAAkC,CAAC,CAAC;YAE7C,KAAK,cAAc,CAAC,KAAK;gBACvB,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5D,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SACzD;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n decorateMethodsOf,\n DecoratorMethodParameters,\n DecoratorParameters,\n decoratorTypeOf,\n DecoratorTypes,\n Type,\n UnsupportedDecoratorType\n} from \"@tsed/core\";\nimport {JsonEntityFn} from \"@tsed/schema\";\n\nexport interface IAuthOptions {\n /**\n * @deprecated Since v6. Use @Returns from @tsed/schema\n */\n responses?: {\n [statusCode: string]: {\n description: string;\n };\n };\n /**\n * @deprecated Since v6. Use @Security from @tsed/schema\n */\n security?:\n | {\n [securityName: string]: string[];\n }[]\n | {\n [securityName: string]: string[];\n };\n\n [key: string]: any;\n}\n\n/**\n * Change authentication options.\n *\n * ```typescript\n * @Controller('/mypath')\n * @UseAuth(MyAuthStrategy, {role: ''})\n * class MyCtrl {\n *\n * @Get('/')\n * @AuthOptions(MyAuthStrategy, {role: 'admin'})\n * public getResource(){}\n * }\n * ```\n *\n * @param guardAuth\n * @param options {Object} Object passed to the customer auth strategy\n * @returns {Function}\n * @decorator\n * @decorator\n * @operation\n */\nexport function AuthOptions(guardAuth: Type<any>, options: IAuthOptions = {}): Function {\n return <T>(...args: DecoratorParameters): TypedPropertyDescriptor<T> | void => {\n switch (decoratorTypeOf(args)) {\n case DecoratorTypes.METHOD:\n return JsonEntityFn((entity) => {\n const store = entity.store;\n\n if (options.responses) {\n const {responses} = options;\n store.merge(\"responses\", responses, true);\n delete options.responses;\n }\n\n if (options.security) {\n const {security} = options;\n [].concat(security as any).forEach((security) => {\n Object.entries(security).forEach(([name, scopes]: [string, string[]]) => {\n entity.operation!.addSecurityScopes(name, scopes);\n });\n });\n\n delete options.security;\n }\n\n store.merge(guardAuth, options, true);\n })(...(args as DecoratorMethodParameters));\n\n case DecoratorTypes.CLASS:\n decorateMethodsOf(args[0], AuthOptions(guardAuth, options));\n break;\n\n default:\n throw new UnsupportedDecoratorType(AuthOptions, args);\n }\n };\n}\n"]}
1
+ {"version":3,"file":"authOptions.js","sourceRoot":"","sources":["../../../src/decorators/authOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAGjB,eAAe,EACf,cAAc,EAEd,wBAAwB,EACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAyB1C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,WAAW,CAAC,SAAoB,EAAE,UAAwB,EAAE;IAC1E,OAAO,CAAI,GAAG,IAAyB,EAAqC,EAAE;QAC5E,QAAQ,eAAe,CAAC,IAAI,CAAC,EAAE;YAC7B,KAAK,cAAc,CAAC,MAAM;gBACxB,OAAO,YAAY,CAAC,CAAC,MAAM,EAAE,EAAE;oBAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;oBAE3B,IAAI,OAAO,CAAC,SAAS,EAAE;wBACrB,MAAM,EAAC,SAAS,EAAC,GAAG,OAAO,CAAC;wBAC5B,KAAK,CAAC,KAAK,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;wBAC1C,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;qBAC/B;oBAED,IAAI,OAAO,CAAC,QAAQ,EAAE;wBACpB,MAAM,EAAC,QAAQ,EAAC,GAAG,OAAO,CAAC;wBAC3B,EAAE,CAAC,MAAM,CAAC,QAAe,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;4BAC9C,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAqB,EAAE,EAAE;gCACtE,MAAM,CAAC,SAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;4BACpD,CAAC,CAAC,CAAC;wBACL,CAAC,CAAC,CAAC;wBAEH,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;qBAC9B;oBAED,KAAK,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;gBACxC,CAAC,CAAC,CAAC,GAAI,IAAkC,CAAC,CAAC;YAE7C,KAAK,cAAc,CAAC,KAAK;gBACvB,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,WAAW,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC5D,MAAM;YAER;gBACE,MAAM,IAAI,wBAAwB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;SACzD;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import {\n decorateMethodsOf,\n DecoratorMethodParameters,\n DecoratorParameters,\n decoratorTypeOf,\n DecoratorTypes,\n Type,\n UnsupportedDecoratorType\n} from \"@tsed/core\";\nimport {JsonEntityFn} from \"@tsed/schema\";\n\nexport interface IAuthOptions {\n /**\n * @deprecated Since v6. Use @Returns from @tsed/schema\n */\n responses?: {\n [statusCode: string]: {\n description: string;\n };\n };\n /**\n * @deprecated Since v6. Use @Security from @tsed/schema\n */\n security?:\n | {\n [securityName: string]: string[];\n }[]\n | {\n [securityName: string]: string[];\n };\n\n [key: string]: any;\n}\n\n/**\n * Change authentication options.\n *\n * ```typescript\n * @Controller('/mypath')\n * @UseAuth(MyAuthStrategy, {role: ''})\n * class MyCtrl {\n *\n * @Get('/')\n * @AuthOptions(MyAuthStrategy, {role: 'admin'})\n * public getResource(){}\n * }\n * ```\n *\n * @param guardAuth\n * @param options {Object} Object passed to the customer auth strategy\n * @returns {Function}\n * @decorator\n * @decorator\n * @operation\n */\nexport function AuthOptions(guardAuth: Type<any>, options: IAuthOptions = {}): Function {\n return <T>(...args: DecoratorParameters): TypedPropertyDescriptor<T> | void => {\n switch (decoratorTypeOf(args)) {\n case DecoratorTypes.METHOD:\n return JsonEntityFn((entity) => {\n const store = entity.store;\n\n if (options.responses) {\n const {responses} = options;\n store.merge(\"responses\", responses, true);\n options.responses = undefined;\n }\n\n if (options.security) {\n const {security} = options;\n [].concat(security as any).forEach((security) => {\n Object.entries(security).forEach(([name, scopes]: [string, string[]]) => {\n entity.operation!.addSecurityScopes(name, scopes);\n });\n });\n\n options.security = undefined;\n }\n\n store.merge(guardAuth, options, true);\n })(...(args as DecoratorMethodParameters));\n\n case DecoratorTypes.CLASS:\n decorateMethodsOf(args[0], AuthOptions(guardAuth, options));\n break;\n\n default:\n throw new UnsupportedDecoratorType(AuthOptions, args);\n }\n };\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsed/platform-middlewares",
3
- "version": "6.116.4",
3
+ "version": "6.117.0",
4
4
  "description": "Middlewares module for Ts.ED Framework",
5
5
  "private": false,
6
6
  "source": "./src/index.ts",
@@ -24,14 +24,14 @@
24
24
  "tslib": "2.4.0"
25
25
  },
26
26
  "devDependencies": {
27
- "@tsed/core": "6.116.4",
28
- "@tsed/di": "6.116.4",
29
- "@tsed/schema": "6.116.4"
27
+ "@tsed/core": "6.117.0",
28
+ "@tsed/di": "6.117.0",
29
+ "@tsed/schema": "6.117.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "@tsed/core": "^6.116.4",
33
- "@tsed/di": "^6.116.4",
34
- "@tsed/schema": "^6.116.4"
32
+ "@tsed/core": "^6.117.0",
33
+ "@tsed/di": "^6.117.0",
34
+ "@tsed/schema": "^6.117.0"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@tsed/core": {