@wise/dynamic-flow-types 2.5.1 → 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,22 +1,40 @@
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';
7
8
  export type { Size as Margin } from './misc/Size';
8
9
  export type { Icon } from './misc/Icon';
10
+ export type { Image } from './misc/Image';
9
11
  export type { Layout } from './layout/Layout';
10
12
  export type { AlertLayout } from './layout/AlertLayout';
11
13
  export type { BoxLayout } from './layout/BoxLayout';
12
14
  export type { ButtonLayout } from './layout/ButtonLayout';
13
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';
14
19
  export type FormLayout = GeneratedFormLayout & {
15
20
  schema?: Reference;
16
21
  };
17
22
  export type { HeadingLayout } from './layout/HeadingLayout';
18
- export type { ParagraphLayout } from './layout/ParagraphLayout';
19
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';
20
38
  export type { Schema } from './schema/Schema';
21
39
  export type { BooleanSchema } from './schema/BooleanSchema';
22
40
  export type { ConstSchema } from './schema/ConstSchema';
@@ -26,27 +44,14 @@ export type { OneOfSchema } from './schema/OneOfSchema';
26
44
  export type { StringSchema } from './schema/StringSchema';
27
45
  export type { NumberSchema } from './schema/NumberSchema';
28
46
  export type { IntegerSchema } from './schema/IntegerSchema';
47
+ export type { ArraySchema } from './schema/ArraySchema';
48
+ export type { ArraySchemaList } from './schema/ArraySchemaList';
49
+ export type { ArraySchemaTuple } from './schema/ArraySchemaTuple';
29
50
  export type { StringSchemaFormat } from './schema/StringSchemaFormat';
30
- type BasicModel = boolean | number | string;
31
- type ObjectModel = {
32
- [key: string]: Model;
33
- };
34
- type ArrayModel = (Model | null)[];
35
- export type Model = BasicModel | ObjectModel | ArrayModel | null;
36
- export type { SearchResult } from './responses/search/SearchResult';
37
- export type { SearchResponseBody } from './responses/search/SearchResponseBody';
38
- type ValidationErrorObject = {
39
- [key: string]: ValidationError;
40
- };
41
- export type ValidationError = string | ValidationErrorObject | null;
42
- export type StepError = {
43
- error?: string;
44
- validation?: ValidationError;
45
- };
46
- export type Step = Omit<GeneratedStep, 'model' | 'errors'> & {
47
- model?: Model;
48
- errors?: StepError;
49
- };
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;
50
55
  export type Reference = {
51
56
  $ref: string;
52
57
  };
@@ -0,0 +1,11 @@
1
+ export type Image = {
2
+ url: string;
3
+ /**
4
+ * @deprecated Please use 'accessibilityDescription' instead
5
+ */
6
+ text?: string;
7
+ /**
8
+ * @experimental This feature may be changed in the future without notice.
9
+ */
10
+ accessibilityDescription?: string;
11
+ };
@@ -1,9 +1,14 @@
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
7
8
  */
8
9
  refreshFormUrl?: string;
10
+ /**
11
+ * @experimental This feature may be changed in the future without notice.
12
+ */
13
+ analytics?: Record<string, string>;
9
14
  };
@@ -1,6 +1,6 @@
1
1
  import type { Schema } from './Schema';
2
2
  import type { Icon } from '../misc/Icon';
3
- import type { ImageLayout } from '../layout/ImageLayout';
3
+ import type { Image } from '../misc/Image';
4
4
  import type { SummaryProvider } from '../feature/SummaryProvider';
5
5
  import type { AlertLayout } from '../layout/AlertLayout';
6
6
  export type AllOfSchema = {
@@ -12,7 +12,7 @@ export type AllOfSchema = {
12
12
  control?: string;
13
13
  hidden?: boolean;
14
14
  icon?: Icon;
15
- image?: ImageLayout;
15
+ image?: Image;
16
16
  keywords?: string[];
17
17
  summary?: SummaryProvider;
18
18
  analyticsId?: string;
@@ -1,6 +1,6 @@
1
1
  import type { Schema } from './Schema';
2
2
  import type { Icon } from '../misc/Icon';
3
- import type { ImageLayout } from '../layout/ImageLayout';
3
+ import type { Image } from '../misc/Image';
4
4
  import type { SummarySummariser } from '../feature/SummarySummariser';
5
5
  import type { PersistAsync } from '../feature/PersistAsync';
6
6
  import type { ValidateAsync } from '../feature/ValidateAsync';
@@ -18,7 +18,7 @@ export type ArraySchemaList = {
18
18
  control?: string;
19
19
  hidden?: boolean;
20
20
  icon?: Icon;
21
- image?: ImageLayout;
21
+ image?: Image;
22
22
  keywords?: string[];
23
23
  summary?: SummarySummariser;
24
24
  analyticsId?: string;
@@ -1,6 +1,6 @@
1
1
  import type { Schema } from './Schema';
2
2
  import type { Icon } from '../misc/Icon';
3
- import type { ImageLayout } from '../layout/ImageLayout';
3
+ import type { Image } from '../misc/Image';
4
4
  import type { SummaryProvider } from '../feature/SummaryProvider';
5
5
  import type { PersistAsync } from '../feature/PersistAsync';
6
6
  import type { ValidateAsync } from '../feature/ValidateAsync';
@@ -14,7 +14,7 @@ export type ArraySchemaTuple = {
14
14
  control?: string;
15
15
  hidden?: boolean;
16
16
  icon?: Icon;
17
- image?: ImageLayout;
17
+ image?: Image;
18
18
  keywords?: string[];
19
19
  summary?: SummaryProvider;
20
20
  analyticsId?: string;
@@ -1,6 +1,6 @@
1
1
  import type { BlobSchemaSource } from './BlobSchemaSource';
2
2
  import type { Icon } from '../misc/Icon';
3
- import type { ImageLayout } from '../layout/ImageLayout';
3
+ import type { Image } from '../misc/Image';
4
4
  import type { SummaryProvider } from '../feature/SummaryProvider';
5
5
  import type { ValidateAsync } from '../feature/ValidateAsync';
6
6
  import type { AlertLayout } from '../layout/AlertLayout';
@@ -16,7 +16,7 @@ export type BlobSchema = {
16
16
  control?: string;
17
17
  hidden?: boolean;
18
18
  icon?: Icon;
19
- image?: ImageLayout;
19
+ image?: Image;
20
20
  keywords?: string[];
21
21
  summary?: SummaryProvider;
22
22
  analyticsId?: string;
@@ -1,5 +1,5 @@
1
1
  import type { Icon } from '../misc/Icon';
2
- import type { ImageLayout } from '../layout/ImageLayout';
2
+ import type { Image } from '../misc/Image';
3
3
  import type { SummaryProvider } from '../feature/SummaryProvider';
4
4
  import type { PersistAsync } from '../feature/PersistAsync';
5
5
  import type { ValidateAsync } from '../feature/ValidateAsync';
@@ -15,7 +15,7 @@ export type BooleanSchema = {
15
15
  hidden?: boolean;
16
16
  disabled?: boolean;
17
17
  icon?: Icon;
18
- image?: ImageLayout;
18
+ image?: Image;
19
19
  keywords?: string[];
20
20
  summary?: SummaryProvider;
21
21
  analyticsId?: string;
@@ -1,6 +1,7 @@
1
1
  import type { AlertLayout } from '../layout/AlertLayout';
2
+ import type { JsonElement } from '../JsonElement';
2
3
  import type { Icon } from '../misc/Icon';
3
- import type { ImageLayout } from '../layout/ImageLayout';
4
+ import type { Image } from '../misc/Image';
4
5
  import type { SummaryProvider } from '../feature/SummaryProvider';
5
6
  export type ConstSchema = {
6
7
  disabled?: boolean;
@@ -8,11 +9,11 @@ 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;
15
- image?: ImageLayout;
16
+ image?: Image;
16
17
  keywords?: string[];
17
18
  summary?: SummaryProvider;
18
19
  analyticsId?: string;
@@ -1,5 +1,5 @@
1
1
  import type { Icon } from '../misc/Icon';
2
- import type { ImageLayout } from '../layout/ImageLayout';
2
+ import type { Image } from '../misc/Image';
3
3
  import type { SummaryProvider } from '../feature/SummaryProvider';
4
4
  import type { PersistAsync } from '../feature/PersistAsync';
5
5
  import type { ValidateAsync } from '../feature/ValidateAsync';
@@ -19,7 +19,7 @@ export type IntegerSchema = {
19
19
  hidden?: boolean;
20
20
  disabled?: boolean;
21
21
  icon?: Icon;
22
- image?: ImageLayout;
22
+ image?: Image;
23
23
  keywords?: string[];
24
24
  summary?: SummaryProvider;
25
25
  analyticsId?: string;
@@ -1,5 +1,5 @@
1
1
  import type { Icon } from '../misc/Icon';
2
- import type { ImageLayout } from '../layout/ImageLayout';
2
+ import type { Image } from '../misc/Image';
3
3
  import type { SummaryProvider } from '../feature/SummaryProvider';
4
4
  import type { PersistAsync } from '../feature/PersistAsync';
5
5
  import type { ValidateAsync } from '../feature/ValidateAsync';
@@ -19,7 +19,7 @@ export type NumberSchema = {
19
19
  hidden?: boolean;
20
20
  disabled?: boolean;
21
21
  icon?: Icon;
22
- image?: ImageLayout;
22
+ image?: Image;
23
23
  keywords?: string[];
24
24
  summary?: SummaryProvider;
25
25
  analyticsId?: string;
@@ -1,7 +1,7 @@
1
1
  import type { Help } from '../feature/Help';
2
2
  import type { Schema } from './Schema';
3
3
  import type { Icon } from '../misc/Icon';
4
- import type { ImageLayout } from '../layout/ImageLayout';
4
+ import type { Image } from '../misc/Image';
5
5
  import type { SummaryProvider } from '../feature/SummaryProvider';
6
6
  import type { AlertLayout } from '../layout/AlertLayout';
7
7
  export type ObjectSchema = {
@@ -16,7 +16,7 @@ export type ObjectSchema = {
16
16
  control?: string;
17
17
  hidden?: boolean;
18
18
  icon?: Icon;
19
- image?: ImageLayout;
19
+ image?: Image;
20
20
  keywords?: string[];
21
21
  summary?: SummaryProvider;
22
22
  analyticsId?: string;
@@ -1,6 +1,7 @@
1
+ import type { JsonElement } from '../JsonElement';
1
2
  import type { Schema } from './Schema';
2
3
  import type { Icon } from '../misc/Icon';
3
- import type { ImageLayout } from '../layout/ImageLayout';
4
+ import type { Image } from '../misc/Image';
4
5
  import type { SummaryProvider } from '../feature/SummaryProvider';
5
6
  import type { AlertLayout } from '../layout/AlertLayout';
6
7
  import type { Help } from '../feature/Help';
@@ -13,10 +14,10 @@ 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
- image?: ImageLayout;
20
+ image?: Image;
20
21
  keywords?: string[];
21
22
  summary?: SummaryProvider;
22
23
  analyticsId?: string;
@@ -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,7 +1,7 @@
1
1
  import type { StringSchemaSource } from './StringSchemaSource';
2
2
  import type { StringSchemaFormat } from './StringSchemaFormat';
3
3
  import type { Icon } from '../misc/Icon';
4
- import type { ImageLayout } from '../layout/ImageLayout';
4
+ import type { Image } from '../misc/Image';
5
5
  import type { SummaryProvider } from '../feature/SummaryProvider';
6
6
  import type { PersistAsync } from '../feature/PersistAsync';
7
7
  import type { ValidateAsync } from '../feature/ValidateAsync';
@@ -26,7 +26,7 @@ export type StringSchema = {
26
26
  hidden?: boolean;
27
27
  disabled?: boolean;
28
28
  icon?: Icon;
29
- image?: ImageLayout;
29
+ image?: Image;
30
30
  keywords?: string[];
31
31
  summary?: SummaryProvider;
32
32
  analyticsId?: string;
@@ -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[];