@andco/protocol 0.0.8 → 0.0.10

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.
@@ -47,8 +47,9 @@ export declare function isIntentDeadline(value: string): boolean;
47
47
  *
48
48
  * `transfer` is the only way money movement is expressed: money leaving an account towards a
49
49
  * `destination`, both named in the `bank_transfer` matcher vocabulary (`account_key`, `account`,
50
- * `external`). A null `source` is the confirmation screen's source picker; the amount and the
51
- * destination are always locked there (`editable: true` is refused). Who may approve the Intent without a person belongs to the Grant, never to
50
+ * `external`). A null `source` is the confirmation screen's source picker; the destination is always
51
+ * locked there (`editable: true` is refused), and so is the amount unless it says `editable: true`, in
52
+ * which case the person sets it. Who may approve the Intent without a person belongs to the Grant, never to
52
53
  * the operation itself.
53
54
  *
54
55
  * @example
@@ -87,10 +88,11 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
87
88
  readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, {}>;
88
89
  }, undefined>, v.StrictObjectSchema<{
89
90
  readonly type: v.LiteralSchema<"transfer", undefined>;
91
+ readonly expires_at: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>, undefined>;
90
92
  readonly amount: v.StrictObjectSchema<{
91
93
  currency: v.LiteralSchema<"CLP", undefined>;
92
94
  value: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, v.CheckAction<string, undefined>]>;
93
- editable: v.OptionalSchema<v.LiteralSchema<false, undefined>, false>;
95
+ editable: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
94
96
  }, undefined>;
95
97
  readonly source: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.StrictObjectSchema<{
96
98
  type: v.LiteralSchema<"account_key", undefined>;
@@ -117,7 +119,6 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
117
119
  readonly holder_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
118
120
  }, undefined>], undefined>;
119
121
  readonly expires_in: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_interval">]>, undefined>;
120
- readonly expires_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>;
121
122
  readonly note: v.OptionalSchema<v.StrictObjectSchema<{
122
123
  readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.CheckAction<string, "note_too_long">]>;
123
124
  readonly editable: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
@@ -125,11 +126,11 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
125
126
  readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, {}>;
126
127
  }, undefined>, v.StrictObjectSchema<{
127
128
  readonly type: v.LiteralSchema<"account_opening", undefined>;
129
+ readonly expires_at: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>, undefined>;
128
130
  readonly accountKey: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
129
131
  readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
130
132
  readonly upsert: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
131
133
  readonly expires_in: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_interval">]>, undefined>;
132
- readonly expires_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>;
133
134
  readonly note: v.OptionalSchema<v.StrictObjectSchema<{
134
135
  readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.CheckAction<string, "note_too_long">]>;
135
136
  readonly editable: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
@@ -176,10 +177,11 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
176
177
  };
177
178
  } | {
178
179
  type: "transfer";
180
+ expires_at?: string | null | undefined;
179
181
  amount: {
180
182
  currency: "CLP";
181
183
  value: string;
182
- editable: false;
184
+ editable: boolean;
183
185
  };
184
186
  source: {
185
187
  type: "account_key";
@@ -206,7 +208,6 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
206
208
  holder_name: string;
207
209
  };
208
210
  expires_in?: string | undefined;
209
- expires_at?: string | undefined;
210
211
  note?: {
211
212
  value: string;
212
213
  editable: boolean;
@@ -216,11 +217,11 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
216
217
  };
217
218
  } | {
218
219
  type: "account_opening";
220
+ expires_at?: string | null | undefined;
219
221
  accountKey: string;
220
222
  name?: string | undefined;
221
223
  upsert: boolean;
222
224
  expires_in?: string | undefined;
223
- expires_at?: string | undefined;
224
225
  note?: {
225
226
  value: string;
226
227
  editable: boolean;
@@ -271,10 +272,11 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
271
272
  };
272
273
  } | {
273
274
  type: "transfer";
275
+ expires_at?: string | null | undefined;
274
276
  amount: {
275
277
  currency: "CLP";
276
278
  value: string;
277
- editable: false;
279
+ editable: boolean;
278
280
  };
279
281
  source: {
280
282
  type: "account_key";
@@ -301,7 +303,6 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
301
303
  holder_name: string;
302
304
  };
303
305
  expires_in?: string | undefined;
304
- expires_at?: string | undefined;
305
306
  note?: {
306
307
  value: string;
307
308
  editable: boolean;
@@ -311,11 +312,11 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
311
312
  };
312
313
  } | {
313
314
  type: "account_opening";
315
+ expires_at?: string | null | undefined;
314
316
  accountKey: string;
315
317
  name?: string | undefined;
316
318
  upsert: boolean;
317
319
  expires_in?: string | undefined;
318
- expires_at?: string | undefined;
319
320
  note?: {
320
321
  value: string;
321
322
  editable: boolean;
@@ -366,10 +367,11 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
366
367
  };
367
368
  } | {
368
369
  type: "transfer";
370
+ expires_at?: string | null | undefined;
369
371
  amount: {
370
372
  currency: "CLP";
371
373
  value: string;
372
- editable: false;
374
+ editable: boolean;
373
375
  };
374
376
  source: {
375
377
  type: "account_key";
@@ -396,7 +398,6 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
396
398
  holder_name: string;
397
399
  };
398
400
  expires_in?: string | undefined;
399
- expires_at?: string | undefined;
400
401
  note?: {
401
402
  value: string;
402
403
  editable: boolean;
@@ -406,11 +407,11 @@ export declare const IntentCreateSchema: v.SchemaWithPipe<readonly [v.VariantSch
406
407
  };
407
408
  } | {
408
409
  type: "account_opening";
410
+ expires_at?: string | null | undefined;
409
411
  accountKey: string;
410
412
  name?: string | undefined;
411
413
  upsert: boolean;
412
414
  expires_in?: string | undefined;
413
- expires_at?: string | undefined;
414
415
  note?: {
415
416
  value: string;
416
417
  editable: boolean;
@@ -463,10 +464,11 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
463
464
  readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, {}>;
464
465
  }, undefined>, v.StrictObjectSchema<{
465
466
  readonly type: v.LiteralSchema<"transfer", undefined>;
467
+ readonly expires_at: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>, undefined>;
466
468
  readonly amount: v.StrictObjectSchema<{
467
469
  currency: v.LiteralSchema<"CLP", undefined>;
468
470
  value: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, v.CheckAction<string, undefined>]>;
469
- editable: v.OptionalSchema<v.LiteralSchema<false, undefined>, false>;
471
+ editable: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
470
472
  }, undefined>;
471
473
  readonly source: v.OptionalSchema<v.NullableSchema<v.VariantSchema<"type", [v.StrictObjectSchema<{
472
474
  type: v.LiteralSchema<"account_key", undefined>;
@@ -493,7 +495,6 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
493
495
  readonly holder_name: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
494
496
  }, undefined>], undefined>;
495
497
  readonly expires_in: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_interval">]>, undefined>;
496
- readonly expires_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>;
497
498
  readonly note: v.OptionalSchema<v.StrictObjectSchema<{
498
499
  readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.CheckAction<string, "note_too_long">]>;
499
500
  readonly editable: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
@@ -501,11 +502,11 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
501
502
  readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, {}>;
502
503
  }, undefined>, v.StrictObjectSchema<{
503
504
  readonly type: v.LiteralSchema<"account_opening", undefined>;
505
+ readonly expires_at: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>, undefined>;
504
506
  readonly accountKey: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>;
505
507
  readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
506
508
  readonly upsert: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
507
509
  readonly expires_in: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_interval">]>, undefined>;
508
- readonly expires_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>;
509
510
  readonly note: v.OptionalSchema<v.StrictObjectSchema<{
510
511
  readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.CheckAction<string, "note_too_long">]>;
511
512
  readonly editable: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
@@ -552,10 +553,11 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
552
553
  };
553
554
  } | {
554
555
  type: "transfer";
556
+ expires_at?: string | null | undefined;
555
557
  amount: {
556
558
  currency: "CLP";
557
559
  value: string;
558
- editable: false;
560
+ editable: boolean;
559
561
  };
560
562
  source: {
561
563
  type: "account_key";
@@ -582,7 +584,6 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
582
584
  holder_name: string;
583
585
  };
584
586
  expires_in?: string | undefined;
585
- expires_at?: string | undefined;
586
587
  note?: {
587
588
  value: string;
588
589
  editable: boolean;
@@ -592,11 +593,11 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
592
593
  };
593
594
  } | {
594
595
  type: "account_opening";
596
+ expires_at?: string | null | undefined;
595
597
  accountKey: string;
596
598
  name?: string | undefined;
597
599
  upsert: boolean;
598
600
  expires_in?: string | undefined;
599
- expires_at?: string | undefined;
600
601
  note?: {
601
602
  value: string;
602
603
  editable: boolean;
@@ -647,10 +648,11 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
647
648
  };
648
649
  } | {
649
650
  type: "transfer";
651
+ expires_at?: string | null | undefined;
650
652
  amount: {
651
653
  currency: "CLP";
652
654
  value: string;
653
- editable: false;
655
+ editable: boolean;
654
656
  };
655
657
  source: {
656
658
  type: "account_key";
@@ -677,7 +679,6 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
677
679
  holder_name: string;
678
680
  };
679
681
  expires_in?: string | undefined;
680
- expires_at?: string | undefined;
681
682
  note?: {
682
683
  value: string;
683
684
  editable: boolean;
@@ -687,11 +688,11 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
687
688
  };
688
689
  } | {
689
690
  type: "account_opening";
691
+ expires_at?: string | null | undefined;
690
692
  accountKey: string;
691
693
  name?: string | undefined;
692
694
  upsert: boolean;
693
695
  expires_in?: string | undefined;
694
- expires_at?: string | undefined;
695
696
  note?: {
696
697
  value: string;
697
698
  editable: boolean;
@@ -742,10 +743,11 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
742
743
  };
743
744
  } | {
744
745
  type: "transfer";
746
+ expires_at?: string | null | undefined;
745
747
  amount: {
746
748
  currency: "CLP";
747
749
  value: string;
748
- editable: false;
750
+ editable: boolean;
749
751
  };
750
752
  source: {
751
753
  type: "account_key";
@@ -772,7 +774,6 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
772
774
  holder_name: string;
773
775
  };
774
776
  expires_in?: string | undefined;
775
- expires_at?: string | undefined;
776
777
  note?: {
777
778
  value: string;
778
779
  editable: boolean;
@@ -782,11 +783,11 @@ export declare function safeParseIntentCreate(input: unknown): v.SafeParseResult
782
783
  };
783
784
  } | {
784
785
  type: "account_opening";
786
+ expires_at?: string | null | undefined;
785
787
  accountKey: string;
786
788
  name?: string | undefined;
787
789
  upsert: boolean;
788
790
  expires_in?: string | undefined;
789
- expires_at?: string | undefined;
790
791
  note?: {
791
792
  value: string;
792
793
  editable: boolean;
@@ -873,7 +874,7 @@ export declare const SignedIntentSchema: v.SchemaWithPipe<readonly [v.VariantSch
873
874
  value: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, v.CheckAction<string, undefined>]>;
874
875
  }, undefined>;
875
876
  readonly expires_in: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_interval">]>, undefined>;
876
- readonly expires_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>;
877
+ readonly expires_at: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>, undefined>;
877
878
  readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.CheckAction<string, "note_too_long">]>, undefined>;
878
879
  readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, {}>;
879
880
  }, undefined>, v.StrictObjectSchema<{
@@ -888,7 +889,7 @@ export declare const SignedIntentSchema: v.SchemaWithPipe<readonly [v.VariantSch
888
889
  readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
889
890
  readonly upsert: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
890
891
  readonly expires_in: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_interval">]>, undefined>;
891
- readonly expires_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>;
892
+ readonly expires_at: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>, undefined>;
892
893
  readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, {}>;
893
894
  }, undefined>, v.StrictObjectSchema<{
894
895
  readonly iss: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
@@ -942,7 +943,7 @@ export declare const SignedIntentSchema: v.SchemaWithPipe<readonly [v.VariantSch
942
943
  value: string;
943
944
  };
944
945
  expires_in?: string | undefined;
945
- expires_at?: string | undefined;
946
+ expires_at?: string | null | undefined;
946
947
  note?: string | undefined;
947
948
  metadata: {
948
949
  [x: string]: unknown;
@@ -959,7 +960,7 @@ export declare const SignedIntentSchema: v.SchemaWithPipe<readonly [v.VariantSch
959
960
  name?: string | undefined;
960
961
  upsert: boolean;
961
962
  expires_in?: string | undefined;
962
- expires_at?: string | undefined;
963
+ expires_at?: string | null | undefined;
963
964
  metadata: {
964
965
  [x: string]: unknown;
965
966
  };
@@ -1017,7 +1018,7 @@ export declare const SignedIntentSchema: v.SchemaWithPipe<readonly [v.VariantSch
1017
1018
  value: string;
1018
1019
  };
1019
1020
  expires_in?: string | undefined;
1020
- expires_at?: string | undefined;
1021
+ expires_at?: string | null | undefined;
1021
1022
  note?: string | undefined;
1022
1023
  metadata: {
1023
1024
  [x: string]: unknown;
@@ -1034,7 +1035,7 @@ export declare const SignedIntentSchema: v.SchemaWithPipe<readonly [v.VariantSch
1034
1035
  name?: string | undefined;
1035
1036
  upsert: boolean;
1036
1037
  expires_in?: string | undefined;
1037
- expires_at?: string | undefined;
1038
+ expires_at?: string | null | undefined;
1038
1039
  metadata: {
1039
1040
  [x: string]: unknown;
1040
1041
  };
@@ -1105,6 +1106,27 @@ export declare function safeParseIntentRejection(input: unknown): v.SafeParseRes
1105
1106
  export declare const ANDCO_INTENT_ERROR_CODES: {
1106
1107
  /** The Intent's deadline to be approved and executed has already passed. */
1107
1108
  readonly INTENT_EXPIRED: "intent_expired";
1109
+ /**
1110
+ * Closing an account is not built yet. Answered as `not_implemented` (501) with this `code`, by the
1111
+ * SDK before any request and by the server at Intent creation, whatever the Grant holds.
1112
+ */
1113
+ readonly ACCOUNT_CLOSURE_NOT_IMPLEMENTED: "account_closure_not_implemented";
1114
+ /**
1115
+ * Opening an additional account by Account Key works where the bank serves it. Where it does not,
1116
+ * the server answers `not_implemented` (501) with this stable `code`: at Intent creation, once the
1117
+ * request is valid and the Grant holds `bank_account` `create` (otherwise `400` or `403` come
1118
+ * first) and nothing is created, and at approval, with the `intent_id`, leaving the Intent as it
1119
+ * was. The SDK always sends the request.
1120
+ */
1121
+ readonly ACCOUNT_OPENING_NOT_IMPLEMENTED: "account_opening_not_implemented";
1122
+ /**
1123
+ * A transfer between two accounts of the same holder (the destination is an Account Key or an
1124
+ * Andco account of the Grant's subject) works where the bank serves it. Where it does not, the
1125
+ * server answers `not_implemented` (501) with this stable `code`: at Intent creation, with
1126
+ * nothing created, and at approval, with the `intent_id`. A transfer to another bank or to
1127
+ * another Andco customer is not affected.
1128
+ */
1129
+ readonly OWN_ACCOUNT_TRANSFER_NOT_IMPLEMENTED: "own_account_transfer_not_implemented";
1108
1130
  };
1109
1131
  /** Returns validation issues for the verified claims without throwing across the HTTP boundary. */
1110
1132
  export declare function safeParseSignedIntent(input: unknown): v.SafeParseResult<v.SchemaWithPipe<readonly [v.VariantSchema<"type", [v.StrictObjectSchema<{
@@ -1141,7 +1163,7 @@ export declare function safeParseSignedIntent(input: unknown): v.SafeParseResult
1141
1163
  value: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, v.CheckAction<string, undefined>]>;
1142
1164
  }, undefined>;
1143
1165
  readonly expires_in: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_interval">]>, undefined>;
1144
- readonly expires_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>;
1166
+ readonly expires_at: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>, undefined>;
1145
1167
  readonly note: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.CheckAction<string, "note_too_long">]>, undefined>;
1146
1168
  readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, {}>;
1147
1169
  }, undefined>, v.StrictObjectSchema<{
@@ -1156,7 +1178,7 @@ export declare function safeParseSignedIntent(input: unknown): v.SafeParseResult
1156
1178
  readonly name: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 80, undefined>]>, undefined>;
1157
1179
  readonly upsert: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
1158
1180
  readonly expires_in: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_interval">]>, undefined>;
1159
- readonly expires_at: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>;
1181
+ readonly expires_at: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "invalid_expiration_datetime">]>, undefined>, undefined>;
1160
1182
  readonly metadata: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.UnknownSchema, undefined>, {}>;
1161
1183
  }, undefined>, v.StrictObjectSchema<{
1162
1184
  readonly iss: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, number, undefined>]>;
@@ -1210,7 +1232,7 @@ export declare function safeParseSignedIntent(input: unknown): v.SafeParseResult
1210
1232
  value: string;
1211
1233
  };
1212
1234
  expires_in?: string | undefined;
1213
- expires_at?: string | undefined;
1235
+ expires_at?: string | null | undefined;
1214
1236
  note?: string | undefined;
1215
1237
  metadata: {
1216
1238
  [x: string]: unknown;
@@ -1227,7 +1249,7 @@ export declare function safeParseSignedIntent(input: unknown): v.SafeParseResult
1227
1249
  name?: string | undefined;
1228
1250
  upsert: boolean;
1229
1251
  expires_in?: string | undefined;
1230
- expires_at?: string | undefined;
1252
+ expires_at?: string | null | undefined;
1231
1253
  metadata: {
1232
1254
  [x: string]: unknown;
1233
1255
  };
@@ -1285,7 +1307,7 @@ export declare function safeParseSignedIntent(input: unknown): v.SafeParseResult
1285
1307
  value: string;
1286
1308
  };
1287
1309
  expires_in?: string | undefined;
1288
- expires_at?: string | undefined;
1310
+ expires_at?: string | null | undefined;
1289
1311
  note?: string | undefined;
1290
1312
  metadata: {
1291
1313
  [x: string]: unknown;
@@ -1302,7 +1324,7 @@ export declare function safeParseSignedIntent(input: unknown): v.SafeParseResult
1302
1324
  name?: string | undefined;
1303
1325
  upsert: boolean;
1304
1326
  expires_in?: string | undefined;
1305
- expires_at?: string | undefined;
1327
+ expires_at?: string | null | undefined;
1306
1328
  metadata: {
1307
1329
  [x: string]: unknown;
1308
1330
  };
@@ -1327,16 +1349,19 @@ export declare function safeParseSignedIntent(input: unknown): v.SafeParseResult
1327
1349
  [x: string]: unknown;
1328
1350
  };
1329
1351
  }, "metadata_too_large">]>>;
1330
- /** Identifies recognized unsupported payment shapes without silently dropping their extra instructions. */
1331
- export declare function unsupportedIntentPaymentShape(input: unknown): string | undefined;
1352
+ /**
1353
+ * Identifies recognized unsupported Intents without silently dropping their extra instructions: an
1354
+ * account closure, and payment shapes that carry several destinations, allocations or instructions.
1355
+ */
1356
+ export declare function unsupportedIntentShape(input: unknown): string | undefined;
1332
1357
  /**
1333
1358
  * Values proposed by the account holder; the database enforces editability and freezes confirmation.
1334
1359
  *
1335
1360
  * Every member but `intent_id` is optional because nothing here is necessarily editable: a screen
1336
1361
  * sends only what the Intent left open, and a value that was frozen has nowhere to arrive from.
1337
- * A transfer is created with its amount and destination locked (`editable: true` is refused at
1338
- * creation), so today `amount` and `destination` always meet `transfer_value_editing_not_implemented`;
1339
- * they stay in the shape for when confirmation-time editing exists.
1362
+ * A transfer is created with its destination locked (`editable: true` is refused at creation), so
1363
+ * today `destination` always meets `transfer_value_editing_not_implemented`; `amount` is accepted only
1364
+ * when the Intent was created with `amount.editable: true`.
1340
1365
  */
1341
1366
  export declare const TransferConfirmationSchema: v.StrictObjectSchema<{
1342
1367
  readonly intent_id: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.UuidAction<string, undefined>]>;
@@ -1 +1 @@
1
- {"version":3,"file":"intent-input.d.ts","sourceRoot":"","sources":["../src/intent-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAmF7B;;;;;;GAMG;AACH,QAAA,MAAM,YAAY;;;;;;0BAGhB,CAAC;AAEH,gGAAgG;AAChG,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,YAAY,CAAC,CAAC;AAK/D,oGAAoG;AACpG,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;0BAI7B,CAAC;AAcH,gFAAgF;AAChF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAK9E,gFAAgF;AAChF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAOvD;AAED,6GAA6G;AAC7G,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CASvD;AAYD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,M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AAC,CAAC,WAAW,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEhF,qGAAqG;AACrG,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO;;eAEzD;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;;aAA6D,CAAC;AAEhG,sFAAsF;AACtF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,kGAAkG;AAClG,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO;;eAEtD;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB;IACnC,4EAA4E;;IAE5E;;;OAGG;;IAEH;;;;;;OAMG;;IAEH;;;;;;OAMG;;CAEK,CAAC;AAEX,mGAAmG;AACnG,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4BAEnD;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAUzE;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;aAOrC,CAAC;AAEH,gGAAgG;AAChG,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,OAAO;;;;;;;;;;;;;eAE3D"}
@@ -24,17 +24,18 @@ const depositAmount = {
24
24
  editable: v.optional(v.boolean(), false),
25
25
  };
26
26
  /**
27
- * The amount a transfer proposes. `editable` only accepts `false`: the confirmation screen cannot
28
- * change what a transfer moves yet (TODO), so asking for an editable amount is an
29
- * `invalid_request` at creation instead of an Intent nobody can confirm. What moved is `settled`.
27
+ * The amount a transfer proposes. `editable: true` lets the person who confirms set the amount on
28
+ * Andco's confirmation screen, and `value` is the initial proposal shown there; the server checks it
29
+ * against the Grant's `transactions.minimum` and `transactions.maximum` and the available balance.
30
+ * Without `editable` (or with `false`) the amount is locked. What moved is `settled`.
30
31
  *
31
32
  * @example
32
- * const amount = { currency: "CLP", value: "40000" };
33
+ * const amount = { currency: "CLP", value: "40000", editable: true };
33
34
  */
34
35
  const transferAmount = {
35
36
  currency: v.literal("CLP"),
36
37
  value: amountValue,
37
- editable: v.optional(v.literal(false), false),
38
+ editable: v.optional(v.boolean(), false),
38
39
  };
39
40
  /**
40
41
  * The amount a Signed Instruction orders: the same `{ currency, value }` as a request, with nothing
@@ -120,6 +121,8 @@ export function isIntentDeadline(value) {
120
121
  }
121
122
  const expiresIn = /* @__PURE__ */ v.pipe(v.string(), v.check(isIntentDuration, "invalid_expiration_interval"));
122
123
  const expiresAt = /* @__PURE__ */ v.pipe(v.string(), v.check(isIntentDeadline, "invalid_expiration_datetime"));
124
+ // `null` is an explicit "never expires": a transfer and an account opening accept it, signed or not.
125
+ const expiresAtOrNever = /* @__PURE__ */ v.nullable(expiresAt);
123
126
  const common = {
124
127
  expires_in: v.optional(expiresIn),
125
128
  expires_at: v.optional(expiresAt),
@@ -137,8 +140,9 @@ const common = {
137
140
  *
138
141
  * `transfer` is the only way money movement is expressed: money leaving an account towards a
139
142
  * `destination`, both named in the `bank_transfer` matcher vocabulary (`account_key`, `account`,
140
- * `external`). A null `source` is the confirmation screen's source picker; the amount and the
141
- * destination are always locked there (`editable: true` is refused). Who may approve the Intent without a person belongs to the Grant, never to
143
+ * `external`). A null `source` is the confirmation screen's source picker; the destination is always
144
+ * locked there (`editable: true` is refused), and so is the amount unless it says `editable: true`, in
145
+ * which case the person sets it. Who may approve the Intent without a person belongs to the Grant, never to
142
146
  * the operation itself.
143
147
  *
144
148
  * @example
@@ -160,11 +164,12 @@ export const IntentCreateSchema = /* @__PURE__ */ v.pipe(v.variant("type", [
160
164
  type: v.literal("deposit"),
161
165
  destination: v.optional(andcoAccount),
162
166
  amount: v.optional(v.strictObject(depositAmount)),
163
- expires_at: v.optional(v.nullable(expiresAt)),
167
+ expires_at: v.optional(expiresAtOrNever),
164
168
  }),
165
169
  v.strictObject({
166
170
  ...common,
167
171
  type: v.literal("transfer"),
172
+ expires_at: v.optional(expiresAtOrNever),
168
173
  amount: v.strictObject(transferAmount),
169
174
  // Null or omitted: the person picks among the Grant's sources on the confirmation screen.
170
175
  source: v.optional(v.nullable(transferSource), null),
@@ -173,6 +178,7 @@ export const IntentCreateSchema = /* @__PURE__ */ v.pipe(v.variant("type", [
173
178
  v.strictObject({
174
179
  ...common,
175
180
  type: v.literal("account_opening"),
181
+ expires_at: v.optional(expiresAtOrNever),
176
182
  // The holder's own name for the account, unique per subject (ADR 0028) and never reused once
177
183
  // the account closes.
178
184
  accountKey: AccountKeySchema,
@@ -184,7 +190,9 @@ export const IntentCreateSchema = /* @__PURE__ */ v.pipe(v.variant("type", [
184
190
  type: v.literal("account_closure"),
185
191
  account: andcoAccount,
186
192
  }),
187
- ]), v.check((input) => (input.expires_in !== undefined) !== (input.expires_at !== undefined), "exactly_one_expiration_required"), v.check((input) => input.expires_at !== null || (input.type === "deposit" && input.amount === undefined), "passive_deposit_requires_no_target"), v.check((input) => JSON.stringify(input.metadata).length <= 16384, "metadata_too_large"));
193
+ ]), v.check((input) => (input.expires_in !== undefined) !== (input.expires_at !== undefined), "exactly_one_expiration_required"), v.check(
194
+ // Only a deposit with a target must expire; for a transfer or an account opening `null` means "never".
195
+ (input) => input.type !== "deposit" || input.expires_at !== null || input.amount === undefined, "passive_deposit_requires_no_target"), v.check((input) => JSON.stringify(input.metadata).length <= 16384, "metadata_too_large"));
188
196
  /** Returns validation issues without throwing across the HTTP boundary. */
189
197
  export function safeParseIntentCreate(input) {
190
198
  return v.safeParse(IntentCreateSchema, input);
@@ -228,7 +236,7 @@ export const SignedIntentSchema = /* @__PURE__ */ v.pipe(v.variant("type", [
228
236
  destination: signedTransferDestination,
229
237
  amount: v.strictObject(signedAmount),
230
238
  expires_in: v.optional(expiresIn),
231
- expires_at: v.optional(expiresAt),
239
+ expires_at: v.optional(expiresAtOrNever),
232
240
  note: v.optional(noteText),
233
241
  metadata: v.optional(v.record(v.string(), v.unknown()), {}),
234
242
  }),
@@ -246,7 +254,7 @@ export const SignedIntentSchema = /* @__PURE__ */ v.pipe(v.variant("type", [
246
254
  // turn "create this account" into "create it or hand me the one that is already there".
247
255
  upsert: v.optional(v.boolean(), false),
248
256
  expires_in: v.optional(expiresIn),
249
- expires_at: v.optional(expiresAt),
257
+ expires_at: v.optional(expiresAtOrNever),
250
258
  metadata: v.optional(v.record(v.string(), v.unknown()), {}),
251
259
  }),
252
260
  v.strictObject({
@@ -302,16 +310,42 @@ export function safeParseIntentRejection(input) {
302
310
  export const ANDCO_INTENT_ERROR_CODES = {
303
311
  /** The Intent's deadline to be approved and executed has already passed. */
304
312
  INTENT_EXPIRED: "intent_expired",
313
+ /**
314
+ * Closing an account is not built yet. Answered as `not_implemented` (501) with this `code`, by the
315
+ * SDK before any request and by the server at Intent creation, whatever the Grant holds.
316
+ */
317
+ ACCOUNT_CLOSURE_NOT_IMPLEMENTED: "account_closure_not_implemented",
318
+ /**
319
+ * Opening an additional account by Account Key works where the bank serves it. Where it does not,
320
+ * the server answers `not_implemented` (501) with this stable `code`: at Intent creation, once the
321
+ * request is valid and the Grant holds `bank_account` `create` (otherwise `400` or `403` come
322
+ * first) and nothing is created, and at approval, with the `intent_id`, leaving the Intent as it
323
+ * was. The SDK always sends the request.
324
+ */
325
+ ACCOUNT_OPENING_NOT_IMPLEMENTED: "account_opening_not_implemented",
326
+ /**
327
+ * A transfer between two accounts of the same holder (the destination is an Account Key or an
328
+ * Andco account of the Grant's subject) works where the bank serves it. Where it does not, the
329
+ * server answers `not_implemented` (501) with this stable `code`: at Intent creation, with
330
+ * nothing created, and at approval, with the `intent_id`. A transfer to another bank or to
331
+ * another Andco customer is not affected.
332
+ */
333
+ OWN_ACCOUNT_TRANSFER_NOT_IMPLEMENTED: "own_account_transfer_not_implemented",
305
334
  };
306
335
  /** Returns validation issues for the verified claims without throwing across the HTTP boundary. */
307
336
  export function safeParseSignedIntent(input) {
308
337
  return v.safeParse(SignedIntentSchema, input);
309
338
  }
310
- /** Identifies recognized unsupported payment shapes without silently dropping their extra instructions. */
311
- export function unsupportedIntentPaymentShape(input) {
339
+ /**
340
+ * Identifies recognized unsupported Intents without silently dropping their extra instructions: an
341
+ * account closure, and payment shapes that carry several destinations, allocations or instructions.
342
+ */
343
+ export function unsupportedIntentShape(input) {
312
344
  if (!input || typeof input !== "object" || Array.isArray(input))
313
345
  return undefined;
314
346
  const record = input;
347
+ if (record["type"] === "account_closure")
348
+ return ANDCO_INTENT_ERROR_CODES.ACCOUNT_CLOSURE_NOT_IMPLEMENTED;
315
349
  if (!["deposit", "transfer"].includes(String(record["type"])))
316
350
  return undefined;
317
351
  if (Object.hasOwn(record, "destinations") || Array.isArray(record["destination"]))
@@ -327,9 +361,9 @@ export function unsupportedIntentPaymentShape(input) {
327
361
  *
328
362
  * Every member but `intent_id` is optional because nothing here is necessarily editable: a screen
329
363
  * sends only what the Intent left open, and a value that was frozen has nowhere to arrive from.
330
- * A transfer is created with its amount and destination locked (`editable: true` is refused at
331
- * creation), so today `amount` and `destination` always meet `transfer_value_editing_not_implemented`;
332
- * they stay in the shape for when confirmation-time editing exists.
364
+ * A transfer is created with its destination locked (`editable: true` is refused at creation), so
365
+ * today `destination` always meets `transfer_value_editing_not_implemented`; `amount` is accepted only
366
+ * when the Intent was created with `amount.editable: true`.
333
367
  */
334
368
  export const TransferConfirmationSchema = /* @__PURE__ */ v.strictObject({
335
369
  intent_id: accountId,
@@ -0,0 +1,29 @@
1
+ /**
2
+ * The lifecycle stage of an Intent status: what precedes the first dot of `<base>[.<detail>]`.
3
+ *
4
+ * Decide on the base, or with {@link IS_INTENT_TERMINAL_STATUS}, never with an exhaustive `switch` over
5
+ * the whole status: its vocabulary is open, and `failed.<code>` can carry a code Identity answered with
6
+ * that no enum lists.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * INTENT_STATUS_BASE("cancelled.grant_revoked"); // "cancelled"
11
+ * INTENT_STATUS_BASE("succeeded"); // "succeeded"
12
+ * ```
13
+ */
14
+ export declare function INTENT_STATUS_BASE(status: string): string;
15
+ /**
16
+ * Whether an Intent status is one the Intent never leaves, decided by its base alone so a detail the
17
+ * server adds later is never misread: `succeeded`, `completed`, `closed`, `failed`, `cancelled`,
18
+ * `rejected` and `expired` are terminal with or without a detail; `requires_action` and
19
+ * `processing` are not. Use it, and {@link INTENT_STATUS_BASE}, instead of an exhaustive `switch` over
20
+ * the whole status, whose vocabulary is open.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * IS_INTENT_TERMINAL_STATUS("cancelled.grant_revoked"); // true
25
+ * IS_INTENT_TERMINAL_STATUS("processing.opening"); // false
26
+ * ```
27
+ */
28
+ export declare function IS_INTENT_TERMINAL_STATUS(status: string): boolean;
29
+ //# sourceMappingURL=intent-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"intent-status.d.ts","sourceRoot":"","sources":["../src/intent-status.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEjE"}