@t4h.framework/core 0.19.0 → 0.20.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.
Files changed (168) hide show
  1. package/.ai/skills/framework-core/SKILL.md +19 -19
  2. package/.ai/skills/framework-workflow-creation/SKILL.md +18 -17
  3. package/.ai/skills/framework-workflow-testing/SKILL.md +2 -4
  4. package/CHANGELOG.md +25 -0
  5. package/README.md +59 -7
  6. package/dist/activities/StartWorkflowActivity.d.ts +13 -13
  7. package/dist/activities/StartWorkflowActivity.d.ts.map +1 -1
  8. package/dist/activities/StartWorkflowActivity.js +1 -3
  9. package/dist/activities/StartWorkflowActivity.js.map +1 -1
  10. package/dist/activities/WorkflowBatchSizeActivity.d.ts +2 -2
  11. package/dist/activities/WorkflowBatchSizeActivity.d.ts.map +1 -1
  12. package/dist/activities/WorkflowBatchSizeActivity.js.map +1 -1
  13. package/dist/activities/WorkflowBatchTakeActivity.d.ts +2 -2
  14. package/dist/activities/WorkflowBatchTakeActivity.d.ts.map +1 -1
  15. package/dist/activities/WorkflowBatchTakeActivity.js +1 -1
  16. package/dist/activities/WorkflowBatchTakeActivity.js.map +1 -1
  17. package/dist/activities/WorkflowBatchToArrayActivity.d.ts +2 -2
  18. package/dist/activities/WorkflowBatchToArrayActivity.d.ts.map +1 -1
  19. package/dist/activities/WorkflowBatchToArrayActivity.js.map +1 -1
  20. package/dist/eslint/index.d.ts +16 -0
  21. package/dist/eslint/index.d.ts.map +1 -0
  22. package/dist/eslint/index.js +69 -0
  23. package/dist/eslint/index.js.map +1 -0
  24. package/dist/eslint/rules/env-from-env-design.d.ts +3 -0
  25. package/dist/eslint/rules/env-from-env-design.d.ts.map +1 -0
  26. package/dist/eslint/rules/env-from-env-design.js +85 -0
  27. package/dist/eslint/rules/env-from-env-design.js.map +1 -0
  28. package/dist/eslint/rules/no-binary-stream-outside-activity.d.ts +3 -0
  29. package/dist/eslint/rules/no-binary-stream-outside-activity.d.ts.map +1 -0
  30. package/dist/eslint/rules/no-binary-stream-outside-activity.js +51 -0
  31. package/dist/eslint/rules/no-binary-stream-outside-activity.js.map +1 -0
  32. package/dist/eslint/rules/no-binary-subclass.d.ts +3 -0
  33. package/dist/eslint/rules/no-binary-subclass.d.ts.map +1 -0
  34. package/dist/eslint/rules/no-binary-subclass.js +31 -0
  35. package/dist/eslint/rules/no-binary-subclass.js.map +1 -0
  36. package/dist/eslint/rules/no-framework-activity-in-app.d.ts +3 -0
  37. package/dist/eslint/rules/no-framework-activity-in-app.d.ts.map +1 -0
  38. package/dist/eslint/rules/no-framework-activity-in-app.js +41 -0
  39. package/dist/eslint/rules/no-framework-activity-in-app.js.map +1 -0
  40. package/dist/eslint/rules/no-io-in-workflow.d.ts +3 -0
  41. package/dist/eslint/rules/no-io-in-workflow.d.ts.map +1 -0
  42. package/dist/eslint/rules/no-io-in-workflow.js +92 -0
  43. package/dist/eslint/rules/no-io-in-workflow.js.map +1 -0
  44. package/dist/eslint/rules/no-literal-secret-in-authorization.d.ts +3 -0
  45. package/dist/eslint/rules/no-literal-secret-in-authorization.d.ts.map +1 -0
  46. package/dist/eslint/rules/no-literal-secret-in-authorization.js +56 -0
  47. package/dist/eslint/rules/no-literal-secret-in-authorization.js.map +1 -0
  48. package/dist/eslint/rules/no-nondeterministic-in-workflow.d.ts +3 -0
  49. package/dist/eslint/rules/no-nondeterministic-in-workflow.d.ts.map +1 -0
  50. package/dist/eslint/rules/no-nondeterministic-in-workflow.js +102 -0
  51. package/dist/eslint/rules/no-nondeterministic-in-workflow.js.map +1 -0
  52. package/dist/eslint/rules/no-secret-to-string.d.ts +3 -0
  53. package/dist/eslint/rules/no-secret-to-string.d.ts.map +1 -0
  54. package/dist/eslint/rules/no-secret-to-string.js +97 -0
  55. package/dist/eslint/rules/no-secret-to-string.js.map +1 -0
  56. package/dist/eslint/rules/no-testing-import-in-source.d.ts +3 -0
  57. package/dist/eslint/rules/no-testing-import-in-source.d.ts.map +1 -0
  58. package/dist/eslint/rules/no-testing-import-in-source.js +34 -0
  59. package/dist/eslint/rules/no-testing-import-in-source.js.map +1 -0
  60. package/dist/eslint/rules/require-workflow-id.d.ts +3 -0
  61. package/dist/eslint/rules/require-workflow-id.d.ts.map +1 -0
  62. package/dist/eslint/rules/require-workflow-id.js +38 -0
  63. package/dist/eslint/rules/require-workflow-id.js.map +1 -0
  64. package/dist/eslint/tools/bindings.d.ts +16 -0
  65. package/dist/eslint/tools/bindings.d.ts.map +1 -0
  66. package/dist/eslint/tools/bindings.js +38 -0
  67. package/dist/eslint/tools/bindings.js.map +1 -0
  68. package/dist/eslint/tools/coreTypes.d.ts +9 -0
  69. package/dist/eslint/tools/coreTypes.d.ts.map +1 -0
  70. package/dist/eslint/tools/coreTypes.js +115 -0
  71. package/dist/eslint/tools/coreTypes.js.map +1 -0
  72. package/dist/eslint/tools/workflowSides.d.ts +15 -0
  73. package/dist/eslint/tools/workflowSides.d.ts.map +1 -0
  74. package/dist/eslint/tools/workflowSides.js +61 -0
  75. package/dist/eslint/tools/workflowSides.js.map +1 -0
  76. package/dist/models/Activity.d.ts +5 -5
  77. package/dist/models/Activity.d.ts.map +1 -1
  78. package/dist/models/App.d.ts +8 -8
  79. package/dist/models/App.d.ts.map +1 -1
  80. package/dist/models/App.js.map +1 -1
  81. package/dist/models/AsyncActivity.d.ts +5 -5
  82. package/dist/models/AsyncActivity.d.ts.map +1 -1
  83. package/dist/models/AsyncActivity.js +1 -1
  84. package/dist/models/AsyncActivity.js.map +1 -1
  85. package/dist/models/AsyncActivityAdvanceResult.d.ts +4 -4
  86. package/dist/models/AsyncActivityAdvanceResult.d.ts.map +1 -1
  87. package/dist/models/AsyncActivityAdvanceResult.js.map +1 -1
  88. package/dist/models/AsyncActivityAwaitable.d.ts +1 -1
  89. package/dist/models/AsyncActivityAwaitable.d.ts.map +1 -1
  90. package/dist/models/AsyncActivityAwaitable.js +4 -1
  91. package/dist/models/AsyncActivityAwaitable.js.map +1 -1
  92. package/dist/models/Authorization.d.ts +2 -2
  93. package/dist/models/Authorization.d.ts.map +1 -1
  94. package/dist/models/Claim.d.ts +5 -4
  95. package/dist/models/Claim.d.ts.map +1 -1
  96. package/dist/models/Claim.js.map +1 -1
  97. package/dist/models/Env.d.ts.map +1 -1
  98. package/dist/models/Env.js +4 -1
  99. package/dist/models/Env.js.map +1 -1
  100. package/dist/models/EnvDesign.d.ts +2 -2
  101. package/dist/models/EnvDesign.d.ts.map +1 -1
  102. package/dist/models/EnvDesign.js +15 -14
  103. package/dist/models/EnvDesign.js.map +1 -1
  104. package/dist/models/History.d.ts +1 -1
  105. package/dist/models/History.d.ts.map +1 -1
  106. package/dist/models/History.js +2 -1
  107. package/dist/models/History.js.map +1 -1
  108. package/dist/models/Logger.d.ts.map +1 -1
  109. package/dist/models/Logger.js +7 -3
  110. package/dist/models/Logger.js.map +1 -1
  111. package/dist/models/SerializableHelper.d.ts +1 -1
  112. package/dist/models/SerializableHelper.d.ts.map +1 -1
  113. package/dist/models/SyncActivity.d.ts +2 -2
  114. package/dist/models/SyncActivity.d.ts.map +1 -1
  115. package/dist/models/SyncActivity.js.map +1 -1
  116. package/dist/models/Workflow.d.ts +6 -4
  117. package/dist/models/Workflow.d.ts.map +1 -1
  118. package/dist/models/Workflow.js +5 -5
  119. package/dist/models/Workflow.js.map +1 -1
  120. package/dist/testing/TestClock.d.ts.map +1 -1
  121. package/dist/testing/TestClock.js +1 -0
  122. package/dist/testing/TestClock.js.map +1 -1
  123. package/dist/testing/TestWorkflowEnvironment.d.ts +3 -3
  124. package/dist/testing/TestWorkflowEnvironment.d.ts.map +1 -1
  125. package/dist/testing/TestWorkflowEnvironment.js +2 -1
  126. package/dist/testing/TestWorkflowEnvironment.js.map +1 -1
  127. package/dist/testing/tools/clone.d.ts +1 -1
  128. package/dist/testing/tools/clone.d.ts.map +1 -1
  129. package/dist/testing/tools/clone.js +30 -20
  130. package/dist/testing/tools/clone.js.map +1 -1
  131. package/dist/testing/tools/create-mock-claim.d.ts.map +1 -1
  132. package/dist/testing/tools/create-mock-claim.js +4 -1
  133. package/dist/testing/tools/create-mock-claim.js.map +1 -1
  134. package/dist/testing/tools/create-mock-claims.d.ts +4 -1
  135. package/dist/testing/tools/create-mock-claims.d.ts.map +1 -1
  136. package/dist/testing/tools/create-mock-claims.js.map +1 -1
  137. package/dist/testing/tools/mock-async.d.ts +3 -1
  138. package/dist/testing/tools/mock-async.d.ts.map +1 -1
  139. package/dist/testing/tools/mock-async.js +8 -6
  140. package/dist/testing/tools/mock-async.js.map +1 -1
  141. package/dist/testing/tools/resolve-async-activity.d.ts.map +1 -1
  142. package/dist/testing/tools/resolve-async-activity.js +33 -19
  143. package/dist/testing/tools/resolve-async-activity.js.map +1 -1
  144. package/dist/testing/tools/run-workflow-ticks.d.ts +2 -2
  145. package/dist/testing/tools/run-workflow-ticks.d.ts.map +1 -1
  146. package/dist/testing/tools/run-workflow-ticks.js +15 -7
  147. package/dist/testing/tools/run-workflow-ticks.js.map +1 -1
  148. package/dist/testing/tools/run-workflow.d.ts +3 -3
  149. package/dist/testing/tools/run-workflow.d.ts.map +1 -1
  150. package/dist/testing/typings/ClaimConstructor.d.ts +2 -1
  151. package/dist/testing/typings/ClaimConstructor.d.ts.map +1 -1
  152. package/dist/tools/AsyncActivityCallback.d.ts.map +1 -1
  153. package/dist/tools/AsyncActivityCallback.js +3 -1
  154. package/dist/tools/AsyncActivityCallback.js.map +1 -1
  155. package/dist/tools/Internals.d.ts +5 -5
  156. package/dist/tools/Internals.d.ts.map +1 -1
  157. package/dist/tools/Internals.js.map +1 -1
  158. package/dist/tools/WorkflowBatchQuery.d.ts +1 -1
  159. package/dist/tools/WorkflowBatchQuery.d.ts.map +1 -1
  160. package/dist/tools/WorkflowBatchQuery.js +7 -4
  161. package/dist/tools/WorkflowBatchQuery.js.map +1 -1
  162. package/dist/typings/Serializable.d.ts +2 -1
  163. package/dist/typings/Serializable.d.ts.map +1 -1
  164. package/package.json +17 -2
  165. package/dist/tools/isActivity.d.ts +0 -4
  166. package/dist/tools/isActivity.d.ts.map +0 -1
  167. package/dist/tools/isActivity.js +0 -13
  168. package/dist/tools/isActivity.js.map +0 -1
@@ -0,0 +1,69 @@
1
+ import { envFromEnvDesign } from './rules/env-from-env-design.js';
2
+ import { noBinaryStreamOutsideActivity } from './rules/no-binary-stream-outside-activity.js';
3
+ import { noBinarySubclass } from './rules/no-binary-subclass.js';
4
+ import { noFrameworkActivityInApp } from './rules/no-framework-activity-in-app.js';
5
+ import { noIoInWorkflow } from './rules/no-io-in-workflow.js';
6
+ import { noLiteralSecretInAuthorization } from './rules/no-literal-secret-in-authorization.js';
7
+ import { noNondeterministicInWorkflow } from './rules/no-nondeterministic-in-workflow.js';
8
+ import { noSecretToString } from './rules/no-secret-to-string.js';
9
+ import { noTestingImportInSource } from './rules/no-testing-import-in-source.js';
10
+ import { requireWorkflowId } from './rules/require-workflow-id.js';
11
+ const NAME = '@t4h.framework/core';
12
+ const ALL_FILES = ['**/*.{js,mjs,cjs,jsx,ts,tsx,mts,cts}'];
13
+ const TYPED_FILES = ['**/*.{ts,tsx,mts,cts}'];
14
+ const SOURCE_FILES = ['src/**/*.{js,mjs,cjs,jsx,ts,tsx,mts,cts}'];
15
+ const TEST_FILES = [
16
+ '**/__tests__/**',
17
+ '**/*.{spec,test}.{js,mjs,cjs,jsx,ts,tsx,mts,cts}',
18
+ ];
19
+ const rules = {
20
+ 'env-from-env-design': envFromEnvDesign,
21
+ 'no-binary-stream-outside-activity': noBinaryStreamOutsideActivity,
22
+ 'no-binary-subclass': noBinarySubclass,
23
+ 'no-framework-activity-in-app': noFrameworkActivityInApp,
24
+ 'no-io-in-workflow': noIoInWorkflow,
25
+ 'no-literal-secret-in-authorization': noLiteralSecretInAuthorization,
26
+ 'no-nondeterministic-in-workflow': noNondeterministicInWorkflow,
27
+ 'no-secret-to-string': noSecretToString,
28
+ 'no-testing-import-in-source': noTestingImportInSource,
29
+ 'require-workflow-id': requireWorkflowId,
30
+ };
31
+ const plugin = { meta: { name: NAME }, rules };
32
+ const recommended = [
33
+ { plugins: { [NAME]: plugin } },
34
+ {
35
+ files: TYPED_FILES,
36
+ rules: {
37
+ [`${NAME}/no-binary-stream-outside-activity`]: 'error',
38
+ [`${NAME}/no-io-in-workflow`]: 'error',
39
+ [`${NAME}/no-nondeterministic-in-workflow`]: 'error',
40
+ [`${NAME}/no-secret-to-string`]: 'error',
41
+ [`${NAME}/require-workflow-id`]: 'error',
42
+ },
43
+ },
44
+ {
45
+ files: TYPED_FILES,
46
+ ignores: TEST_FILES,
47
+ rules: {
48
+ [`${NAME}/no-binary-subclass`]: 'error',
49
+ [`${NAME}/no-framework-activity-in-app`]: 'error',
50
+ [`${NAME}/no-literal-secret-in-authorization`]: 'error',
51
+ },
52
+ },
53
+ {
54
+ files: ALL_FILES,
55
+ ignores: TEST_FILES,
56
+ rules: { [`${NAME}/no-testing-import-in-source`]: 'error' },
57
+ },
58
+ {
59
+ files: SOURCE_FILES,
60
+ rules: { [`${NAME}/env-from-env-design`]: 'error' },
61
+ },
62
+ ];
63
+ const core = { ...plugin, configs: { recommended } };
64
+ /**
65
+ * The ESLint plugin of `@t4h.framework/core`, with the rules for code that
66
+ * uses the core.
67
+ */
68
+ export default core;
69
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/eslint/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAA;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAA;AAC9F,OAAO,EAAE,4BAA4B,EAAE,MAAM,4C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C,EAAE,OAAO;SACzC;KACF;IACD;QACE,KAAK,EAAE,WAAW;QAClB,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE;YACL,CAAC,GAAG,IAAI,qBAAqB,CAAC,EAAE,OAAO;YACvC,CAAC,GAAG,IAAI,+BAA+B,CAAC,EAAE,OAAO;YACjD,CAAC,GAAG,IAAI,qCAAqC,CAAC,EAAE,OAAO;SACxD;KACF;IACD;QACE,KAAK,EAAE,SAAS;QAChB,OAAO,EAAE,UAAU;QACnB,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,8BAA8B,CAAC,EAAE,OAAO,EAAE;KAC5D;IACD;QACE,KAAK,EAAE,YAAY;QACnB,KAAK,EAAE,EAAE,CAAC,GAAG,IAAI,sBAAsB,CAAC,EAAE,OAAO,EAAE;KACpD;CACF,CAAA;AASD,MAAM,IAAI,GAA0B,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,EAAE,CAAA;AAE3E;;;GAGG;AACH,eAAe,IAAI,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const envFromEnvDesign: Rule.RuleModule;
3
+ //# sourceMappingURL=env-from-env-design.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-from-env-design.d.ts","sourceRoot":"","sources":["../../../src/eslint/rules/env-from-env-design.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAyClC,eAAO,MAAM,gBAAgB,EAAE,IAAI,CAAC,UA+DnC,CAAA"}
@@ -0,0 +1,85 @@
1
+ const CORE = '@t4h.framework/core';
2
+ const PROCESS_MODULES = new Set(['process', 'node:process']);
3
+ function messageIdOf(source) {
4
+ if (source === CORE)
5
+ return 'coreEnv';
6
+ if (PROCESS_MODULES.has(String(source)))
7
+ return 'processEnv';
8
+ return undefined;
9
+ }
10
+ function isEnvKey(node, computed) {
11
+ if (!computed)
12
+ return node.type === 'Identifier' && node.name === 'env';
13
+ return node.type === 'Literal' && node.value === 'env';
14
+ }
15
+ function identifierName(node) {
16
+ return node.type === 'Identifier' ? node.name : undefined;
17
+ }
18
+ function specifierName(specifier) {
19
+ if (specifier.type === 'ExportSpecifier')
20
+ return identifierName(specifier.local);
21
+ if (specifier.type === 'ImportSpecifier')
22
+ return identifierName(specifier.imported);
23
+ return undefined;
24
+ }
25
+ function isWholeModule(specifier) {
26
+ return (specifier.type === 'ImportNamespaceSpecifier' ||
27
+ specifier.type === 'ImportDefaultSpecifier');
28
+ }
29
+ export const envFromEnvDesign = {
30
+ meta: {
31
+ type: 'problem',
32
+ docs: {
33
+ description: 'Requires env to come from EnvDesign, not from @t4h.framework/core or process.env',
34
+ },
35
+ messages: {
36
+ coreEnv: 'Do not import env from @t4h.framework/core. Create env with EnvDesign and import it from that module.',
37
+ processEnv: 'Do not read process.env. Declare the variable with EnvDesign and read it from the env that EnvDesign creates.',
38
+ },
39
+ schema: [],
40
+ },
41
+ create(context) {
42
+ const modules = new Map([['process', 'processEnv']]);
43
+ function checkSpecifiers(specifiers, messageId) {
44
+ for (const specifier of specifiers) {
45
+ if (isWholeModule(specifier))
46
+ modules.set(specifier.local.name, messageId);
47
+ if (specifierName(specifier) === 'env')
48
+ context.report({ node: specifier, messageId });
49
+ }
50
+ }
51
+ return {
52
+ ImportDeclaration(node) {
53
+ const messageId = messageIdOf(node.source.value);
54
+ if (messageId)
55
+ checkSpecifiers(node.specifiers, messageId);
56
+ },
57
+ ExportNamedDeclaration(node) {
58
+ const messageId = messageIdOf(node.source?.value);
59
+ if (messageId)
60
+ checkSpecifiers(node.specifiers, messageId);
61
+ },
62
+ MemberExpression(node) {
63
+ if (node.object.type !== 'Identifier')
64
+ return;
65
+ if (!isEnvKey(node.property, node.computed))
66
+ return;
67
+ const messageId = modules.get(node.object.name);
68
+ if (messageId)
69
+ context.report({ node, messageId });
70
+ },
71
+ VariableDeclarator(node) {
72
+ if (node.init?.type !== 'Identifier' ||
73
+ node.id.type !== 'ObjectPattern')
74
+ return;
75
+ if (modules.get(node.init.name) !== 'processEnv')
76
+ return;
77
+ const readsEnv = node.id.properties.some(property => property.type === 'Property' &&
78
+ isEnvKey(property.key, property.computed));
79
+ if (readsEnv)
80
+ context.report({ node, messageId: 'processEnv' });
81
+ },
82
+ };
83
+ },
84
+ };
85
+ //# sourceMappingURL=env-from-env-design.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env-from-env-design.js","sourceRoot":"","sources":["../../../src/eslint/rules/env-from-env-design.ts"],"names":[],"mappings":"AAIA,MAAM,IAAI,GAAG,qBAAqB,CAAA;AAElC,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC,CAAA;AAE5D,SAAS,WAAW,CAAC,MAAe;IAClC,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,SAAS,CAAA;IACrC,IAAI,eAAe,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAAE,OAAO,YAAY,CAAA;IAE5D,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,QAAQ,CAAC,IAAe,EAAE,QAAiB;IAClD,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC,IAAI,KAAK,YAAY,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAA;IAEvE,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,CAAA;AACxD,CAAC;AAED,SAAS,cAAc,CAAC,IAAe;IACrC,OAAO,IAAI,CAAC,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;AAC3D,CAAC;AAED,SAAS,aAAa,CAAC,SAAoB;IACzC,IAAI,SAAS,CAAC,IAAI,KAAK,iBAAiB;QACtC,OAAO,cAAc,CAAC,SAAS,CAAC,KAAkB,CAAC,CAAA;IACrD,IAAI,SAAS,C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Activity: Rule.RuleModule;
3
+ //# sourceMappingURL=no-binary-stream-outside-activity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-binary-stream-outside-activity.d.ts","sourceRoot":"","sources":["../../../src/eslint/rules/no-binary-stream-outside-activity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AA+BlC,eAAO,MAAM,6BAA6B,EAAE,IAAI,CAAC,UA8BhD,CAAA"}
@@ -0,0 +1,51 @@
1
+ import { createCoreTypes } from '../tools/coreTypes.js';
2
+ import { findClassMember, isActivityClass, isFrontMethodName, } from '../tools/workflowSides.js';
3
+ const BINARY_CLASSES = new Set(['Binary']);
4
+ function isBackMethod(types, member) {
5
+ if (isFrontMethodName(member.name))
6
+ return false;
7
+ return isActivityClass(types, member.classNode);
8
+ }
9
+ function isBinaryStreamMethod(types, member) {
10
+ if (member.name !== 'stream')
11
+ return false;
12
+ return types.extendsCoreClass(member.classNode, BINARY_CLASSES);
13
+ }
14
+ function isAllowedPlace(types, node) {
15
+ const member = findClassMember(node);
16
+ if (!member)
17
+ return false;
18
+ return isBackMethod(types, member) || isBinaryStreamMethod(types, member);
19
+ }
20
+ export const noBinaryStreamOutsideActivity = {
21
+ meta: {
22
+ type: 'problem',
23
+ docs: {
24
+ description: 'Allows Binary.stream() only in the methods of an activity, other than toInput and toOutput',
25
+ },
26
+ messages: {
27
+ stream: 'Call stream() of a Binary only in a method of an activity, such as run, bootstrap or advance. The workflow, toInput and toOutput run again on each replay, so they must not read the content of a Binary. A function out of the activity class must not read it either. Give the Binary to an activity.',
28
+ },
29
+ schema: [],
30
+ },
31
+ create(context) {
32
+ const types = createCoreTypes(context);
33
+ return {
34
+ CallExpression(node) {
35
+ const { callee } = node;
36
+ if (callee.type !== 'MemberExpression' || callee.computed)
37
+ return;
38
+ if (callee.property.type !== 'Identifier')
39
+ return;
40
+ if (callee.property.name !== 'stream')
41
+ return;
42
+ if (!types.extendsCoreClass(callee.object, BINARY_CLASSES))
43
+ return;
44
+ if (isAllowedPlace(types, node))
45
+ return;
46
+ context.report({ node, messageId: 'stream' });
47
+ },
48
+ };
49
+ },
50
+ };
51
+ //# sourceMappingURL=no-binary-stream-outside-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-binary-stream-outside-activity.js","sourceRoot":"","sources":["../../../src/eslint/rules/no-binary-stream-outside-activity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAkB,MAAM,uBAAuB,CAAA;AACvE,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,GAElB,MAAM,2BAA2B,CAAA;AAElC,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;AAE1C,SAAS,YAAY,CAAC,KAAgB,EAAE,MAAmB;IACzD,IAAI,iBAAiB,CAAC,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAA;IAEhD,OAAO,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,CAAA;AACjD,CAAC;AAED,SAAS,oBAAoB,CAAC,KAAgB,EAAE,MAAmB;IACjE,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAA;IAE1C,OAAO,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,cAAc,CAAC,CAAA;AACjE,CAAC;AAED,SAAS,cAAc,CAAC,KAAgB,EAAE,IAAe;IACvD,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC,CAAA;IACpC,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAA;IAEzB,OAAO,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAA;AAC3E,CAAC;AAED,MAAM,CAAC,MAAM,6BAA6B,GAAoB;IAC5D,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,4FAA4F;SAC/F;QACD,QAAQ,EAAE;YACR,MAAM,EACJ,ySAAyS;SAC5S;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,CAAC,OAAO;QACZ,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;QAEtC,OAAO;YACL,cAAc,CAAC,IAAI;gBACjB,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;gBACvB,IAAI,MAAM,CAAC,IAAI,KAAK,kBAAkB,IAAI,MAAM,CAAC,QAAQ;oBAAE,OAAM;gBACjE,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,YAAY;oBAAE,OAAM;gBACjD,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ;oBAAE,OAAM;gBAC7C,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAmB,EAAE,cAAc,CAAC;oBACrE,OAAM;gBACR,IAAI,cAAc,CAAC,KAAK,EAAE,IAAI,CAAC;oBAAE,OAAM;gBAEvC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAA;YAC/C,CAAC;SACF,CAAA;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const noBinarySubclass: Rule.RuleModule;
3
+ //# sourceMappingURL=no-binary-subclass.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-binary-subclass.d.ts","sourceRoot":"","sources":["../../../src/eslint/rules/no-binary-subclass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAUlC,eAAO,MAAM,gBAAgB,EAAE,IAAI,CAAC,UA0BnC,CAAA"}
@@ -0,0 +1,31 @@
1
+ import { createCoreTypes } from '../tools/coreTypes.js';
2
+ const BINARY_CLASSES = new Set(['Binary']);
3
+ function isAmbient(node) {
4
+ return node.declare === true;
5
+ }
6
+ export const noBinarySubclass = {
7
+ meta: {
8
+ type: 'problem',
9
+ docs: {
10
+ description: 'Disallows a class that extends Binary in app code',
11
+ },
12
+ messages: {
13
+ subclass: 'Do not extend Binary. A Binary that app code makes fails in dev and in the runtime, because only the framework can read and store its content. Use write from @t4h.framework/fs to turn a string or a Buffer into a Binary.',
14
+ },
15
+ schema: [],
16
+ },
17
+ create(context) {
18
+ const types = createCoreTypes(context);
19
+ function check(node) {
20
+ if (node.type !== 'ClassDeclaration' && node.type !== 'ClassExpression')
21
+ return;
22
+ if (!node.superClass || isAmbient(node))
23
+ return;
24
+ if (!types.extendsCoreClass(node, BINARY_CLASSES))
25
+ return;
26
+ context.report({ node, messageId: 'subclass' });
27
+ }
28
+ return { ClassDeclaration: check, ClassExpression: check };
29
+ },
30
+ };
31
+ //# sourceMappingURL=no-binary-subclass.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-binary-subclass.js","sourceRoot":"","sources":["../../../src/eslint/rules/no-binary-subclass.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAA;AAE1C,SAAS,SAAS,CAAC,IAAe;IAChC,OAAQ,IAA8B,CAAC,OAAO,KAAK,IAAI,CAAA;AACzD,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAoB;IAC/C,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EAAE,mDAAmD;SACjE;QACD,QAAQ,EAAE;YACR,QAAQ,EACN,6NAA6N;SAChO;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,CAAC,OAAO;QACZ,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;QAEtC,SAAS,KAAK,CAAC,IAAe;YAC5B,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB;gBACrE,OAAM;YACR,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,SAAS,CAAC,IAAI,CAAC;gBAAE,OAAM;YAC/C,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,cAAc,CAAC;gBAAE,OAAM;YAEzD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,CAAA;QACjD,CAAC;QAED,OAAO,EAAE,gBAAgB,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,CAAA;IAC5D,CAAC;CACF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const noFrameworkActivityInApp: Rule.RuleModule;
3
+ //# sourceMappingURL=no-framework-activity-in-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-framework-activity-in-app.d.ts","sourceRoot":"","sources":["../../../src/eslint/rules/no-framework-activity-in-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAelC,eAAO,MAAM,wBAAwB,EAAE,IAAI,CAAC,UAsC3C,CAAA"}
@@ -0,0 +1,41 @@
1
+ import { createCoreTypes } from '../tools/coreTypes.js';
2
+ import { isActivityClass } from '../tools/workflowSides.js';
3
+ function isFrameworkActivity(types, node, declaration) {
4
+ if (!types.isDeclaredInOtherFrameworkPackage(declaration))
5
+ return false;
6
+ return isActivityClass(types, node);
7
+ }
8
+ export const noFrameworkActivityInApp = {
9
+ meta: {
10
+ type: 'problem',
11
+ docs: {
12
+ description: 'Disallows constructing or extending an activity of a framework package other than the core',
13
+ },
14
+ messages: {
15
+ construct: 'Do not construct the activity of a framework package. Call the function of the package in the workflow, for example http.get, render, unzip or write.',
16
+ extend: 'Do not extend the activity of a framework package. Call the function of the package in the workflow, for example http.get, render, unzip or write.',
17
+ },
18
+ schema: [],
19
+ },
20
+ create(context) {
21
+ const types = createCoreTypes(context);
22
+ function checkClass(node) {
23
+ if (node.type !== 'ClassDeclaration' && node.type !== 'ClassExpression')
24
+ return;
25
+ const superClass = node.superClass;
26
+ if (!superClass || !isFrameworkActivity(types, node, superClass))
27
+ return;
28
+ context.report({ node: superClass, messageId: 'extend' });
29
+ }
30
+ return {
31
+ NewExpression(node) {
32
+ if (!isFrameworkActivity(types, node, node))
33
+ return;
34
+ context.report({ node, messageId: 'construct' });
35
+ },
36
+ ClassDeclaration: checkClass,
37
+ ClassExpression: checkClass,
38
+ };
39
+ },
40
+ };
41
+ //# sourceMappingURL=no-framework-activity-in-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-framework-activity-in-app.js","sourceRoot":"","sources":["../../../src/eslint/rules/no-framework-activity-in-app.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAkB,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAE3D,SAAS,mBAAmB,CAC1B,KAAgB,EAChB,IAAe,EACf,WAAsB;IAEtB,IAAI,CAAC,KAAK,CAAC,iCAAiC,CAAC,WAAW,CAAC;QAAE,OAAO,KAAK,CAAA;IAEvE,OAAO,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACrC,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAoB;IACvD,IAAI,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,IAAI,EAAE;YACJ,WAAW,EACT,4FAA4F;SAC/F;QACD,QAAQ,EAAE;YACR,SAAS,EACP,uJAAuJ;YACzJ,MAAM,EACJ,oJAAoJ;SACvJ;QACD,MAAM,EAAE,EAAE;KACX;IACD,MAAM,CAAC,OAAO;QACZ,MAAM,KAAK,GAAG,eAAe,CAAC,OAAO,CAAC,CAAA;QAEtC,SAAS,UAAU,CAAC,IAAe;YACjC,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB;gBACrE,OAAM;YAER,MAAM,UAAU,GAAG,IAAI,CAAC,UAA0C,CAAA;YAClE,IAAI,CAAC,UAAU,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC;gBAAE,OAAM;YAExE,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAA;QAC3D,CAAC;QAED,OAAO;YACL,aAAa,CAAC,IAAI;gBAChB,IAAI,CAAC,mBAAmB,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC;oBAAE,OAAM;gBAEnD,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC,CAAA;YAClD,CAAC;YACD,gBAAgB,EAAE,UAAU;YAC5B,eAAe,EAAE,UAAU;SAC5B,CAAA;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const noIoInWorkflow: Rule.RuleModule;
3
+ //# sourceMappingURL=no-io-in-workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-io-in-workflow.d.ts","sourceRoot":"","sources":["../../../src/eslint/rules/no-io-in-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAS,MAAM,QAAQ,CAAA;AA+EzC,eAAO,MAAM,cAAc,EAAE,IAAI,CAAC,UAiCjC,CAAA"}
@@ -0,0 +1,92 @@
1
+ import { resolveBinding } from '../tools/bindings.js';
2
+ import { createCoreTypes } from '../tools/coreTypes.js';
3
+ import { isInWorkflowFront } from '../tools/workflowSides.js';
4
+ const NODE_IO_MODULES = [
5
+ 'http',
6
+ 'https',
7
+ 'http2',
8
+ 'net',
9
+ 'tls',
10
+ 'dgram',
11
+ 'dns',
12
+ 'fs',
13
+ 'fs/promises',
14
+ 'child_process',
15
+ 'worker_threads',
16
+ ];
17
+ const NODE_MEMORY_MODULES = ['zlib', 'stream', 'stream/promises'];
18
+ const PACKAGE_IO_MODULES = [
19
+ 'axios',
20
+ 'undici',
21
+ 'got',
22
+ 'node-fetch',
23
+ 'ky',
24
+ 'pg',
25
+ 'mysql',
26
+ 'mysql2',
27
+ 'knex',
28
+ 'typeorm',
29
+ 'sequelize',
30
+ 'mongodb',
31
+ 'mongoose',
32
+ 'ioredis',
33
+ 'redis',
34
+ 'ssh2',
35
+ 'ssh2-sftp-client',
36
+ 'basic-ftp',
37
+ 'nodemailer',
38
+ ];
39
+ function withNodePrefix(names) {
40
+ return [...names, ...names.map(name => `node:${name}`)];
41
+ }
42
+ const MODULE_MESSAGES = new Map([
43
+ ...withNodePrefix(NODE_IO_MODULES).map(name => [name, 'io']),
44
+ ...PACKAGE_IO_MODULES.map(name => [name, 'io']),
45
+ ...withNodePrefix(NODE_MEMORY_MODULES).map(name => [name, 'memory']),
46
+ ]);
47
+ function baseIdentifier(node) {
48
+ let current = node;
49
+ while (current.type === 'MemberExpression')
50
+ current = current.object;
51
+ return current.type === 'Identifier' ? current : undefined;
52
+ }
53
+ function messageIdOf(scope, callee) {
54
+ const base = baseIdentifier(callee);
55
+ if (!base)
56
+ return undefined;
57
+ const binding = resolveBinding(scope, base.name);
58
+ if (binding.kind === 'import')
59
+ return MODULE_MESSAGES.get(binding.source);
60
+ const isFetch = callee === base && base.name === 'fetch';
61
+ return binding.kind === 'global' && isFetch ? 'io' : undefined;
62
+ }
63
+ export const noIoInWorkflow = {
64
+ meta: {
65
+ type: 'problem',
66
+ docs: {
67
+ description: 'Disallows I/O and in-memory compression or streams in a workflow and in the constructor, toInput and toOutput of an activity',
68
+ },
69
+ messages: {
70
+ io: '{{label}} does I/O. The workflow and the constructor, toInput and toOutput of an activity run again on each replay. So the I/O runs again, and its result can change. Call a function of a framework package, such as @t4h.framework/http, orm, sftp, smtp, fs or zip. Or do the I/O in the run method of an activity.',
71
+ memory: '{{label}} works on the content in memory. The workflow and the constructor, toInput and toOutput of an activity run again on each replay. So a large buffer costs memory and time again on each replay. Do this work in an activity, or use @t4h.framework/zip or @t4h.framework/fs.',
72
+ },
73
+ schema: [],
74
+ },
75
+ create(context) {
76
+ const types = createCoreTypes(context);
77
+ function check(node) {
78
+ if (node.type !== 'CallExpression' && node.type !== 'NewExpression')
79
+ return;
80
+ const callee = node.callee;
81
+ const scope = context.sourceCode.getScope(node);
82
+ const messageId = messageIdOf(scope, callee);
83
+ if (!messageId || !isInWorkflowFront(types, node))
84
+ return;
85
+ const prefix = node.type === 'NewExpression' ? 'new ' : '';
86
+ const label = `${prefix}${context.sourceCode.getText(callee)}()`;
87
+ context.report({ node, messageId, data: { label } });
88
+ }
89
+ return { CallExpression: check, NewExpression: check };
90
+ },
91
+ };
92
+ //# sourceMappingURL=no-io-in-workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-io-in-workflow.js","sourceRoot":"","sources":["../../../src/eslint/rules/no-io-in-workflow.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAE7D,MAAM,eAAe,GAAG;IACtB,MAAM;IACN,OAAO;IACP,OAAO;IACP,KAAK;IACL,KAAK;IACL,OAAO;IACP,KAAK;IACL,IAAI;IACJ,aAAa;IACb,eAAe;IACf,gBAAgB;CACjB,CAAA;AAED,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,iBAAiB,CAAC,CAAA;AAIjE,MAAM,kBAAkB,GAAG;IACzB,OAAO;IACP,QAAQ;IACR,KAAK;IACL,YAAY;IACZ,IAAI;IACJ,IAAI;IACJ,OAAO;IACP,QAAQ;IACR,MAAM;IACN,SAAS;IACT,WAAW;IACX,SAAS;IACT,UAAU;IACV,SAAS;IAC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,CAAC,CAAA;QACtD,CAAC;QAED,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,CAAA;IACxD,CAAC;CACF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const noLiteralSecretInAuthorization: Rule.RuleModule;
3
+ //# sourceMappingURL=no-literal-secret-in-authorization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-literal-secret-in-authorization.d.ts","sourceRoot":"","sources":["../../../src/eslint/rules/no-literal-secret-in-authorization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AA6ClC,eAAO,MAAM,8BAA8B,EAAE,IAAI,CAAC,UA6BjD,CAAA"}
@@ -0,0 +1,56 @@
1
+ import { createCoreTypes } from '../tools/coreTypes.js';
2
+ const AUTHORIZATION_CLASSES = new Set(['Authorization']);
3
+ const SECRET_KEYS = new Set(['secret', 'clientSecret']);
4
+ function keyName(node) {
5
+ if (node.type === 'Identifier')
6
+ return node.name;
7
+ if (node.type === 'Literal' && typeof node.value === 'string')
8
+ return node.value;
9
+ return undefined;
10
+ }
11
+ function isLiteralString(node) {
12
+ if (node.type === 'Literal')
13
+ return typeof node.value === 'string';
14
+ return node.type === 'TemplateLiteral' && node.expressions.length === 0;
15
+ }
16
+ function toLiteralSecret(property) {
17
+ if (property.type !== 'Property' || property.computed)
18
+ return [];
19
+ const key = keyName(property.key);
20
+ const value = property.value;
21
+ if (!key || !SECRET_KEYS.has(key) || !isLiteralString(value))
22
+ return [];
23
+ return [{ key, value }];
24
+ }
25
+ function literalSecrets(argument) {
26
+ if (argument.type !== 'ObjectExpression')
27
+ return [];
28
+ return argument.properties.flatMap(property => toLiteralSecret(property));
29
+ }
30
+ export const noLiteralSecretInAuthorization = {
31
+ meta: {
32
+ type: 'problem',
33
+ docs: {
34
+ description: 'Disallows a literal secret in the options of an Authorization',
35
+ },
36
+ messages: {
37
+ literal: 'Do not write the value of {{key}} in code. A secret in code goes into the repository and into the manifest. Read the value from the env that EnvDesign creates in src/constants/environments.ts.',
38
+ },
39
+ schema: [],
40
+ },
41
+ create(context) {
42
+ const types = createCoreTypes(context);
43
+ return {
44
+ NewExpression(node) {
45
+ const secrets = node.arguments.flatMap(argument => literalSecrets(argument));
46
+ if (secrets.length === 0)
47
+ return;
48
+ if (!types.extendsCoreClass(node, AUTHORIZATION_CLASSES))
49
+ return;
50
+ for (const { key, value } of secrets)
51
+ context.report({ node: value, messageId: 'literal', data: { key } });
52
+ },
53
+ };
54
+ },
55
+ };
56
+ //# sourceMappingURL=no-literal-secret-in-authorization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-literal-secret-in-authorization.js","sourceRoot":"","sources":["../../../src/eslint/rules/no-literal-secret-in-authorization.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC,CAAC,eAAe,CAAC,CAAC,CAAA;AAExD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAA;AAEvD,SAAS,OAAO,CAAC,IAAe;IAC9B,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY;QAAE,OAAO,IAAI,CAAC,IAAI,CAAA;IAChD,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;QAC3D,OAAO,IAAI,CAAC,KAAK,CAAA;IAEnB,OAAO,SAAS,CAAA;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,IAAe;IACtC,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAA;IAElE,OAAO,IAAI,CAAC,IAAI,KAAK,iBAAiB,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,C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BAAgB,CAAC,IAAI,EAAE,qBAAqB,CAAC;oBAAE,OAAM;gBAEhE,KAAK,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,IAAI,OAAO;oBAClC,OAAO,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAAA;YACxE,CAAC;SACF,CAAA;IACH,CAAC;CACF,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { Rule } from 'eslint';
2
+ export declare const noNondeterministicInWorkflow: Rule.RuleModule;
3
+ //# sourceMappingURL=no-nondeterministic-in-workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-nondeterministic-in-workflow.d.ts","sourceRoot":"","sources":["../../../src/eslint/rules/no-nondeterministic-in-workflow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAS,MAAM,QAAQ,CAAA;AAwGzC,eAAO,MAAM,4BAA4B,EAAE,IAAI,CAAC,UA6B/C,CAAA"}
@@ -0,0 +1,102 @@
1
+ import { resolveBinding } from '../tools/bindings.js';
2
+ import { createCoreTypes } from '../tools/coreTypes.js';
3
+ import { isInWorkflowFront } from '../tools/workflowSides.js';
4
+ const CRYPTO_METHODS = new Set([
5
+ 'randomUUID',
6
+ 'getRandomValues',
7
+ 'randomBytes',
8
+ 'randomInt',
9
+ ]);
10
+ const NONDETERMINISTIC_CALLS = {
11
+ Date: new Set(['now']),
12
+ Math: new Set(['random']),
13
+ crypto: CRYPTO_METHODS,
14
+ performance: new Set(['now']),
15
+ };
16
+ const CRYPTO_MODULES = new Set(['crypto', 'node:crypto']);
17
+ const PERF_HOOKS_MODULES = new Set(['perf_hooks', 'node:perf_hooks']);
18
+ function importOwner(source, imported) {
19
+ if (CRYPTO_MODULES.has(source) &&
20
+ (imported === 'default' || imported === '*'))
21
+ return 'crypto';
22
+ if (PERF_HOOKS_MODULES.has(source) && imported === 'performance')
23
+ return 'performance';
24
+ return undefined;
25
+ }
26
+ function ownerOf(binding, name) {
27
+ if (binding.kind === 'global')
28
+ return name;
29
+ if (binding.kind === 'import')
30
+ return importOwner(binding.source, binding.imported);
31
+ return undefined;
32
+ }
33
+ function describeMemberCall(scope, node) {
34
+ if (node.type !== 'CallExpression')
35
+ return undefined;
36
+ const { callee } = node;
37
+ if (callee.type !== 'MemberExpression' || callee.computed)
38
+ return undefined;
39
+ if (callee.object.type !== 'Identifier')
40
+ return undefined;
41
+ if (callee.property.type !== 'Identifier')
42
+ return undefined;
43
+ const { name } = callee.object;
44
+ const method = callee.property.name;
45
+ const owner = ownerOf(resolveBinding(scope, name), name);
46
+ if (!owner || !NONDETERMINISTIC_CALLS[owner]?.has(method))
47
+ return undefined;
48
+ return { label: `${owner}.${method}()` };
49
+ }
50
+ function describeImportedCall(scope, node) {
51
+ if (node.type !== 'CallExpression' || node.callee.type !== 'Identifier')
52
+ return undefined;
53
+ const binding = resolveBinding(scope, node.callee.name);
54
+ if (binding.kind !== 'import' || !CRYPTO_MODULES.has(binding.source))
55
+ return undefined;
56
+ if (!CRYPTO_METHODS.has(binding.imported))
57
+ return undefined;
58
+ return { label: `${binding.imported}()` };
59
+ }
60
+ function describeCurrentDate(scope, node) {
61
+ if (node.type !== 'CallExpression' && node.type !== 'NewExpression')
62
+ return undefined;
63
+ if (node.callee.type !== 'Identifier' || node.callee.name !== 'Date')
64
+ return undefined;
65
+ if (node.arguments.length > 0)
66
+ return undefined;
67
+ if (resolveBinding(scope, 'Date').kind !== 'global')
68
+ return undefined;
69
+ return { label: node.type === 'NewExpression' ? 'new Date()' : 'Date()' };
70
+ }
71
+ function describeCall(scope, node) {
72
+ return (describeMemberCall(scope, node) ??
73
+ describeImportedCall(scope, node) ??
74
+ describeCurrentDate(scope, node));
75
+ }
76
+ export const noNondeterministicInWorkflow = {
77
+ meta: {
78
+ type: 'problem',
79
+ docs: {
80
+ description: 'Disallows the clock and random values in a workflow and in the constructor, toInput and toOutput of an activity',
81
+ },
82
+ messages: {
83
+ nondeterministic: '{{label}} gives a different value on each run. The workflow and the constructor, toInput and toOutput of an activity run again on each replay, so the result changes. Get the value in the run, bootstrap or advance method of an activity.',
84
+ },
85
+ schema: [],
86
+ },
87
+ create(context) {
88
+ const types = createCoreTypes(context);
89
+ function check(node) {
90
+ const call = describeCall(context.sourceCode.getScope(node), node);
91
+ if (!call || !isInWorkflowFront(types, node))
92
+ return;
93
+ context.report({
94
+ node,
95
+ messageId: 'nondeterministic',
96
+ data: { label: call.label },
97
+ });
98
+ }
99
+ return { CallExpression: check, NewExpression: check };
100
+ },
101
+ };
102
+ //# sourceMappingURL=no-nondeterministic-in-workflow.js.map