zinkee 0.1.50 → 0.1.52

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
@@ -716,11 +716,11 @@ Valid action types: `create_record`, `update_record`, `search_records`, `send_me
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` 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.
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; `"actionId": null`, as `automations get` returns it, counts as absent and is not sent.
720
720
 
721
721
  ### Native invoicing
722
722
 
723
- Use action type `invoicing` with `--operation prepare|issue|refund|cancel|create_correction`
723
+ Use action type `invoicing` with `--operation prepare|issue|refund|cancel|create_correction|prepare_fiscal_correction|execute_fiscal_correction`
724
724
  and `--schema <source-schema-uuid>`. Preparation and issuance run in separate automations.
725
725
  Existing plugin automations remain unchanged; replace them manually during activation.
726
726
 
@@ -743,6 +743,8 @@ objects as record mappings (`--input-json name=json`):
743
743
  | `refund` | `seriesSchemaId`, `seriesId`, `cause`, `reason` |
744
744
  | `cancel` | `cause`, `reason` |
745
745
  | `create_correction` | `draftSchemaId`, `seriesSchemaId`, `seriesId`, `cause`, `reason` |
746
+ | `prepare_fiscal_correction` | `correctionSchemaId` (normal destination table) |
747
+ | `execute_fiscal_correction` | `reason` (`--schema` is the correction requests table) |
746
748
 
747
749
  All operations accept `recordId`; omitting it uses the trigger record only when
748
750
  its schema matches. `invoiceNumber` is an optional override for `issue` and `refund`;
@@ -757,6 +759,23 @@ Correction returns `draftSchemaId` / `draftId` for the editable draft. Issuance
757
759
  continues only after the invoice projection and PDF are ready; AEAT delivery has
758
760
  its own state. Retrying recovers the same invoice and finishes pending work.
759
761
 
762
+ Fiscal corrections use two separate steps: prepare from the visible invoice, review the
763
+ request in a normal table, then execute from that request. `recipientNifConfirmed`
764
+ is optional on execution and accepts `true`/`false` (or the template option IDs
765
+ `1`/`2`). Confirm only a checked, correct NIF for the diagnosed uncensused recipient case.
766
+ No input exposes AEAT flags, XML or hashes.
767
+
768
+ Outputs include `requestId` (durable request), `correctionSchemaId` / `correctionId`
769
+ (visible request), `sourceRecordId` (record being corrected), `recordId` (resulting
770
+ fiscal record, when generated), `state`, `resolution`, `diagnosisCode` and `diagnosis`.
771
+ The request UUID currently equals its visible record UUID. `invoiceId` and
772
+ `originalInvoiceId` are internal; `projectedInvoiceSchemaId` / `projectedInvoiceId`
773
+ refer to the visible original invoice. Preparation does not generate a fiscal record.
774
+ Execution continues after persisting the operation and its visible row, before AEAT
775
+ acceptance. Repeating an executed request recovers the stored operation and ignores
776
+ later edits to its inputs; another correction needs a new request. An UNKNOWN result
777
+ must be reconciled before another fiscal operation can be generated.
778
+
760
779
  ### Flow wiring
761
780
 
762
781
  Actions are NOT auto-wired. Connect them explicitly:
@@ -3858,6 +3858,46 @@ var specificExamples = {
3858
3858
  "schemaId": "68d2c7be-4392-42de-b5ae-625ad79cfc3c",
3859
3859
  "inputs": {}
3860
3860
  }
3861
+ }`
3862
+ },
3863
+ {
3864
+ description: "Prepare a request from the visible invoice; review it in the normal corrections table before execution.",
3865
+ command: 'zinkee --json automations actions add automation-1 --type invoicing --name "Prepare fiscal correction" --operation prepare_fiscal_correction --schema 68d2c7be-4392-42de-b5ae-625ad79cfc3c --input correctionSchemaId=35443450-0000-4000-8000-000000000001',
3866
+ raw: `{
3867
+ "type": "invoicing",
3868
+ "name": "Prepare fiscal correction",
3869
+ "config": {
3870
+ "operation": "prepare_fiscal_correction",
3871
+ "schemaId": "68d2c7be-4392-42de-b5ae-625ad79cfc3c",
3872
+ "inputs": {
3873
+ "correctionSchemaId": {
3874
+ "rawValue": "35443450-0000-4000-8000-000000000001",
3875
+ "source": null
3876
+ }
3877
+ }
3878
+ }
3879
+ }`
3880
+ },
3881
+ {
3882
+ description: "Execute the reviewed request from its own trigger row. Returning PENDING confirms durable work, not AEAT acceptance. Repeating the request recovers it.",
3883
+ command: 'zinkee --json automations actions add automation-1 --type invoicing --name "Execute fiscal correction" --operation execute_fiscal_correction --schema 35443450-0000-4000-8000-000000000001 --input reason="Correct the fiscal registration" --input recipientNifConfirmed=false',
3884
+ raw: `{
3885
+ "type": "invoicing",
3886
+ "name": "Execute fiscal correction",
3887
+ "config": {
3888
+ "operation": "execute_fiscal_correction",
3889
+ "schemaId": "35443450-0000-4000-8000-000000000001",
3890
+ "inputs": {
3891
+ "reason": {
3892
+ "rawValue": "Correct the fiscal registration",
3893
+ "source": null
3894
+ },
3895
+ "recipientNifConfirmed": {
3896
+ "rawValue": "false",
3897
+ "source": null
3898
+ }
3899
+ }
3900
+ }
3861
3901
  }`
3862
3902
  },
3863
3903
  {
@@ -4374,4 +4414,4 @@ function withResponseEnvelope(example, commandName) {
4374
4414
  export {
4375
4415
  getCommandExamples
4376
4416
  };
4377
- //# sourceMappingURL=examples-CFZMP2GJ.js.map
4417
+ //# sourceMappingURL=examples-V3PR2VTY.js.map