sharetribe / flex-cli

Flex CLI
https://www.sharetribe.com/docs/tutorials/getting-started-with-flex-cli/
Apache License 2.0
4 stars 1 forks source link

Events CLI command #85

Closed ovan closed 3 years ago

ovan commented 3 years ago
$ node target/min.js help events
Get a list of events.

USAGE
  $ flex-cli events

OPTIONS
  --after-seqid=SEQUENCE_ID         Show events with sequence ID larger than (after) the specified.
  --after-ts=TIMESTAMP              Show events created after the given timestamp, e.g. '--after-ts 2020-10-10' or '--after-ts 2020-10-10T10:00.000Z'
  --before-seqid=SEQUENCE_ID        Show events with sequence ID smaller than (before) the specified.
  --before-ts=TIMESTAMP             Show events created before the given timestamp, e.g. '--before-ts 2020-11-15' or '--before-ts 2020-11-15T12:00.000Z'
  --filter=EVENT_TYPES              Show only events of given types, e.g. '--filter listing/updated,user'.
  --json                            Print full event data as one JSON string.
  --json-pretty                     Print full event data as indented multi-line JSON string.
  --resource=RESOURCE_ID            Show events for a specific resource ID only.
  --seqid=SEQUENCE_ID               Get only the event with the given sequence id.
  -l, --limit=NUMBER                Show given number of events (default and max is 100). Can be combined with other parameters.
  -m, --marketplace=MARKETPLACE_ID  marketplace identifier

ollivanhapiha at olli-mpb-16 in ~/dev/projects/sharetribe/flex-cli (events-command●)
$ node target/min.js events -m bike-soil

Seq ID   Resource ID                           Event type                     Created at              Source           Actor
1        7b98dd96-74c7-4ddc-9f46-38c0f91c4a19  user/updated                   2020-11-25 2:04:16 PM   console          admin@example.com
2        7b98dd96-74c7-4ddc-9f46-38c0f91c4a19  user/updated                   2020-11-25 2:04:47 PM   console          admin@example.com
5        5f8fde3d-d231-4d52-a596-0b7f239c3b07  listing/updated                2020-11-27 6:29:25 PM   console          admin@example.com
6        5fc4a915-73b5-4467-809b-7094d3217c6b  listing/created                2020-11-30 10:11:01 AM  marketplace-api  boyan+test4@sharetribe.com
7        5fc4a919-d636-4c82-a8f4-2ac95c656b32  availabilityException/created  2020-11-30 10:11:06 AM  marketplace-api  boyan+test4@sharetribe.com
8        5fc4a915-73b5-4467-809b-7094d3217c6b  listing/updated                2020-11-30 10:19:04 AM  marketplace-api  boyan+test4@sharetribe.com
9        7b98dd96-74c7-4ddc-9f46-38c0f91c4a19  user/updated                   2020-11-30 9:45:57 PM   console          admin@example.com

ollivanhapiha at olli-mpb-16 in ~/dev/projects/sharetribe/flex-cli (events-command●)
$ node target/min.js events -m bike-soil --filter listing/updated,user

Seq ID   Resource ID                           Event type       Created at              Source           Actor
1        7b98dd96-74c7-4ddc-9f46-38c0f91c4a19  user/updated     2020-11-25 2:04:16 PM   console          admin@example.com
2        7b98dd96-74c7-4ddc-9f46-38c0f91c4a19  user/updated     2020-11-25 2:04:47 PM   console          admin@example.com
5        5f8fde3d-d231-4d52-a596-0b7f239c3b07  listing/updated  2020-11-27 6:29:25 PM   console          admin@example.com
8        5fc4a915-73b5-4467-809b-7094d3217c6b  listing/updated  2020-11-30 10:19:04 AM  marketplace-api  boyan+test4@sharetribe.com
9        7b98dd96-74c7-4ddc-9f46-38c0f91c4a19  user/updated     2020-11-30 9:45:57 PM   console          admin@example.com

ollivanhapiha at olli-mpb-16 in ~/dev/projects/sharetribe/flex-cli (events-command●)
$ node target/min.js events -m bike-soil --filter listing/updated,user --after-seqid 5

Seq ID   Resource ID                           Event type       Created at              Source           Actor
8        5fc4a915-73b5-4467-809b-7094d3217c6b  listing/updated  2020-11-30 10:19:04 AM  marketplace-api  boyan+test4@sharetribe.com
9        7b98dd96-74c7-4ddc-9f46-38c0f91c4a19  user/updated     2020-11-30 9:45:57 PM   console          admin@example.com

ollivanhapiha at olli-mpb-16 in ~/dev/projects/sharetribe/flex-cli (events-command●)
$ node target/min.js events -m bike-soil --before-ts 2020-11-28

Seq ID   Resource ID                           Event type       Created at             Source   Actor
1        7b98dd96-74c7-4ddc-9f46-38c0f91c4a19  user/updated     2020-11-25 2:04:16 PM  console  admin@example.com
2        7b98dd96-74c7-4ddc-9f46-38c0f91c4a19  user/updated     2020-11-25 2:04:47 PM  console  admin@example.com
5        5f8fde3d-d231-4d52-a596-0b7f239c3b07  listing/updated  2020-11-27 6:29:25 PM  console  admin@example.com

ollivanhapiha at olli-mpb-16 in ~/dev/projects/sharetribe/flex-cli (events-command●)
$ node target/min.js events -m bike-soil --seqid 5 --json-pretty
{
  "eventType": "listing/updated",
  "createdAt": "2020-11-27T16:29:25.640Z",
  "resourceType": "listing",
  "source": "source/console",
  "resourceId": "5f8fde3d-d231-4d52-a596-0b7f239c3b07",
  "id": "97d13c8f-999e-5bb7-9300-b8380b557e27",
  "resource": {
    "description": "Listing just got described!",
    "deleted": false,
    "geolocation": null,
    "images": [],
    "createdAt": "2020-10-21T07:07:41.097Z",
    "state": "closed",
    "privateData": {
      "fun?": false,
      "objectify": [
        "aa",
        "dd",
        "cc"
      ]
    },
    "title": "Whatever",
    "author": {
      "id": "7b98dd96-74c7-4ddc-9f46-38c0f91c4a19"
    },
    "availabilityPlan": null,
    "id": "5f8fde3d-d231-4d52-a596-0b7f239c3b07",
    "publicData": {},
    "price": null,
    "marketplace": {
      "id": "16c6a4b8-88ee-429b-835a-6725206cd08c"
    },
    "metadata": {}
  },
  "auditData": {
    "userId": null,
    "adminId": "44bcd537-ce59-4aec-892a-9a64672b4257",
    "clientId": null,
    "requestId": "88c83b38-0933-4212-a4a8-0c0ee67b13d1"
  },
  "sequenceId": 5,
  "previousValues": {
    "state": "published"
  },
  "marketplaceId": "16c6a4b8-88ee-429b-835a-6725206cd08c"
}

ollivanhapiha at olli-mpb-16 in ~/dev/projects/sharetribe/flex-cli (events-command●)
$ node target/min.js events -m bike-soil --json | jq -s '[.[] | {sequenceId,source,eventType}]'
[
  {
    "sequenceId": 1,
    "source": "source/console",
    "eventType": "user/updated"
  },
  {
    "sequenceId": 2,
    "source": "source/console",
    "eventType": "user/updated"
  },
  {
    "sequenceId": 5,
    "source": "source/console",
    "eventType": "listing/updated"
  },
  {
    "sequenceId": 6,
    "source": "source/marketplace-api",
    "eventType": "listing/created"
  },
  {
    "sequenceId": 7,
    "source": "source/marketplace-api",
    "eventType": "availabilityException/created"
  },
  {
    "sequenceId": 8,
    "source": "source/marketplace-api",
    "eventType": "listing/updated"
  },
  {
    "sequenceId": 9,
    "source": "source/console",
    "eventType": "user/updated"
  }
]
ollivanhapiha at olli-mpb-16 in ~/dev/projects/sharetribe/flex-cli (events-command●)
$ node target/min.js events -m bike-soil --after-seqid 5 --before-ts 2020-10-10
Invalid arguments for command events:
› Only one of seqid, after-seqid, before-seqid, after-ts or before-ts can be specified.

ollivanhapiha at olli-mpb-16 in ~/dev/projects/sharetribe/flex-cli (events-command●)
$ node target/min.js events -m bike-soil --filter user/updated,listin
› Invalid input value 'listin' for param filter.

ollivanhapiha at olli-mpb-16 in ~/dev/projects/sharetribe/flex-cli (events-command●)
$ node target/min.js events -m bike-soil --resource not-a-valid-uuid
› Invalid input value 'not-a-valid-uuid' for param resource.