@nordcraft/core 1.0.78 → 1.0.80
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/api/ToddleApiV2.d.ts +2 -2
- package/dist/api/apiTypes.d.ts +1 -1
- package/dist/component/component.types.d.ts +1 -1
- package/dist/component/schemas/action-schema.d.ts +3 -0
- package/dist/component/schemas/action-schema.js +169 -0
- package/dist/component/schemas/action-schema.js.map +1 -0
- package/dist/component/schemas/api-schema.d.ts +3 -0
- package/dist/component/schemas/api-schema.js +174 -0
- package/dist/component/schemas/api-schema.js.map +1 -0
- package/dist/component/schemas/attribute-schema.d.ts +3 -0
- package/dist/component/schemas/attribute-schema.js +12 -0
- package/dist/component/schemas/attribute-schema.js.map +1 -0
- package/dist/component/schemas/component-schema.d.ts +6 -0
- package/dist/component/schemas/component-schema.js +132 -0
- package/dist/component/schemas/component-schema.js.map +1 -0
- package/dist/component/schemas/context-schema.d.ts +3 -0
- package/dist/component/schemas/context-schema.js +20 -0
- package/dist/component/schemas/context-schema.js.map +1 -0
- package/dist/component/schemas/event-schema.d.ts +4 -0
- package/dist/component/schemas/event-schema.js +25 -0
- package/dist/component/schemas/event-schema.js.map +1 -0
- package/dist/component/schemas/formula-schema.d.ts +5 -0
- package/dist/component/schemas/formula-schema.js +203 -0
- package/dist/component/schemas/formula-schema.js.map +1 -0
- package/dist/component/schemas/node-schema.d.ts +3 -0
- package/dist/component/schemas/node-schema.js +159 -0
- package/dist/component/schemas/node-schema.js.map +1 -0
- package/dist/component/schemas/route-schema.d.ts +3 -0
- package/dist/component/schemas/route-schema.js +88 -0
- package/dist/component/schemas/route-schema.js.map +1 -0
- package/dist/component/schemas/variable-schema.d.ts +3 -0
- package/dist/component/schemas/variable-schema.js +8 -0
- package/dist/component/schemas/variable-schema.js.map +1 -0
- package/dist/component/schemas/workflow-schema.d.ts +3 -0
- package/dist/component/schemas/workflow-schema.js +23 -0
- package/dist/component/schemas/workflow-schema.js.map +1 -0
- package/dist/component/schemas/zod-schemas.d.ts +26 -3
- package/dist/component/schemas/zod-schemas.js +4 -1081
- package/dist/component/schemas/zod-schemas.js.map +1 -1
- package/dist/styling/theme.js +1 -0
- package/dist/styling/theme.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/utils/collections.d.ts +1 -1
- package/dist/utils/collections.js.map +1 -1
- package/package.json +1 -1
- package/src/api/apiTypes.ts +1 -1
- package/src/component/component.types.ts +1 -1
- package/src/component/schemas/action-schema.ts +258 -0
- package/src/component/schemas/api-schema.ts +255 -0
- package/src/component/schemas/attribute-schema.ts +15 -0
- package/src/component/schemas/component-schema.ts +174 -0
- package/src/component/schemas/context-schema.ts +21 -0
- package/src/component/schemas/event-schema.ts +35 -0
- package/src/component/schemas/formula-schema.ts +299 -0
- package/src/component/schemas/node-schema.ts +259 -0
- package/src/component/schemas/route-schema.ts +135 -0
- package/src/component/schemas/variable-schema.ts +11 -0
- package/src/component/schemas/workflow-schema.ts +30 -0
- package/src/component/schemas/zod-schemas.ts +4 -1493
- package/src/styling/theme.ts +1 -0
- package/src/types.ts +1 -1
- package/src/utils/collections.ts +4 -1
|
@@ -30,7 +30,7 @@ export declare class ToddleApiV2<Handler> implements ApiRequest {
|
|
|
30
30
|
get method(): Nullable<import("./apiTypes").ApiMethod>;
|
|
31
31
|
get body(): Nullable<Formula>;
|
|
32
32
|
get inputs(): Record<string, {
|
|
33
|
-
formula
|
|
33
|
+
formula?: Nullable<Formula>;
|
|
34
34
|
}>;
|
|
35
35
|
get queryParams(): Nullable<Record<string, {
|
|
36
36
|
formula: Formula;
|
|
@@ -73,7 +73,7 @@ export declare class ToddleApiV2<Handler> implements ApiRequest {
|
|
|
73
73
|
formula: Formula;
|
|
74
74
|
}>;
|
|
75
75
|
get '@nordcraft/metadata'(): Nullable<{
|
|
76
|
-
comments
|
|
76
|
+
comments?: Nullable<Partial<Record<string, import("../types").Comment & {
|
|
77
77
|
index: number;
|
|
78
78
|
}>>>;
|
|
79
79
|
}>;
|
package/dist/api/apiTypes.d.ts
CHANGED
|
@@ -70,7 +70,7 @@ export interface ApiRequest extends ApiBase {
|
|
|
70
70
|
method?: Nullable<ApiMethod>;
|
|
71
71
|
body?: Nullable<Formula>;
|
|
72
72
|
inputs: Record<string, {
|
|
73
|
-
formula
|
|
73
|
+
formula?: Nullable<Formula>;
|
|
74
74
|
}>;
|
|
75
75
|
service?: Nullable<string>;
|
|
76
76
|
servicePath?: Nullable<string>;
|
|
@@ -276,7 +276,7 @@ export interface FetchActionModel {
|
|
|
276
276
|
type: 'Fetch';
|
|
277
277
|
api: string;
|
|
278
278
|
inputs?: Nullable<Record<string, {
|
|
279
|
-
formula
|
|
279
|
+
formula?: Nullable<Formula>;
|
|
280
280
|
}>>;
|
|
281
281
|
onSuccess: ActionModelActions;
|
|
282
282
|
onError: ActionModelActions;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { FormulaSchema } from './formula-schema';
|
|
3
|
+
// Action Models
|
|
4
|
+
const VariableActionModelSchema = z
|
|
5
|
+
.object({
|
|
6
|
+
type: z.literal('SetVariable'),
|
|
7
|
+
variable: z.string().describe('Name of the variable to be set.'),
|
|
8
|
+
data: FormulaSchema.describe('Formula evaluating to the new variable value.'),
|
|
9
|
+
})
|
|
10
|
+
.describe('Model describing the action of setting a variable.');
|
|
11
|
+
const EventActionModelSchema = z
|
|
12
|
+
.object({
|
|
13
|
+
type: z.literal('TriggerEvent'),
|
|
14
|
+
event: z.string().describe('Name of the event to be triggered.'),
|
|
15
|
+
data: FormulaSchema.describe('Data to pass to the event being triggered.'),
|
|
16
|
+
})
|
|
17
|
+
.describe('Model describing the action of triggering an event. This is only relevant on components as they are the only entities that can have events defined.');
|
|
18
|
+
const SwitchActionModelSchema = z
|
|
19
|
+
.object({
|
|
20
|
+
type: z.literal('Switch'),
|
|
21
|
+
cases: z
|
|
22
|
+
.array(z.object({
|
|
23
|
+
condition: FormulaSchema.describe('Condition to evaluate for this case. If truthy the actions are executed.'),
|
|
24
|
+
actions: z
|
|
25
|
+
.array(z.lazy(() => ActionModelSchema))
|
|
26
|
+
.describe('List of actions to execute if the condition is met.'),
|
|
27
|
+
}))
|
|
28
|
+
.describe('Cases for the switch action. Each case has a condition and actions.'),
|
|
29
|
+
default: z
|
|
30
|
+
.object({
|
|
31
|
+
actions: z.array(z.lazy(() => ActionModelSchema)),
|
|
32
|
+
})
|
|
33
|
+
.describe('Actions to execute if no case conditions are met.'),
|
|
34
|
+
})
|
|
35
|
+
.describe('Model describing a switch action. A switch action allows branching logic based on conditions.');
|
|
36
|
+
const FetchActionModelSchema = z
|
|
37
|
+
.object({
|
|
38
|
+
type: z.literal('Fetch'),
|
|
39
|
+
api: z
|
|
40
|
+
.string()
|
|
41
|
+
.describe('Key of the API to fetch data from. This is the key defined in the APIs object in the file.'),
|
|
42
|
+
inputs: z
|
|
43
|
+
.record(z.string().describe('Name of the API input.'), z.object({
|
|
44
|
+
formula: FormulaSchema.nullish().describe('Formula for the input.'),
|
|
45
|
+
}))
|
|
46
|
+
.describe('Inputs overriding the default input values for the API. Available inputs are defined as part of the API definition.'),
|
|
47
|
+
onSuccess: z
|
|
48
|
+
.object({
|
|
49
|
+
actions: z.array(z.lazy(() => ActionModelSchema)),
|
|
50
|
+
})
|
|
51
|
+
.describe('Actions to execute when the fetch is successful.'),
|
|
52
|
+
onError: z
|
|
53
|
+
.object({
|
|
54
|
+
actions: z.array(z.lazy(() => ActionModelSchema)),
|
|
55
|
+
})
|
|
56
|
+
.describe('Actions to execute when the fetch fails.'),
|
|
57
|
+
onMessage: z
|
|
58
|
+
.object({
|
|
59
|
+
actions: z.array(z.lazy(() => ActionModelSchema)),
|
|
60
|
+
})
|
|
61
|
+
.nullish()
|
|
62
|
+
.describe('Actions to execute when a message is received during streaming.'),
|
|
63
|
+
})
|
|
64
|
+
.describe('Model describing the action of fetching data from an API.');
|
|
65
|
+
const CustomActionModelSchema = z
|
|
66
|
+
.object({
|
|
67
|
+
type: z.literal('Custom'),
|
|
68
|
+
name: z.string().describe('Name of the custom action to be executed.'),
|
|
69
|
+
package: z
|
|
70
|
+
.string()
|
|
71
|
+
.nullish()
|
|
72
|
+
.describe('Package where the custom action is defined. Should not be set for local custom actions.'),
|
|
73
|
+
arguments: z
|
|
74
|
+
.array(z.object({
|
|
75
|
+
name: z.string().describe('Name of the argument.'),
|
|
76
|
+
formula: FormulaSchema.describe('Formula evaluating to the argument value.'),
|
|
77
|
+
}))
|
|
78
|
+
.nullish()
|
|
79
|
+
.describe('Arguments to pass to the custom action.'),
|
|
80
|
+
events: z
|
|
81
|
+
.record(z.string().describe('Name of the event.'), z
|
|
82
|
+
.object({
|
|
83
|
+
actions: z
|
|
84
|
+
.array(z.lazy(() => ActionModelSchema))
|
|
85
|
+
.describe('List of actions to execute when the event is triggered.'),
|
|
86
|
+
})
|
|
87
|
+
.describe('Record with one entry called "actions" which is a list of actions to execute when the event is triggered..'))
|
|
88
|
+
.nullish()
|
|
89
|
+
.describe('Record of events defined in the custom action. Each event has a list of actions to execute when the event is emitted.'),
|
|
90
|
+
version: z
|
|
91
|
+
.literal(2)
|
|
92
|
+
.nullish()
|
|
93
|
+
.describe('Version of the custom action model. This should always be 2.'),
|
|
94
|
+
})
|
|
95
|
+
.describe('Model describing the action of a custom action. A custom action is a user-defined action that can be reused across the project. A list of available custom actions has been provided as part of the system prompt.');
|
|
96
|
+
const BuiltInActionModelSchema = z
|
|
97
|
+
.object({
|
|
98
|
+
name: z
|
|
99
|
+
.string()
|
|
100
|
+
.describe('Name of the built-in action. This will always be prefixed with "@toddle/" and should match the action key in the system.'),
|
|
101
|
+
arguments: z
|
|
102
|
+
.array(z.object({
|
|
103
|
+
name: z.string().describe('Name of the argument.'),
|
|
104
|
+
formula: FormulaSchema.describe('Formula evaluating to the argument value.'),
|
|
105
|
+
}))
|
|
106
|
+
.nullish()
|
|
107
|
+
.describe('Arguments to pass to the built-in action.'),
|
|
108
|
+
events: z
|
|
109
|
+
.record(z.string().describe('Name of the event.'), z
|
|
110
|
+
.object({
|
|
111
|
+
actions: z.array(z.lazy(() => ActionModelSchema)),
|
|
112
|
+
})
|
|
113
|
+
.describe('List of actions to execute when the event is triggered.'))
|
|
114
|
+
.nullish()
|
|
115
|
+
.describe('Events that can be triggered by the built-in action. Common events include onSuccess and onError.'),
|
|
116
|
+
label: z
|
|
117
|
+
.string()
|
|
118
|
+
.describe('Label for the built-in action. This label will be used in the UI.'),
|
|
119
|
+
})
|
|
120
|
+
.describe('Model describing a built-in action provided by the Nordcraft system. Built-in actions are pre-defined actions that can be used to perform common tasks within a Nordcraft project.');
|
|
121
|
+
const SetURLParameterActionSchema = z
|
|
122
|
+
.object({
|
|
123
|
+
type: z.literal('SetURLParameter'),
|
|
124
|
+
parameter: z.string(),
|
|
125
|
+
data: FormulaSchema,
|
|
126
|
+
historyMode: z.enum(['replace', 'push']).nullish(),
|
|
127
|
+
})
|
|
128
|
+
.describe('This model is deprecated. Instead refer to SetMultiUrlParameterActionSchema.');
|
|
129
|
+
const SetMultiUrlParameterActionSchema = z
|
|
130
|
+
.object({
|
|
131
|
+
type: z.literal('SetURLParameters'),
|
|
132
|
+
parameters: z
|
|
133
|
+
.record(z.string(), FormulaSchema)
|
|
134
|
+
.describe('Record of URL parameters to set, where the key is the parameter name and the value is a formula evaluating to the parameter value.'),
|
|
135
|
+
historyMode: z
|
|
136
|
+
.enum(['replace', 'push'])
|
|
137
|
+
.nullish()
|
|
138
|
+
.describe('This determines how the URL is updated in the browser history. Use "replace" to update the current history entry without adding a new one, or "push" to create a new history entry for the URL change. If not specified, the default behavior is to use "push".'),
|
|
139
|
+
})
|
|
140
|
+
.describe('Model describing the action of setting multiple URL parameters. Use this action to update any number (1-*) of URL parameter(s) in one go.');
|
|
141
|
+
const WorkflowActionModelSchema = z
|
|
142
|
+
.object({
|
|
143
|
+
type: z.literal('TriggerWorkflow'),
|
|
144
|
+
workflow: z.string().describe('ID of the workflow to be triggered.'),
|
|
145
|
+
parameters: z
|
|
146
|
+
.record(z.string().describe('Name of the workflow parameter.'), z
|
|
147
|
+
.object({
|
|
148
|
+
formula: FormulaSchema,
|
|
149
|
+
})
|
|
150
|
+
.describe('Formula evaluating to the parameter value.'))
|
|
151
|
+
.describe('Parameters to pass to the workflow being triggered. '),
|
|
152
|
+
contextProvider: z
|
|
153
|
+
.string()
|
|
154
|
+
.nullish()
|
|
155
|
+
.describe('If the workflow being triggered is from a parent component and exposed via a context provider, this is the ID of that context provider.'),
|
|
156
|
+
})
|
|
157
|
+
.describe('Model describing the action of triggering a workflow.');
|
|
158
|
+
export const ActionModelSchema = z.lazy(() => z.union([
|
|
159
|
+
VariableActionModelSchema,
|
|
160
|
+
EventActionModelSchema,
|
|
161
|
+
SwitchActionModelSchema,
|
|
162
|
+
FetchActionModelSchema,
|
|
163
|
+
CustomActionModelSchema,
|
|
164
|
+
SetURLParameterActionSchema,
|
|
165
|
+
SetMultiUrlParameterActionSchema,
|
|
166
|
+
WorkflowActionModelSchema,
|
|
167
|
+
BuiltInActionModelSchema,
|
|
168
|
+
]));
|
|
169
|
+
//# sourceMappingURL=action-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-schema.js","sourceRoot":"","sources":["../../../src/component/schemas/action-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAYvB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAEhD,gBAAgB;AAChB,MAAM,yBAAyB,GAAmC,CAAC;KAChE,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAChE,IAAI,EAAE,aAAa,CAAC,QAAQ,CAC1B,+CAA+C,CAChD;CACF,CAAC;KACD,QAAQ,CAAC,oDAAoD,CAAC,CAAA;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N,OAAO,EAAE,aAAa;KACvB,CAAC;SACD,QAAQ,CAAC,4CAA4C,CAAC,CAC1D;SACA,QAAQ,CAAC,sDAAsD,CAAC;IACnE,eAAe,EAAE,CAAC;SACf,MAAM,EAAE;SACR,OAAO,EAAE;SACT,QAAQ,CACP,yIAAyI,CAC1I;CACJ,CAAC;KACD,QAAQ,CAAC,uDAAuD,CAAC,CAAA;AAEpE,MAAM,CAAC,MAAM,iBAAiB,GAA2B,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACnE,CAAC,CAAC,KAAK,CAAC;IACN,yBAAyB;IACzB,sBAAsB;IACtB,uBAAuB;IACvB,sBAAsB;IACtB,uBAAuB;IACvB,2BAA2B;IAC3B,gCAAgC;IAChC,yBAAyB;IACzB,wBAAwB;CACzB,CAAC,CACH,CAAA"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { EventModelSchema } from './event-schema';
|
|
3
|
+
import { FormulaSchema } from './formula-schema';
|
|
4
|
+
import { MetadataSchema } from './zod-schemas';
|
|
5
|
+
// API Models
|
|
6
|
+
const ApiMethodSchema = z
|
|
7
|
+
.enum(['GET', 'POST', 'DELETE', 'PUT', 'PATCH', 'HEAD', 'OPTIONS'])
|
|
8
|
+
.describe('HTTP method for the API request.');
|
|
9
|
+
const ApiParserModeSchema = z
|
|
10
|
+
.enum(['auto', 'text', 'json', 'event-stream', 'json-stream', 'blob'])
|
|
11
|
+
.describe('Available modes for parsing API responses.');
|
|
12
|
+
const RedirectStatusCodes = {
|
|
13
|
+
'300': 300,
|
|
14
|
+
'301': 301,
|
|
15
|
+
'302': 302,
|
|
16
|
+
'303': 303,
|
|
17
|
+
'304': 304,
|
|
18
|
+
'307': 307,
|
|
19
|
+
'308': 308,
|
|
20
|
+
};
|
|
21
|
+
const RedirectStatusCodeSchema = z
|
|
22
|
+
.enum(RedirectStatusCodes)
|
|
23
|
+
.describe('HTTP status code to use for the redirect.');
|
|
24
|
+
const ApiRequestSchema = z
|
|
25
|
+
.object({
|
|
26
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe('Metadata for the API request'),
|
|
27
|
+
version: z
|
|
28
|
+
.literal(2)
|
|
29
|
+
.describe('Version of the API request schema. This should always be 2.'),
|
|
30
|
+
name: z.string().describe('Name of the API request.'),
|
|
31
|
+
type: z.enum(['http', 'ws']).describe('Type of the API request.'),
|
|
32
|
+
method: ApiMethodSchema.nullish().describe('HTTP method for the API request.'),
|
|
33
|
+
url: FormulaSchema.nullish().describe('Base URL for the API request. Params and query strings are added when this API is called.'),
|
|
34
|
+
service: z
|
|
35
|
+
.string()
|
|
36
|
+
.nullish()
|
|
37
|
+
.describe('Name of the service to use for the API request. Only Services defined in the project can be used here.'),
|
|
38
|
+
servicePath: z
|
|
39
|
+
.string()
|
|
40
|
+
.nullish()
|
|
41
|
+
.describe('File path to the service definition. If service is defined, servicePath must also be defined.'),
|
|
42
|
+
inputs: z
|
|
43
|
+
.record(z.string().describe('Name of the input'), z
|
|
44
|
+
.object({
|
|
45
|
+
formula: FormulaSchema.nullish(),
|
|
46
|
+
})
|
|
47
|
+
.describe('Formula evaluating to the input value.'))
|
|
48
|
+
.describe('Inputs to the API request. Inputs have a default value that can be overridden when the API is started from a workflow. Inputs can be used inside any Formula in the API request definition.'),
|
|
49
|
+
path: z
|
|
50
|
+
.record(z.string().describe('Name of the path segment'), z.object({
|
|
51
|
+
formula: FormulaSchema.describe('Formula evaluating to the value of the path segment'),
|
|
52
|
+
index: z
|
|
53
|
+
.number()
|
|
54
|
+
.describe('Index defining the order of the path segments.'),
|
|
55
|
+
}))
|
|
56
|
+
.nullish()
|
|
57
|
+
.describe('Path segments to include in the API request.'),
|
|
58
|
+
queryParams: z
|
|
59
|
+
.record(z.string().describe('Name of the query parameter'), z.object({
|
|
60
|
+
formula: FormulaSchema.describe('Formula evaluating to the value of the query parameter'),
|
|
61
|
+
enabled: FormulaSchema.nullish().describe('Formula evaluating to whether the query parameter is included or not. If included it should evaluate to true.'),
|
|
62
|
+
}))
|
|
63
|
+
.nullish()
|
|
64
|
+
.describe('Query parameters to include in the API request.'),
|
|
65
|
+
headers: z
|
|
66
|
+
.record(z.string().describe('Name of the header'), z.object({
|
|
67
|
+
formula: FormulaSchema.describe('Formula evaluating to the header value'),
|
|
68
|
+
enabled: FormulaSchema.nullish().describe('Formula evaluating to whether the header is included or not. If included it should evaluate to true.'),
|
|
69
|
+
}))
|
|
70
|
+
.nullish()
|
|
71
|
+
.describe('Headers to include in the API request.'),
|
|
72
|
+
body: FormulaSchema.nullish().describe('Body of the API request.'),
|
|
73
|
+
autoFetch: FormulaSchema.nullish().describe('Indicates if the API request should be automatically fetched when the component or page loads.'),
|
|
74
|
+
client: z
|
|
75
|
+
.object({
|
|
76
|
+
parserMode: ApiParserModeSchema.describe('Defines how the API response should be parsed.'),
|
|
77
|
+
credentials: z
|
|
78
|
+
.enum(['include', 'same-origin', 'omit'])
|
|
79
|
+
.nullish()
|
|
80
|
+
.describe('Indicates whether credentials such as cookies or authorization headers should be sent with the request.'),
|
|
81
|
+
debounce: z
|
|
82
|
+
.object({ formula: FormulaSchema })
|
|
83
|
+
.nullish()
|
|
84
|
+
.describe('Debounce time in milliseconds for the API request. Useful for limiting the number of requests made when inputs change rapidly.'),
|
|
85
|
+
onCompleted: EventModelSchema.nullish().describe('Event triggered when the API request completes successfully.'),
|
|
86
|
+
onFailed: EventModelSchema.nullish().describe('Event triggered when the API request fails. This is also triggered when the isError formula evaluates to true.'),
|
|
87
|
+
onMessage: EventModelSchema.nullish().describe('Event triggered when a message is received from the API. Only applicable for WebSocket and streaming APIs.'),
|
|
88
|
+
})
|
|
89
|
+
.nullish()
|
|
90
|
+
.describe('Client-side settings for the API request.'),
|
|
91
|
+
server: z
|
|
92
|
+
.object({
|
|
93
|
+
proxy: z
|
|
94
|
+
.object({
|
|
95
|
+
enabled: z
|
|
96
|
+
.object({ formula: FormulaSchema })
|
|
97
|
+
.describe('Indicates if the API request should be proxied through the Nordcraft backend server. This is useful for avoiding CORS issues or hiding sensitive information in the request. It is also useful if the request needs access to http-only cookies.'),
|
|
98
|
+
useTemplatesInBody: z
|
|
99
|
+
.object({ formula: FormulaSchema })
|
|
100
|
+
.nullish()
|
|
101
|
+
.describe('Indicates if templates in the body should be processed when proxying the request. A template could be a http-only cookie that needs to be included in the proxied request. Enabling this flag will ensure that templates in the body are processed before sending the proxied request.'),
|
|
102
|
+
})
|
|
103
|
+
.nullish()
|
|
104
|
+
.describe('Proxy settings for the API request.'),
|
|
105
|
+
ssr: z
|
|
106
|
+
.object({
|
|
107
|
+
enabled: z
|
|
108
|
+
.object({ formula: FormulaSchema })
|
|
109
|
+
.nullish()
|
|
110
|
+
.describe('Indicates if server-side rendering is enabled for this API request. This means the API will be executed on the server during the initial page load. Note: This can have performance implications for the loading of a page on slow APIs.'),
|
|
111
|
+
})
|
|
112
|
+
.nullish()
|
|
113
|
+
.describe('Server-side rendering settings.'),
|
|
114
|
+
})
|
|
115
|
+
.nullish()
|
|
116
|
+
.describe('Server-side settings for the API request.'),
|
|
117
|
+
timeout: z
|
|
118
|
+
.object({ formula: FormulaSchema })
|
|
119
|
+
.nullish()
|
|
120
|
+
.describe('Timeout for the API request in milliseconds.'),
|
|
121
|
+
hash: z.object({ formula: FormulaSchema }).nullish(),
|
|
122
|
+
isError: z
|
|
123
|
+
.object({ formula: FormulaSchema })
|
|
124
|
+
.nullish()
|
|
125
|
+
.describe('Indicates if the last API response was an error. Useful for forcing a response to be treated as an error even if status code is 200.'),
|
|
126
|
+
redirectRules: z
|
|
127
|
+
.record(z.string().describe('The key of the redirect rule.'), z
|
|
128
|
+
.object({
|
|
129
|
+
formula: FormulaSchema.describe('Formula evaluating to the URL. If a URL is returned, the redirect will be triggered. If null is returned, no redirect will happen.'),
|
|
130
|
+
index: z
|
|
131
|
+
.number()
|
|
132
|
+
.describe('Index defining the order of the redirect rules.'),
|
|
133
|
+
statusCode: RedirectStatusCodeSchema.nullish().describe('HTTP status code to use for the redirect.'),
|
|
134
|
+
})
|
|
135
|
+
.describe('Defines a single redirect rule.'))
|
|
136
|
+
.nullish()
|
|
137
|
+
.describe('Rules for redirecting based on response data. The key is a unique identifier for the rule.'),
|
|
138
|
+
})
|
|
139
|
+
.describe('Schema defining an API request from a component or a page.');
|
|
140
|
+
const LegacyComponentAPISchema = z
|
|
141
|
+
.object({
|
|
142
|
+
type: z.literal('REST'),
|
|
143
|
+
name: z.string(),
|
|
144
|
+
method: z.enum(['GET', 'POST', 'DELETE', 'PUT']),
|
|
145
|
+
url: FormulaSchema.nullish(),
|
|
146
|
+
path: z.array(z.object({ formula: FormulaSchema })).nullish(),
|
|
147
|
+
queryParams: z
|
|
148
|
+
.record(z.string(), z.object({
|
|
149
|
+
name: z.string(),
|
|
150
|
+
formula: FormulaSchema,
|
|
151
|
+
}))
|
|
152
|
+
.nullish(),
|
|
153
|
+
headers: z
|
|
154
|
+
.union([z.record(z.string(), FormulaSchema), FormulaSchema])
|
|
155
|
+
.nullish(),
|
|
156
|
+
body: FormulaSchema.nullish(),
|
|
157
|
+
autoFetch: FormulaSchema.nullish(),
|
|
158
|
+
proxy: z.boolean().nullish(),
|
|
159
|
+
debounce: z.number().nullish(),
|
|
160
|
+
throttle: z.number().nullish(),
|
|
161
|
+
onCompleted: EventModelSchema.nullish(),
|
|
162
|
+
onFailed: EventModelSchema.nullish(),
|
|
163
|
+
auth: z
|
|
164
|
+
.object({
|
|
165
|
+
type: z.enum(['Bearer id_token', 'Bearer access_token']),
|
|
166
|
+
})
|
|
167
|
+
.nullish(),
|
|
168
|
+
})
|
|
169
|
+
.describe('Legacy API schema for backward compatibility. Never use this for new APIs.');
|
|
170
|
+
export const ComponentAPISchema = z.union([
|
|
171
|
+
LegacyComponentAPISchema,
|
|
172
|
+
ApiRequestSchema,
|
|
173
|
+
]);
|
|
174
|
+
//# sourceMappingURL=api-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-schema.js","sour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CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC9B,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE;IAC9B,WAAW,EAAE,gBAAgB,CAAC,OAAO,EAAE;IACvC,QAAQ,EAAE,gBAAgB,CAAC,OAAO,EAAE;IACpC,IAAI,EAAE,CAAC;SACJ,MAAM,CAAC;QACN,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CAAC;KACzD,CAAC;SACD,OAAO,EAAE;CACb,CAAC;KACD,QAAQ,CACP,4EAA4E,CAC7E,CAAA;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAA4B,CAAC,CAAC,KAAK,CAAC;IACjE,wBAAwB;IACxB,gBAAgB;CACjB,CAAC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { MetadataSchema, SCHEMA_DESCRIPTIONS } from './zod-schemas';
|
|
3
|
+
export const ComponentAttributeSchema = z
|
|
4
|
+
.object({
|
|
5
|
+
'@nordcraft/metadata': MetadataSchema.nullish().describe(SCHEMA_DESCRIPTIONS.metadata('component attribute')),
|
|
6
|
+
name: z.string().describe('Name of the component attribute'),
|
|
7
|
+
testValue: z
|
|
8
|
+
.any()
|
|
9
|
+
.describe(SCHEMA_DESCRIPTIONS.testData('component attribute')),
|
|
10
|
+
})
|
|
11
|
+
.describe('Schema for a component attribute.');
|
|
12
|
+
//# sourceMappingURL=attribute-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attribute-schema.js","sourceRoot":"","sources":["../../../src/component/schemas/attribute-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnE,MAAM,CAAC,MAAM,wBAAwB,GAAkC,CAAC;KACrE,MAAM,CAAC;IACN,qBAAqB,EAAE,cAAc,CAAC,OAAO,EAAE,CAAC,QAAQ,CACtD,mBAAmB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CACpD;IACD,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAC5D,SAAS,EAAE,CAAC;SACT,GAAG,EAAE;SACL,QAAQ,CAAC,mBAAmB,CAAC,QAAQ,CAAC,qBAAqB,CAAC,CAAC;CACjE,CAAC;KACD,QAAQ,CAAC,mCAAmC,CAAC,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Component, PageComponent } from '../component.types';
|
|
3
|
+
export declare const ComponentSchema: z.ZodType<Component>;
|
|
4
|
+
export declare const PageSchema: z.ZodType<PageComponent>;
|
|
5
|
+
export declare const ShallowComponentSchema: z.ZodType<Component>;
|
|
6
|
+
export declare const ShallowPageSchema: z.ZodType<PageComponent>;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ActionModelSchema } from './action-schema';
|
|
3
|
+
import { ComponentAPISchema } from './api-schema';
|
|
4
|
+
import { ComponentAttributeSchema } from './attribute-schema';
|
|
5
|
+
import { ComponentContextSchema } from './context-schema';
|
|
6
|
+
import { ComponentEventSchema } from './event-schema';
|
|
7
|
+
import { ComponentFormulaSchema } from './formula-schema';
|
|
8
|
+
import { NodeModelSchema } from './node-schema';
|
|
9
|
+
import { RouteSchema } from './route-schema';
|
|
10
|
+
import { ComponentVariableSchema } from './variable-schema';
|
|
11
|
+
import { ComponentWorkflowSchema } from './workflow-schema';
|
|
12
|
+
import { SCHEMA_DESCRIPTIONS } from './zod-schemas';
|
|
13
|
+
const commonComponentSchema = (type) => z
|
|
14
|
+
.object({
|
|
15
|
+
name: z.string().describe(`Name of the ${type}`),
|
|
16
|
+
exported: z
|
|
17
|
+
.boolean()
|
|
18
|
+
.nullish()
|
|
19
|
+
.describe(`Whether the ${type} is exported in a package project for use in other projects. Do not change this value. It should be managed by the user.`),
|
|
20
|
+
nodes: z
|
|
21
|
+
.record(z.string(), NodeModelSchema)
|
|
22
|
+
.nullish()
|
|
23
|
+
.describe(`All nodes in the ${type}, indexed by their unique IDs. Nodes represent HTML elements, text, slots, or ${type === 'component' ? 'other components' : 'components'}. They defined the UI structure of the ${type}.`),
|
|
24
|
+
variables: z
|
|
25
|
+
.record(z.string(), ComponentVariableSchema)
|
|
26
|
+
.nullish()
|
|
27
|
+
.describe(SCHEMA_DESCRIPTIONS.variables(type)),
|
|
28
|
+
formulas: z
|
|
29
|
+
.record(z.string(), ComponentFormulaSchema)
|
|
30
|
+
.nullish()
|
|
31
|
+
.describe(SCHEMA_DESCRIPTIONS.formulas(type)),
|
|
32
|
+
workflows: z
|
|
33
|
+
.record(z.string(), ComponentWorkflowSchema)
|
|
34
|
+
.nullish()
|
|
35
|
+
.describe(SCHEMA_DESCRIPTIONS.workflows(type)),
|
|
36
|
+
apis: z
|
|
37
|
+
.record(z.string(), ComponentAPISchema)
|
|
38
|
+
.nullish()
|
|
39
|
+
.describe(SCHEMA_DESCRIPTIONS.apis(type)),
|
|
40
|
+
events: z
|
|
41
|
+
.array(ComponentEventSchema)
|
|
42
|
+
.nullish()
|
|
43
|
+
.describe('All events this the component can emit. Events allow the component to communicate with its parent or other components. They can be triggered via actions.'),
|
|
44
|
+
contexts: z
|
|
45
|
+
.record(z.string(), ComponentContextSchema)
|
|
46
|
+
.nullish()
|
|
47
|
+
.describe('Defines which contexts this component is subscribed to. Contexts allow the component to access formulas and workflows from other components, enabling reusability and modular design.'),
|
|
48
|
+
onLoad: z
|
|
49
|
+
.object({
|
|
50
|
+
trigger: z.literal('Load'),
|
|
51
|
+
actions: z.array(ActionModelSchema),
|
|
52
|
+
})
|
|
53
|
+
.nullish()
|
|
54
|
+
.describe(SCHEMA_DESCRIPTIONS.onLoad(type)),
|
|
55
|
+
onAttributeChange: z
|
|
56
|
+
.object({
|
|
57
|
+
trigger: z.literal('Attribute change'),
|
|
58
|
+
actions: z.array(ActionModelSchema),
|
|
59
|
+
})
|
|
60
|
+
.nullish()
|
|
61
|
+
.describe(SCHEMA_DESCRIPTIONS.onAttributeChange(type)),
|
|
62
|
+
})
|
|
63
|
+
.describe('Schema defining a reusable Nordcraft component.');
|
|
64
|
+
export const ComponentSchema = commonComponentSchema('component').extend({
|
|
65
|
+
attributes: z
|
|
66
|
+
.record(z.string(), ComponentAttributeSchema)
|
|
67
|
+
.nullish()
|
|
68
|
+
.describe('All attributes that can be passed into the component when it is used. Attributes allow for customization and configuration of the component instance. When the value of an attribute changes, any formulas depending on it will automatically recalculate and the onAttributeChange lifecycle event is triggered.'),
|
|
69
|
+
});
|
|
70
|
+
export const PageSchema = commonComponentSchema('page').extend({
|
|
71
|
+
attributes: z
|
|
72
|
+
.object({})
|
|
73
|
+
.nullish()
|
|
74
|
+
.describe('Attributes for the page (currently none). Should always be an empty object.'),
|
|
75
|
+
route: RouteSchema.describe('Route information for the page, including path segments, query parameters, and metadata such as title and description.'),
|
|
76
|
+
});
|
|
77
|
+
const shallowCommonComponentSchema = (type) => z
|
|
78
|
+
.object({
|
|
79
|
+
name: z.string().describe(`Name of the ${type}`),
|
|
80
|
+
exported: z
|
|
81
|
+
.boolean()
|
|
82
|
+
.nullish()
|
|
83
|
+
.describe(`Whether the ${type} is exported in a package project for use in other projects. Do not change this value. It should be managed by the user.`),
|
|
84
|
+
nodes: z
|
|
85
|
+
.record(z.string(), z.any())
|
|
86
|
+
.nullish()
|
|
87
|
+
.describe(`All nodes in the ${type}, indexed by their unique IDs. Nodes represent HTML elements, text, slots, or ${type === 'component' ? 'other components' : 'components'}. They defined the UI structure of the ${type}.`),
|
|
88
|
+
variables: z
|
|
89
|
+
.record(z.string(), z.any())
|
|
90
|
+
.nullish()
|
|
91
|
+
.describe(SCHEMA_DESCRIPTIONS.variables(type)),
|
|
92
|
+
formulas: z
|
|
93
|
+
.record(z.string(), z.any())
|
|
94
|
+
.nullish()
|
|
95
|
+
.describe(SCHEMA_DESCRIPTIONS.formulas(type)),
|
|
96
|
+
workflows: z
|
|
97
|
+
.record(z.string(), z.any())
|
|
98
|
+
.nullish()
|
|
99
|
+
.describe(SCHEMA_DESCRIPTIONS.workflows(type)),
|
|
100
|
+
apis: z
|
|
101
|
+
.record(z.string(), z.any())
|
|
102
|
+
.nullish()
|
|
103
|
+
.describe(SCHEMA_DESCRIPTIONS.apis(type)),
|
|
104
|
+
events: z
|
|
105
|
+
.array(z.any())
|
|
106
|
+
.nullish()
|
|
107
|
+
.describe('All events this the component can emit. Events allow the component to communicate with its parent or other components. They can be triggered via actions.'),
|
|
108
|
+
contexts: z
|
|
109
|
+
.record(z.string(), z.any())
|
|
110
|
+
.nullish()
|
|
111
|
+
.describe('Defines which contexts this component is subscribed to. Contexts allow the component to access formulas and workflows from other components, enabling reusability and modular design.'),
|
|
112
|
+
onLoad: z.any().nullish().describe(SCHEMA_DESCRIPTIONS.onLoad(type)),
|
|
113
|
+
onAttributeChange: z
|
|
114
|
+
.any()
|
|
115
|
+
.nullish()
|
|
116
|
+
.describe(SCHEMA_DESCRIPTIONS.onAttributeChange(type)),
|
|
117
|
+
})
|
|
118
|
+
.describe('Schema defining a reusable Nordcraft component.');
|
|
119
|
+
export const ShallowComponentSchema = shallowCommonComponentSchema('component').extend({
|
|
120
|
+
attributes: z
|
|
121
|
+
.record(z.string(), z.any())
|
|
122
|
+
.nullish()
|
|
123
|
+
.describe('All attributes that can be passed into the component when it is used. Attributes allow for customization and configuration of the component instance. When the value of an attribute changes, any formulas depending on it will automatically recalculate and the onAttributeChange lifecycle event is triggered.'),
|
|
124
|
+
});
|
|
125
|
+
export const ShallowPageSchema = shallowCommonComponentSchema('page').extend({
|
|
126
|
+
attributes: z
|
|
127
|
+
.any()
|
|
128
|
+
.nullish()
|
|
129
|
+
.describe('Attributes for the page (currently none). Should always be an empty object.'),
|
|
130
|
+
route: RouteSchema.describe('Route information for the page, including path segments, query parameters, and metadata such as title and description.'),
|
|
131
|
+
});
|
|
132
|
+
//# sourceMappingURL=component-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-schema.js","sourceRoot":"","sources":["../../../src/component/schemas/component-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAA;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAEnD,MAAM,qBAAqB,GAAG,CAAC,IAA0B,EAAE,EAAE,CAC3D,CAAC;KACE,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,IAAI,EAAE,CAAC;IAChD,QAAQ,EAAE,CAAC;SACR,OAAO,EAAE;SACT,OAAO,EAAE;SACT,QAAQ,CACP,eAAe,IAAI,0HAA0H,CAC9I;IACH,KAAK,EAAE,CAAC;SACL,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,eAAe,CAAC;SACnC,OAAO,EAAE;SACT,QAAQ,CACP,oBAAoB,IAAI,iF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C,CAAC;IACpE,iBAAiB,EAAE,CAAC;SACjB,GAAG,EAAE;SACL,OAAO,EAAE;SACT,QAAQ,CAAC,mBAAmB,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;CACzD,CAAC;KACD,QAAQ,CAAC,iDAAiD,CAAC,CAAA;AAEhE,MAAM,CAAC,MAAM,sBAAsB,GACjC,4BAA4B,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;IAC/C,UAAU,EAAE,CAAC;SACV,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;SAC3B,OAAO,EAAE;SACT,QAAQ,CACP,mTAAmT,CACpT;CACJ,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,iBAAiB,GAC5B,4BAA4B,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC;IAC1C,UAAU,EAAE,CAAC;SACV,GAAG,EAAE;SACL,OAAO,EAAE;SACT,QAAQ,CACP,6EAA6E,CAC9E;IACH,KAAK,EAAE,WAAW,CAAC,QAAQ,CACzB,wHAAwH,CACzH;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const ComponentContextSchema = z
|
|
3
|
+
.object({
|
|
4
|
+
package: z
|
|
5
|
+
.string()
|
|
6
|
+
.nullish()
|
|
7
|
+
.describe('Package name of the component providing the context'),
|
|
8
|
+
componentName: z
|
|
9
|
+
.string()
|
|
10
|
+
.nullish()
|
|
11
|
+
.describe('Name of the component providing the context'),
|
|
12
|
+
formulas: z
|
|
13
|
+
.array(z.string())
|
|
14
|
+
.describe('Names of the formulas from the context to subscribe to'),
|
|
15
|
+
workflows: z
|
|
16
|
+
.array(z.string())
|
|
17
|
+
.describe('Names of the workflows from the context to subscribe to'),
|
|
18
|
+
})
|
|
19
|
+
.describe('Schema defining a component context subscription.');
|
|
20
|
+
//# sourceMappingURL=context-schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-schema.js","sourceRoot":"","sources":["../../../src/component/schemas/context-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,MAAM,CAAC,MAAM,sBAAsB,GAAgC,CAAC;KACjE,MAAM,CAAC;IACN,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,OAAO,EAAE;SACT,QAAQ,CAAC,qDAAqD,CAAC;IAClE,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,OAAO,EAAE;SACT,QAAQ,CAAC,6CAA6C,CAAC;IAC1D,QAAQ,EAAE,CAAC;SACR,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,CAAC,wDAAwD,CAAC;IACrE,SAAS,EAAE,CAAC;SACT,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,CAAC,yDAAyD,CAAC;CACvE,CAAC;KACD,QAAQ,CAAC,mDAAmD,CAAC,CAAA"}
|