generate_data.ts 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import * as fs from "fs"
  2. import { faker } from '@faker-js/faker';
  3. let GigaPayload: any[] = []
  4. let tags = ['free', 'basic', 'business', 'enterprise', 'rich', 'super-rich', 'mega-rich', 'empire'];
  5. export function createMessage(): any {
  6. return {
  7. header: {
  8. messageType: "Command",
  9. messageID: faker.datatype.uuid(),
  10. messageName: faker.word.adjective(),
  11. dateCreated: faker.date.recent(),
  12. isAggregated: faker.datatype.boolean(),
  13. servicecId: faker.datatype.uuid(),
  14. userId: faker.datatype.uuid(),
  15. requesterId: faker.datatype.uuid(),
  16. messagePreoducerInformation: {
  17. origin: {
  18. userApplication: {
  19. userAppId: faker.finance.accountName(),
  20. userAppName: faker.name.jobTitle()
  21. }
  22. },
  23. components: faker.word.adverb()
  24. },
  25. security: {
  26. ucpid: faker.datatype.uuid()
  27. },
  28. messageDataLocation: {
  29. isEmbaded: faker.datatype.boolean()
  30. },
  31. messageDataFormat: {
  32. dataFormate: faker.datatype.json()
  33. },
  34. requestExecutiomNode: faker.datatype.number(),
  35. requestTimeOut: faker.datatype.number(),
  36. command: faker.word.adjective()
  37. },
  38. data: {
  39. header: faker.datatype.uuid(),
  40. data: {
  41. appLogLocId: faker.datatype.uuid(),
  42. appData: {
  43. msgId: faker.datatype.uuid(),
  44. msgLogDateTime: faker.date.past(),
  45. msgDateTime: faker.date.past(),
  46. msgTag: faker.helpers.arrayElements(tags, 3),
  47. msgPayload: faker.lorem.sentences()
  48. }
  49. }
  50. }
  51. }
  52. }
  53. Array.from({ length: 100 }).forEach(() => {
  54. GigaPayload.push(createMessage());
  55. });
  56. fs.writeFileSync('payload.json', JSON.stringify(GigaPayload))