diff --git a/.github/workflows/test.common.yaml b/.github/workflows/test.common.yaml index 780bf9bb42..feae4897b8 100644 --- a/.github/workflows/test.common.yaml +++ b/.github/workflows/test.common.yaml @@ -17,7 +17,5 @@ jobs: - uses: actions/setup-node@v2 with: node-version: 18.3.0 - - run: cd Common && npm install - - run: cd Common && bash test-setup.sh - - run: export $(grep -v '^#' config.env | xargs) && cd Common && rm -rf build && npm run test + - run: cd Common && npm install && rm -rf build && npm run test \ No newline at end of file diff --git a/Common/Server/Utils/AnalyticsDatabase/Statement.ts b/Common/Server/Utils/AnalyticsDatabase/Statement.ts index 219763b938..4244d5d5a3 100644 --- a/Common/Server/Utils/AnalyticsDatabase/Statement.ts +++ b/Common/Server/Utils/AnalyticsDatabase/Statement.ts @@ -172,6 +172,16 @@ export class Statement implements BaseQueryParams { }; if ((statementParam as StatementParameter).value instanceof Includes) { + const isNumberArray = ( + (statementParam as StatementParameter).value as Includes + ).values.every((v) => { + return typeof v === "number"; + }); + + if (isNumberArray) { + return "Array(Int32)"; + } + return "Array(String)"; } diff --git a/Common/Tests/Utils/Faker.test.ts b/Common/Tests/Utils/Faker.test.ts index 2bfc3b5bca..ee795a3fb6 100644 --- a/Common/Tests/Utils/Faker.test.ts +++ b/Common/Tests/Utils/Faker.test.ts @@ -14,7 +14,7 @@ describe("Faker Class", () => { }); it("should generate a string of random numbers of specified length", () => { - expect(Faker.getRandomNumbers(8)).toMatch(/^\d{8}$/); + expect(Faker.getRandomNumbers(8).toString()).toMatch(/^\d{8}$/); }); it("should generate a user full name", () => { diff --git a/Common/UI/Utils/Dropdown.ts b/Common/UI/Utils/Dropdown.ts index 4e320976bc..c1463d2628 100644 --- a/Common/UI/Utils/Dropdown.ts +++ b/Common/UI/Utils/Dropdown.ts @@ -11,7 +11,7 @@ export default class DropdownUtil { return Object.keys(obj).map((key: string) => { return { label: useKeyAsLebel ? key : (obj as any)[key].toString(), - value: (obj as any)[key].toString(), + value: (obj as any)[key], }; }); } diff --git a/Common/package-lock.json b/Common/package-lock.json index 20e55cf6a2..60845fa392 100644 --- a/Common/package-lock.json +++ b/Common/package-lock.json @@ -66,6 +66,7 @@ "nodemailer": "^6.9.10", "otpauth": "^9.3.1", "pg": "^8.7.3", + "pg-mem": "^3.0.2", "posthog-js": "^1.139.6", "prop-types": "^15.8.1", "qrcode": "^1.5.3", @@ -6316,6 +6317,12 @@ "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==", "license": "MIT" }, + "node_modules/discontinuous-range": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/discontinuous-range/-/discontinuous-range-1.0.0.tgz", + "integrity": "sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==", + "license": "MIT" + }, "node_modules/dom-accessibility-api": { "version": "0.5.16", "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", @@ -7138,6 +7145,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", + "license": "MIT" + }, "node_modules/functions-have-names": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", @@ -7626,6 +7639,12 @@ ], "license": "BSD-3-Clause" }, + "node_modules/immutable": { + "version": "4.3.7", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.7.tgz", + "integrity": "sha512-1hqclzwYwjRDFLjcFxOM5AYkkG0rpFPpr1RLPMEuGczoS7YA8gLhy8SWXYRAA/XwfEHpfo3cw5JGioS32fnMRw==", + "license": "MIT" + }, "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", @@ -8195,7 +8214,6 @@ "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", - "dev": true, "license": "MIT" }, "node_modules/isexe": { @@ -9587,6 +9605,24 @@ "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", "license": "MIT" }, + "node_modules/json-stable-stringify": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.1.1.tgz", + "integrity": "sha512-SU/971Kt5qVQfJpyDveVhQ/vya+5hvrjClFOcr8c0Fq5aODJjMwutrOfCU+eCnVD5gpx1Q3fEqkyom77zH1iIg==", + "license": "MIT", + "dependencies": { + "call-bind": "^1.0.5", + "isarray": "^2.0.5", + "jsonify": "^0.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/json2csv": { "version": "5.0.7", "resolved": "https://registry.npmjs.org/json2csv/-/json2csv-5.0.7.tgz", @@ -9618,6 +9654,15 @@ "node": ">=6" } }, + "node_modules/jsonify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", + "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==", + "license": "Public Domain", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", @@ -10948,6 +10993,12 @@ "license": "MIT", "peer": true }, + "node_modules/moo": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/moo/-/moo-0.5.2.tgz", + "integrity": "sha512-iSAJLHYKnX41mKcJKjqvnAN9sf0LMDTXDEvFv+ffuRR9a1MIuXLjMNL6EsnDHSkKLTWNqQQ5uo61P4EbU4NU+Q==", + "license": "BSD-3-Clause" + }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", @@ -11012,6 +11063,34 @@ "dev": true, "license": "MIT" }, + "node_modules/nearley": { + "version": "2.20.1", + "resolved": "https://registry.npmjs.org/nearley/-/nearley-2.20.1.tgz", + "integrity": "sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ==", + "license": "MIT", + "dependencies": { + "commander": "^2.19.0", + "moo": "^0.5.0", + "railroad-diagrams": "^1.0.0", + "randexp": "0.4.6" + }, + "bin": { + "nearley-railroad": "bin/nearley-railroad.js", + "nearley-test": "bin/nearley-test.js", + "nearley-unparse": "bin/nearley-unparse.js", + "nearleyc": "bin/nearleyc.js" + }, + "funding": { + "type": "individual", + "url": "https://nearley.js.org/#give-to-nearley" + } + }, + "node_modules/nearley/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, "node_modules/negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -11177,6 +11256,15 @@ "node": ">=0.10.0" } }, + "node_modules/object-hash": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz", + "integrity": "sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw==", + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, "node_modules/object-inspect": { "version": "1.13.2", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", @@ -11210,7 +11298,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true, "license": "MIT", "engines": { "node": ">= 0.4" @@ -11558,6 +11645,82 @@ "node": ">=4.0.0" } }, + "node_modules/pg-mem": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/pg-mem/-/pg-mem-3.0.2.tgz", + "integrity": "sha512-fbf55spR1nNWfxBm28h9Cx6lC5VSubqBjbTMkCMORtGJPiBD3GTDyHAntUm3s5eSt4/ork7HvpNmeWgkgRmDWg==", + "license": "MIT", + "dependencies": { + "functional-red-black-tree": "^1.0.1", + "immutable": "^4.3.4", + "json-stable-stringify": "^1.0.1", + "lru-cache": "^6.0.0", + "moment": "^2.27.0", + "object-hash": "^2.0.3", + "pgsql-ast-parser": "^12.0.1" + }, + "peerDependencies": { + "@mikro-orm/core": ">=4.5.3", + "@mikro-orm/postgresql": ">=4.5.3", + "knex": ">=0.20", + "kysely": ">=0.26", + "pg-promise": ">=10.8.7", + "pg-server": "^0.1.5", + "postgres": "^3.4.4", + "slonik": ">=23.0.1", + "typeorm": ">=0.2.29" + }, + "peerDependenciesMeta": { + "@mikro-orm/core": { + "optional": true + }, + "@mikro-orm/postgresql": { + "optional": true + }, + "knex": { + "optional": true + }, + "kysely": { + "optional": true + }, + "mikro-orm": { + "optional": true + }, + "pg-promise": { + "optional": true + }, + "pg-server": { + "optional": true + }, + "postgres": { + "optional": true + }, + "slonik": { + "optional": true + }, + "typeorm": { + "optional": true + } + } + }, + "node_modules/pg-mem/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/pg-mem/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "license": "ISC" + }, "node_modules/pg-pool": { "version": "3.6.2", "resolved": "https://registry.npmjs.org/pg-pool/-/pg-pool-3.6.2.tgz", @@ -11598,6 +11761,16 @@ "split2": "^4.1.0" } }, + "node_modules/pgsql-ast-parser": { + "version": "12.0.1", + "resolved": "https://registry.npmjs.org/pgsql-ast-parser/-/pgsql-ast-parser-12.0.1.tgz", + "integrity": "sha512-pe8C6Zh5MsS+o38WlSu18NhrTjAv1UNMeDTs2/Km2ZReZdYBYtwtbWGZKK2BM2izv5CrQpbmP0oI10wvHOwv4A==", + "license": "MIT", + "dependencies": { + "moo": "^0.5.1", + "nearley": "^2.19.5" + } + }, "node_modules/picocolors": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", @@ -12014,6 +12187,25 @@ "integrity": "sha512-tQkJl2GRWh83ui2DiPTJz9wEiMN20syf+5oKfB03yYP7ioZcJwsIK8FjrtLwH1m7C7e+Tt2yYBlrOpdT+dyeIQ==", "license": "MIT" }, + "node_modules/railroad-diagrams": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz", + "integrity": "sha512-cz93DjNeLY0idrCNOH6PviZGRN9GJhsdm9hpn1YCS879fj4W+x5IFJhhkRZcwVgMmFF7R82UA/7Oh+R8lLZg6A==", + "license": "CC0-1.0" + }, + "node_modules/randexp": { + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.4.6.tgz", + "integrity": "sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ==", + "license": "MIT", + "dependencies": { + "discontinuous-range": "1.0.0", + "ret": "~0.1.10" + }, + "engines": { + "node": ">=0.12" + } + }, "node_modules/range-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", @@ -12716,6 +12908,15 @@ "node": ">=10" } }, + "node_modules/ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "license": "MIT", + "engines": { + "node": ">=0.12" + } + }, "node_modules/reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", diff --git a/Common/package.json b/Common/package.json index 20c3d4a676..203049cbf5 100644 --- a/Common/package.json +++ b/Common/package.json @@ -18,9 +18,17 @@ "@testing-library/jest-dom": "^5.16.5", "@testing-library/react": "^13.3.0", "@testing-library/user-event": "^14.4.3", + "@types/cookie-parser": "^1.4.4", + "@types/cors": "^2.8.12", + "@types/ejs": "^3.1.1", + "@types/express": "^4.17.13", "@types/jest": "^28.1.4", + "@types/json2csv": "^5.0.3", + "@types/jsonwebtoken": "^8.5.9", "@types/lodash": "^4.14.202", "@types/node": "^17.0.45", + "@types/node-cron": "^3.0.7", + "@types/nodemailer": "^6.4.7", "@types/react": "^18.2.38", "@types/react-beautiful-dnd": "^13.1.2", "@types/react-big-calendar": "^1.8.5", @@ -29,34 +37,46 @@ "@types/react-toggle": "^4.0.3", "jest": "^28.1.1", "jest-environment-jsdom": "^29.7.0", + "jest-mock-extended": "^3.0.5", "react-test-renderer": "^18.2.0", - "ts-jest": "^28.0.5", - "@types/cookie-parser": "^1.4.4", - "@types/cors": "^2.8.12", - "@types/ejs": "^3.1.1", - "@types/express": "^4.17.13", - "@types/json2csv": "^5.0.3", - "@types/jsonwebtoken": "^8.5.9", - "@types/node-cron": "^3.0.7", - "@types/nodemailer": "^6.4.7", - "jest-mock-extended": "^3.0.5" + "ts-jest": "^28.0.5" }, "dependencies": { "@clickhouse/client": "^0.2.10", "@elastic/elasticsearch": "^8.12.1", + "@monaco-editor/react": "^4.4.6", + "@nivo/core": "^0.87.0", + "@nivo/line": "^0.87.0", + "@opentelemetry/api": "^1.9.0", "@opentelemetry/api-logs": "^0.52.1", "@opentelemetry/auto-instrumentations-node": "^0.49.1", + "@opentelemetry/context-zone": "^1.25.0", "@opentelemetry/exporter-logs-otlp-http": "^0.52.1", "@opentelemetry/exporter-metrics-otlp-proto": "^0.52.1", + "@opentelemetry/exporter-trace-otlp-http": "^0.52.0", "@opentelemetry/exporter-trace-otlp-proto": "^0.52.1", "@opentelemetry/id-generator-aws-xray": "^1.2.1", + "@opentelemetry/instrumentation": "^0.52.0", + "@opentelemetry/instrumentation-fetch": "^0.52.1", + "@opentelemetry/instrumentation-xml-http-request": "^0.52.1", + "@opentelemetry/resources": "^1.25.0", "@opentelemetry/sdk-logs": "^0.52.1", "@opentelemetry/sdk-metrics": "^1.21.0", "@opentelemetry/sdk-node": "^0.52.1", "@opentelemetry/sdk-trace-node": "^1.21.0", + "@opentelemetry/sdk-trace-web": "^1.23.0", + "@opentelemetry/semantic-conventions": "^1.25.0", + "@tippyjs/react": "^4.2.6", + "@types/crypto-js": "^4.2.2", + "@types/qrcode": "^1.5.5", + "@types/react-highlight": "^0.12.8", + "@types/react-syntax-highlighter": "^15.5.13", + "@types/uuid": "^8.3.4", "acme-client": "^5.3.0", "airtable": "^0.12.2", + "axios": "^1.7.2", "bullmq": "^5.3.3", + "Common": "file:../Common", "cookie-parser": "^1.4.6", "cors": "^2.8.5", "cron-parser": "^4.8.1", @@ -64,51 +84,23 @@ "dotenv": "^16.4.4", "ejs": "^3.1.10", "express": "^4.19.2", + "formik": "^2.4.6", + "history": "^5.3.0", "ioredis": "^5.3.2", "json2csv": "^5.0.7", + "json5": "^2.2.3", "jsonwebtoken": "^9.0.0", + "jwt-decode": "^4.0.0", + "lodash": "^4.17.21", "marked": "^12.0.2", + "moment": "^2.30.1", + "moment-timezone": "^0.5.45", "node-cron": "^3.0.3", "nodemailer": "^6.9.10", "otpauth": "^9.3.1", "pg": "^8.7.3", - "redis-semaphore": "^5.5.1", - "socket.io": "^4.7.4", - "stripe": "^10.17.0", - "twilio": "^4.22.0", - "typeorm-extension": "^2.2.13", - "@types/crypto-js": "^4.2.2", - "@types/uuid": "^8.3.4", - "axios": "^1.7.2", - "json5": "^2.2.3", - "moment": "^2.30.1", - "moment-timezone": "^0.5.45", + "pg-mem": "^3.0.2", "posthog-js": "^1.139.6", - "reflect-metadata": "^0.2.2", - "slugify": "^1.6.5", - "typeorm": "^0.3.20", - "uuid": "^8.3.2", - "@monaco-editor/react": "^4.4.6", - "@nivo/core": "^0.87.0", - "@nivo/line": "^0.87.0", - "@opentelemetry/api": "^1.9.0", - "@opentelemetry/context-zone": "^1.25.0", - "@opentelemetry/exporter-trace-otlp-http": "^0.52.0", - "@opentelemetry/instrumentation": "^0.52.0", - "@opentelemetry/instrumentation-fetch": "^0.52.1", - "@opentelemetry/instrumentation-xml-http-request": "^0.52.1", - "@opentelemetry/resources": "^1.25.0", - "@opentelemetry/sdk-trace-web": "^1.23.0", - "@opentelemetry/semantic-conventions": "^1.25.0", - "@tippyjs/react": "^4.2.6", - "@types/qrcode": "^1.5.5", - "@types/react-highlight": "^0.12.8", - "@types/react-syntax-highlighter": "^15.5.13", - "Common": "file:../Common", - "formik": "^2.4.6", - "history": "^5.3.0", - "jwt-decode": "^4.0.0", - "lodash": "^4.17.21", "prop-types": "^15.8.1", "qrcode": "^1.5.3", "react": "^18.3.1", @@ -126,10 +118,19 @@ "react-syntax-highlighter": "^15.5.0", "react-toggle": "^4.1.3", "reactflow": "^11.11.4", + "redis-semaphore": "^5.5.1", + "reflect-metadata": "^0.2.2", "remark-gfm": "^3.0.1", + "slugify": "^1.6.5", + "socket.io": "^4.7.4", "socket.io-client": "^4.7.5", + "stripe": "^10.17.0", "tippy.js": "^6.3.7", + "twilio": "^4.22.0", + "typeorm": "^0.3.20", + "typeorm-extension": "^2.2.13", "universal-cookie": "^4.0.4", - "use-async-effect": "^2.2.6" + "use-async-effect": "^2.2.6", + "uuid": "^8.3.2" } -} \ No newline at end of file +} diff --git a/Dashboard/src/Utils/SpanUtil.ts b/Dashboard/src/Utils/SpanUtil.ts index b2fd8c719b..5032a90fd8 100644 --- a/Dashboard/src/Utils/SpanUtil.ts +++ b/Dashboard/src/Utils/SpanUtil.ts @@ -19,15 +19,18 @@ export interface DivisibilityFactor { export default class SpanUtil { public static getSpanStatusDropdownOptions(): Array { - return DropdownUtil.getDropdownOptionsFromEnum(SpanStatus, true).filter( - (dropdownOption: DropdownOption) => { - return ( - dropdownOption.label === "Unset" || - dropdownOption.label === "Ok" || - dropdownOption.label === "Error" - ); - }, - ); + const dropdownOptions: Array = + DropdownUtil.getDropdownOptionsFromEnum(SpanStatus, true).filter( + (dropdownOption: DropdownOption) => { + return ( + dropdownOption.label === "Unset" || + dropdownOption.label === "Ok" || + dropdownOption.label === "Error" + ); + }, + ); + + return dropdownOptions; } public static getSpanDurationAsString(data: {