@conduit-client/model 3.15.0 → 3.16.0-dev1

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.
@@ -1,15 +1,15 @@
1
1
  import amf from 'amf-client-js';
2
- import { OpenAPIV3 } from 'openapi-types';
3
2
  import { AMFAPI } from '../amf/AMFAPI';
4
- import { AMFType } from '../amf/types';
5
- import { LoggerService } from '@conduit-client/utils';
6
- import { Mock } from 'vitest';
7
- import { SwaggerType, TypeRegistry } from '../..';
8
- import { SwaggerEndPoint } from '../swagger/endpoints/swagger-endpoint';
9
- import { SourcePositionMap } from '../swagger/source-position-map';
10
3
  import { SwaggerAPI } from '../swagger/SwaggerAPI';
11
- import { AmfEndPoint } from '../amf/endpoints/amf-endpoint';
12
- import { API, Server } from '../../api';
4
+ import type { AmfEndPoint } from '../amf/endpoints/amf-endpoint';
5
+ import type { SourcePositionMap } from '../swagger/source-position-map';
6
+ import type { Mock } from 'vitest';
7
+ import type { LoggerService } from '@conduit-client/utils';
8
+ import type { SwaggerType, TypeRegistry } from '../..';
9
+ import type { AMFType } from '../amf/types';
10
+ import type { SwaggerEndPoint } from '../swagger/endpoints/swagger-endpoint';
11
+ import type { OpenAPIV3 } from 'openapi-types';
12
+ import type { API, Server } from '../../api';
13
13
  import type SwaggerParser from '@apidevtools/swagger-parser';
14
14
  export type ParserKind = 'amf' | 'swagger';
15
15
  type ClassOfConstructor<T> = T extends new () => infer R ? R : never;
@@ -272,6 +272,7 @@ declare const specFileConfigs: {
272
272
  readonly failGetMethodWithMutationOperationTypeAndWireBinding: "/fail/get-method-with-mutation-operation-type-and-wire-binding";
273
273
  readonly failGetMethodWithMutationOperationTypeAndImperativeInvokerBinding: "/fail/get-method-with-mutation-operation-type-and-imperative-legacy-binding";
274
274
  readonly failMultipleOperationsShareBindingIdentifier: "/fail/multiple-operations-share-binding-identifier";
275
+ readonly failImperativeLegacyNonCaching: "/fail/imperative-legacy-non-caching";
275
276
  };
276
277
  };
277
278
  readonly amfGraphQLBindings: {
@@ -614,7 +614,7 @@ export declare class OperationSchemaBuilder {
614
614
  private operationCacheStrategyType;
615
615
  constructor(method: HttpMethod, operationId: string | undefined, operationCacheStrategyType: Pick<CacheStrategy, 'type'>);
616
616
  buildOperationSchema(): z.ZodObject<{
617
- onestore: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
617
+ onestore: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
618
618
  config: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
619
619
  'operation-type': z.ZodDefault<z.ZodEnum<["query", "mutation", "graphql"]>>;
620
620
  schema: z.ZodDefault<z.ZodEnum<["flattened", "default"]>>;
@@ -1254,6 +1254,72 @@ export declare class OperationSchemaBuilder {
1254
1254
  } | {
1255
1255
  type: "fetchResponse";
1256
1256
  } | undefined;
1257
+ } | undefined>, {
1258
+ config: {
1259
+ bindings: {
1260
+ type: "wire" | "imperative" | "imperative-legacy" | "mutation";
1261
+ identifier: string;
1262
+ }[];
1263
+ 'operation-type': "mutation" | "query" | "graphql";
1264
+ schema: "default" | "flattened";
1265
+ exposeRefresh: boolean;
1266
+ 'body-param'?: string | undefined;
1267
+ };
1268
+ 'cache-strategy': {
1269
+ type: "none";
1270
+ } | {
1271
+ type: "resource";
1272
+ config: {
1273
+ 'max-age': number;
1274
+ 'stale-while-revalidate'?: number | undefined;
1275
+ };
1276
+ } | {
1277
+ type: "normalized";
1278
+ key?: Record<string, string> | undefined;
1279
+ 'cache-control'?: {
1280
+ 'max-age': number;
1281
+ type: "max-age";
1282
+ 'stale-while-revalidate'?: number | undefined;
1283
+ } | {
1284
+ type: "no-cache";
1285
+ } | undefined;
1286
+ };
1287
+ 'error-strategy': {
1288
+ type: "stringified";
1289
+ } | {
1290
+ type: "fetchResponse";
1291
+ };
1292
+ services?: Record<string, {
1293
+ ref: string;
1294
+ } | {
1295
+ version: string;
1296
+ tags?: Record<string, string> | undefined;
1297
+ optional?: boolean | undefined;
1298
+ }> | undefined;
1299
+ }, {
1300
+ services?: Record<string, {
1301
+ ref: string;
1302
+ } | {
1303
+ version: string;
1304
+ tags?: Record<string, string> | undefined;
1305
+ optional?: boolean | undefined;
1306
+ }> | undefined;
1307
+ config?: {
1308
+ bindings?: {
1309
+ type?: "wire" | "imperative" | "imperative-legacy" | "mutation" | undefined;
1310
+ identifier?: string | undefined;
1311
+ }[] | undefined;
1312
+ 'operation-type'?: "mutation" | "query" | "graphql" | undefined;
1313
+ schema?: "default" | "flattened" | undefined;
1314
+ exposeRefresh?: boolean | undefined;
1315
+ 'body-param'?: string | undefined;
1316
+ } | undefined;
1317
+ 'cache-strategy'?: unknown;
1318
+ 'error-strategy'?: {
1319
+ type: "stringified";
1320
+ } | {
1321
+ type: "fetchResponse";
1322
+ } | undefined;
1257
1323
  } | undefined>;
1258
1324
  }, "strip", z.ZodTypeAny, {
1259
1325
  onestore: {
@@ -1327,7 +1393,7 @@ export declare class OperationSchemaBuilder {
1327
1393
  } | undefined;
1328
1394
  }>;
1329
1395
  buildHttpOperationSchema(): z.ZodEffects<z.ZodObject<{
1330
- onestore: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
1396
+ onestore: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
1331
1397
  config: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
1332
1398
  'operation-type': z.ZodDefault<z.ZodEnum<["query", "mutation", "graphql"]>>;
1333
1399
  schema: z.ZodDefault<z.ZodEnum<["flattened", "default"]>>;
@@ -1967,6 +2033,72 @@ export declare class OperationSchemaBuilder {
1967
2033
  } | {
1968
2034
  type: "fetchResponse";
1969
2035
  } | undefined;
2036
+ } | undefined>, {
2037
+ config: {
2038
+ bindings: {
2039
+ type: "wire" | "imperative" | "imperative-legacy" | "mutation";
2040
+ identifier: string;
2041
+ }[];
2042
+ 'operation-type': "mutation" | "query" | "graphql";
2043
+ schema: "default" | "flattened";
2044
+ exposeRefresh: boolean;
2045
+ 'body-param'?: string | undefined;
2046
+ };
2047
+ 'cache-strategy': {
2048
+ type: "none";
2049
+ } | {
2050
+ type: "resource";
2051
+ config: {
2052
+ 'max-age': number;
2053
+ 'stale-while-revalidate'?: number | undefined;
2054
+ };
2055
+ } | {
2056
+ type: "normalized";
2057
+ key?: Record<string, string> | undefined;
2058
+ 'cache-control'?: {
2059
+ 'max-age': number;
2060
+ type: "max-age";
2061
+ 'stale-while-revalidate'?: number | undefined;
2062
+ } | {
2063
+ type: "no-cache";
2064
+ } | undefined;
2065
+ };
2066
+ 'error-strategy': {
2067
+ type: "stringified";
2068
+ } | {
2069
+ type: "fetchResponse";
2070
+ };
2071
+ services?: Record<string, {
2072
+ ref: string;
2073
+ } | {
2074
+ version: string;
2075
+ tags?: Record<string, string> | undefined;
2076
+ optional?: boolean | undefined;
2077
+ }> | undefined;
2078
+ }, {
2079
+ services?: Record<string, {
2080
+ ref: string;
2081
+ } | {
2082
+ version: string;
2083
+ tags?: Record<string, string> | undefined;
2084
+ optional?: boolean | undefined;
2085
+ }> | undefined;
2086
+ config?: {
2087
+ bindings?: {
2088
+ type?: "wire" | "imperative" | "imperative-legacy" | "mutation" | undefined;
2089
+ identifier?: string | undefined;
2090
+ }[] | undefined;
2091
+ 'operation-type'?: "mutation" | "query" | "graphql" | undefined;
2092
+ schema?: "default" | "flattened" | undefined;
2093
+ exposeRefresh?: boolean | undefined;
2094
+ 'body-param'?: string | undefined;
2095
+ } | undefined;
2096
+ 'cache-strategy'?: unknown;
2097
+ 'error-strategy'?: {
2098
+ type: "stringified";
2099
+ } | {
2100
+ type: "fetchResponse";
2101
+ } | undefined;
1970
2102
  } | undefined>;
1971
2103
  }, "strip", z.ZodTypeAny, {
1972
2104
  onestore: {
@@ -2079,7 +2211,7 @@ export declare class OperationSchemaBuilder {
2079
2211
  } | undefined;
2080
2212
  }>;
2081
2213
  buildAuraOperationSchema(): z.ZodIntersection<z.ZodObject<{
2082
- onestore: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
2214
+ onestore: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
2083
2215
  config: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
2084
2216
  'operation-type': z.ZodDefault<z.ZodEnum<["query", "mutation", "graphql"]>>;
2085
2217
  schema: z.ZodDefault<z.ZodEnum<["flattened", "default"]>>;
@@ -2719,6 +2851,72 @@ export declare class OperationSchemaBuilder {
2719
2851
  } | {
2720
2852
  type: "fetchResponse";
2721
2853
  } | undefined;
2854
+ } | undefined>, {
2855
+ config: {
2856
+ bindings: {
2857
+ type: "wire" | "imperative" | "imperative-legacy" | "mutation";
2858
+ identifier: string;
2859
+ }[];
2860
+ 'operation-type': "mutation" | "query" | "graphql";
2861
+ schema: "default" | "flattened";
2862
+ exposeRefresh: boolean;
2863
+ 'body-param'?: string | undefined;
2864
+ };
2865
+ 'cache-strategy': {
2866
+ type: "none";
2867
+ } | {
2868
+ type: "resource";
2869
+ config: {
2870
+ 'max-age': number;
2871
+ 'stale-while-revalidate'?: number | undefined;
2872
+ };
2873
+ } | {
2874
+ type: "normalized";
2875
+ key?: Record<string, string> | undefined;
2876
+ 'cache-control'?: {
2877
+ 'max-age': number;
2878
+ type: "max-age";
2879
+ 'stale-while-revalidate'?: number | undefined;
2880
+ } | {
2881
+ type: "no-cache";
2882
+ } | undefined;
2883
+ };
2884
+ 'error-strategy': {
2885
+ type: "stringified";
2886
+ } | {
2887
+ type: "fetchResponse";
2888
+ };
2889
+ services?: Record<string, {
2890
+ ref: string;
2891
+ } | {
2892
+ version: string;
2893
+ tags?: Record<string, string> | undefined;
2894
+ optional?: boolean | undefined;
2895
+ }> | undefined;
2896
+ }, {
2897
+ services?: Record<string, {
2898
+ ref: string;
2899
+ } | {
2900
+ version: string;
2901
+ tags?: Record<string, string> | undefined;
2902
+ optional?: boolean | undefined;
2903
+ }> | undefined;
2904
+ config?: {
2905
+ bindings?: {
2906
+ type?: "wire" | "imperative" | "imperative-legacy" | "mutation" | undefined;
2907
+ identifier?: string | undefined;
2908
+ }[] | undefined;
2909
+ 'operation-type'?: "mutation" | "query" | "graphql" | undefined;
2910
+ schema?: "default" | "flattened" | undefined;
2911
+ exposeRefresh?: boolean | undefined;
2912
+ 'body-param'?: string | undefined;
2913
+ } | undefined;
2914
+ 'cache-strategy'?: unknown;
2915
+ 'error-strategy'?: {
2916
+ type: "stringified";
2917
+ } | {
2918
+ type: "fetchResponse";
2919
+ } | undefined;
2722
2920
  } | undefined>;
2723
2921
  }, "strip", z.ZodTypeAny, {
2724
2922
  onestore: {
@@ -2840,7 +3038,7 @@ export declare class OperationSchemaBuilder {
2840
3038
  };
2841
3039
  }>>;
2842
3040
  buildAuraOperationWithBodySchema(): z.ZodEffects<z.ZodIntersection<z.ZodIntersection<z.ZodObject<{
2843
- onestore: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
3041
+ onestore: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
2844
3042
  config: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
2845
3043
  'operation-type': z.ZodDefault<z.ZodEnum<["query", "mutation", "graphql"]>>;
2846
3044
  schema: z.ZodDefault<z.ZodEnum<["flattened", "default"]>>;
@@ -3480,6 +3678,72 @@ export declare class OperationSchemaBuilder {
3480
3678
  } | {
3481
3679
  type: "fetchResponse";
3482
3680
  } | undefined;
3681
+ } | undefined>, {
3682
+ config: {
3683
+ bindings: {
3684
+ type: "wire" | "imperative" | "imperative-legacy" | "mutation";
3685
+ identifier: string;
3686
+ }[];
3687
+ 'operation-type': "mutation" | "query" | "graphql";
3688
+ schema: "default" | "flattened";
3689
+ exposeRefresh: boolean;
3690
+ 'body-param'?: string | undefined;
3691
+ };
3692
+ 'cache-strategy': {
3693
+ type: "none";
3694
+ } | {
3695
+ type: "resource";
3696
+ config: {
3697
+ 'max-age': number;
3698
+ 'stale-while-revalidate'?: number | undefined;
3699
+ };
3700
+ } | {
3701
+ type: "normalized";
3702
+ key?: Record<string, string> | undefined;
3703
+ 'cache-control'?: {
3704
+ 'max-age': number;
3705
+ type: "max-age";
3706
+ 'stale-while-revalidate'?: number | undefined;
3707
+ } | {
3708
+ type: "no-cache";
3709
+ } | undefined;
3710
+ };
3711
+ 'error-strategy': {
3712
+ type: "stringified";
3713
+ } | {
3714
+ type: "fetchResponse";
3715
+ };
3716
+ services?: Record<string, {
3717
+ ref: string;
3718
+ } | {
3719
+ version: string;
3720
+ tags?: Record<string, string> | undefined;
3721
+ optional?: boolean | undefined;
3722
+ }> | undefined;
3723
+ }, {
3724
+ services?: Record<string, {
3725
+ ref: string;
3726
+ } | {
3727
+ version: string;
3728
+ tags?: Record<string, string> | undefined;
3729
+ optional?: boolean | undefined;
3730
+ }> | undefined;
3731
+ config?: {
3732
+ bindings?: {
3733
+ type?: "wire" | "imperative" | "imperative-legacy" | "mutation" | undefined;
3734
+ identifier?: string | undefined;
3735
+ }[] | undefined;
3736
+ 'operation-type'?: "mutation" | "query" | "graphql" | undefined;
3737
+ schema?: "default" | "flattened" | undefined;
3738
+ exposeRefresh?: boolean | undefined;
3739
+ 'body-param'?: string | undefined;
3740
+ } | undefined;
3741
+ 'cache-strategy'?: unknown;
3742
+ 'error-strategy'?: {
3743
+ type: "stringified";
3744
+ } | {
3745
+ type: "fetchResponse";
3746
+ } | undefined;
3483
3747
  } | undefined>;
3484
3748
  }, "strip", z.ZodTypeAny, {
3485
3749
  onestore: {
@@ -3768,7 +4032,7 @@ export declare class OperationSchemaBuilder {
3768
4032
  };
3769
4033
  }>;
3770
4034
  buildGraphQLOperationSchema(): z.ZodIntersection<z.ZodObject<{
3771
- onestore: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
4035
+ onestore: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
3772
4036
  config: z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodEffects<z.ZodDefault<z.ZodObject<{
3773
4037
  'operation-type': z.ZodDefault<z.ZodEnum<["query", "mutation", "graphql"]>>;
3774
4038
  schema: z.ZodDefault<z.ZodEnum<["flattened", "default"]>>;
@@ -4408,6 +4672,72 @@ export declare class OperationSchemaBuilder {
4408
4672
  } | {
4409
4673
  type: "fetchResponse";
4410
4674
  } | undefined;
4675
+ } | undefined>, {
4676
+ config: {
4677
+ bindings: {
4678
+ type: "wire" | "imperative" | "imperative-legacy" | "mutation";
4679
+ identifier: string;
4680
+ }[];
4681
+ 'operation-type': "mutation" | "query" | "graphql";
4682
+ schema: "default" | "flattened";
4683
+ exposeRefresh: boolean;
4684
+ 'body-param'?: string | undefined;
4685
+ };
4686
+ 'cache-strategy': {
4687
+ type: "none";
4688
+ } | {
4689
+ type: "resource";
4690
+ config: {
4691
+ 'max-age': number;
4692
+ 'stale-while-revalidate'?: number | undefined;
4693
+ };
4694
+ } | {
4695
+ type: "normalized";
4696
+ key?: Record<string, string> | undefined;
4697
+ 'cache-control'?: {
4698
+ 'max-age': number;
4699
+ type: "max-age";
4700
+ 'stale-while-revalidate'?: number | undefined;
4701
+ } | {
4702
+ type: "no-cache";
4703
+ } | undefined;
4704
+ };
4705
+ 'error-strategy': {
4706
+ type: "stringified";
4707
+ } | {
4708
+ type: "fetchResponse";
4709
+ };
4710
+ services?: Record<string, {
4711
+ ref: string;
4712
+ } | {
4713
+ version: string;
4714
+ tags?: Record<string, string> | undefined;
4715
+ optional?: boolean | undefined;
4716
+ }> | undefined;
4717
+ }, {
4718
+ services?: Record<string, {
4719
+ ref: string;
4720
+ } | {
4721
+ version: string;
4722
+ tags?: Record<string, string> | undefined;
4723
+ optional?: boolean | undefined;
4724
+ }> | undefined;
4725
+ config?: {
4726
+ bindings?: {
4727
+ type?: "wire" | "imperative" | "imperative-legacy" | "mutation" | undefined;
4728
+ identifier?: string | undefined;
4729
+ }[] | undefined;
4730
+ 'operation-type'?: "mutation" | "query" | "graphql" | undefined;
4731
+ schema?: "default" | "flattened" | undefined;
4732
+ exposeRefresh?: boolean | undefined;
4733
+ 'body-param'?: string | undefined;
4734
+ } | undefined;
4735
+ 'cache-strategy'?: unknown;
4736
+ 'error-strategy'?: {
4737
+ type: "stringified";
4738
+ } | {
4739
+ type: "fetchResponse";
4740
+ } | undefined;
4411
4741
  } | undefined>;
4412
4742
  }, "strip", z.ZodTypeAny, {
4413
4743
  onestore: {
package/dist/v1/index.js CHANGED
@@ -5694,6 +5694,20 @@ class OperationSchemaBuilder {
5694
5694
  {
5695
5695
  message: "GraphQL operations must use normalized cache strategy"
5696
5696
  }
5697
+ ).refine(
5698
+ (extensions) => {
5699
+ var _a;
5700
+ const hasImperativeLegacy = extensions.config.bindings.some(
5701
+ (binding) => binding.type === "imperative-legacy"
5702
+ );
5703
+ if (hasImperativeLegacy) {
5704
+ return ((_a = extensions["cache-strategy"]) == null ? void 0 : _a.type) !== "none";
5705
+ }
5706
+ return true;
5707
+ },
5708
+ {
5709
+ message: 'Cannot use "imperative-legacy" binding with non-caching operations. The "imperative-legacy" binding requires a caching cache-strategy.'
5710
+ }
5697
5711
  )
5698
5712
  });
5699
5713
  }