@wise/dynamic-flow-types 2.5.2 → 2.6.1

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/build/index.d.ts CHANGED
@@ -12,4 +12,5 @@ export * from './spec/Schema';
12
12
  export * from './spec/Step';
13
13
  export * from './spec/ValidationAsync';
14
14
  export * from './spec/Search';
15
+ export { stepSchema, actionResponseBodySchema, errorResponseBodySchema, searchResponseBodySchema, } from './zod/schemas';
15
16
  export type { FileUploadSchema, CameraDirection } from './spec/FileUploadSchema';
@@ -0,0 +1,6 @@
1
+ export type JsonElement = JsonPrimitive | JsonObject | JsonArray;
2
+ export type JsonPrimitive = boolean | number | string | null;
3
+ export interface JsonObject extends Record<string, JsonPrimitive | JsonObject | JsonArray> {
4
+ }
5
+ export interface JsonArray extends Array<JsonPrimitive | JsonObject | JsonArray> {
6
+ }
@@ -1,12 +1,13 @@
1
1
  import type { ActionType } from './ActionType';
2
2
  import type { HttpMethod } from '../misc/HttpMethod';
3
+ import type { JsonElement } from '../JsonElement';
3
4
  export type Action = {
4
5
  id?: string;
5
6
  url?: string;
6
7
  method?: HttpMethod;
7
8
  exit?: boolean;
8
- result?: unknown;
9
- data?: unknown;
9
+ result?: JsonElement;
10
+ data?: JsonElement;
10
11
  timeout?: number;
11
12
  /**
12
13
  * @deprecated Please use Button.title instead
@@ -1,4 +1,5 @@
1
+ import type { JsonElement } from '../JsonElement';
1
2
  export type StepError = {
2
3
  error?: string;
3
- validation?: unknown;
4
+ validation?: JsonElement;
4
5
  };
@@ -1,6 +1,7 @@
1
- import type { Step as GeneratedStep } from './step/Step';
2
1
  import type { FormLayout as GeneratedFormLayout } from './layout/FormLayout';
2
+ import type { JsonElement } from './JsonElement';
3
3
  export type { Action } from './feature/Action';
4
+ export type { PersistAsync } from './feature/PersistAsync';
4
5
  export type { Align } from './misc/Align';
5
6
  export type { Context } from './misc/Context';
6
7
  export type { Size } from './misc/Size';
@@ -12,12 +13,28 @@ export type { AlertLayout } from './layout/AlertLayout';
12
13
  export type { BoxLayout } from './layout/BoxLayout';
13
14
  export type { ButtonLayout } from './layout/ButtonLayout';
14
15
  export type { ColumnsLayout } from './layout/ColumnsLayout';
16
+ export type { DecisionLayout } from './layout/DecisionLayout';
17
+ export type { DecisionLayoutOption } from './layout/DecisionLayoutOption';
18
+ export type { DividerLayout } from './layout/DividerLayout';
15
19
  export type FormLayout = GeneratedFormLayout & {
16
20
  schema?: Reference;
17
21
  };
18
22
  export type { HeadingLayout } from './layout/HeadingLayout';
19
- export type { ParagraphLayout } from './layout/ParagraphLayout';
20
23
  export type { ImageLayout } from './layout/ImageLayout';
24
+ export type { InstructionsLayout } from './layout/InstructionsLayout';
25
+ export type { InstructionsLayoutItem } from './layout/InstructionsLayoutItem';
26
+ export type { InfoLayout } from './layout/InfoLayout';
27
+ export type { LoadingIndicatorLayout } from './layout/LoadingIndicatorLayout';
28
+ export type { MarkdownLayout } from './layout/MarkdownLayout';
29
+ export type { ModalLayout } from './layout/ModalLayout';
30
+ export type { ModalLayoutContent } from './layout/ModalLayoutContent';
31
+ export type { ModalLayoutTrigger } from './layout/ModalLayoutTrigger';
32
+ export type { ParagraphLayout } from './layout/ParagraphLayout';
33
+ export type { ReviewLayout } from './layout/ReviewLayout';
34
+ export type { ReviewLayoutCallToAction } from './layout/ReviewLayoutCallToAction';
35
+ export type { ReviewLayoutField } from './layout/ReviewLayoutField';
36
+ export type { SearchResult } from './responses/search/SearchResult';
37
+ export type { SearchResponseBody } from './responses/search/SearchResponseBody';
21
38
  export type { Schema } from './schema/Schema';
22
39
  export type { BooleanSchema } from './schema/BooleanSchema';
23
40
  export type { ConstSchema } from './schema/ConstSchema';
@@ -31,26 +48,10 @@ export type { ArraySchema } from './schema/ArraySchema';
31
48
  export type { ArraySchemaList } from './schema/ArraySchemaList';
32
49
  export type { ArraySchemaTuple } from './schema/ArraySchemaTuple';
33
50
  export type { StringSchemaFormat } from './schema/StringSchemaFormat';
34
- type BasicModel = boolean | number | string | null;
35
- interface ObjectModel extends Record<string, BasicModel | ObjectModel | ArrayModel> {
36
- }
37
- export interface ArrayModel extends Array<BasicModel | ObjectModel | ArrayModel> {
38
- }
39
- export type Model = BasicModel | ObjectModel | ArrayModel;
40
- export type { SearchResult } from './responses/search/SearchResult';
41
- export type { SearchResponseBody } from './responses/search/SearchResponseBody';
42
- type ValidationErrorObject = {
43
- [key: string]: ValidationError;
44
- };
45
- export type ValidationError = string | ValidationErrorObject | null;
46
- export type StepError = {
47
- error?: string;
48
- validation?: ValidationError;
49
- };
50
- export type Step = Omit<GeneratedStep, 'model' | 'errors'> & {
51
- model?: Model;
52
- errors?: StepError;
53
- };
51
+ export type { Step } from './step/Step';
52
+ export type { JsonElement, JsonPrimitive, JsonArray, JsonObject } from './JsonElement';
53
+ export type Model = JsonElement;
54
+ export type ValidationError = JsonElement;
54
55
  export type Reference = {
55
56
  $ref: string;
56
57
  };
@@ -1,6 +1,7 @@
1
+ import type { JsonElement } from '../../JsonElement';
1
2
  export type ErrorResponseBody = {
2
3
  error?: string;
3
- validation?: unknown;
4
+ validation?: JsonElement;
4
5
  refreshUrl?: string;
5
6
  /**
6
7
  * @deprecated Please use 'refreshUrl' instead
@@ -1,4 +1,5 @@
1
1
  import type { AlertLayout } from '../layout/AlertLayout';
2
+ import type { JsonElement } from '../JsonElement';
2
3
  import type { Icon } from '../misc/Icon';
3
4
  import type { Image } from '../misc/Image';
4
5
  import type { SummaryProvider } from '../feature/SummaryProvider';
@@ -8,7 +9,7 @@ export type ConstSchema = {
8
9
  alert?: AlertLayout;
9
10
  control?: string;
10
11
  $id?: string;
11
- const: unknown;
12
+ const: JsonElement;
12
13
  title?: string;
13
14
  description?: string;
14
15
  icon?: Icon;
@@ -1,3 +1,4 @@
1
+ import type { JsonElement } from '../JsonElement';
1
2
  import type { Schema } from './Schema';
2
3
  import type { Icon } from '../misc/Icon';
3
4
  import type { Image } from '../misc/Image';
@@ -13,7 +14,7 @@ export type OneOfSchema = {
13
14
  title?: string;
14
15
  description?: string;
15
16
  control?: string;
16
- default?: unknown;
17
+ default?: JsonElement;
17
18
  hidden?: boolean;
18
19
  icon?: Icon;
19
20
  image?: Image;
@@ -49,5 +50,5 @@ export type OneOfSchema = {
49
50
  /**
50
51
  * @deprecated OneOf Promotion is no longer supported
51
52
  */
52
- promotion?: unknown;
53
+ promotion?: JsonElement;
53
54
  };
@@ -1,6 +1,7 @@
1
1
  import type { Action } from '../feature/Action';
2
2
  import type { Schema } from '../schema/Schema';
3
3
  import type { Layout } from '../layout/Layout';
4
+ import type { JsonElement } from '../JsonElement';
4
5
  import type { External } from '../feature/External';
5
6
  import type { Polling } from '../feature/Polling';
6
7
  import type { LinkHandler } from '../feature/LinkHandler';
@@ -11,7 +12,7 @@ export type Step = {
11
12
  title: string;
12
13
  schemas: Schema[];
13
14
  layout: Layout[];
14
- model?: unknown;
15
+ model?: JsonElement;
15
16
  external?: External;
16
17
  polling?: Polling;
17
18
  linkHandlers?: LinkHandler[];
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Unfortunately we need this because ts-to-zod can't generate a valid
3
+ * schema for our exported version of this type. So, we add this manually
4
+ * during the schema generation because it is equivalent, but can be converted
5
+ * by ts-to-zod. (We can't use this type anywhere else because we get infinitely
6
+ * nesting types.)
7
+ */
8
+ export type JsonElement = string | number | boolean | null | {
9
+ [x: string]: JsonElement;
10
+ } | JsonElement[];