@tai42/api-client 14.0.0 → 15.0.0

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/dist/client.d.ts CHANGED
@@ -46,9 +46,7 @@ export interface ApiKeyBody {
46
46
  readonly description: string;
47
47
  readonly scopes: string[];
48
48
  readonly policy_data?: Record<string, unknown> | null;
49
- readonly condition?: string | null;
50
- readonly condition_id?: string | null;
51
- readonly condition_kwargs?: Record<string, unknown> | null;
49
+ readonly condition?: s.TemplatedText | null;
52
50
  }
53
51
  /**
54
52
  * Body for one-time claim-link creation (POST `/api/auth/claim-links`). The
@@ -61,16 +59,13 @@ export interface ClaimLinkBody {
61
59
  readonly ttl_seconds?: number | null;
62
60
  }
63
61
  /**
64
- * Body for the fail-closed jq guard (POST `/api/auth/validate-condition`).
65
- * `condition` (inline jq) and `condition_id` (named template) are mutually
66
- * exclusive — send exactly one. `sample_context` is a `JqAuthContext`-shaped
67
- * sample; when present the guard also evaluates the condition against it and
68
- * returns the boolean `result` (else `result` is `null`).
62
+ * Body for the fail-closed jq guard (POST `/api/auth/validate-condition`). The guard
63
+ * compile-checks the inline jq `condition` the author typed. `sample_context` is a
64
+ * `JqAuthContext`-shaped sample; when present the guard also evaluates the condition
65
+ * against it and returns the boolean `result` (else `result` is `null`).
69
66
  */
70
67
  export interface ValidateConditionBody {
71
68
  readonly condition?: string;
72
- readonly condition_id?: string;
73
- readonly condition_kwargs?: Record<string, unknown>;
74
69
  readonly sample_context?: Record<string, unknown>;
75
70
  }
76
71
  /**
@@ -562,18 +557,42 @@ export declare function createApiClient(config: ApiConfig): {
562
557
  states: {
563
558
  state: string;
564
559
  templates: string[];
565
- subject_expr: string;
566
- scope_expr: string | null;
560
+ subject_expr: {
561
+ content?: string | undefined;
562
+ id?: string | undefined;
563
+ kwargs?: Record<string, unknown> | undefined;
564
+ };
565
+ scope_expr: {
566
+ content?: string | undefined;
567
+ id?: string | undefined;
568
+ kwargs?: Record<string, unknown> | undefined;
569
+ } | null;
567
570
  input_injections: {
568
571
  template_jq: string | null;
569
- jq: string | null;
572
+ jq: {
573
+ content?: string | undefined;
574
+ id?: string | undefined;
575
+ kwargs?: Record<string, unknown> | undefined;
576
+ } | null;
570
577
  into: string;
571
578
  }[];
572
579
  updates: {
573
580
  template_jq: string | null;
574
- jq: string | null;
575
- adapter: string | null;
576
- op_id: string | null;
581
+ jq: {
582
+ content?: string | undefined;
583
+ id?: string | undefined;
584
+ kwargs?: Record<string, unknown> | undefined;
585
+ } | null;
586
+ adapter: {
587
+ content?: string | undefined;
588
+ id?: string | undefined;
589
+ kwargs?: Record<string, unknown> | undefined;
590
+ } | null;
591
+ op_id: {
592
+ content?: string | undefined;
593
+ id?: string | undefined;
594
+ kwargs?: Record<string, unknown> | undefined;
595
+ } | null;
577
596
  }[];
578
597
  }[];
579
598
  } | null;
@@ -598,18 +617,42 @@ export declare function createApiClient(config: ApiConfig): {
598
617
  states: {
599
618
  state: string;
600
619
  templates: string[];
601
- subject_expr: string;
602
- scope_expr: string | null;
620
+ subject_expr: {
621
+ content?: string | undefined;
622
+ id?: string | undefined;
623
+ kwargs?: Record<string, unknown> | undefined;
624
+ };
625
+ scope_expr: {
626
+ content?: string | undefined;
627
+ id?: string | undefined;
628
+ kwargs?: Record<string, unknown> | undefined;
629
+ } | null;
603
630
  input_injections: {
604
631
  template_jq: string | null;
605
- jq: string | null;
632
+ jq: {
633
+ content?: string | undefined;
634
+ id?: string | undefined;
635
+ kwargs?: Record<string, unknown> | undefined;
636
+ } | null;
606
637
  into: string;
607
638
  }[];
608
639
  updates: {
609
640
  template_jq: string | null;
610
- jq: string | null;
611
- adapter: string | null;
612
- op_id: string | null;
641
+ jq: {
642
+ content?: string | undefined;
643
+ id?: string | undefined;
644
+ kwargs?: Record<string, unknown> | undefined;
645
+ } | null;
646
+ adapter: {
647
+ content?: string | undefined;
648
+ id?: string | undefined;
649
+ kwargs?: Record<string, unknown> | undefined;
650
+ } | null;
651
+ op_id: {
652
+ content?: string | undefined;
653
+ id?: string | undefined;
654
+ kwargs?: Record<string, unknown> | undefined;
655
+ } | null;
613
656
  }[];
614
657
  }[];
615
658
  } | null;
@@ -634,18 +677,42 @@ export declare function createApiClient(config: ApiConfig): {
634
677
  states: {
635
678
  state: string;
636
679
  templates: string[];
637
- subject_expr: string;
638
- scope_expr: string | null;
680
+ subject_expr: {
681
+ content?: string | undefined;
682
+ id?: string | undefined;
683
+ kwargs?: Record<string, unknown> | undefined;
684
+ };
685
+ scope_expr: {
686
+ content?: string | undefined;
687
+ id?: string | undefined;
688
+ kwargs?: Record<string, unknown> | undefined;
689
+ } | null;
639
690
  input_injections: {
640
691
  template_jq: string | null;
641
- jq: string | null;
692
+ jq: {
693
+ content?: string | undefined;
694
+ id?: string | undefined;
695
+ kwargs?: Record<string, unknown> | undefined;
696
+ } | null;
642
697
  into: string;
643
698
  }[];
644
699
  updates: {
645
700
  template_jq: string | null;
646
- jq: string | null;
647
- adapter: string | null;
648
- op_id: string | null;
701
+ jq: {
702
+ content?: string | undefined;
703
+ id?: string | undefined;
704
+ kwargs?: Record<string, unknown> | undefined;
705
+ } | null;
706
+ adapter: {
707
+ content?: string | undefined;
708
+ id?: string | undefined;
709
+ kwargs?: Record<string, unknown> | undefined;
710
+ } | null;
711
+ op_id: {
712
+ content?: string | undefined;
713
+ id?: string | undefined;
714
+ kwargs?: Record<string, unknown> | undefined;
715
+ } | null;
649
716
  }[];
650
717
  }[];
651
718
  } | null;
@@ -930,7 +997,14 @@ export declare function createApiClient(config: ApiConfig): {
930
997
  parameters: Record<string, unknown>;
931
998
  schema: Record<string, unknown>;
932
999
  regimes: Record<string, unknown>[];
933
- declarations: Record<string, unknown> | null;
1000
+ declarations: {
1001
+ schema: Record<string, unknown>;
1002
+ check: {
1003
+ content?: string | undefined;
1004
+ id?: string | undefined;
1005
+ kwargs?: Record<string, unknown> | undefined;
1006
+ } | null;
1007
+ } | null;
934
1008
  trace: Record<string, unknown>;
935
1009
  template_jq: Record<string, {
936
1010
  description: string;
@@ -938,12 +1012,28 @@ export declare function createApiClient(config: ApiConfig): {
938
1012
  params: string[];
939
1013
  reads: string[][];
940
1014
  writes: string[][];
941
- jq: string;
1015
+ jq: {
1016
+ content?: string | undefined;
1017
+ id?: string | undefined;
1018
+ kwargs?: Record<string, unknown> | undefined;
1019
+ };
942
1020
  }> | null;
943
1021
  reconcile: {
944
- view: string;
945
- close: string;
946
- resolutions: string;
1022
+ orphans: {
1023
+ content?: string | undefined;
1024
+ id?: string | undefined;
1025
+ kwargs?: Record<string, unknown> | undefined;
1026
+ };
1027
+ close: {
1028
+ content?: string | undefined;
1029
+ id?: string | undefined;
1030
+ kwargs?: Record<string, unknown> | undefined;
1031
+ };
1032
+ resolutions: {
1033
+ content?: string | undefined;
1034
+ id?: string | undefined;
1035
+ kwargs?: Record<string, unknown> | undefined;
1036
+ };
947
1037
  } | null;
948
1038
  attached_to: number;
949
1039
  shipped_default: boolean;
@@ -955,7 +1045,14 @@ export declare function createApiClient(config: ApiConfig): {
955
1045
  parameters: Record<string, unknown>;
956
1046
  schema: Record<string, unknown>;
957
1047
  regimes: Record<string, unknown>[];
958
- declarations: Record<string, unknown> | null;
1048
+ declarations: {
1049
+ schema: Record<string, unknown>;
1050
+ check: {
1051
+ content?: string | undefined;
1052
+ id?: string | undefined;
1053
+ kwargs?: Record<string, unknown> | undefined;
1054
+ } | null;
1055
+ } | null;
959
1056
  trace: Record<string, unknown>;
960
1057
  template_jq: Record<string, {
961
1058
  description: string;
@@ -963,12 +1060,28 @@ export declare function createApiClient(config: ApiConfig): {
963
1060
  params: string[];
964
1061
  reads: string[][];
965
1062
  writes: string[][];
966
- jq: string;
1063
+ jq: {
1064
+ content?: string | undefined;
1065
+ id?: string | undefined;
1066
+ kwargs?: Record<string, unknown> | undefined;
1067
+ };
967
1068
  }> | null;
968
1069
  reconcile: {
969
- view: string;
970
- close: string;
971
- resolutions: string;
1070
+ orphans: {
1071
+ content?: string | undefined;
1072
+ id?: string | undefined;
1073
+ kwargs?: Record<string, unknown> | undefined;
1074
+ };
1075
+ close: {
1076
+ content?: string | undefined;
1077
+ id?: string | undefined;
1078
+ kwargs?: Record<string, unknown> | undefined;
1079
+ };
1080
+ resolutions: {
1081
+ content?: string | undefined;
1082
+ id?: string | undefined;
1083
+ kwargs?: Record<string, unknown> | undefined;
1084
+ };
972
1085
  } | null;
973
1086
  }>;
974
1087
  readonly putStateTemplate: (name: string, body: StateTemplateBody, replace?: boolean) => Promise<{
@@ -978,7 +1091,14 @@ export declare function createApiClient(config: ApiConfig): {
978
1091
  parameters: Record<string, unknown>;
979
1092
  schema: Record<string, unknown>;
980
1093
  regimes: Record<string, unknown>[];
981
- declarations: Record<string, unknown> | null;
1094
+ declarations: {
1095
+ schema: Record<string, unknown>;
1096
+ check: {
1097
+ content?: string | undefined;
1098
+ id?: string | undefined;
1099
+ kwargs?: Record<string, unknown> | undefined;
1100
+ } | null;
1101
+ } | null;
982
1102
  trace: Record<string, unknown>;
983
1103
  template_jq: Record<string, {
984
1104
  description: string;
@@ -986,12 +1106,28 @@ export declare function createApiClient(config: ApiConfig): {
986
1106
  params: string[];
987
1107
  reads: string[][];
988
1108
  writes: string[][];
989
- jq: string;
1109
+ jq: {
1110
+ content?: string | undefined;
1111
+ id?: string | undefined;
1112
+ kwargs?: Record<string, unknown> | undefined;
1113
+ };
990
1114
  }> | null;
991
1115
  reconcile: {
992
- view: string;
993
- close: string;
994
- resolutions: string;
1116
+ orphans: {
1117
+ content?: string | undefined;
1118
+ id?: string | undefined;
1119
+ kwargs?: Record<string, unknown> | undefined;
1120
+ };
1121
+ close: {
1122
+ content?: string | undefined;
1123
+ id?: string | undefined;
1124
+ kwargs?: Record<string, unknown> | undefined;
1125
+ };
1126
+ resolutions: {
1127
+ content?: string | undefined;
1128
+ id?: string | undefined;
1129
+ kwargs?: Record<string, unknown> | undefined;
1130
+ };
995
1131
  } | null;
996
1132
  }>;
997
1133
  readonly deleteStateTemplate: (name: string) => Promise<{
@@ -1172,11 +1308,7 @@ export declare function createApiClient(config: ApiConfig): {
1172
1308
  path: string;
1173
1309
  deleted: true;
1174
1310
  }>;
1175
- readonly renderTemplate: (body: {
1176
- content?: string;
1177
- template_id?: string;
1178
- kwargs?: Record<string, unknown>;
1179
- }) => Promise<{
1311
+ readonly renderTemplate: (text: s.TemplatedText) => Promise<{
1180
1312
  rendered: string;
1181
1313
  }>;
1182
1314
  readonly clearTemplatesCache: () => Promise<{
@@ -1952,18 +2084,42 @@ export declare function createApiClient(config: ApiConfig): {
1952
2084
  states: {
1953
2085
  state: string;
1954
2086
  templates: string[];
1955
- subject_expr: string;
1956
- scope_expr: string | null;
2087
+ subject_expr: {
2088
+ content?: string | undefined;
2089
+ id?: string | undefined;
2090
+ kwargs?: Record<string, unknown> | undefined;
2091
+ };
2092
+ scope_expr: {
2093
+ content?: string | undefined;
2094
+ id?: string | undefined;
2095
+ kwargs?: Record<string, unknown> | undefined;
2096
+ } | null;
1957
2097
  input_injections: {
1958
2098
  template_jq: string | null;
1959
- jq: string | null;
2099
+ jq: {
2100
+ content?: string | undefined;
2101
+ id?: string | undefined;
2102
+ kwargs?: Record<string, unknown> | undefined;
2103
+ } | null;
1960
2104
  into: string;
1961
2105
  }[];
1962
2106
  updates: {
1963
2107
  template_jq: string | null;
1964
- jq: string | null;
1965
- adapter: string | null;
1966
- op_id: string | null;
2108
+ jq: {
2109
+ content?: string | undefined;
2110
+ id?: string | undefined;
2111
+ kwargs?: Record<string, unknown> | undefined;
2112
+ } | null;
2113
+ adapter: {
2114
+ content?: string | undefined;
2115
+ id?: string | undefined;
2116
+ kwargs?: Record<string, unknown> | undefined;
2117
+ } | null;
2118
+ op_id: {
2119
+ content?: string | undefined;
2120
+ id?: string | undefined;
2121
+ kwargs?: Record<string, unknown> | undefined;
2122
+ } | null;
1967
2123
  }[];
1968
2124
  }[];
1969
2125
  } | null;
@@ -1992,18 +2148,42 @@ export declare function createApiClient(config: ApiConfig): {
1992
2148
  states: {
1993
2149
  state: string;
1994
2150
  templates: string[];
1995
- subject_expr: string;
1996
- scope_expr: string | null;
2151
+ subject_expr: {
2152
+ content?: string | undefined;
2153
+ id?: string | undefined;
2154
+ kwargs?: Record<string, unknown> | undefined;
2155
+ };
2156
+ scope_expr: {
2157
+ content?: string | undefined;
2158
+ id?: string | undefined;
2159
+ kwargs?: Record<string, unknown> | undefined;
2160
+ } | null;
1997
2161
  input_injections: {
1998
2162
  template_jq: string | null;
1999
- jq: string | null;
2163
+ jq: {
2164
+ content?: string | undefined;
2165
+ id?: string | undefined;
2166
+ kwargs?: Record<string, unknown> | undefined;
2167
+ } | null;
2000
2168
  into: string;
2001
2169
  }[];
2002
2170
  updates: {
2003
2171
  template_jq: string | null;
2004
- jq: string | null;
2005
- adapter: string | null;
2006
- op_id: string | null;
2172
+ jq: {
2173
+ content?: string | undefined;
2174
+ id?: string | undefined;
2175
+ kwargs?: Record<string, unknown> | undefined;
2176
+ } | null;
2177
+ adapter: {
2178
+ content?: string | undefined;
2179
+ id?: string | undefined;
2180
+ kwargs?: Record<string, unknown> | undefined;
2181
+ } | null;
2182
+ op_id: {
2183
+ content?: string | undefined;
2184
+ id?: string | undefined;
2185
+ kwargs?: Record<string, unknown> | undefined;
2186
+ } | null;
2007
2187
  }[];
2008
2188
  }[];
2009
2189
  } | null;
@@ -2236,28 +2416,56 @@ export declare function createApiClient(config: ApiConfig): {
2236
2416
  kind: string;
2237
2417
  key_expr: string;
2238
2418
  } | null;
2239
- condition: string | null;
2240
- condition_id: string | null;
2241
- condition_kwargs: Record<string, unknown>;
2242
- expr: string | null;
2243
- expr_id: string | null;
2244
- expr_kwargs: Record<string, unknown>;
2419
+ condition: {
2420
+ content?: string | undefined;
2421
+ id?: string | undefined;
2422
+ kwargs?: Record<string, unknown> | undefined;
2423
+ } | null;
2424
+ expr: {
2425
+ content?: string | undefined;
2426
+ id?: string | undefined;
2427
+ kwargs?: Record<string, unknown> | undefined;
2428
+ } | null;
2245
2429
  state_binding: {
2246
2430
  states: {
2247
2431
  state: string;
2248
2432
  templates: string[];
2249
- subject_expr: string;
2250
- scope_expr: string | null;
2433
+ subject_expr: {
2434
+ content?: string | undefined;
2435
+ id?: string | undefined;
2436
+ kwargs?: Record<string, unknown> | undefined;
2437
+ };
2438
+ scope_expr: {
2439
+ content?: string | undefined;
2440
+ id?: string | undefined;
2441
+ kwargs?: Record<string, unknown> | undefined;
2442
+ } | null;
2251
2443
  input_injections: {
2252
2444
  template_jq: string | null;
2253
- jq: string | null;
2445
+ jq: {
2446
+ content?: string | undefined;
2447
+ id?: string | undefined;
2448
+ kwargs?: Record<string, unknown> | undefined;
2449
+ } | null;
2254
2450
  into: string;
2255
2451
  }[];
2256
2452
  updates: {
2257
2453
  template_jq: string | null;
2258
- jq: string | null;
2259
- adapter: string | null;
2260
- op_id: string | null;
2454
+ jq: {
2455
+ content?: string | undefined;
2456
+ id?: string | undefined;
2457
+ kwargs?: Record<string, unknown> | undefined;
2458
+ } | null;
2459
+ adapter: {
2460
+ content?: string | undefined;
2461
+ id?: string | undefined;
2462
+ kwargs?: Record<string, unknown> | undefined;
2463
+ } | null;
2464
+ op_id: {
2465
+ content?: string | undefined;
2466
+ id?: string | undefined;
2467
+ kwargs?: Record<string, unknown> | undefined;
2468
+ } | null;
2261
2469
  }[];
2262
2470
  }[];
2263
2471
  } | null;
@@ -2364,9 +2572,11 @@ export declare function createApiClient(config: ApiConfig): {
2364
2572
  name: string;
2365
2573
  description: string;
2366
2574
  scopes: string[];
2367
- condition: string | null;
2368
- condition_id: string | null;
2369
- condition_kwargs: unknown;
2575
+ condition: {
2576
+ content?: string | undefined;
2577
+ id?: string | undefined;
2578
+ kwargs?: Record<string, unknown> | undefined;
2579
+ } | null;
2370
2580
  base_tier: string | null;
2371
2581
  allow_all: boolean;
2372
2582
  grants: Record<string, "none" | "read" | "write">;
@@ -2375,9 +2585,11 @@ export declare function createApiClient(config: ApiConfig): {
2375
2585
  name: string;
2376
2586
  description: string;
2377
2587
  scopes: string[];
2378
- condition: string | null;
2379
- condition_id: string | null;
2380
- condition_kwargs: unknown;
2588
+ condition: {
2589
+ content?: string | undefined;
2590
+ id?: string | undefined;
2591
+ kwargs?: Record<string, unknown> | undefined;
2592
+ } | null;
2381
2593
  base_tier: string | null;
2382
2594
  allow_all: boolean;
2383
2595
  grants: Record<string, "none" | "read" | "write">;
@@ -2386,9 +2598,11 @@ export declare function createApiClient(config: ApiConfig): {
2386
2598
  name: string;
2387
2599
  description: string;
2388
2600
  scopes: string[];
2389
- condition: string | null;
2390
- condition_id: string | null;
2391
- condition_kwargs: unknown;
2601
+ condition: {
2602
+ content?: string | undefined;
2603
+ id?: string | undefined;
2604
+ kwargs?: Record<string, unknown> | undefined;
2605
+ } | null;
2392
2606
  base_tier: string | null;
2393
2607
  allow_all: boolean;
2394
2608
  grants: Record<string, "none" | "read" | "write">;
@@ -2404,9 +2618,11 @@ export declare function createApiClient(config: ApiConfig): {
2404
2618
  name: string;
2405
2619
  description: string;
2406
2620
  scopes: string[];
2407
- condition: string | null;
2408
- condition_id: string | null;
2409
- condition_kwargs: unknown;
2621
+ condition: {
2622
+ content?: string | undefined;
2623
+ id?: string | undefined;
2624
+ kwargs?: Record<string, unknown> | undefined;
2625
+ } | null;
2410
2626
  base_tier: string | null;
2411
2627
  allow_all: boolean;
2412
2628
  grants: Record<string, "none" | "read" | "write">;
@@ -2432,9 +2648,11 @@ export declare function createApiClient(config: ApiConfig): {
2432
2648
  name: string;
2433
2649
  description: string;
2434
2650
  scopes: string[];
2435
- condition: string | null;
2436
- condition_id: string | null;
2437
- condition_kwargs: unknown;
2651
+ condition: {
2652
+ content?: string | undefined;
2653
+ id?: string | undefined;
2654
+ kwargs?: Record<string, unknown> | undefined;
2655
+ } | null;
2438
2656
  base_tier: string | null;
2439
2657
  allow_all: boolean;
2440
2658
  grants: Record<string, "none" | "read" | "write">;
@@ -2444,9 +2662,11 @@ export declare function createApiClient(config: ApiConfig): {
2444
2662
  description: string;
2445
2663
  scopes: string[];
2446
2664
  policy_data: unknown;
2447
- condition?: string | null | undefined;
2448
- condition_id?: string | null | undefined;
2449
- condition_kwargs?: unknown;
2665
+ condition?: {
2666
+ content?: string | undefined;
2667
+ id?: string | undefined;
2668
+ kwargs?: Record<string, unknown> | undefined;
2669
+ } | null | undefined;
2450
2670
  }[]>;
2451
2671
  readonly createApiKey: (body: ApiKeyBody) => Promise<string>;
2452
2672
  readonly editApiKey: (userId: string, body: Omit<ApiKeyBody, "user_id">) => Promise<{
@@ -2541,9 +2761,11 @@ export declare function createApiClient(config: ApiConfig): {
2541
2761
  body: {
2542
2762
  scopes: string[];
2543
2763
  policy_data: unknown;
2544
- condition: string | null;
2545
- condition_id: string | null;
2546
- condition_kwargs: unknown;
2764
+ condition: {
2765
+ content?: string | undefined;
2766
+ id?: string | undefined;
2767
+ kwargs?: Record<string, unknown> | undefined;
2768
+ } | null;
2547
2769
  };
2548
2770
  tags: string[];
2549
2771
  created_at: string;