@mhubcloud/tms_core 1.7.6 → 2.0.0-beta.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 (44) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc.cjs +87 -0
  3. package/.prettierignore +3 -0
  4. package/.prettierrc +10 -0
  5. package/.vscode/extensions.json +12 -0
  6. package/.vscode/settings.json +52 -0
  7. package/dist/index.js +609 -0
  8. package/index.js +1 -0
  9. package/{lib → js/lib}/defaultPublisher.js +26 -24
  10. package/js/lib/utils.js +349 -0
  11. package/js/publishers/AffiliatePort.js +78 -0
  12. package/{publishers → js/publishers}/CJ.js +7 -5
  13. package/{publishers → js/publishers}/Facebook.js +6 -4
  14. package/{publishers → js/publishers}/GoogleAnalytics4.js +8 -6
  15. package/js/publishers/HttpPublisher.js +64 -0
  16. package/{publishers → js/publishers}/Piano.js +6 -4
  17. package/{publishers → js/publishers}/UniversalAnalytics.js +7 -5
  18. package/package.json +46 -29
  19. package/releasePlan.md +3 -0
  20. package/src/defaultPublisher.ts +132 -0
  21. package/src/index.ts +25 -0
  22. package/src/publishers/affiliatePort.ts +69 -0
  23. package/src/publishers/cj.ts +67 -0
  24. package/src/publishers/facebook.ts +49 -0
  25. package/src/publishers/googleAnalytics4.ts +60 -0
  26. package/src/publishers/piano.ts +71 -0
  27. package/src/publishers/universalAnalytics.ts +63 -0
  28. package/src/types/EventHubMessage.ts +8 -0
  29. package/src/types/EventPublisher.ts +9 -0
  30. package/src/types/PlatformPublisher.ts +19 -0
  31. package/src/types/UtilTypes.ts +1 -0
  32. package/src/types/global.d.ts +3 -0
  33. package/src/utils/utils.ts +358 -0
  34. package/tests/AffiliatePort.js +107 -85
  35. package/tests/CJ.js +144 -119
  36. package/tests/Facebook.js +124 -103
  37. package/tests/GoogleAnalytics4.js +82 -74
  38. package/tests/Piano.js +112 -99
  39. package/tests/UniversalAnalytics.js +90 -77
  40. package/tests/testUtils.js +7 -0
  41. package/tsconfig.eslint.json +43 -0
  42. package/tsconfig.json +26 -0
  43. package/lib/utils.js +0 -307
  44. package/publishers/AffiliatePort.js +0 -61
package/.eslintignore ADDED
@@ -0,0 +1,3 @@
1
+ node_modules/
2
+ build/
3
+ dist/
package/.eslintrc.cjs ADDED
@@ -0,0 +1,87 @@
1
+ module.exports = {
2
+ root: true,
3
+ plugins: ['@typescript-eslint', 'prettier'],
4
+ extends: [
5
+ 'eslint:recommended',
6
+ 'plugin:@typescript-eslint/recommended',
7
+ 'plugin:import/recommended',
8
+ 'plugin:import/typescript',
9
+ 'plugin:prettier/recommended',
10
+ 'plugin:@typescript-eslint/recommended-requiring-type-checking',
11
+ 'plugin:@typescript-eslint/strict',
12
+ ],
13
+ parser: '@typescript-eslint/parser',
14
+ parserOptions: {
15
+ ecmaVersion: 'latest',
16
+ sourceType: 'module',
17
+ project: ['./tsconfig.eslint.json'],
18
+ },
19
+ env: {
20
+ node: true,
21
+ es6: true,
22
+ es2021: true,
23
+ },
24
+ settings: {
25
+ 'import/resolver': {
26
+ // https://github.com/import-js/eslint-plugin-import#typescript
27
+ typescript: true,
28
+ node: true,
29
+ },
30
+ },
31
+ rules: {
32
+ 'no-nested-ternary': 'error', // https://eslint.org/docs/latest/rules/no-nested-ternary
33
+ 'spaced-comment': ['error', 'always'], // https://eslint.org/docs/latest/rules/spaced-comment
34
+ curly: 'error', // https://eslint.org/docs/latest/rules/curly
35
+ 'import/order': [
36
+ // Enforce a convention in module import order
37
+ // https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/order.md
38
+ 'error',
39
+ {
40
+ groups: [
41
+ 'type',
42
+ 'builtin',
43
+ 'external',
44
+ 'internal',
45
+ ['parent', 'sibling', 'index'],
46
+ 'unknown',
47
+ ],
48
+ 'newlines-between': 'never',
49
+ alphabetize: {
50
+ order: 'asc',
51
+ caseInsensitive: true,
52
+ },
53
+ warnOnUnassignedImports: true,
54
+ },
55
+ ],
56
+ // TypeScript specific rules
57
+ '@typescript-eslint/method-signature-style': 'error', // https://typescript-eslint.io/rules/method-signature-style/
58
+ '@typescript-eslint/naming-convention': [
59
+ // https://typescript-eslint.io/rules/naming-convention/
60
+ 'error',
61
+ {
62
+ selector: 'default',
63
+ format: ['camelCase'],
64
+ leadingUnderscore: 'forbid',
65
+ trailingUnderscore: 'forbid',
66
+ },
67
+ {
68
+ selector: 'variable',
69
+ format: ['camelCase', 'UPPER_CASE'],
70
+ },
71
+ {
72
+ selector: 'parameter',
73
+ format: ['camelCase'],
74
+ leadingUnderscore: 'allow',
75
+ filter: {
76
+ regex: '^(_req|_res|_next)$',
77
+ match: true, // We need this for Express _req to work
78
+ },
79
+ },
80
+ {
81
+ selector: 'typeLike',
82
+ format: ['PascalCase'],
83
+ },
84
+ ],
85
+ },
86
+ ignorePatterns: ['.eslintrc.cjs', 'build_scripts/post-build.mjs', 'build_scripts/web-app-post-db-generate.mjs']
87
+ };
@@ -0,0 +1,3 @@
1
+ node_modules
2
+ build/
3
+ dist/
package/.prettierrc ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/prettierrc",
3
+ "arrowParens": "always",
4
+ "singleQuote": true,
5
+ "jsxSingleQuote": true,
6
+ "useTabs": false,
7
+ "trailingComma": "all",
8
+ "singleAttributePerLine": true,
9
+ "endOfLine": "auto"
10
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
3
+ // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
4
+ // List of extensions which should be recommended for users of this workspace.
5
+ "recommendations": [
6
+ "dbaeumer.vscode-eslint"
7
+ ],
8
+ // List of extensions recommended by VS Code that should not be recommended for users of this workspace.
9
+ "unwantedRecommendations": [
10
+ "esbenp.prettier-vscode"
11
+ ]
12
+ }
@@ -0,0 +1,52 @@
1
+ {
2
+ // EDITOR
3
+ // ----------------------------------------
4
+ "[javascript]": {
5
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint"
6
+ },
7
+ "[json]": {
8
+ "editor.defaultFormatter": "vscode.json-language-features"
9
+ },
10
+ "[jsonc]": {
11
+ "editor.defaultFormatter": "vscode.json-language-features"
12
+ },
13
+ "[typescript]": {
14
+ "editor.autoClosingBrackets": "always",
15
+ "editor.defaultFormatter": "dbaeumer.vscode-eslint"
16
+ },
17
+ "editor.codeActionsOnSave": [
18
+ // "source.organizeImports",
19
+ "source.fixAll.eslint"
20
+ ],
21
+ // "editor.formatOnSave": true,
22
+ "typescript.tsdk": "node_modules/typescript/lib",
23
+ // ESLINT
24
+ // ----------------------------------------
25
+ "eslint.alwaysShowStatus": true,
26
+ "eslint.options": {
27
+ "extensions": [
28
+ ".js",
29
+ ".cjs",
30
+ ".ts",
31
+ ".tsx"
32
+ ]
33
+ },
34
+ "eslint.validate": [
35
+ "javascript",
36
+ "typescript"
37
+ ],
38
+ "eslint.format.enable": true,
39
+ // FILES
40
+ // ----------------------------------------
41
+ "files.exclude": {
42
+ "**/*.log": true,
43
+ "**/*.log*": true,
44
+ "**/build": true,
45
+ "**/dist": true
46
+ },
47
+ "search.exclude": {
48
+ "**/node_modules": false
49
+ },
50
+ "volar.completion.preferredTagNameCase": "pascal",
51
+ "eslint.packageManager": "pnpm"
52
+ }