@gls_spain/gps-common 31.0.3 → 32.0.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.
@@ -1,7 +1,9 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
3
  <component name="ChangeListManager">
4
- <list default="true" id="c2833e40-3178-44f3-9bc5-203849985c7f" name="Default Changelist" comment="" />
4
+ <list default="true" id="c2833e40-3178-44f3-9bc5-203849985c7f" name="Default Changelist" comment="">
5
+ <change beforePath="$PROJECT_DIR$/open-api-spec/index.js" beforeDir="false" afterPath="$PROJECT_DIR$/open-api-spec/index.js" afterDir="false" />
6
+ </list>
5
7
  <option name="SHOW_DIALOG" value="false" />
6
8
  <option name="HIGHLIGHT_CONFLICTS" value="true" />
7
9
  <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@@ -537,6 +539,17 @@
537
539
  <workItem from="1585171020202" duration="389000" />
538
540
  <workItem from="1585200026785" duration="2273000" />
539
541
  <workItem from="1585233345225" duration="1174000" />
542
+ <workItem from="1585251412197" duration="856000" />
543
+ <workItem from="1585290769759" duration="503000" />
544
+ <workItem from="1585309502233" duration="144000" />
545
+ <workItem from="1585319154346" duration="599000" />
546
+ <workItem from="1585377577645" duration="3315000" />
547
+ <workItem from="1585476384500" duration="770000" />
548
+ <workItem from="1585492634523" duration="20000" />
549
+ <workItem from="1585557077739" duration="601000" />
550
+ <workItem from="1585571204150" duration="600000" />
551
+ <workItem from="1585587710749" duration="604000" />
552
+ <workItem from="1585635898343" duration="1736000" />
540
553
  </task>
541
554
  <servers />
542
555
  </component>
@@ -592,22 +605,22 @@
592
605
  <screen x="0" y="23" width="2048" height="1129" />
593
606
  </state>
594
607
  <state x="606" y="280" key="EditFileWatcherDialog/0.23.2048.1129@0.23.2048.1129" timestamp="1580283934403" />
595
- <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1585251545014">
608
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom" timestamp="1585643647311">
596
609
  <screen x="0" y="23" width="2048" height="1129" />
597
610
  </state>
598
- <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1585251545014" />
599
- <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1585251545014">
611
+ <state width="2006" height="269" key="GridCell.Tab.0.bottom/0.23.2048.1129@0.23.2048.1129" timestamp="1585643647311" />
612
+ <state width="2006" height="269" key="GridCell.Tab.0.center" timestamp="1585643647311">
600
613
  <screen x="0" y="23" width="2048" height="1129" />
601
614
  </state>
602
- <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1585251545014" />
603
- <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1585251545013">
615
+ <state width="2006" height="269" key="GridCell.Tab.0.center/0.23.2048.1129@0.23.2048.1129" timestamp="1585643647311" />
616
+ <state width="2006" height="269" key="GridCell.Tab.0.left" timestamp="1585643647310">
604
617
  <screen x="0" y="23" width="2048" height="1129" />
605
618
  </state>
606
- <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1585251545013" />
607
- <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1585251545014">
619
+ <state width="2006" height="269" key="GridCell.Tab.0.left/0.23.2048.1129@0.23.2048.1129" timestamp="1585643647310" />
620
+ <state width="2006" height="269" key="GridCell.Tab.0.right" timestamp="1585643647311">
608
621
  <screen x="0" y="23" width="2048" height="1129" />
609
622
  </state>
610
- <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1585251545014" />
623
+ <state width="2006" height="269" key="GridCell.Tab.0.right/0.23.2048.1129@0.23.2048.1129" timestamp="1585643647311" />
611
624
  <state x="0" y="23" width="2048" height="1129" key="SettingsEditor" timestamp="1580283935326">
612
625
  <screen x="0" y="23" width="2048" height="1129" />
613
626
  </state>
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [32.0.1](https://github.com/GLS-Spain/gps-common/compare/v32.0.0...v32.0.1) (2020-03-31)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * improve documentation about receiving expeditions with no shop ([3c08269](https://github.com/GLS-Spain/gps-common/commit/3c08269d7a68f631a37cfd4322fc8cdb1ede2795))
7
+
8
+ # [32.0.0](https://github.com/GLS-Spain/gps-common/compare/v31.0.3...v32.0.0) (2020-03-28)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * change historic record actionDetails for actionKeys ([7f9acc5](https://github.com/GLS-Spain/gps-common/commit/7f9acc5f746a16b42a58bbc99379381a84ac9f49))
14
+
15
+
16
+ ### BREAKING CHANGES
17
+
18
+ * historic records schema has changed
19
+
1
20
  ## [31.0.3](https://github.com/GLS-Spain/gps-common/compare/v31.0.2...v31.0.3) (2020-03-26)
2
21
 
3
22
 
@@ -417,8 +417,6 @@ own network using the [shop users](#tag/Shop-users) endpoints.
417
417
  description: `
418
418
  Expeditions are the packages that are delivered and picked up at parcel shops.
419
419
 
420
- Every expedition is associated to a parcel shop.
421
-
422
420
  Super administrators can manage expeditions using the [expeditions](#tag/Expeditions) endpoints. Shop users can also use
423
421
  some of those endpoints to receive and give expeditions from and to GLS and customers.
424
422
 
@@ -427,10 +425,10 @@ some of those endpoints to receive and give expeditions from and to GLS and cust
427
425
  {
428
426
  name: 'Pod',
429
427
  description: `
430
- Expeditions that have been delivered to a customer have a POD (Proof Of Delivery) associated to them that contains the
431
- signature of the customer that picked up the expedition.
428
+ Expeditions that have been picked up by or delivered to a customer have a POD (Proof Of Delivery) associated to them that contains the
429
+ signature of the customer.
432
430
 
433
- Pods are created automatically by the API when an expedition is delivered to a customer.
431
+ Pods are created automatically by the API when an expedition is picked up by or delivered to a customer.
434
432
 
435
433
  Super administrators, network administrators and shop users can use the [pods](#tag/Pods) endpoints to find the pods of the
436
434
  expeditions they have access to.
@@ -441,24 +439,21 @@ expeditions they have access to.
441
439
  name: 'Historic records introduction',
442
440
  'x-displayName': 'Historic records',
443
441
  description: `
444
- Every time the API creates, updates or deletes a resource, it stores a historic record of: the action, the full document as it was after
442
+ Every time the API creates, updates or deletes a resource it stores a historic record of the action, the full document as it was after
445
443
  the action, the time it occurred and the user that made it.
446
444
 
447
445
  The only exception are \`pods\` which have no records because they are created when their expeditions are delivered and they are never
448
- updated or deleted.
446
+ updated. They are also never deleted because they need to remain accessible via the historic records of expeditions.
449
447
 
450
448
  These historic records serve two purposes:
451
449
 
452
450
  - They allow to track the full history of a document.
453
451
  - They are the basis for the [integrations](#tag/Integrations-introduction) with other systems.
454
452
 
455
- The \`actionDetails\` field adds more information about the action when necessary, for example:
456
-
457
- - An expedition reception from a customer is an \`update\` action with the \`receiveFromCustomer\` and \`price\` details.
458
- - An update of an expedition packages is an \`update\` action with a \`price\` detail.
459
- - An automatic background expiration of an expedition is an \`update\` action with an \`expired\` detail.
453
+ The \`actionKeys\` lists the paths of the updated fields for an \`update\` action. The depth of the paths may vary:
460
454
 
461
- The values in \`actionDetails\` only apply to certain combinations of \`type\` and \`action\`.
455
+ - Usually it is just the root key, for example an update of any field in a shop address is just \`address\`.
456
+ - Some updated are more specific, for example delivering an expedition is \`status.code\` and \`status.givenTo\`.
462
457
 
463
458
  The \`integrations\` field is where each integration stores what it did with it. Its properties are the names of the integrations and
464
459
  their values the result of that integration for that record.
@@ -589,13 +584,13 @@ Sent when a shop delivers an expedition to a driver.
589
584
 
590
585
  ## Expiration reminder event
591
586
 
592
- Sent when the API detects in the background that it is time to remind the customer to pick up the expedition and updates its status.
587
+ Sent when the API detects in the background that it is time to remind the customer to pick up the expedition.
593
588
 
594
589
  <SchemaDefinition schemaRef="#/components/schemas/expirationReminderEvent" />
595
590
 
596
591
  ## Expired event
597
592
 
598
- Sent when the API detects in the background that it is time to expire the expedition and updates its status.
593
+ Sent when the API detects in the background that the expedition has expired.
599
594
 
600
595
  <SchemaDefinition schemaRef="#/components/schemas/expiredEvent" />
601
596
 
@@ -643,10 +638,6 @@ These settings can be set at various levels of specificity:
643
638
  - Network specific values: each network can have its custom settings, which override the default ones.
644
639
  - Shop specific values: each shop can have its custom settings, which override the network and default ones.`,
645
640
  },
646
- {
647
- name: 'Integrations',
648
- description: `Find integrations configurations.`,
649
- },
650
641
  {
651
642
  name: 'Super admins',
652
643
  description: `Create and manage super admins.
@@ -743,7 +734,7 @@ at the parcel shop for a driver to retrieve it later.
743
734
 
744
735
  ### Status
745
736
 
746
- The \`status.code\` property of an expedition indicates the situation of an expedition from the parcel shop perspective:
737
+ The \`status.code\` property of an expedition indicates the situation of an expedition from the parcel shop point of view:
747
738
 
748
739
  - \`incoming\`: the expedition is on its way to the parcel shop. A driver or a customer is expected to come and leave it at the parcel shop.
749
740
  - \`inShop\`: the parcel shop has received the expedition and it is waiting for the other person to retrieve it.
@@ -759,7 +750,7 @@ because it has a predetermined life cycle. The following endpoints update an exp
759
750
  | :--- | :--- | :--- | :--- | :--- |
760
751
  | [receiveFromDriver](#tag/Expeditions/paths/~1expeditions~1receiveFromDriver/post) | delivery | incoming | inShop | receivedFrom, expiration |
761
752
  | [receiveAllFromDriver](#tag/Expeditions/paths/~1expeditions~1receiveAllFromDriver/post) | delivery | incoming | inShop | receivedFrom, expiration |
762
- | [receiveFromCustomer](#tag/Expeditions/paths/~1expeditions~1receiveFromCustomer/post) | pickup | incoming | inShop | receivedFrom, expiration |
753
+ | [receiveFromCustomer](#tag/Expeditions/paths/~1expeditions~1receiveFromCustomer/post) | pickup | incoming | inShop | receivedFrom |
763
754
  | [giveToCustomer](#tag/Expeditions/paths/~1expeditions~1giveToCustomer/post) | delivery | inShop | delivered | givenTo |
764
755
  | [giveToDriver](#tag/Expeditions/paths/~1expeditions~1giveToDriver/post) | delivery<br/>pickup | inShopExpired<br/>inShop | delivered<br/>delivered | givenTo<br/>givenTo |
765
756
  | [redirect](#tag/Expeditions/paths/~1expeditions~1redirect/post) | any | any | incoming | clear everything |
@@ -780,6 +771,10 @@ Once created, sales representatives can be associated to parcel shops.`,
780
771
  name: 'Historic records',
781
772
  description: `Find historic records.`,
782
773
  },
774
+ {
775
+ name: 'Integrations',
776
+ description: `Find integrations configurations.`,
777
+ },
783
778
  ];
784
779
 
785
780
  const headers = {
@@ -2702,15 +2697,16 @@ Receives expeditions from a driver, changing their status code and adding more p
2702
2697
  Each expedition is processed individually and its result returned, so it is possible that some expeditions are processed
2703
2698
  and some are not. The result for each expedition depends on its situation:
2704
2699
 
2705
- | Expedition | Type + Status code | Result | New status code | New status properties |
2706
- | :--- | :--- | :--- | :--- | :--- |
2707
- | found in no shop<br/>found in same shop | delivery + incoming | ok | inShop | receivedFrom, expiration |
2708
- | found in same shop | any other combination | another situation | - | - |
2709
- | found in another shop | - | another shop | - | - |
2710
- | not found | - | not found | - | - |
2711
- | server error | - | error | - | - |
2700
+ | Expedition | Type + Status code | Result | New status code | New status properties |
2701
+ | :--- | :--- | :--- | :--- | :--- |
2702
+ | found in no shop (*)<br/>found in same shop | delivery + incoming | ok | inShop | receivedFrom, expiration |
2703
+ | found in no shop | any other combination | not found | - | - |
2704
+ | found in same shop | any other combination | another situation | - | - |
2705
+ | found in another shop | - | another shop | - | - |
2706
+ | not found | - | not found | - | - |
2707
+ | server error | - | error | - | - |
2712
2708
 
2713
- If the received expedition is not associated to a shop this operation will associate it to the shop receiving it.
2709
+ (*) If the received expedition is not associated to a shop this operation will associate it to the shop that is receiving it.
2714
2710
 
2715
2711
  ${securitySchemes.tokens}
2716
2712
  ${securitySchemes.shopUserRole}`,
@@ -2739,12 +2735,11 @@ ${securitySchemes.shopUserRole}`,
2739
2735
  tags: ['Expeditions'],
2740
2736
  summary: '[U] Receive all from driver',
2741
2737
  description: `
2742
- Receives all the \`incoming\` expeditions for this shop.
2743
-
2744
- Calling this endpoint is equivalent to calling [receiveFromDriver](#tag/Expeditions/paths/~1expeditions~1receiveFromDriver/post) with all
2745
- the \`_ids\` of the \`incoming\` expeditions. It returns how many expeditions have been processed.
2738
+ Receives all the \`delivery\` and \`incoming\` expeditions for this shop.
2746
2739
 
2747
- If the received expedition is not associated to a shop this operation will associate it to the shop receiving it.
2740
+ Calling this endpoint is equivalent to calling [receiveFromDriver](#tag/Expeditions/paths/~1expeditions~1receiveFromDriver/post) with the
2741
+ \`_ids\` of all the \`delivery\` expeditions in \`incoming\` status associated to the shop. It returns how many expeditions have been
2742
+ processed.
2748
2743
 
2749
2744
  ${securitySchemes.tokens}
2750
2745
  ${securitySchemes.shopUserRole}`,
@@ -2778,15 +2773,16 @@ Receives expeditions from a customer, changing their status code and adding more
2778
2773
  Each expedition is processed individually and its result returned, so it is possible that some expeditions are processed
2779
2774
  and some are not. The result for each expedition depends on its situation:
2780
2775
 
2781
- | Expedition | Type + Status code | Result | New status code | New status properties |
2782
- | :--- | :--- | :--- | :--- | :--- |
2783
- | found in no shop<br/>found in same shop | pickup + incoming | ok | inShop | receivedFrom |
2784
- | found in same shop | any other combination | another situation | - | - |
2785
- | found in another shop | - | another shop | - | - |
2786
- | not found | - | not found | - | - |
2787
- | server error | - | error | - | - |
2776
+ | Expedition | Type + Status code | Result | New status code | New status properties |
2777
+ | :--- | :--- | :--- | :--- | :--- |
2778
+ | found in no shop (*)<br/>found in same shop | pickup + incoming | ok | inShop | receivedFrom |
2779
+ | found in no shop | any other combination | not found | - | - |
2780
+ | found in same shop | any other combination | another situation | - | - |
2781
+ | found in another shop | - | another shop | - | - |
2782
+ | not found | - | not found | - | - |
2783
+ | server error | - | error | - | - |
2788
2784
 
2789
- If the received expedition is not associated to a shop this operation will associate it to the shop receiving it.
2785
+ (*) If the received expedition is not associated to a shop this operation will associate it to the shop that is receiving it.
2790
2786
 
2791
2787
  ${securitySchemes.tokens}
2792
2788
  ${securitySchemes.shopUserRole}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gls_spain/gps-common",
3
- "version": "31.0.3",
3
+ "version": "32.0.1",
4
4
  "description": "Errors, schemas and documentation for the Parcel Shops project",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -20,25 +20,14 @@ const historicRecord = () => ({
20
20
  type: 'string',
21
21
  enum: ['defaults', 'superAdmin', 'network', 'networkAdmin', 'zone', 'representative', 'shop', 'shopUser', 'expedition'],
22
22
  },
23
+ document: { oneOf: [defaults(), superAdmin(), network(), networkAdmin(), zone(), representative(), shop(), shopUser(), expedition()] },
23
24
  action: { type: 'string', enum: ['create', 'update', 'delete'] },
24
- actionDetails: {
25
+ actionKeys: {
25
26
  type: 'array',
26
- items: {
27
- type: 'string',
28
- enum: [
29
- 'receiveFromDriver',
30
- 'receiveFromCustomer',
31
- 'giveToDriver',
32
- 'giveToCustomer',
33
- 'redirect',
34
- 'expirationReminder',
35
- 'expire',
36
- 'price',
37
- ],
38
- },
27
+ items: { type: 'string' },
28
+ description: 'the list of updated keys in an update action, e.g ["name", "status.code"]',
39
29
  },
40
- actor: { type: 'string', description: 'the username of the user who made the action' },
41
- document: { oneOf: [defaults(), superAdmin(), network(), networkAdmin(), zone(), representative(), shop(), shopUser(), expedition()] },
30
+ actor: { type: 'string', description: 'who made the action, e.g. username of the user, name of the script' },
42
31
  integrations: {
43
32
  type: 'object',
44
33
  additionalProperties: {
@@ -54,7 +43,7 @@ const historicRecord = () => ({
54
43
  description: 'one property per integration where the property name is the name of the integration',
55
44
  },
56
45
  },
57
- required: ['_id', 'createdAt', 'updatedAt', 'deletable', 'type', 'action', 'actionDetails', 'actor', 'document', 'integrations'],
46
+ required: ['_id', 'createdAt', 'updatedAt', 'deletable', 'type', 'document', 'action', 'actionKeys', 'actor', 'integrations'],
58
47
  additionalProperties: false,
59
48
  });
60
49