Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ jobs:
- run: npm run build
- run: npm run lint
- run: npm run test
- name: Validate generated documentation
run: |
npm run generate:docs
if ! git diff --quiet; then
git --no-pager diff
exit 1
fi
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Full documentation is located in the [`docs/`](docs/) folder:
- [GLS Action Overview](docs/Actions/GLS/overview.md)
- [GLS Configuration](docs/Actions/GLS/configs.md)
- [GLS Functions](docs/Actions/GLS/functions.md)
- [GLS Types](docs/Actions/GLS/types.md)
- [GLS Types](docs/Actions/GLS/types.mdx)
- [GLS Events](docs/Actions/GLS/events.md)
- [Common Use Cases](docs/Actions/GLS/use-cases.md)
- [Troubleshooting & Community Support](docs/Actions/GLS/troubleshooting.md)
Expand Down
6 changes: 5 additions & 1 deletion actions/gls-action/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"build": "vite build",
"lint": "eslint .",
"test": "vitest run",
"start": "node dist/main.js"
"start": "node dist/main.js",
"generate:docs": "npm run build && node dist/generateDocs.js"
},
"dependencies": {
"ts-morph": "^27.0.2"
}
}
58 changes: 58 additions & 0 deletions actions/gls-action/scripts/generateDocs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import {runStandardActionDocs, StandardActionDocsConfig} from "../../../src/standardActionDocs"
import {loadAllDefinitions} from "../src/helpers";

export function createGlsDocsConfig(): StandardActionDocsConfig {
return {
actionName: "GLS",
typePrefix: "GLS_",
typesOutputPath: "../../docs/Actions/GLS/types.mdx",
functionsOutputPath: "../../docs/Actions/GLS/functions.mdx",
loadAllDefinitions,
typeLinkOverrides: {
GLS_SHIPMENT_UNIT_SERVICE: "GLS_SHIPMENT_UNIT$Service",
},
typesCopy: {
title: "Datatypes",
description: "All data types registered by the GLS Action.",
heading: "GLS Action Types",
intro: `The GLS Action registers the following data types with the Hercules platform. These types are used as inputs and outputs of the GLS functions and can be referenced in your flows.`,
},
functionsCopy: {
title: "Functions",
description: "All functions registered by the GLS Action.",
intro: `The GLS Action exposes functions grouped into three categories:

- **Builder functions** — Construct data objects (no API call)
- **Shipment functions** — Create different types of GLS shipments (calls GLS API)
- **API functions** — Query or modify shipments (calls GLS API)`,
},
functionGroups: [
{
heading: "Builder functions",
modules: import.meta.glob("../src/functions/utils/*.ts"),
},
{
heading: "Shipment functions",
intro: `All shipment functions accept a common set of parameters in addition to their type-specific parameters. They call the GLS ShipIT API (\`POST /rs/shipments\`) and return a \`GLS_CREATE_PARCELS_RESPONSE\`.

**Common parameters for all shipment functions:**

| Parameter | Type | Required | Description |
|-------------------|-------------------------------|----------|----------------------------------------------------|
| \`shipment\` | GLS_SHIPMENT_WITHOUT_SERVICES | **Yes** | Shipment data (consignee, shipper, units, product) |
| \`printingOptions\` | GLS_PRINTING_OPTIONS | **Yes** | Label format settings |
| \`returnOptions\` | GLS_RETURN_OPTIONS | No | Whether to return print data and routing info |
| \`customContent\` | GLS_CUSTOM_CONTENT | No | Custom logo and barcode settings |

---`,
modules: import.meta.glob("../src/functions/services/*.ts"),
},
{
heading: "API functions",
modules: import.meta.glob("../src/functions/*.ts"),
},
],
}
}

await runStandardActionDocs(createGlsDocsConfig())
14 changes: 13 additions & 1 deletion actions/gls-action/src/functions/cancelShipment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ export default (sdk: ActionSdk) => {
{
definition: {
runtimeName: "cancelShipment",
documentation: [
{
code: "en-US",
content: "Cancels an existing shipment by its Track ID. Only possible if the parcel has not yet been scanned."
}
],
displayMessage: [
{
code: "en-US",
content: "Cancel shipment"
}
],
name: [
{
code: "en-US",
Expand All @@ -16,7 +28,7 @@ export default (sdk: ActionSdk) => {
description: [
{
code: "en-US",
content: "Cancels a GLS shipment.",
content: "Cancels an existing shipment by its Track ID. Only possible if the parcel has not yet been scanned.",
}
],
signature: "(data: GLS_CANCEL_SHIPMENT_REQUEST_DATA): GLS_CANCEL_SHIPMENT_RESPONSE_DATA",
Expand Down
14 changes: 13 additions & 1 deletion actions/gls-action/src/functions/getAllowedServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ export default (sdk: ActionSdk) => {
{
definition: {
runtimeName: "getAllowedServices",
documentation: [
{
code: "en-US",
content: "Returns the GLS services available for a given origin/destination country and ZIP code combination."
}
],
displayMessage: [
{
code: "en-US",
content: "Get allowed services"
}
],
name: [
{
code: "en-US",
Expand All @@ -21,7 +33,7 @@ export default (sdk: ActionSdk) => {
description: [
{
code: "en-US",
content: "Returns the allowed GLS services for a given set of parameters.",
content: "Returns the GLS services available for a given origin/destination country and ZIP code combination.",
}
],
signature: "(data: GLS_ALLOWED_SERVICES_REQUEST_DATA): GLS_ALLOWED_SERVICES_RESPONSE_DATA",
Expand Down
14 changes: 13 additions & 1 deletion actions/gls-action/src/functions/getEndOfDayReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ export default (sdk: ActionSdk) => {
{
definition: {
runtimeName: "getEndOfDayReport",
documentation: [
{
code: "en-US",
content: "Retrieves all shipments dispatched on a given date. Useful for reconciliation and end-of-day processing."
}
],
displayMessage: [
{
code: "en-US",
content: "Get end of day report"
}
],
name: [
{
code: "en-US",
Expand All @@ -17,7 +29,7 @@ export default (sdk: ActionSdk) => {
description: [
{
code: "en-US",
content: "Returns the GLS end of day report.",
content: "Retrieves all shipments dispatched on a given date. Useful for reconciliation and end-of-day processing.",
}
],
signature: "(data: GLS_END_OF_DAY_REQUEST_DATA): GLS_END_OF_DAY_RESPONSE_DATA",
Expand Down
14 changes: 13 additions & 1 deletion actions/gls-action/src/functions/reprintParcel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ export default (sdk: ActionSdk) => {
{
definition: {
runtimeName: "reprintParcel",
documentation: [
{
code: "en-US",
content: "Reprints the label for an existing parcel. Use this if the original label is damaged, lost, or needs to be printed in a different format."
}
],
displayMessage: [
{
code: "en-US",
content: "Reprint parcel"
}
],
name: [
{
code: "en-US",
Expand All @@ -21,7 +33,7 @@ export default (sdk: ActionSdk) => {
description: [
{
code: "en-US",
content: "Reprints the labels for a GLS parcel.",
content: "Reprints the label for an existing parcel. Use this if the original label is damaged, lost, or needs to be printed in a different format.",
}
],
signature: "(data: GLS_REPRINT_PARCEL_REQUEST_DATA): GLS_REPRINT_PARCEL_RESPONSE_DATA",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => {
{
definition: {
runtimeName: "createAddresseeOnlyShipment",
documentation: [
{
code: "en-US",
content: "Creates a shipment that can only be delivered to the named addressee (no neighbor delivery)."
}
],
displayMessage: [
{
code: "en-US",
content: "Create addressee only shipment"
}
],
name: [
{
code: "en-US",
Expand All @@ -24,7 +36,7 @@ export default (sdk: ActionSdk) => {
description: [
{
code: "en-US",
content: "Creates a GLS addressee only shipment.",
content: "Creates a shipment that can only be delivered to the named addressee (no neighbor delivery).",
}
],
signature: `(${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`,
Expand All @@ -44,4 +56,5 @@ export default (sdk: ActionSdk) => {
}
},
)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => {
{
definition: {
runtimeName: "createDeliveryAtWorkShipment",
documentation: [
{
code: "en-US",
content: "Delivers a parcel to a specific location within a workplace (building, floor, room)."
}
],
displayMessage: [
{
code: "en-US",
content: "Create delivery at work shipment"
}
],
name: [
{
code: "en-US",
Expand All @@ -24,7 +36,7 @@ export default (sdk: ActionSdk) => {
description: [
{
code: "en-US",
content: "Creates a GLS delivery at work shipment.",
content: "Delivers a parcel to a specific location within a workplace (building, floor, room).",
}
],
signature: `(recipientName: string, building: string, floor: number, ${DEFAULT_SIGNATURE_FOR_SERVICES}, alternateRecipientName?: string, room?: number, phonenumber?: string): GLS_CREATE_PARCELS_RESPONSE`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ export default (sdk: ActionSdk) => {
{
definition: {
runtimeName: "createDeliveryNextWorkingDayShipment",
documentation: [
{
code: "en-US",
content: "Creates an EXPRESS shipment for delivery on the next working day (EOB service)."
}
],
displayMessage: [
{
code: "en-US",
content: "Create delivery next working day shipment"
}
],
name: [
{
code: "en-US",
Expand All @@ -24,7 +36,7 @@ export default (sdk: ActionSdk) => {
description: [
{
code: "en-US",
content: "Creates a GLS delivery next working day shipment.",
content: "Creates an EXPRESS shipment for delivery on the next working day (EOB service).",
}
],
signature: `(${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ export default (sdk: ActionSdk) => {
{
definition: {
runtimeName: "createDeliverySaturdayShipment",
documentation: [
{
code: "en-US",
content: "Creates an EXPRESS shipment for Saturday delivery."
}
],
displayMessage: [
{
code: "en-US",
content: "Create delivery Saturday shipment"
}
],
name: [
{
code: "en-US",
Expand All @@ -25,7 +37,7 @@ export default (sdk: ActionSdk) => {
description: [
{
code: "en-US",
content: "Creates a GLS delivery Saturday shipment.",
content: "Creates an EXPRESS shipment for Saturday delivery.",
}
],
signature: `(${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ export default (sdk: ActionSdk) => {
{
definition: {
runtimeName: "createDepositShipment",
documentation: [
{
code: "en-US",
content: "Delivers a parcel to a designated deposit location (e.g. a garage or shed) without requiring a signature."
}
],
displayMessage: [
{
code: "en-US",
content: "Create deposit shipment"
}
],
name: [
{
code: "en-US",
Expand All @@ -25,7 +37,7 @@ export default (sdk: ActionSdk) => {
description: [
{
code: "en-US",
content: "Creates a GLS deposit shipment.",
content: "Delivers a parcel to a designated deposit location (e.g. a garage or shed) without requiring a signature.",
}
],
signature: `(placeOfDeposit: string, ${DEFAULT_SIGNATURE_FOR_SERVICES}): GLS_CREATE_PARCELS_RESPONSE`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ export default (sdk: ActionSdk) => {
{
definition: {
runtimeName: "createExchangeShipment",
documentation: [
{
code: "en-US",
content: "Delivers a new parcel while simultaneously picking up an existing one (exchange)."
}
],
displayMessage: [
{
code: "en-US",
content: "Create exchange shipment"
}
],
name: [
{
code: "en-US",
Expand All @@ -25,7 +37,7 @@ export default (sdk: ActionSdk) => {
description: [
{
code: "en-US",
content: "Creates a GLS exchange shipment.",
content: "Delivers a new parcel while simultaneously picking up an existing one (exchange).",
}
],
signature: `(address: GLS_ADDRESS, ${DEFAULT_SIGNATURE_FOR_SERVICES}, expectedWeight?: number): GLS_CREATE_PARCELS_RESPONSE`,
Expand Down
Loading