@appland/scanner 1.33.1

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.
Files changed (196) hide show
  1. package/LICENSE.txt +25 -0
  2. package/README.md +122 -0
  3. package/built/algorithms/dataStructures/graph/Graph.js +155 -0
  4. package/built/algorithms/dataStructures/graph/Graph.js.map +1 -0
  5. package/built/algorithms/dataStructures/graph/GraphEdge.js +27 -0
  6. package/built/algorithms/dataStructures/graph/GraphEdge.js.map +1 -0
  7. package/built/algorithms/dataStructures/graph/GraphVertex.js +79 -0
  8. package/built/algorithms/dataStructures/graph/GraphVertex.js.map +1 -0
  9. package/built/algorithms/dataStructures/linked-list/LinkedList.js +134 -0
  10. package/built/algorithms/dataStructures/linked-list/LinkedList.js.map +1 -0
  11. package/built/algorithms/dataStructures/linked-list/LinkedListNode.js +16 -0
  12. package/built/algorithms/dataStructures/linked-list/LinkedListNode.js.map +1 -0
  13. package/built/algorithms/graph/depth-first-search/index.js +49 -0
  14. package/built/algorithms/graph/depth-first-search/index.js.map +1 -0
  15. package/built/algorithms/graph/detect-cycle/index.js +77 -0
  16. package/built/algorithms/graph/detect-cycle/index.js.map +1 -0
  17. package/built/algorithms/utils/Comparator.js +35 -0
  18. package/built/algorithms/utils/Comparator.js.map +1 -0
  19. package/built/analyzer/recordSecrets.js +17 -0
  20. package/built/analyzer/recordSecrets.js.map +1 -0
  21. package/built/analyzer/secretsRegexes.js +13 -0
  22. package/built/analyzer/secretsRegexes.js.map +1 -0
  23. package/built/analyzer/secretsRegexesData.json +51 -0
  24. package/built/check.js +47 -0
  25. package/built/check.js.map +1 -0
  26. package/built/checkInstance.js +69 -0
  27. package/built/checkInstance.js.map +1 -0
  28. package/built/cli/ci/command.js +183 -0
  29. package/built/cli/ci/command.js.map +1 -0
  30. package/built/cli/ci/options.js +3 -0
  31. package/built/cli/ci/options.js.map +1 -0
  32. package/built/cli/exitCode.js +11 -0
  33. package/built/cli/exitCode.js.map +1 -0
  34. package/built/cli/progressReporter.js +16 -0
  35. package/built/cli/progressReporter.js.map +1 -0
  36. package/built/cli/resolveAppId.js +83 -0
  37. package/built/cli/resolveAppId.js.map +1 -0
  38. package/built/cli/scan/command.js +174 -0
  39. package/built/cli/scan/command.js.map +1 -0
  40. package/built/cli/scan/options.js +3 -0
  41. package/built/cli/scan/options.js.map +1 -0
  42. package/built/cli/scan/scanner.js +154 -0
  43. package/built/cli/scan/scanner.js.map +1 -0
  44. package/built/cli/scan.js +103 -0
  45. package/built/cli/scan.js.map +1 -0
  46. package/built/cli/scanArgs.js +26 -0
  47. package/built/cli/scanArgs.js.map +1 -0
  48. package/built/cli/scanOptions.js +3 -0
  49. package/built/cli/scanOptions.js.map +1 -0
  50. package/built/cli/upload/command.js +95 -0
  51. package/built/cli/upload/command.js.map +1 -0
  52. package/built/cli/upload/options.js +3 -0
  53. package/built/cli/upload/options.js.map +1 -0
  54. package/built/cli/validateFile.js +66 -0
  55. package/built/cli/validateFile.js.map +1 -0
  56. package/built/cli.js +32 -0
  57. package/built/cli.js.map +1 -0
  58. package/built/configuration/configurationProvider.js +169 -0
  59. package/built/configuration/configurationProvider.js.map +1 -0
  60. package/built/configuration/schema/match-pattern-config.json +32 -0
  61. package/built/configuration/schema/options.json +193 -0
  62. package/built/configuration/types/checkConfig.js +3 -0
  63. package/built/configuration/types/checkConfig.js.map +1 -0
  64. package/built/configuration/types/configuration.js +3 -0
  65. package/built/configuration/types/configuration.js.map +1 -0
  66. package/built/configuration/types/matchEventConfig.js +3 -0
  67. package/built/configuration/types/matchEventConfig.js.map +1 -0
  68. package/built/configuration/types/matchPatternConfig.js +3 -0
  69. package/built/configuration/types/matchPatternConfig.js.map +1 -0
  70. package/built/database/index.js +259 -0
  71. package/built/database/index.js.map +1 -0
  72. package/built/database/visit.js +80 -0
  73. package/built/database/visit.js.map +1 -0
  74. package/built/errors.js +35 -0
  75. package/built/errors.js.map +1 -0
  76. package/built/findings.js +15 -0
  77. package/built/findings.js.map +1 -0
  78. package/built/integration/appland/fetchStatus.js +51 -0
  79. package/built/integration/appland/fetchStatus.js.map +1 -0
  80. package/built/integration/appland/upload.js +193 -0
  81. package/built/integration/appland/upload.js.map +1 -0
  82. package/built/integration/github/commitStatus.js +19 -0
  83. package/built/integration/github/commitStatus.js.map +1 -0
  84. package/built/integration/vars.js +68 -0
  85. package/built/integration/vars.js.map +1 -0
  86. package/built/openapi/index.js +100 -0
  87. package/built/openapi/index.js.map +1 -0
  88. package/built/openapi/method.js +120 -0
  89. package/built/openapi/method.js.map +1 -0
  90. package/built/openapi/model.js +49 -0
  91. package/built/openapi/model.js.map +1 -0
  92. package/built/openapi/path.js +36 -0
  93. package/built/openapi/path.js.map +1 -0
  94. package/built/openapi/provider.js +133 -0
  95. package/built/openapi/provider.js.map +1 -0
  96. package/built/openapi/response.js +59 -0
  97. package/built/openapi/response.js.map +1 -0
  98. package/built/openapi/rpcRequest.js +130 -0
  99. package/built/openapi/rpcRequest.js.map +1 -0
  100. package/built/openapi/schema.js +42 -0
  101. package/built/openapi/schema.js.map +1 -0
  102. package/built/openapi/securitySchemes.js +32 -0
  103. package/built/openapi/securitySchemes.js.map +1 -0
  104. package/built/openapi/statusCodes.js +68 -0
  105. package/built/openapi/statusCodes.js.map +1 -0
  106. package/built/openapi/util.js +91 -0
  107. package/built/openapi/util.js.map +1 -0
  108. package/built/report/appMapMetadata.js +2 -0
  109. package/built/report/appMapMetadata.js.map +1 -0
  110. package/built/report/findingSummary.js +3 -0
  111. package/built/report/findingSummary.js.map +1 -0
  112. package/built/report/findingsReport.js +37 -0
  113. package/built/report/findingsReport.js.map +1 -0
  114. package/built/report/scanResults.js +103 -0
  115. package/built/report/scanResults.js.map +1 -0
  116. package/built/report/scanSummary.js +3 -0
  117. package/built/report/scanSummary.js.map +1 -0
  118. package/built/report/summaryReport.js +70 -0
  119. package/built/report/summaryReport.js.map +1 -0
  120. package/built/ruleChecker.js +260 -0
  121. package/built/ruleChecker.js.map +1 -0
  122. package/built/rules/authzBeforeAuthn.js +82 -0
  123. package/built/rules/authzBeforeAuthn.js.map +1 -0
  124. package/built/rules/circularDependency.js +227 -0
  125. package/built/rules/circularDependency.js.map +1 -0
  126. package/built/rules/http500.js +18 -0
  127. package/built/rules/http500.js.map +1 -0
  128. package/built/rules/illegalPackageDependency.js +38 -0
  129. package/built/rules/illegalPackageDependency.js.map +1 -0
  130. package/built/rules/incompatibleHttpClientRequest.js +96 -0
  131. package/built/rules/incompatibleHttpClientRequest.js.map +1 -0
  132. package/built/rules/insecureCompare.js +59 -0
  133. package/built/rules/insecureCompare.js.map +1 -0
  134. package/built/rules/jobNotCancelled.js +72 -0
  135. package/built/rules/jobNotCancelled.js.map +1 -0
  136. package/built/rules/lib/hasParameterOrReceiver.js +11 -0
  137. package/built/rules/lib/hasParameterOrReceiver.js.map +1 -0
  138. package/built/rules/lib/matchEvent.js +32 -0
  139. package/built/rules/lib/matchEvent.js.map +1 -0
  140. package/built/rules/lib/matchPattern.js +28 -0
  141. package/built/rules/lib/matchPattern.js.map +1 -0
  142. package/built/rules/lib/rpcWithoutProtection.js +40 -0
  143. package/built/rules/lib/rpcWithoutProtection.js.map +1 -0
  144. package/built/rules/missingAuthentication.js +65 -0
  145. package/built/rules/missingAuthentication.js.map +1 -0
  146. package/built/rules/missingContentType.js +27 -0
  147. package/built/rules/missingContentType.js.map +1 -0
  148. package/built/rules/nPlusOneQuery.js +84 -0
  149. package/built/rules/nPlusOneQuery.js.map +1 -0
  150. package/built/rules/queryFromInvalidPackage.js +37 -0
  151. package/built/rules/queryFromInvalidPackage.js.map +1 -0
  152. package/built/rules/queryFromView.js +29 -0
  153. package/built/rules/queryFromView.js.map +1 -0
  154. package/built/rules/rpcWithoutCircuitBreaker.js +97 -0
  155. package/built/rules/rpcWithoutCircuitBreaker.js.map +1 -0
  156. package/built/rules/saveWithoutValidation.js +27 -0
  157. package/built/rules/saveWithoutValidation.js.map +1 -0
  158. package/built/rules/secretInLog.js +76 -0
  159. package/built/rules/secretInLog.js.map +1 -0
  160. package/built/rules/slowFunctionCall.js +37 -0
  161. package/built/rules/slowFunctionCall.js.map +1 -0
  162. package/built/rules/slowHttpServerRequest.js +24 -0
  163. package/built/rules/slowHttpServerRequest.js.map +1 -0
  164. package/built/rules/slowQuery.js +23 -0
  165. package/built/rules/slowQuery.js.map +1 -0
  166. package/built/rules/tooManyJoins.js +77 -0
  167. package/built/rules/tooManyJoins.js.map +1 -0
  168. package/built/rules/tooManyUpdates.js +143 -0
  169. package/built/rules/tooManyUpdates.js.map +1 -0
  170. package/built/rules/unbatchedMaterializedQuery.js +65 -0
  171. package/built/rules/unbatchedMaterializedQuery.js.map +1 -0
  172. package/built/rules/updateInGetRequest.js +66 -0
  173. package/built/rules/updateInGetRequest.js.map +1 -0
  174. package/built/rules/util.js +102 -0
  175. package/built/rules/util.js.map +1 -0
  176. package/built/sampleConfig/bike_index.yml +10 -0
  177. package/built/sampleConfig/default.yml +19 -0
  178. package/built/sampleConfig/railsSampleApp6thEd.yml +29 -0
  179. package/built/sampleConfig/solidus.yml +31 -0
  180. package/built/scope/commandScope.js +156 -0
  181. package/built/scope/commandScope.js.map +1 -0
  182. package/built/scope/httpClientRequestScope.js +105 -0
  183. package/built/scope/httpClientRequestScope.js.map +1 -0
  184. package/built/scope/httpServerRequestScope.js +105 -0
  185. package/built/scope/httpServerRequestScope.js.map +1 -0
  186. package/built/scope/rootScope.js +105 -0
  187. package/built/scope/rootScope.js.map +1 -0
  188. package/built/scope/scopeImpl.js +88 -0
  189. package/built/scope/scopeImpl.js.map +1 -0
  190. package/built/scope/scopeIterator.js +21 -0
  191. package/built/scope/scopeIterator.js.map +1 -0
  192. package/built/scope/sqlTransactionScope.js +175 -0
  193. package/built/scope/sqlTransactionScope.js.map +1 -0
  194. package/built/wellKnownLabels.js +9 -0
  195. package/built/wellKnownLabels.js.map +1 -0
  196. package/package.json +89 -0
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var util_1 = require("./util");
4
+ var Options = /** @class */ (function () {
5
+ function Options(queryInclude, queryExclude) {
6
+ if (queryInclude === void 0) { queryInclude = [/\binsert\b/i, /\bupdate\b/i]; }
7
+ if (queryExclude === void 0) { queryExclude = []; }
8
+ this._queryInclude = queryInclude;
9
+ this._queryExclude = queryExclude;
10
+ }
11
+ Object.defineProperty(Options.prototype, "queryInclude", {
12
+ get: function () {
13
+ return this._queryInclude;
14
+ },
15
+ set: function (value) {
16
+ this._queryInclude = (0, util_1.toRegExpArray)(value);
17
+ },
18
+ enumerable: false,
19
+ configurable: true
20
+ });
21
+ Object.defineProperty(Options.prototype, "queryExclude", {
22
+ get: function () {
23
+ return this._queryExclude;
24
+ },
25
+ set: function (value) {
26
+ this._queryExclude = (0, util_1.toRegExpArray)(value);
27
+ },
28
+ enumerable: false,
29
+ configurable: true
30
+ });
31
+ return Options;
32
+ }());
33
+ function build(options) {
34
+ if (options === void 0) { options = new Options(); }
35
+ return {
36
+ matcher: function (e) {
37
+ var httpServerRequest;
38
+ function hasHttpServerRequest() {
39
+ httpServerRequest = e
40
+ .ancestors()
41
+ .find(function (ancestor) {
42
+ return ancestor.httpServerRequest &&
43
+ ['head', 'get'].includes(ancestor.httpServerRequest.request_method.toLowerCase());
44
+ });
45
+ return httpServerRequest !== undefined;
46
+ }
47
+ if (options.queryInclude.some(function (pattern) { return e.sqlQuery.match(pattern); }) &&
48
+ !options.queryExclude.some(function (pattern) { return e.sqlQuery.match(pattern); }) &&
49
+ !e.ancestors().some(function (ancestor) { return ancestor.codeObject.labels.has(Audit); }) &&
50
+ hasHttpServerRequest()) {
51
+ return "Data update performed in " + httpServerRequest.route + ": " + e.sqlQuery;
52
+ }
53
+ },
54
+ where: function (e) { return !!e.sqlQuery; },
55
+ };
56
+ }
57
+ var Audit = 'audit';
58
+ exports.default = {
59
+ id: 'update-in-get-request',
60
+ title: 'Data update performed in GET or HEAD request',
61
+ scope: 'http_server_request',
62
+ labels: [Audit],
63
+ Options: Options,
64
+ build: build,
65
+ };
66
+ //# sourceMappingURL=updateInGetRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateInGetRequest.js","sourceRoot":"","sources":["../../src/rules/updateInGetRequest.ts"],"names":[],"mappings":";;AAEA,+BAAuC;AAEvC;IAIE,iBACE,YAAuD,EACvD,YAA2B;QAD3B,6BAAA,EAAA,gBAA0B,aAAa,EAAE,aAAa,CAAC;QACvD,6BAAA,EAAA,iBAA2B;QAE3B,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;QAClC,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC;IACpC,CAAC;IAED,sBAAI,iCAAY;aAAhB;YACE,OAAO,IAAI,CAAC,aAAa,CAAC;QAC5B,CAAC;aAED,UAAiB,KAA0B;YACzC,IAAI,CAAC,aAAa,GAAG,IAAA,oBAAa,EAAC,KAAK,CAAC,CAAC;QAC5C,CAAC;;;OAJA;IAMD,sBAAI,iCAAY;aAAhB;YACE,OAAO,IAAI,CAAC,aAAa,CAAC;QAC5B,CAAC;aAED,UAAiB,KAA0B;YACzC,IAAI,CAAC,aAAa,GAAG,IAAA,oBAAa,EAAC,KAAK,CAAC,CAAC;QAC5C,CAAC;;;OAJA;IAKH,cAAC;AAAD,CAAC,AA3BD,IA2BC;AAED,SAAS,KAAK,CAAC,OAAgC;IAAhC,wBAAA,EAAA,cAAuB,OAAO,EAAE;IAC7C,OAAO;QACL,OAAO,EAAE,UAAC,CAAC;YACT,IAAI,iBAAoC,CAAC;YACzC,SAAS,oBAAoB;gBAC3B,iBAAiB,GAAG,CAAC;qBAClB,SAAS,EAAE;qBACX,IAAI,CACH,UAAC,QAAQ;oBACP,OAAA,QAAQ,CAAC,iBAAiB;wBAC1B,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,iBAAiB,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;gBADjF,CACiF,CACpF,CAAC;gBACJ,OAAO,iBAAiB,KAAK,SAAS,CAAC;YACzC,CAAC;YAED,IACE,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,UAAC,OAAO,IAAK,OAAA,CAAC,CAAC,QAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAA1B,CAA0B,CAAC;gBAClE,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,UAAC,OAAO,IAAK,OAAA,CAAC,CAAC,QAAS,CAAC,KAAK,CAAC,OAAO,CAAC,EAA1B,CAA0B,CAAC;gBACnE,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,IAAI,CAAC,UAAC,QAAQ,IAAK,OAAA,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAArC,CAAqC,CAAC;gBACxE,oBAAoB,EAAE,EACtB;gBACA,OAAO,8BAA4B,iBAAkB,CAAC,KAAK,UAAK,CAAC,CAAC,QAAU,CAAC;aAC9E;QACH,CAAC;QACD,KAAK,EAAE,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAZ,CAAY;KAC3B,CAAC;AACJ,CAAC;AAED,IAAM,KAAK,GAAG,OAAO,CAAC;AAEtB,kBAAe;IACb,EAAE,EAAE,uBAAuB;IAC3B,KAAK,EAAE,8CAA8C;IACrD,KAAK,EAAE,qBAAqB;IAC5B,MAAM,EAAE,CAAC,KAAK,CAAC;IACf,OAAO,SAAA;IACP,KAAK,OAAA;CACE,CAAC"}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.verbose = exports.toRegExpArray = exports.responseContentType = exports.toRegExp = exports.providesAuthentication = exports.isRoot = exports.ideLink = exports.isTruthy = exports.isFalsey = exports.emptyValue = exports.capitalize = exports.appMapDir = void 0;
4
+ var path_1 = require("path");
5
+ var isVerbose = false;
6
+ function verbose(v) {
7
+ if (v === void 0) { v = null; }
8
+ if (v === true || v === false) {
9
+ isVerbose = v;
10
+ }
11
+ return isVerbose;
12
+ }
13
+ exports.verbose = verbose;
14
+ function capitalize(str) {
15
+ if (!str || str === '') {
16
+ return str;
17
+ }
18
+ return [str.charAt(0).toUpperCase(), str.slice(1)].join('');
19
+ }
20
+ exports.capitalize = capitalize;
21
+ function emptyValue(value) {
22
+ return [null, undefined, ''].includes(value);
23
+ }
24
+ exports.emptyValue = emptyValue;
25
+ function responseContentType(event) {
26
+ var _a, _b;
27
+ if ((_a = event.httpServerResponse) === null || _a === void 0 ? void 0 : _a.headers) {
28
+ return event.httpServerResponse.headers['Content-Type'];
29
+ }
30
+ else if ((_b = event.httpClientResponse) === null || _b === void 0 ? void 0 : _b.headers) {
31
+ return event.httpClientResponse.headers['Content-Type'];
32
+ }
33
+ }
34
+ exports.responseContentType = responseContentType;
35
+ function appMapDir(appMapFileName) {
36
+ return appMapFileName.substring(0, appMapFileName.length - '.appmap.json'.length);
37
+ }
38
+ exports.appMapDir = appMapDir;
39
+ // eslint-disable-next-line
40
+ function isFalsey(valueObj) {
41
+ if (!valueObj) {
42
+ return true;
43
+ }
44
+ if (valueObj.class === 'FalseClass') {
45
+ return true;
46
+ }
47
+ if (valueObj.class === 'Array' && valueObj.value === '[]') {
48
+ return true;
49
+ }
50
+ if (valueObj.value === '') {
51
+ return true;
52
+ }
53
+ return false;
54
+ }
55
+ exports.isFalsey = isFalsey;
56
+ var isTruthy = function (valueObj) { return !isFalsey(valueObj); };
57
+ exports.isTruthy = isTruthy;
58
+ function providesAuthentication(event, label) {
59
+ return event.returnValue && event.labels.has(label) && isTruthy(event.returnValue.value);
60
+ }
61
+ exports.providesAuthentication = providesAuthentication;
62
+ function ideLink(filePath, ide, eventId) {
63
+ var OSC = '\u001B]';
64
+ var BEL = '\u0007';
65
+ var SEP = ';';
66
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
67
+ var supportsHyperlinks = require('supports-hyperlinks');
68
+ if (!supportsHyperlinks.stdout) {
69
+ return filePath;
70
+ }
71
+ var path;
72
+ if (!(0, path_1.isAbsolute)(filePath)) {
73
+ path = __dirname + "/../../../../../" + filePath;
74
+ }
75
+ else {
76
+ path = filePath;
77
+ }
78
+ var state = { currentView: 'viewFlow', selectedObject: "event:" + eventId };
79
+ var encodedState = encodeURIComponent(JSON.stringify(state));
80
+ var link = ide == 'vscode'
81
+ ? "vscode://appland.appmap/open?uri=" + path + "&state=" + encodedState
82
+ : ide + "://open?file=" + path;
83
+ return [OSC, '8', SEP, SEP, link, BEL, filePath, OSC, '8', SEP, SEP, BEL].join('');
84
+ }
85
+ exports.ideLink = ideLink;
86
+ var toRegExp = function (value) {
87
+ return typeof value === 'string' ? new RegExp(value) : value;
88
+ };
89
+ exports.toRegExp = toRegExp;
90
+ var toRegExpArray = function (value) {
91
+ return value.map(toRegExp);
92
+ };
93
+ exports.toRegExpArray = toRegExpArray;
94
+ var RootLabels = ['command', 'job'];
95
+ var isRoot = function (event) {
96
+ if (!event) {
97
+ return true;
98
+ }
99
+ return (!!event.httpServerRequest || RootLabels.some(function (label) { return event.codeObject.labels.has(label); }));
100
+ };
101
+ exports.isRoot = isRoot;
102
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/rules/util.ts"],"names":[],"mappings":";;;AACA,6BAAkC;AAElC,IAAI,SAAS,GAAG,KAAK,CAAC;AACtB,SAAS,OAAO,CAAC,CAAwB;IAAxB,kBAAA,EAAA,QAAwB;IACvC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,KAAK,EAAE;QAC7B,SAAS,GAAG,CAAC,CAAC;KACf;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AA4GC,0BAAO;AA1GT,SAAS,UAAU,CAAC,GAAW;IAC7B,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,EAAE,EAAE;QACtB,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,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AAE,GAAG,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrF,CAAC;AA2BC,0BAAO;AAzBT,IAAM,QAAQ,GAAG,UAAC,KAAsB;IACtC,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,MAAM,CAAC,KAAe,CAAC,CAAC,CAAC,CAAE,KAAgB,CAAC;AACrF,CAAC,CAAC;AA0BA,4BAAQ;AAxBV,IAAM,aAAa,GAAG,UAAC,KAA0B;IAC/C,OAAO,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC,CAAC;AAwBA,sCAAa;AAtBf,IAAM,UAAU,GAAG,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAEtC,IAAM,MAAM,GAAG,UAAC,KAAwB;IACtC,IAAI,CAAC,KAAK,EAAE;QACV,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,CAAC,CAAC,KAAK,CAAC,iBAAiB,IAAI,UAAU,CAAC,IAAI,CAAC,UAAC,KAAK,IAAK,OAAA,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAlC,CAAkC,CAAC,CAC5F,CAAC;AACJ,CAAC,CAAC;AASA,wBAAM"}
@@ -0,0 +1,10 @@
1
+ checks:
2
+ - rule: http500
3
+ - rule: missingContentType
4
+ - rule: missingAuthentication
5
+ - rule: nPlusOneQuery
6
+ - rule: saveWithoutValidation
7
+ - rule: secretInLog
8
+ - rule: slowHttpServerRequest
9
+ - rule: slowQuery
10
+ - rule: tooManyUpdates
@@ -0,0 +1,19 @@
1
+ checks:
2
+ - rule: circularDependency
3
+ - rule: http500
4
+ - rule: missingContentType
5
+ - rule: nPlusOneQuery
6
+ # - rule: slowHttpServerRequest
7
+ # - rule: slowQuery
8
+ # - rule: tooManyJoins
9
+ # - rule: tooManyUpdates
10
+ # - rule: updateInGetRequest
11
+ # Required labels: secret, log
12
+ # - rule: secretInLog
13
+ # Required labels: security.authentication, security.authorization
14
+ # - rule: authzBeforeAuthn
15
+ # Required labels: security.authentication
16
+ # Optional labels: public
17
+ # - rule: missingAuthentication
18
+ # Required labels: dao.materialize
19
+ # - rule: unbatchedMaterializedQuery
@@ -0,0 +1,29 @@
1
+ checks:
2
+ - rule: authzBeforeAuthn
3
+ - rule: http500
4
+ - rule: illegalPackageDependency
5
+ properties:
6
+ callerPackages:
7
+ - equal: actionpack
8
+ calleePackage:
9
+ equal: app/controllers
10
+ - rule: insecureCompare
11
+ - rule: missingAuthentication
12
+ - rule: missingContentType
13
+ - rule: nPlusOneQuery
14
+ - rule: secretInLog
15
+ - rule: slowFunctionCall
16
+ properties:
17
+ timeAllowed: 0.2
18
+ functions:
19
+ - match: Controller#
20
+ - rule: slowHttpServerRequest
21
+ properties:
22
+ timeAllowed: 0.5
23
+ - rule: slowQuery
24
+ properties:
25
+ timeAllowed: 0.05
26
+ - rule: tooManyJoins
27
+ - rule: tooManyUpdates
28
+ - rule: unbatchedMaterializedQuery
29
+ - rule: updateInGetRequest
@@ -0,0 +1,31 @@
1
+ checks:
2
+ - rule: http500
3
+ - rule: illegalPackageDependency
4
+ properties:
5
+ callerPackages:
6
+ - equal: actionpack
7
+ - equal: activesupport
8
+ - equal: solidus_core
9
+ calleePackage:
10
+ include: app/controllers
11
+ - rule: missingContentType
12
+ - rule: missingAuthentication
13
+ exclude:
14
+ - event:
15
+ property: route
16
+ test:
17
+ include: /api/
18
+ - rule: secretInLog
19
+ - rule: slowHttpServerRequest
20
+ properties:
21
+ timeAllowed: 1.0
22
+ - rule: slowQuery
23
+ properties:
24
+ timeAllowed: 0.25
25
+ - rule: tooManyUpdates
26
+ - rule: updateInGetRequest
27
+ exclude:
28
+ - event:
29
+ property: query
30
+ test:
31
+ include: INSERT INTO "spree_order_mutexes"
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __generator = (this && this.__generator) || function (thisArg, body) {
18
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
19
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
20
+ function verb(n) { return function (v) { return step([n, v]); }; }
21
+ function step(op) {
22
+ if (f) throw new TypeError("Generator is already executing.");
23
+ while (_) try {
24
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
25
+ if (y = 0, t) op = [op[0] & 2, t.value];
26
+ switch (op[0]) {
27
+ case 0: case 1: t = op; break;
28
+ case 4: _.label++; return { value: op[1], done: false };
29
+ case 5: _.label++; y = op[1]; op = [0]; continue;
30
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
31
+ default:
32
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
34
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
35
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
36
+ if (t[2]) _.ops.pop();
37
+ _.trys.pop(); continue;
38
+ }
39
+ op = body.call(thisArg, _);
40
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
41
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
42
+ }
43
+ };
44
+ var __values = (this && this.__values) || function(o) {
45
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
46
+ if (m) return m.call(o);
47
+ if (o && typeof o.length === "number") return {
48
+ next: function () {
49
+ if (o && i >= o.length) o = void 0;
50
+ return { value: o && o[i++], done: !o };
51
+ }
52
+ };
53
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
54
+ };
55
+ var __importDefault = (this && this.__importDefault) || function (mod) {
56
+ return (mod && mod.__esModule) ? mod : { "default": mod };
57
+ };
58
+ Object.defineProperty(exports, "__esModule", { value: true });
59
+ var models_1 = require("@appland/models");
60
+ var scopeIterator_1 = __importDefault(require("./scopeIterator"));
61
+ var ScopeImpl = /** @class */ (function () {
62
+ function ScopeImpl(event) {
63
+ this.scope = event;
64
+ this.descendants = new models_1.EventNavigator(event);
65
+ }
66
+ ScopeImpl.prototype.events = function () {
67
+ var _a, _b, event, e_1_1;
68
+ var e_1, _c;
69
+ return __generator(this, function (_d) {
70
+ switch (_d.label) {
71
+ case 0: return [4 /*yield*/, this.scope];
72
+ case 1:
73
+ _d.sent();
74
+ _d.label = 2;
75
+ case 2:
76
+ _d.trys.push([2, 7, 8, 9]);
77
+ _a = __values(this.descendants.descendants()), _b = _a.next();
78
+ _d.label = 3;
79
+ case 3:
80
+ if (!!_b.done) return [3 /*break*/, 6];
81
+ event = _b.value;
82
+ return [4 /*yield*/, event.event];
83
+ case 4:
84
+ _d.sent();
85
+ _d.label = 5;
86
+ case 5:
87
+ _b = _a.next();
88
+ return [3 /*break*/, 3];
89
+ case 6: return [3 /*break*/, 9];
90
+ case 7:
91
+ e_1_1 = _d.sent();
92
+ e_1 = { error: e_1_1 };
93
+ return [3 /*break*/, 9];
94
+ case 8:
95
+ try {
96
+ if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
97
+ }
98
+ finally { if (e_1) throw e_1.error; }
99
+ return [7 /*endfinally*/];
100
+ case 9: return [2 /*return*/];
101
+ }
102
+ });
103
+ };
104
+ return ScopeImpl;
105
+ }());
106
+ // TODO: Document the usage of these labels.
107
+ var Command = 'command';
108
+ var Job = 'job';
109
+ var CommandScope = /** @class */ (function (_super) {
110
+ __extends(CommandScope, _super);
111
+ function CommandScope() {
112
+ return _super !== null && _super.apply(this, arguments) || this;
113
+ }
114
+ CommandScope.prototype.scopes = function (events) {
115
+ var events_1, events_1_1, event, e_2_1;
116
+ var e_2, _a;
117
+ return __generator(this, function (_b) {
118
+ switch (_b.label) {
119
+ case 0:
120
+ _b.trys.push([0, 5, 6, 7]);
121
+ events_1 = __values(events), events_1_1 = events_1.next();
122
+ _b.label = 1;
123
+ case 1:
124
+ if (!!events_1_1.done) return [3 /*break*/, 4];
125
+ event = events_1_1.value;
126
+ if (!(event.isCall() &&
127
+ (event.codeObject.labels.has(Command) ||
128
+ event.codeObject.labels.has(Job) ||
129
+ event.httpServerRequest))) return [3 /*break*/, 3];
130
+ return [4 /*yield*/, new ScopeImpl(event)];
131
+ case 2:
132
+ _b.sent();
133
+ this.advanceToReturnEvent(event, events);
134
+ _b.label = 3;
135
+ case 3:
136
+ events_1_1 = events_1.next();
137
+ return [3 /*break*/, 1];
138
+ case 4: return [3 /*break*/, 7];
139
+ case 5:
140
+ e_2_1 = _b.sent();
141
+ e_2 = { error: e_2_1 };
142
+ return [3 /*break*/, 7];
143
+ case 6:
144
+ try {
145
+ if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
146
+ }
147
+ finally { if (e_2) throw e_2.error; }
148
+ return [7 /*endfinally*/];
149
+ case 7: return [2 /*return*/];
150
+ }
151
+ });
152
+ };
153
+ return CommandScope;
154
+ }(scopeIterator_1.default));
155
+ exports.default = CommandScope;
156
+ //# sourceMappingURL=commandScope.js.map
@@ -0,0 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KAG9C;IACH,mBAAC;AAAD,CAAC,AAfD,CAA0C,uBAAa,GAetD"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __generator = (this && this.__generator) || function (thisArg, body) {
18
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
19
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
20
+ function verb(n) { return function (v) { return step([n, v]); }; }
21
+ function step(op) {
22
+ if (f) throw new TypeError("Generator is already executing.");
23
+ while (_) try {
24
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
25
+ if (y = 0, t) op = [op[0] & 2, t.value];
26
+ switch (op[0]) {
27
+ case 0: case 1: t = op; break;
28
+ case 4: _.label++; return { value: op[1], done: false };
29
+ case 5: _.label++; y = op[1]; op = [0]; continue;
30
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
31
+ default:
32
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
34
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
35
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
36
+ if (t[2]) _.ops.pop();
37
+ _.trys.pop(); continue;
38
+ }
39
+ op = body.call(thisArg, _);
40
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
41
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
42
+ }
43
+ };
44
+ var __values = (this && this.__values) || function(o) {
45
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
46
+ if (m) return m.call(o);
47
+ if (o && typeof o.length === "number") return {
48
+ next: function () {
49
+ if (o && i >= o.length) o = void 0;
50
+ return { value: o && o[i++], done: !o };
51
+ }
52
+ };
53
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
54
+ };
55
+ var __importDefault = (this && this.__importDefault) || function (mod) {
56
+ return (mod && mod.__esModule) ? mod : { "default": mod };
57
+ };
58
+ Object.defineProperty(exports, "__esModule", { value: true });
59
+ var scopeImpl_1 = __importDefault(require("./scopeImpl"));
60
+ var scopeIterator_1 = __importDefault(require("./scopeIterator"));
61
+ var HTTPClientRequestScope = /** @class */ (function (_super) {
62
+ __extends(HTTPClientRequestScope, _super);
63
+ function HTTPClientRequestScope() {
64
+ return _super !== null && _super.apply(this, arguments) || this;
65
+ }
66
+ HTTPClientRequestScope.prototype.scopes = function (events) {
67
+ var events_1, events_1_1, event, e_1_1;
68
+ var e_1, _a;
69
+ return __generator(this, function (_b) {
70
+ switch (_b.label) {
71
+ case 0:
72
+ _b.trys.push([0, 5, 6, 7]);
73
+ events_1 = __values(events), events_1_1 = events_1.next();
74
+ _b.label = 1;
75
+ case 1:
76
+ if (!!events_1_1.done) return [3 /*break*/, 4];
77
+ event = events_1_1.value;
78
+ if (!(event.isCall() && event.httpClientRequest)) return [3 /*break*/, 3];
79
+ return [4 /*yield*/, new scopeImpl_1.default(event)];
80
+ case 2:
81
+ _b.sent();
82
+ this.advanceToReturnEvent(event, events);
83
+ _b.label = 3;
84
+ case 3:
85
+ events_1_1 = events_1.next();
86
+ return [3 /*break*/, 1];
87
+ case 4: return [3 /*break*/, 7];
88
+ case 5:
89
+ e_1_1 = _b.sent();
90
+ e_1 = { error: e_1_1 };
91
+ return [3 /*break*/, 7];
92
+ case 6:
93
+ try {
94
+ if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
95
+ }
96
+ finally { if (e_1) throw e_1.error; }
97
+ return [7 /*endfinally*/];
98
+ case 7: return [2 /*return*/];
99
+ }
100
+ });
101
+ };
102
+ return HTTPClientRequestScope;
103
+ }(scopeIterator_1.default));
104
+ exports.default = HTTPClientRequestScope;
105
+ //# sourceMappingURL=httpClientRequestScope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpClientRequestScope.js","sourceRoot":"","sources":["../../src/scope/httpClientRequestScope.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0DAAoC;AACpC,kEAA4C;AAE5C;IAAoD,0CAAa;IAAjE;;IAUA,CAAC;IATE,uCAAM,GAAP,UAAQ,MAAwB;;;;;;;oBACV,WAAA,SAAA,MAAM,CAAA;;;;oBAAf,KAAK;yBACV,CAAA,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,iBAAiB,CAAA,EAAzC,wBAAyC;oBAC3C,qBAAM,IAAI,mBAAS,CAAC,KAAK,CAAC,EAAA;;oBAA1B,SAA0B,CAAC;oBAE3B,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;;KAG9C;IACH,6BAAC;AAAD,CAAC,AAVD,CAAoD,uBAAa,GAUhE"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __generator = (this && this.__generator) || function (thisArg, body) {
18
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
19
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
20
+ function verb(n) { return function (v) { return step([n, v]); }; }
21
+ function step(op) {
22
+ if (f) throw new TypeError("Generator is already executing.");
23
+ while (_) try {
24
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
25
+ if (y = 0, t) op = [op[0] & 2, t.value];
26
+ switch (op[0]) {
27
+ case 0: case 1: t = op; break;
28
+ case 4: _.label++; return { value: op[1], done: false };
29
+ case 5: _.label++; y = op[1]; op = [0]; continue;
30
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
31
+ default:
32
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
33
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
34
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
35
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
36
+ if (t[2]) _.ops.pop();
37
+ _.trys.pop(); continue;
38
+ }
39
+ op = body.call(thisArg, _);
40
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
41
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
42
+ }
43
+ };
44
+ var __values = (this && this.__values) || function(o) {
45
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
46
+ if (m) return m.call(o);
47
+ if (o && typeof o.length === "number") return {
48
+ next: function () {
49
+ if (o && i >= o.length) o = void 0;
50
+ return { value: o && o[i++], done: !o };
51
+ }
52
+ };
53
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
54
+ };
55
+ var __importDefault = (this && this.__importDefault) || function (mod) {
56
+ return (mod && mod.__esModule) ? mod : { "default": mod };
57
+ };
58
+ Object.defineProperty(exports, "__esModule", { value: true });
59
+ var scopeImpl_1 = __importDefault(require("./scopeImpl"));
60
+ var scopeIterator_1 = __importDefault(require("./scopeIterator"));
61
+ var HTTPServerRequestScope = /** @class */ (function (_super) {
62
+ __extends(HTTPServerRequestScope, _super);
63
+ function HTTPServerRequestScope() {
64
+ return _super !== null && _super.apply(this, arguments) || this;
65
+ }
66
+ HTTPServerRequestScope.prototype.scopes = function (events) {
67
+ var events_1, events_1_1, event, e_1_1;
68
+ var e_1, _a;
69
+ return __generator(this, function (_b) {
70
+ switch (_b.label) {
71
+ case 0:
72
+ _b.trys.push([0, 5, 6, 7]);
73
+ events_1 = __values(events), events_1_1 = events_1.next();
74
+ _b.label = 1;
75
+ case 1:
76
+ if (!!events_1_1.done) return [3 /*break*/, 4];
77
+ event = events_1_1.value;
78
+ if (!(event.isCall() && event.httpServerRequest)) return [3 /*break*/, 3];
79
+ return [4 /*yield*/, new scopeImpl_1.default(event)];
80
+ case 2:
81
+ _b.sent();
82
+ this.advanceToReturnEvent(event, events);
83
+ _b.label = 3;
84
+ case 3:
85
+ events_1_1 = events_1.next();
86
+ return [3 /*break*/, 1];
87
+ case 4: return [3 /*break*/, 7];
88
+ case 5:
89
+ e_1_1 = _b.sent();
90
+ e_1 = { error: e_1_1 };
91
+ return [3 /*break*/, 7];
92
+ case 6:
93
+ try {
94
+ if (events_1_1 && !events_1_1.done && (_a = events_1.return)) _a.call(events_1);
95
+ }
96
+ finally { if (e_1) throw e_1.error; }
97
+ return [7 /*endfinally*/];
98
+ case 7: return [2 /*return*/];
99
+ }
100
+ });
101
+ };
102
+ return HTTPServerRequestScope;
103
+ }(scopeIterator_1.default));
104
+ exports.default = HTTPServerRequestScope;
105
+ //# sourceMappingURL=httpServerRequestScope.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpServerRequestScope.js","sourceRoot":"","sources":["../../src/scope/httpServerRequestScope.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,0DAAoC;AACpC,kEAA4C;AAE5C;IAAoD,0CAAa;IAAjE;;IAUA,CAAC;IATE,uCAAM,GAAP,UAAQ,MAAwB;;;;;;;oBACV,WAAA,SAAA,MAAM,CAAA;;;;oBAAf,KAAK;yBACV,CAAA,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,iBAAiB,CAAA,EAAzC,wBAAyC;oBAC3C,qBAAM,IAAI,mBAAS,CAAC,KAAK,CAAC,EAAA;;oBAA1B,SAA0B,CAAC;oBAE3B,IAAI,CAAC,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;;KAG9C;IACH,6BAAC;AAAD,CAAC,AAVD,CAAoD,uBAAa,GAUhE"}