zinkee 0.1.49 → 0.1.50

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.
package/README.md CHANGED
@@ -709,14 +709,53 @@ zinkee --json automations actions add <automation-uuid> \
709
709
  --arg mode=safe
710
710
  ```
711
711
 
712
- Valid action types: `create_record`, `update_record`, `search_records`, `send_message`, `http_request`, `execute_plugin`.
712
+ Valid action types: `create_record`, `update_record`, `search_records`, `send_message`, `send_email`, `http_request`, `execute_plugin`, `generate_document`, `invoicing`.
713
713
 
714
714
  ### Field mapping format
715
715
 
716
716
  - `--map field=value` → `{"rawValue":"value","source":null}` (literal)
717
717
  - `--map-json field='{"rawValue":null,"source":{"type":"TRIGGER","id":"<field-uuid>"}}'` (from trigger)
718
718
  - `source.type` values: `TRIGGER`, `PREVIOUS_ACTION`
719
- - `source.id` must be a field UUID — slugs are not resolved here
719
+ - `source.id` is a field UUID or a named output of the preceding action; slugs are not resolved here. Use `source.actionId` to select the preceding action explicitly.
720
+
721
+ ### Native invoicing
722
+
723
+ Use action type `invoicing` with `--operation prepare|issue|refund|cancel|create_correction`
724
+ and `--schema <source-schema-uuid>`. Preparation and issuance run in separate automations.
725
+ Existing plugin automations remain unchanged; replace them manually during activation.
726
+
727
+ ```bash
728
+ zinkee --json automations actions add <automation-uuid> \
729
+ --type invoicing --name "Issue invoice" --operation issue --schema <draft-schema-uuid>
730
+
731
+ zinkee --json automations actions add <automation-uuid> \
732
+ --type invoicing --name "Cancel invoice" --operation cancel --schema <invoice-schema-uuid> \
733
+ --input cause=DUPLICATE_INVOICE --input reason="Duplicate invoice" \
734
+ --input-json 'recordId={"source":{"type":"PREVIOUS_ACTION","id":"projectedInvoiceId","actionId":"<preceding-action-uuid>"}}'
735
+ ```
736
+
737
+ Inputs accept fixed values (`--input name=value`) or the same `{rawValue, source}`
738
+ objects as record mappings (`--input-json name=json`):
739
+
740
+ | Operation | Required inputs |
741
+ | --- | --- |
742
+ | `prepare`, `issue` | None when the trigger record belongs to the configured schema |
743
+ | `refund` | `seriesSchemaId`, `seriesId`, `cause`, `reason` |
744
+ | `cancel` | `cause`, `reason` |
745
+ | `create_correction` | `draftSchemaId`, `seriesSchemaId`, `seriesId`, `cause`, `reason` |
746
+
747
+ All operations accept `recordId`; omitting it uses the trigger record only when
748
+ its schema matches. `invoiceNumber` is an optional override for `issue` and `refund`;
749
+ otherwise the fiscal service assigns the next number in the series.
750
+
751
+ Invoicing outputs can be selected by `source.type=PREVIOUS_ACTION`, `source.actionId`
752
+ and a named `source.id`. Fiscal `invoiceId`, `recordId` and `operationId` are distinct
753
+ from the visible `projectedInvoiceSchemaId` / `projectedInvoiceId`; use the latter
754
+ for record actions. `file` is the FileField value and `fileId` identifies its PDF;
755
+ `fileName`, `mediaType` and `sha256` describe that stored PDF.
756
+ Correction returns `draftSchemaId` / `draftId` for the editable draft. Issuance
757
+ continues only after the invoice projection and PDF are ready; AEAT delivery has
758
+ its own state. Retrying recovers the same invoice and finishes pending work.
720
759
 
721
760
  ### Flow wiring
722
761
 
@@ -3845,6 +3845,19 @@ var specificExamples = {
3845
3845
  "authMode": "STORED",
3846
3846
  "connectionId": "connection-1"
3847
3847
  }
3848
+ }`
3849
+ },
3850
+ {
3851
+ description: "Issue a previously prepared draft using native invoicing. The trigger record belongs to schemaId; the configured series assigns the invoice number.",
3852
+ command: 'zinkee --json automations actions add automation-1 --type invoicing --name "Issue invoice" --operation issue --schema 68d2c7be-4392-42de-b5ae-625ad79cfc3c',
3853
+ raw: `{
3854
+ "type": "invoicing",
3855
+ "name": "Issue invoice",
3856
+ "config": {
3857
+ "operation": "issue",
3858
+ "schemaId": "68d2c7be-4392-42de-b5ae-625ad79cfc3c",
3859
+ "inputs": {}
3860
+ }
3848
3861
  }`
3849
3862
  },
3850
3863
  {
@@ -4361,4 +4374,4 @@ function withResponseEnvelope(example, commandName) {
4361
4374
  export {
4362
4375
  getCommandExamples
4363
4376
  };
4364
- //# sourceMappingURL=examples-4CKJHTGV.js.map
4377
+ //# sourceMappingURL=examples-CFZMP2GJ.js.map