@process.co/element-types 0.0.1 → 0.0.2
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/README.md +44 -21
- package/dist/index.d.ts +333 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/package.json +11 -6
- package/src/index.ts +453 -48
- package/.github/workflows/publish-element-types.yml +0 -71
- package/tsconfig.json +0 -12
package/README.md
CHANGED
|
@@ -1,39 +1,62 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @process.co/element-types
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[<img src="https://img.shields.io/npm/v/%40process.co%2Felement-types" />](https://www.npmjs.com/package/@process.co/element-types)
|
|
4
|
+
[<img src="https://img.shields.io/github/v/release/process-co/npm-element-types" />](https://github.com/process-co/npm-element-types/releases/latest)
|
|
5
|
+
[<img alt="GitHub package.json version (branch)" src="https://img.shields.io/github/package-json/v/process-co/npm-element-types/main?color=%23AA00AA" />
|
|
6
|
+
](https://github.com/process-co/npm-element-types#main)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
TypeScript types and utilities for defining Process.co Elements.
|
|
4
10
|
|
|
5
11
|
## Installation
|
|
6
12
|
|
|
7
13
|
```bash
|
|
8
|
-
# Install
|
|
9
14
|
npm install @process.co/element-types
|
|
10
15
|
```
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
### Command Line Interface
|
|
15
|
-
|
|
17
|
+
### Pinned Version
|
|
16
18
|
```bash
|
|
17
|
-
process-
|
|
19
|
+
npm install git+https://github.com/process-co/npm-element-types.git#v0.0.1
|
|
18
20
|
```
|
|
19
21
|
|
|
20
|
-
###
|
|
22
|
+
### Latest Development Version
|
|
23
|
+
```bash
|
|
24
|
+
npm install git+https://github.com/process-co/npm-element-types.git#main
|
|
25
|
+
```
|
|
21
26
|
|
|
22
|
-
|
|
23
|
-
const { loadElement } = require('@process.co/element-types');
|
|
27
|
+
## Usage
|
|
24
28
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
```typescript
|
|
30
|
+
import { defineApp } from '@process.co/element-types';
|
|
31
|
+
|
|
32
|
+
// Define the app
|
|
33
|
+
const exampleApp = defineApp({
|
|
34
|
+
type: "app",
|
|
35
|
+
app: "example_app",
|
|
36
|
+
props: {
|
|
37
|
+
someProp: {
|
|
38
|
+
label: "Some Prop",
|
|
39
|
+
description: "This is some prop",
|
|
40
|
+
type: "string",
|
|
41
|
+
},
|
|
42
|
+
} as const,
|
|
43
|
+
methods: {
|
|
44
|
+
async doSomthing(this: DeriveAppInstance<ExampleApp>, $: any, switchExpression: string, cases: Record<string, unknown>) {
|
|
45
|
+
// Implementation
|
|
46
|
+
return {};
|
|
47
|
+
},
|
|
48
|
+
// ... other methods
|
|
49
|
+
},
|
|
28
50
|
});
|
|
29
|
-
```
|
|
30
51
|
|
|
31
|
-
|
|
52
|
+
// Derive types from the implementation
|
|
53
|
+
export type ExampleApp = typeof exampleApp;
|
|
54
|
+
export type ExampleAppInstance = DeriveAppInstance<ExampleApp>;
|
|
32
55
|
|
|
33
|
-
|
|
34
|
-
import { loadElement } from '@process.co/element-types';
|
|
56
|
+
export default processInternalApp;
|
|
35
57
|
|
|
36
|
-
// Use the library
|
|
37
|
-
const result = await loadElement('./path/to/element');
|
|
38
|
-
console.log(result);
|
|
39
58
|
```
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -13,6 +13,11 @@ export type ElementNumber = {
|
|
|
13
13
|
label?: string;
|
|
14
14
|
description?: string;
|
|
15
15
|
};
|
|
16
|
+
export type ElementInteger = {
|
|
17
|
+
type: "integer";
|
|
18
|
+
label?: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
};
|
|
16
21
|
export type ElementBoolean = {
|
|
17
22
|
type: "boolean";
|
|
18
23
|
label?: string;
|
|
@@ -22,24 +27,289 @@ export type ElementApp<T> = {
|
|
|
22
27
|
type: "app";
|
|
23
28
|
app: T;
|
|
24
29
|
};
|
|
30
|
+
export type ElementAction<T> = {
|
|
31
|
+
type: "action";
|
|
32
|
+
icon?: ElementIcon;
|
|
33
|
+
label?: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
} & T;
|
|
36
|
+
export type ElementSource<T> = {
|
|
37
|
+
type: "source";
|
|
38
|
+
icon?: ElementIcon;
|
|
39
|
+
label?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
} & T;
|
|
42
|
+
export type ElementTrigger<T> = {
|
|
43
|
+
type: "trigger";
|
|
44
|
+
icon?: ElementIcon;
|
|
45
|
+
label?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
} & T;
|
|
48
|
+
export type ElementSignal<T> = {
|
|
49
|
+
type: "signal";
|
|
50
|
+
icon?: ElementIcon;
|
|
51
|
+
label?: string;
|
|
52
|
+
description?: string;
|
|
53
|
+
} & T;
|
|
54
|
+
export type ElementIcon = {
|
|
55
|
+
type: "FontAwesome" | "MaterialIcons" | "ProcessIcons" | "RemoteImage";
|
|
56
|
+
icon: string | ['far' | 'fas' | 'fab' | 'fal' | 'fad', string];
|
|
57
|
+
} | string;
|
|
58
|
+
export type ISlotDefinition = {
|
|
59
|
+
dynamic: {
|
|
60
|
+
id: string | "{{DYNAMIC_GUID}}";
|
|
61
|
+
path: string;
|
|
62
|
+
idPath: string;
|
|
63
|
+
labelPath: string;
|
|
64
|
+
enabledPath: string;
|
|
65
|
+
};
|
|
66
|
+
static: {
|
|
67
|
+
id: string;
|
|
68
|
+
label: string;
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
}[];
|
|
71
|
+
};
|
|
25
72
|
export type ModuleDefinition = {
|
|
26
73
|
type: string;
|
|
27
74
|
app: string;
|
|
28
75
|
propDefinitions: Record<string, unknown>;
|
|
29
76
|
methods: Record<string, (params: any) => Promise<unknown>>;
|
|
30
77
|
};
|
|
78
|
+
export type ProcessTicket = {
|
|
79
|
+
requestId: string;
|
|
80
|
+
timestamp: string;
|
|
81
|
+
executionId: string;
|
|
82
|
+
flowId: string;
|
|
83
|
+
source: 'webhook' | 'smtp' | 'manual' | 'scheduled';
|
|
84
|
+
verified: boolean;
|
|
85
|
+
buildId: string;
|
|
86
|
+
};
|
|
87
|
+
export type SignalEventShape = {
|
|
88
|
+
$$process: ProcessTicket;
|
|
89
|
+
method: string;
|
|
90
|
+
path: string;
|
|
91
|
+
query: {
|
|
92
|
+
[key: string]: string;
|
|
93
|
+
};
|
|
94
|
+
hostname: string;
|
|
95
|
+
headers: {
|
|
96
|
+
[key: string]: string;
|
|
97
|
+
};
|
|
98
|
+
bodyRaw: string | Buffer | NodeJS.ReadableStream | undefined;
|
|
99
|
+
body: {
|
|
100
|
+
[key: string]: JSONValue;
|
|
101
|
+
} | string | Buffer | NodeJS.ReadableStream;
|
|
102
|
+
};
|
|
103
|
+
export interface FileMetadata {
|
|
104
|
+
size: number;
|
|
105
|
+
contentType?: string;
|
|
106
|
+
lastModified?: Date;
|
|
107
|
+
name?: string;
|
|
108
|
+
etag?: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Http Response.
|
|
112
|
+
*/
|
|
113
|
+
export interface HTTPResponse {
|
|
114
|
+
/**
|
|
115
|
+
* HTTP Status
|
|
116
|
+
*/
|
|
117
|
+
status: number;
|
|
118
|
+
/**
|
|
119
|
+
* Http Body
|
|
120
|
+
*/
|
|
121
|
+
body: string | Buffer | NodeJS.ReadableStream;
|
|
122
|
+
/**
|
|
123
|
+
* If true, issue the response when the promise returned is resolved, otherwise issue
|
|
124
|
+
* the response at the end of the workflow execution
|
|
125
|
+
*/
|
|
126
|
+
immediate?: boolean;
|
|
127
|
+
headers?: SendConfigHTTPKv;
|
|
128
|
+
}
|
|
129
|
+
export interface FlowFunctions {
|
|
130
|
+
exit: (reason: string) => void;
|
|
131
|
+
delay: (ms: number, context: object) => {
|
|
132
|
+
resume_url: string;
|
|
133
|
+
cancel_url: string;
|
|
134
|
+
};
|
|
135
|
+
rerun: (ms: number, context: object) => {
|
|
136
|
+
resume_url: string;
|
|
137
|
+
cancel_url: string;
|
|
138
|
+
};
|
|
139
|
+
suspend: (ms: number, context: object) => {
|
|
140
|
+
resume_url: string;
|
|
141
|
+
cancel_url: string;
|
|
142
|
+
};
|
|
143
|
+
refreshTimeout: () => string;
|
|
144
|
+
}
|
|
145
|
+
export type SendPayload = any;
|
|
146
|
+
export interface SendConfigHTTPKv {
|
|
147
|
+
[key: string]: string;
|
|
148
|
+
}
|
|
149
|
+
export interface SendConfigHTTPAuth {
|
|
150
|
+
username: string;
|
|
151
|
+
password: string;
|
|
152
|
+
}
|
|
153
|
+
export type UppercaseHTTPMethod = "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "CONNECT" | "OPTIONS" | "TRACE" | "PATCH";
|
|
154
|
+
export type HTTPAuthenticationType = "none" | "simple" | "platform" | "external";
|
|
155
|
+
export type JSONValue = string | number | boolean | null | JSONValue[] | {
|
|
156
|
+
[key: string]: JSONValue;
|
|
157
|
+
};
|
|
158
|
+
export interface SendConfigHTTP {
|
|
159
|
+
method?: UppercaseHTTPMethod;
|
|
160
|
+
url: string;
|
|
161
|
+
headers?: SendConfigHTTPKv;
|
|
162
|
+
params?: SendConfigHTTPKv;
|
|
163
|
+
auth?: SendConfigHTTPAuth;
|
|
164
|
+
data?: SendPayload;
|
|
165
|
+
}
|
|
166
|
+
export interface SendConfigS3 {
|
|
167
|
+
bucket: string;
|
|
168
|
+
prefix: string;
|
|
169
|
+
payload: SendPayload;
|
|
170
|
+
}
|
|
171
|
+
export interface SendConfigEmail {
|
|
172
|
+
subject: string;
|
|
173
|
+
text?: string;
|
|
174
|
+
html?: string;
|
|
175
|
+
}
|
|
176
|
+
export interface SendConfigEmit {
|
|
177
|
+
raw_event: SendPayload;
|
|
178
|
+
}
|
|
179
|
+
export interface SendConfigSSE {
|
|
180
|
+
channel: string;
|
|
181
|
+
payload: SendPayload;
|
|
182
|
+
}
|
|
183
|
+
export interface SendFunctionsWrapper {
|
|
184
|
+
http: (config: SendConfigHTTP) => void;
|
|
185
|
+
email: (config: SendConfigEmail) => void;
|
|
186
|
+
emit: (config: SendConfigEmit) => void;
|
|
187
|
+
s3: (config: SendConfigS3) => void;
|
|
188
|
+
sse: (config: SendConfigSSE) => void;
|
|
189
|
+
}
|
|
190
|
+
export interface IFile {
|
|
191
|
+
delete(): Promise<void>;
|
|
192
|
+
createReadStream(): Promise<NodeJS.ReadableStream>;
|
|
193
|
+
createWriteStream(contentType?: string, contentLength?: number): Promise<NodeJS.WritableStream>;
|
|
194
|
+
toEncodedString(encoding?: string, start?: number, end?: number): Promise<string>;
|
|
195
|
+
toUrl(): Promise<string>;
|
|
196
|
+
toFile(localFilePath: string): Promise<void>;
|
|
197
|
+
toBuffer(): Promise<Buffer>;
|
|
198
|
+
fromReadableStream(readableStream: NodeJS.ReadableStream, contentType?: string, contentSize?: number): Promise<IFile>;
|
|
199
|
+
fromFile(localFilePath: string, contentType?: string): Promise<IFile>;
|
|
200
|
+
fromUrl(url: string, options?: any): Promise<IFile>;
|
|
201
|
+
toJSON(): any;
|
|
202
|
+
}
|
|
203
|
+
export interface IApi {
|
|
204
|
+
open(path: string): IFile;
|
|
205
|
+
openDescriptor(descriptor: any): IFile;
|
|
206
|
+
dir(path?: string): AsyncGenerator<{
|
|
207
|
+
isDirectory: () => boolean;
|
|
208
|
+
isFile: () => boolean;
|
|
209
|
+
path: string;
|
|
210
|
+
name: string;
|
|
211
|
+
size?: number;
|
|
212
|
+
modifiedAt?: Date;
|
|
213
|
+
file?: IFile;
|
|
214
|
+
}>;
|
|
215
|
+
}
|
|
216
|
+
export interface SlotDefinition {
|
|
217
|
+
id: string;
|
|
218
|
+
label: string;
|
|
219
|
+
}
|
|
220
|
+
export interface ProcessInternalFunctions extends ProcessFunctions {
|
|
221
|
+
$transitionToSlot(SlotDefinition: SlotDefinition): void;
|
|
222
|
+
}
|
|
223
|
+
export interface FlowControlExtensions {
|
|
224
|
+
$$innerSlots?: Record<string, string>;
|
|
225
|
+
$$event?: 'slotCompletionEvent' | 'slotIterationEvent';
|
|
226
|
+
$$iteration?: number;
|
|
227
|
+
$$slotId?: string;
|
|
228
|
+
}
|
|
229
|
+
export interface ProcessFunctions {
|
|
230
|
+
export: (key: string, value: JSONValue) => void;
|
|
231
|
+
send: SendFunctionsWrapper;
|
|
232
|
+
/**
|
|
233
|
+
* Respond to an HTTP interface.
|
|
234
|
+
* @param response Define the status and body of the request.
|
|
235
|
+
* @returns A promise that is fulfilled when the body is read or an immediate response is issued
|
|
236
|
+
*/
|
|
237
|
+
respond: (response: HTTPResponse) => Promise<any> | void;
|
|
238
|
+
flow: FlowFunctions;
|
|
239
|
+
files: IApi;
|
|
240
|
+
}
|
|
241
|
+
export interface ActionRunOptions<T extends ProcessFunctions = ProcessFunctions> {
|
|
242
|
+
$: T;
|
|
243
|
+
steps: JSONValue;
|
|
244
|
+
}
|
|
245
|
+
export interface EmitMetadata {
|
|
246
|
+
id?: string | number;
|
|
247
|
+
name?: string;
|
|
248
|
+
summary?: string;
|
|
249
|
+
ts?: number;
|
|
250
|
+
}
|
|
251
|
+
export interface IdEmitMetadata extends EmitMetadata {
|
|
252
|
+
id: string | number;
|
|
253
|
+
}
|
|
254
|
+
type EmitFunction = {
|
|
255
|
+
$emit: (event: SignalEventShape | SignalEventShape["body"] | SignalEventShape["bodyRaw"] | JSONValue, metadata?: EmitMetadata) => Promise<void>;
|
|
256
|
+
};
|
|
257
|
+
type StringToType<S extends string> = S extends "string" ? string : S extends "number" ? number : S extends "boolean" ? boolean : S extends "null" ? null : S extends "undefined" ? undefined : S extends "object" ? object : S extends "any" ? any : S extends "unknown" ? unknown : S extends "never" ? never : S extends "void" ? void : never;
|
|
258
|
+
type TrimSpaces<S extends string> = S extends ` ${infer R}` ? TrimSpaces<R> : S extends `${infer R} ` ? TrimSpaces<R> : S;
|
|
259
|
+
type ParseUnion<S extends string> = S extends `${infer A}|${infer B}` ? StringToType<TrimSpaces<A>> | ParseUnion<B> : StringToType<TrimSpaces<S>>;
|
|
260
|
+
type InferType<T extends string> = T extends `$infer<${infer Inner}>` ? ParseUnion<Inner> : any;
|
|
31
261
|
export type PropType<T> = T extends {
|
|
32
262
|
props: Record<string, any>;
|
|
33
263
|
methods: Record<string, any>;
|
|
34
264
|
} ? DeriveAppInstance<T> : T extends {
|
|
265
|
+
propDefinition: readonly [infer App, infer PropName];
|
|
266
|
+
} ? App extends {
|
|
267
|
+
propDefinitions: Record<string, any>;
|
|
268
|
+
} ? PropName extends keyof App["propDefinitions"] ? PropType<App["propDefinitions"][PropName]> : App extends {
|
|
269
|
+
props: Record<string, any>;
|
|
270
|
+
} ? PropName extends keyof App["props"] ? PropType<App["props"][PropName]> : unknown : unknown : App extends {
|
|
271
|
+
props: Record<string, any>;
|
|
272
|
+
} ? PropName extends keyof App["props"] ? PropType<App["props"][PropName]> : unknown : unknown : T extends {
|
|
273
|
+
props: Record<string, any>;
|
|
274
|
+
} ? {
|
|
275
|
+
[K in keyof T["props"]]: PropType<T["props"][K]>;
|
|
276
|
+
} : T extends {
|
|
277
|
+
type: "http_request";
|
|
278
|
+
} ? {
|
|
279
|
+
execute: () => Promise<{
|
|
280
|
+
headers?: Record<string, string>;
|
|
281
|
+
[key: string]: any;
|
|
282
|
+
}>;
|
|
283
|
+
} : T extends {
|
|
35
284
|
type: "string";
|
|
36
285
|
} ? string : T extends {
|
|
286
|
+
type: `$infer<${string}>`;
|
|
287
|
+
} ? T extends {
|
|
288
|
+
type: infer S extends string;
|
|
289
|
+
} ? InferType<S> : any : T extends {
|
|
290
|
+
type: "$infer";
|
|
291
|
+
} ? any : T extends {
|
|
37
292
|
type: "object";
|
|
38
293
|
} ? Record<string, unknown> : T extends {
|
|
39
294
|
type: "number";
|
|
40
295
|
} ? number : T extends {
|
|
41
296
|
type: "boolean";
|
|
42
|
-
} ? boolean :
|
|
297
|
+
} ? boolean : T extends {
|
|
298
|
+
type: "integer";
|
|
299
|
+
} ? number : T extends {
|
|
300
|
+
type: "$.interface.http";
|
|
301
|
+
} ? {
|
|
302
|
+
respond: (response: HTTPResponse) => Promise<any> | void;
|
|
303
|
+
authenticate: (authType: HTTPAuthenticationType, options?: {
|
|
304
|
+
token?: string;
|
|
305
|
+
}) => Promise<any> | void;
|
|
306
|
+
flow: FlowFunctions;
|
|
307
|
+
end: () => void;
|
|
308
|
+
execute: () => Promise<{
|
|
309
|
+
headers?: Record<string, string>;
|
|
310
|
+
[key: string]: any;
|
|
311
|
+
}>;
|
|
312
|
+
} : unknown;
|
|
43
313
|
export type ModuleShape = {
|
|
44
314
|
type: string;
|
|
45
315
|
props: Record<string, any>;
|
|
@@ -48,32 +318,52 @@ export type ModuleShape = {
|
|
|
48
318
|
export type Spread<T> = {
|
|
49
319
|
[K in keyof T]: T[K];
|
|
50
320
|
};
|
|
51
|
-
export type DeriveAppInstance<T> = T extends {
|
|
52
|
-
methods: Record<string, any>;
|
|
321
|
+
export type DeriveAppInstance<T> = Spread<Omit<T, "props" | "propDefinitions" | "methods"> & (T extends {
|
|
53
322
|
props: Record<string, any>;
|
|
54
|
-
} ?
|
|
323
|
+
} ? {
|
|
55
324
|
[K in keyof T["props"]]: PropType<T["props"][K]>;
|
|
56
|
-
} & {
|
|
325
|
+
} : {}) & (T extends {
|
|
326
|
+
propDefinitions: Record<string, any>;
|
|
327
|
+
} ? {
|
|
328
|
+
[K in keyof T["propDefinitions"]]: PropType<T["propDefinitions"][K]>;
|
|
329
|
+
} : {}) & EmitFunction & (T extends {
|
|
330
|
+
methods: Record<string, any>;
|
|
331
|
+
} ? {
|
|
57
332
|
[K in keyof T["methods"]]: T["methods"][K];
|
|
58
|
-
}
|
|
59
|
-
|
|
333
|
+
} : {}) & {
|
|
334
|
+
[K in keyof T as K extends "props" | "propDefinitions" | "methods" ? never : K]: T[K];
|
|
335
|
+
}>;
|
|
336
|
+
export type DeriveSignalInstance<T> = Spread<Omit<T, "props" | "propDefinitions" | "methods"> & (T extends {
|
|
337
|
+
props: Record<string, any>;
|
|
338
|
+
} ? {
|
|
339
|
+
[K in keyof T["props"]]: PropType<T["props"][K]>;
|
|
340
|
+
} : {}) & (T extends {
|
|
341
|
+
propDefinitions: Record<string, any>;
|
|
342
|
+
} ? {
|
|
343
|
+
[K in keyof T["propDefinitions"]]: PropType<T["propDefinitions"][K]>;
|
|
344
|
+
} : {}) & EmitFunction & (T extends {
|
|
60
345
|
methods: Record<string, any>;
|
|
346
|
+
} ? {
|
|
347
|
+
[K in keyof T["methods"]]: T["methods"][K];
|
|
348
|
+
} : {}) & {
|
|
349
|
+
[K in keyof T as K extends "props" | "propDefinitions" | "methods" ? never : K]: T[K];
|
|
350
|
+
}>;
|
|
351
|
+
export type PropDefinitionType<App, PropName extends string> = App extends {
|
|
352
|
+
propDefinitions: Record<string, any>;
|
|
353
|
+
} ? PropName extends keyof App['propDefinitions'] ? PropType<App['propDefinitions'][PropName]> : unknown : unknown;
|
|
354
|
+
export type DeriveActionInstance<T> = Spread<Omit<T, "props" | "propDefinitions" | "methods"> & (T extends {
|
|
61
355
|
props: Record<string, any>;
|
|
62
|
-
} ?
|
|
63
|
-
[K in keyof T["props"]]: T["props"][K]
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
methods: Record<string, any>;
|
|
72
|
-
props: Record<string, any>;
|
|
73
|
-
} ? DeriveActionInstance<T["props"][K]> : T["props"][K];
|
|
74
|
-
} & {
|
|
356
|
+
} ? {
|
|
357
|
+
[K in keyof T["props"]]: PropType<T["props"][K]>;
|
|
358
|
+
} : {}) & (T extends {
|
|
359
|
+
propDefinitions: Record<string, any>;
|
|
360
|
+
} ? {
|
|
361
|
+
[K in keyof T["propDefinitions"]]: PropType<T["propDefinitions"][K]>;
|
|
362
|
+
} : {}) & (T extends {
|
|
363
|
+
methods: Record<string, any>;
|
|
364
|
+
} ? {
|
|
75
365
|
[K in keyof T["methods"]]: T["methods"][K];
|
|
76
|
-
}
|
|
366
|
+
} : {})>;
|
|
77
367
|
export type ModuleWithThis<T> = T & ThisType<DeriveActionInstance<T>>;
|
|
78
368
|
export interface Action<P extends Record<string, any> = Record<string, any>> extends ModuleDefinition {
|
|
79
369
|
type: "action";
|
|
@@ -82,7 +372,16 @@ export interface Action<P extends Record<string, any> = Record<string, any>> ext
|
|
|
82
372
|
$: any;
|
|
83
373
|
}) => Promise<unknown>;
|
|
84
374
|
}
|
|
375
|
+
export interface Signal<P extends Record<string, any> = Record<string, any>> extends ModuleDefinition {
|
|
376
|
+
type: "signal";
|
|
377
|
+
props: P;
|
|
378
|
+
run: (this: DeriveSignalInstance<Signal<P>>, params: {
|
|
379
|
+
event: SignalEventShape;
|
|
380
|
+
}) => Promise<unknown>;
|
|
381
|
+
}
|
|
85
382
|
export type ActionInstance<A extends Action> = DeriveActionInstance<A>;
|
|
383
|
+
export type SignalInstance<S extends Signal> = DeriveSignalInstance<S>;
|
|
384
|
+
export type SignalMethod<S extends Signal> = (this: SignalInstance<S>, params: SignalEventShape) => Promise<unknown>;
|
|
86
385
|
export type ActionMethod<A extends Action> = (this: ActionInstance<A>, params: {
|
|
87
386
|
$: any;
|
|
88
387
|
}) => Promise<unknown>;
|
|
@@ -94,6 +393,18 @@ export type PropDefinition = {
|
|
|
94
393
|
};
|
|
95
394
|
export declare function defineApp<T extends object>(app: T & ThisType<DeriveAppInstance<T>>): T;
|
|
96
395
|
export declare function defineAction<T extends object>(action: T & ThisType<DeriveActionInstance<T>>): T;
|
|
396
|
+
export declare function defineSignal<T extends {
|
|
397
|
+
run: (event: SignalEventShape) => Promise<void>;
|
|
398
|
+
}>(signal: T & ThisType<DeriveSignalInstance<T>>): T;
|
|
399
|
+
export type OnChangeOpts = {
|
|
400
|
+
layoutShift?: boolean;
|
|
401
|
+
};
|
|
402
|
+
export type ElementUIProps<T> = {
|
|
403
|
+
onChange: (value: T, opts?: OnChangeOpts) => void;
|
|
404
|
+
onBlur: () => void;
|
|
405
|
+
value: T;
|
|
406
|
+
readonly?: boolean;
|
|
407
|
+
};
|
|
97
408
|
export type WithThis<T> = T extends {
|
|
98
409
|
methods: Record<string, any>;
|
|
99
410
|
props: Record<string, any>;
|
|
@@ -102,4 +413,5 @@ export type WithThis<T> = T extends {
|
|
|
102
413
|
[K in keyof T['methods']]: T['methods'][K] extends (...args: infer A) => infer R ? (this: DeriveActionInstance<T>, ...args: A) => R : T['methods'][K];
|
|
103
414
|
};
|
|
104
415
|
} : T;
|
|
416
|
+
export {};
|
|
105
417
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACrF,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACrF,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACrF,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AACvF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,GAAG,EAAE,CAAC,CAAA;CAAE,CAAC;AAGpD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAA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2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.defineApp = defineApp;
|
|
4
4
|
exports.defineAction = defineAction;
|
|
5
|
+
exports.defineSignal = defineSignal;
|
|
5
6
|
// Helper to provide ThisType context for app definitions
|
|
6
7
|
function defineApp(app) {
|
|
7
8
|
return app;
|
|
@@ -10,4 +11,7 @@ function defineApp(app) {
|
|
|
10
11
|
function defineAction(action) {
|
|
11
12
|
return action;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
function defineSignal(signal) {
|
|
15
|
+
return signal;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUE4ZEEsOEJBRUM7QUFHRCxvQ0FFQztBQUVELG9DQUVDO0FBWkQseURBQXlEO0FBQ3pELFNBQWdCLFNBQVMsQ0FBbUIsR0FBdUM7SUFDL0UsT0FBTyxHQUFHLENBQUM7QUFDZixDQUFDO0FBRUQsNERBQTREO0FBQzVELFNBQWdCLFlBQVksQ0FBbUIsTUFBNkM7SUFDeEYsT0FBTyxNQUFNLENBQUM7QUFDbEIsQ0FBQztBQUVELFNBQWdCLFlBQVksQ0FBZ0UsTUFBNkM7SUFDckksT0FBTyxNQUFNLENBQUM7QUFDbEIsQ0FBQyJ9
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@process.co/element-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "tsc"
|
|
8
|
+
},
|
|
6
9
|
"repository": {
|
|
7
10
|
"type": "git",
|
|
8
11
|
"url": "git+https://github.com/process-co/npm-element-types.git"
|
|
@@ -22,9 +25,11 @@
|
|
|
22
25
|
"name": "Process.co Team",
|
|
23
26
|
"email": "developers@process.co"
|
|
24
27
|
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@repo/config-typescript": "workspace:^",
|
|
30
|
+
"@types/node": "^22.13.14",
|
|
31
|
+
"typescript": "^5.7.3"
|
|
32
|
+
},
|
|
25
33
|
"license": "ISC",
|
|
26
|
-
"registry": "https://registry.npmjs.org"
|
|
27
|
-
|
|
28
|
-
"build": "tsc"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
34
|
+
"registry": "https://registry.npmjs.org"
|
|
35
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -2,103 +2,508 @@
|
|
|
2
2
|
export type ElementString = { type: "string"; label?: string; description?: string };
|
|
3
3
|
export type ElementObject = { type: "object"; label?: string; description?: string };
|
|
4
4
|
export type ElementNumber = { type: "number"; label?: string; description?: string };
|
|
5
|
+
export type ElementInteger = { type: "integer"; label?: string; description?: string };
|
|
5
6
|
export type ElementBoolean = { type: "boolean"; label?: string; description?: string };
|
|
6
7
|
export type ElementApp<T> = { type: "app"; app: T };
|
|
7
8
|
|
|
9
|
+
export type ElementAction<T> = { type: "action"; icon?: ElementIcon; label?: string; description?: string } & T;
|
|
10
|
+
export type ElementSource<T> = { type: "source"; icon?: ElementIcon; label?: string; description?: string } & T;
|
|
11
|
+
export type ElementTrigger<T> = { type: "trigger"; icon?: ElementIcon; label?: string; description?: string } & T;
|
|
12
|
+
export type ElementSignal<T> = { type: "signal"; icon?: ElementIcon; label?: string; description?: string } & T;
|
|
13
|
+
|
|
14
|
+
export type ElementIcon = { type: "FontAwesome" | "MaterialIcons" | "ProcessIcons" | "RemoteImage"; icon: string | ['far' | 'fas' | 'fab' | 'fal' | 'fad', string] } | string;
|
|
15
|
+
|
|
16
|
+
export type ISlotDefinition = {
|
|
17
|
+
dynamic: {
|
|
18
|
+
id: string | "{{DYNAMIC_GUID}}";
|
|
19
|
+
path: string;
|
|
20
|
+
idPath: string;
|
|
21
|
+
labelPath: string;
|
|
22
|
+
enabledPath: string;
|
|
23
|
+
};
|
|
24
|
+
static: {
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
enabled: boolean;
|
|
28
|
+
}[];
|
|
29
|
+
}
|
|
30
|
+
|
|
8
31
|
// Base types for module definitions
|
|
9
32
|
export type ModuleDefinition = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
33
|
+
type: string;
|
|
34
|
+
app: string;
|
|
35
|
+
propDefinitions: Record<string, unknown>;
|
|
36
|
+
methods: Record<string, (params: any) => Promise<unknown>>;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type ProcessTicket = {
|
|
40
|
+
requestId: string;
|
|
41
|
+
timestamp: string;
|
|
42
|
+
executionId: string;
|
|
43
|
+
flowId: string;
|
|
44
|
+
source: 'webhook' | 'smtp' | 'manual' | 'scheduled';
|
|
45
|
+
verified: boolean;
|
|
46
|
+
buildId: string;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type SignalEventShape = {
|
|
50
|
+
|
|
51
|
+
$$process: ProcessTicket;
|
|
52
|
+
|
|
53
|
+
method: string;
|
|
54
|
+
|
|
55
|
+
path: string;
|
|
56
|
+
|
|
57
|
+
query: {
|
|
58
|
+
[key: string]: string;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
hostname: string;
|
|
62
|
+
|
|
63
|
+
headers: {
|
|
64
|
+
[key: string]: string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
bodyRaw: string | Buffer | NodeJS.ReadableStream | undefined;
|
|
68
|
+
|
|
69
|
+
body: {
|
|
70
|
+
[key: string]: JSONValue;
|
|
71
|
+
} | string | Buffer | NodeJS.ReadableStream;
|
|
72
|
+
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export interface FileMetadata {
|
|
76
|
+
size: number;
|
|
77
|
+
contentType?: string;
|
|
78
|
+
lastModified?: Date;
|
|
79
|
+
name?: string;
|
|
80
|
+
etag?: string;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Http Response.
|
|
85
|
+
*/
|
|
86
|
+
export interface HTTPResponse {
|
|
87
|
+
/**
|
|
88
|
+
* HTTP Status
|
|
89
|
+
*/
|
|
90
|
+
status: number;
|
|
91
|
+
/**
|
|
92
|
+
* Http Body
|
|
93
|
+
*/
|
|
94
|
+
body: string | Buffer | NodeJS.ReadableStream;
|
|
95
|
+
/**
|
|
96
|
+
* If true, issue the response when the promise returned is resolved, otherwise issue
|
|
97
|
+
* the response at the end of the workflow execution
|
|
98
|
+
*/
|
|
99
|
+
immediate?: boolean;
|
|
100
|
+
|
|
101
|
+
headers?: SendConfigHTTPKv;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface FlowFunctions {
|
|
105
|
+
exit: (reason: string) => void;
|
|
106
|
+
delay: (ms: number, context: object) => {
|
|
107
|
+
resume_url: string;
|
|
108
|
+
cancel_url: string;
|
|
109
|
+
};
|
|
110
|
+
rerun: (ms: number, context: object) => {
|
|
111
|
+
resume_url: string;
|
|
112
|
+
cancel_url: string;
|
|
113
|
+
};
|
|
114
|
+
suspend: (ms: number, context: object) => {
|
|
115
|
+
resume_url: string;
|
|
116
|
+
cancel_url: string;
|
|
117
|
+
};
|
|
118
|
+
refreshTimeout: () => string;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export type SendPayload = any;
|
|
122
|
+
|
|
123
|
+
export interface SendConfigHTTPKv {
|
|
124
|
+
[key: string]: string;
|
|
125
|
+
}
|
|
126
|
+
export interface SendConfigHTTPAuth {
|
|
127
|
+
username: string;
|
|
128
|
+
password: string;
|
|
129
|
+
}
|
|
130
|
+
export type UppercaseHTTPMethod =
|
|
131
|
+
| "GET"
|
|
132
|
+
| "HEAD"
|
|
133
|
+
| "POST"
|
|
134
|
+
| "PUT"
|
|
135
|
+
| "DELETE"
|
|
136
|
+
| "CONNECT"
|
|
137
|
+
| "OPTIONS"
|
|
138
|
+
| "TRACE"
|
|
139
|
+
| "PATCH";
|
|
140
|
+
|
|
141
|
+
export type HTTPAuthenticationType = "none" | "simple" | "platform" | "external";
|
|
142
|
+
|
|
143
|
+
export type JSONValue =
|
|
144
|
+
| string
|
|
145
|
+
| number
|
|
146
|
+
| boolean
|
|
147
|
+
| null
|
|
148
|
+
| JSONValue[]
|
|
149
|
+
| { [key: string]: JSONValue; };
|
|
150
|
+
|
|
151
|
+
export interface SendConfigHTTP {
|
|
152
|
+
method?: UppercaseHTTPMethod;
|
|
153
|
+
url: string;
|
|
154
|
+
headers?: SendConfigHTTPKv;
|
|
155
|
+
params?: SendConfigHTTPKv;
|
|
156
|
+
auth?: SendConfigHTTPAuth;
|
|
157
|
+
data?: SendPayload;
|
|
158
|
+
}
|
|
159
|
+
export interface SendConfigS3 {
|
|
160
|
+
bucket: string;
|
|
161
|
+
prefix: string;
|
|
162
|
+
payload: SendPayload;
|
|
163
|
+
}
|
|
164
|
+
export interface SendConfigEmail {
|
|
165
|
+
subject: string;
|
|
166
|
+
text?: string;
|
|
167
|
+
html?: string;
|
|
168
|
+
}
|
|
169
|
+
export interface SendConfigEmit {
|
|
170
|
+
raw_event: SendPayload;
|
|
171
|
+
}
|
|
172
|
+
export interface SendConfigSSE {
|
|
173
|
+
channel: string;
|
|
174
|
+
payload: SendPayload;
|
|
175
|
+
}
|
|
176
|
+
export interface SendFunctionsWrapper {
|
|
177
|
+
http: (config: SendConfigHTTP) => void;
|
|
178
|
+
email: (config: SendConfigEmail) => void;
|
|
179
|
+
emit: (config: SendConfigEmit) => void;
|
|
180
|
+
s3: (config: SendConfigS3) => void;
|
|
181
|
+
sse: (config: SendConfigSSE) => void;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export interface IFile {
|
|
185
|
+
delete(): Promise<void>;
|
|
186
|
+
createReadStream(): Promise<NodeJS.ReadableStream>;
|
|
187
|
+
createWriteStream(contentType?: string, contentLength?: number): Promise<NodeJS.WritableStream>;
|
|
188
|
+
toEncodedString(encoding?: string, start?: number, end?: number): Promise<string>;
|
|
189
|
+
toUrl(): Promise<string>;
|
|
190
|
+
toFile(localFilePath: string): Promise<void>;
|
|
191
|
+
toBuffer(): Promise<Buffer>;
|
|
192
|
+
fromReadableStream(readableStream: NodeJS.ReadableStream, contentType?: string, contentSize?: number): Promise<IFile>;
|
|
193
|
+
fromFile(localFilePath: string, contentType?: string): Promise<IFile>;
|
|
194
|
+
fromUrl(url: string, options?: any): Promise<IFile>;
|
|
195
|
+
toJSON(): any;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface IApi {
|
|
199
|
+
open(path: string): IFile;
|
|
200
|
+
openDescriptor(descriptor: any): IFile;
|
|
201
|
+
dir(path?: string): AsyncGenerator<{
|
|
202
|
+
isDirectory: () => boolean;
|
|
203
|
+
isFile: () => boolean;
|
|
204
|
+
path: string;
|
|
205
|
+
name: string;
|
|
206
|
+
size?: number;
|
|
207
|
+
modifiedAt?: Date;
|
|
208
|
+
file?: IFile;
|
|
209
|
+
}>;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export interface SlotDefinition {
|
|
213
|
+
id: string;
|
|
214
|
+
label: string;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export interface ProcessInternalFunctions extends ProcessFunctions {
|
|
218
|
+
$transitionToSlot(SlotDefinition: SlotDefinition): void;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface FlowControlExtensions {
|
|
222
|
+
$$innerSlots?: Record<string, string>;
|
|
223
|
+
$$event?: 'slotCompletionEvent' | 'slotIterationEvent';
|
|
224
|
+
$$iteration?: number;
|
|
225
|
+
$$slotId?: string;
|
|
226
|
+
// /$transitionToSlot(slotId: string): void;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export interface ProcessFunctions {
|
|
230
|
+
|
|
231
|
+
export: (key: string, value: JSONValue) => void;
|
|
232
|
+
|
|
233
|
+
send: SendFunctionsWrapper;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Respond to an HTTP interface.
|
|
237
|
+
* @param response Define the status and body of the request.
|
|
238
|
+
* @returns A promise that is fulfilled when the body is read or an immediate response is issued
|
|
239
|
+
*/
|
|
240
|
+
respond: (response: HTTPResponse) => Promise<any> | void;
|
|
241
|
+
|
|
242
|
+
flow: FlowFunctions;
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
// end: () => void;
|
|
247
|
+
|
|
248
|
+
files: IApi;
|
|
249
|
+
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface ActionRunOptions<T extends ProcessFunctions = ProcessFunctions> {
|
|
253
|
+
|
|
254
|
+
$: T;
|
|
255
|
+
|
|
256
|
+
steps: JSONValue;
|
|
257
|
+
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export interface EmitMetadata {
|
|
261
|
+
id?: string | number;
|
|
262
|
+
name?: string;
|
|
263
|
+
summary?: string;
|
|
264
|
+
ts?: number;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export interface IdEmitMetadata extends EmitMetadata {
|
|
268
|
+
id: string | number;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
type EmitFunction = {
|
|
272
|
+
$emit: (event: SignalEventShape | SignalEventShape["body"] | SignalEventShape["bodyRaw"] | JSONValue, metadata?: EmitMetadata) => Promise<void>;
|
|
14
273
|
};
|
|
15
274
|
|
|
275
|
+
type IdEmitFunction = {
|
|
276
|
+
$emit: (event: JSONValue, metadata: IdEmitMetadata) => Promise<void>;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// ============================================
|
|
280
|
+
// Template literal type parsing for $infer<T>
|
|
281
|
+
// ============================================
|
|
282
|
+
|
|
283
|
+
// Map string literals to actual types
|
|
284
|
+
type StringToType<S extends string> =
|
|
285
|
+
S extends "string" ? string :
|
|
286
|
+
S extends "number" ? number :
|
|
287
|
+
S extends "boolean" ? boolean :
|
|
288
|
+
S extends "null" ? null :
|
|
289
|
+
S extends "undefined" ? undefined :
|
|
290
|
+
S extends "object" ? object :
|
|
291
|
+
S extends "any" ? any :
|
|
292
|
+
S extends "unknown" ? unknown :
|
|
293
|
+
S extends "never" ? never :
|
|
294
|
+
S extends "void" ? void :
|
|
295
|
+
never;
|
|
296
|
+
|
|
297
|
+
// Trim leading/trailing spaces
|
|
298
|
+
type TrimSpaces<S extends string> =
|
|
299
|
+
S extends ` ${infer R}` ? TrimSpaces<R> :
|
|
300
|
+
S extends `${infer R} ` ? TrimSpaces<R> :
|
|
301
|
+
S;
|
|
302
|
+
|
|
303
|
+
// Parse union types separated by |
|
|
304
|
+
type ParseUnion<S extends string> =
|
|
305
|
+
S extends `${infer A}|${infer B}`
|
|
306
|
+
? StringToType<TrimSpaces<A>> | ParseUnion<B>
|
|
307
|
+
: StringToType<TrimSpaces<S>>;
|
|
308
|
+
|
|
309
|
+
// Extract and parse the type parameter from $infer<...>
|
|
310
|
+
type InferType<T extends string> =
|
|
311
|
+
T extends `$infer<${infer Inner}>`
|
|
312
|
+
? ParseUnion<Inner>
|
|
313
|
+
: any; // fallback to any if no generic specified
|
|
314
|
+
|
|
16
315
|
// Utility type for transforming prop definitions to their runtime types
|
|
17
316
|
export type PropType<T> =
|
|
18
|
-
|
|
317
|
+
// 1. If T is an app definition, derive its instance type
|
|
318
|
+
T extends { props: Record<string, any>; methods: Record<string, any> }
|
|
19
319
|
? DeriveAppInstance<T>
|
|
320
|
+
// 2. If T is a propDefinition, resolve from propDefinitions or props
|
|
321
|
+
: T extends { propDefinition: readonly [infer App, infer PropName] }
|
|
322
|
+
? App extends { propDefinitions: Record<string, any> }
|
|
323
|
+
? PropName extends keyof App["propDefinitions"]
|
|
324
|
+
? PropType<App["propDefinitions"][PropName]>
|
|
325
|
+
: App extends { props: Record<string, any> }
|
|
326
|
+
? PropName extends keyof App["props"]
|
|
327
|
+
? PropType<App["props"][PropName]>
|
|
328
|
+
: unknown
|
|
329
|
+
: unknown
|
|
330
|
+
: App extends { props: Record<string, any> }
|
|
331
|
+
? PropName extends keyof App["props"]
|
|
332
|
+
? PropType<App["props"][PropName]>
|
|
333
|
+
: unknown
|
|
334
|
+
: unknown
|
|
335
|
+
// 3. Nested objects (recursion) - handle objects with their own props
|
|
336
|
+
: T extends { props: Record<string, any> }
|
|
337
|
+
? { [K in keyof T["props"]]: PropType<T["props"][K]> }
|
|
338
|
+
// 4. Built-in types
|
|
339
|
+
: T extends { type: "http_request" }
|
|
340
|
+
? { execute: () => Promise<{ headers?: Record<string, string>;[key: string]: any }> }
|
|
20
341
|
: T extends { type: "string" } ? string
|
|
342
|
+
// Handle $infer<T> with generic parameter FIRST
|
|
343
|
+
: T extends { type: `$infer<${string}>` }
|
|
344
|
+
? T extends { type: infer S extends string } ? InferType<S> : any
|
|
345
|
+
// Then handle plain $infer (no generic) - falls back to any
|
|
346
|
+
: T extends { type: "$infer" } ? any
|
|
21
347
|
: T extends { type: "object" } ? Record<string, unknown>
|
|
22
348
|
: T extends { type: "number" } ? number
|
|
23
349
|
: T extends { type: "boolean" } ? boolean
|
|
350
|
+
: T extends { type: "integer" } ? number
|
|
351
|
+
: T extends { type: "$.interface.http" } ? {
|
|
352
|
+
respond: (response: HTTPResponse) => Promise<any> | void;
|
|
353
|
+
authenticate: (authType: HTTPAuthenticationType, options?: { token?: string }) => Promise<any> | void;
|
|
354
|
+
flow: FlowFunctions;
|
|
355
|
+
end: () => void;
|
|
356
|
+
execute: () => Promise<{ headers?: Record<string, string>;[key: string]: any }>
|
|
357
|
+
}
|
|
358
|
+
// 5. Fallback
|
|
24
359
|
: unknown;
|
|
25
360
|
|
|
26
361
|
// Base module shape type
|
|
27
362
|
export type ModuleShape = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
363
|
+
type: string;
|
|
364
|
+
props: Record<string, any>;
|
|
365
|
+
methods: Record<string, any>;
|
|
31
366
|
};
|
|
32
367
|
|
|
33
368
|
// Utility type to force flattening of intersections
|
|
34
369
|
export type Spread<T> = { [K in keyof T]: T[K] };
|
|
35
370
|
|
|
36
371
|
// Helper type to derive instance type from app definition, fully flattened
|
|
372
|
+
// export type DeriveAppInstance<T> =
|
|
373
|
+
// T extends { methods: Record<string, any>; props: Record<string, any> }
|
|
374
|
+
// ? Spread<
|
|
375
|
+
// Omit<T, "props" | "methods"> &
|
|
376
|
+
// { [K in keyof T["props"]]: PropType<T["props"][K]> } &
|
|
377
|
+
// { [K in keyof T["methods"]]: T["methods"][K] }
|
|
378
|
+
// >
|
|
379
|
+
// : never;
|
|
380
|
+
|
|
381
|
+
|
|
37
382
|
export type DeriveAppInstance<T> =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
//
|
|
383
|
+
Spread<
|
|
384
|
+
Omit<T, "props" | "propDefinitions" | "methods"> &
|
|
385
|
+
(T extends { props: Record<string, any> }
|
|
386
|
+
? { [K in keyof T["props"]]: PropType<T["props"][K]> }
|
|
387
|
+
: {}) &
|
|
388
|
+
(T extends { propDefinitions: Record<string, any> }
|
|
389
|
+
? { [K in keyof T["propDefinitions"]]: PropType<T["propDefinitions"][K]> }
|
|
390
|
+
: {}) &
|
|
391
|
+
// Add $emit to all signal instances
|
|
392
|
+
EmitFunction &
|
|
393
|
+
|
|
394
|
+
(T extends { methods: Record<string, any> }
|
|
395
|
+
? { [K in keyof T["methods"]]: T["methods"][K] }
|
|
396
|
+
: {}) &
|
|
397
|
+
|
|
398
|
+
// Also include all direct methods on the object
|
|
399
|
+
{ [K in keyof T as K extends "props" | "propDefinitions" | "methods" ? never : K]: T[K] }
|
|
400
|
+
>;
|
|
401
|
+
|
|
402
|
+
export type DeriveSignalInstance<T> =
|
|
403
|
+
Spread<
|
|
404
|
+
Omit<T, "props" | "propDefinitions" | "methods"> &
|
|
405
|
+
(T extends { props: Record<string, any> }
|
|
406
|
+
? { [K in keyof T["props"]]: PropType<T["props"][K]> }
|
|
407
|
+
: {}) &
|
|
408
|
+
(T extends { propDefinitions: Record<string, any> }
|
|
409
|
+
? { [K in keyof T["propDefinitions"]]: PropType<T["propDefinitions"][K]> }
|
|
410
|
+
: {}) &
|
|
411
|
+
// Add $emit to all signal instances
|
|
412
|
+
EmitFunction &
|
|
413
|
+
(T extends { methods: Record<string, any> }
|
|
414
|
+
? { [K in keyof T["methods"]]: T["methods"][K] }
|
|
415
|
+
: {}) &
|
|
416
|
+
// Also include all direct methods on the object
|
|
417
|
+
{ [K in keyof T as K extends "props" | "propDefinitions" | "methods" ? never : K]: T[K] }
|
|
418
|
+
>;
|
|
419
|
+
|
|
420
|
+
// In your element-types
|
|
421
|
+
export type PropDefinitionType<App, PropName extends string> =
|
|
422
|
+
App extends { propDefinitions: Record<string, any> }
|
|
423
|
+
? PropName extends keyof App['propDefinitions']
|
|
424
|
+
? PropType<App['propDefinitions'][PropName]>
|
|
425
|
+
: unknown
|
|
426
|
+
: unknown;
|
|
427
|
+
|
|
428
|
+
// --- Add this helper above DeriveActionInstance ---
|
|
429
|
+
|
|
430
|
+
// Enhanced action instance type
|
|
47
431
|
export type DeriveActionInstance<T> =
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
? { [
|
|
55
|
-
:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
>
|
|
61
|
-
: never;
|
|
432
|
+
Spread<
|
|
433
|
+
Omit<T, "props" | "propDefinitions" | "methods"> &
|
|
434
|
+
(T extends { props: Record<string, any> }
|
|
435
|
+
? { [K in keyof T["props"]]: PropType<T["props"][K]> }
|
|
436
|
+
: {}) &
|
|
437
|
+
(T extends { propDefinitions: Record<string, any> }
|
|
438
|
+
? { [K in keyof T["propDefinitions"]]: PropType<T["propDefinitions"][K]> }
|
|
439
|
+
: {}) &
|
|
440
|
+
(T extends { methods: Record<string, any> }
|
|
441
|
+
? { [K in keyof T["methods"]]: T["methods"][K] }
|
|
442
|
+
: {})
|
|
443
|
+
>;
|
|
62
444
|
|
|
63
445
|
// Helper type to create a module with proper this context
|
|
64
446
|
export type ModuleWithThis<T> = T & ThisType<DeriveActionInstance<T>>;
|
|
65
447
|
|
|
66
448
|
// Action-specific types
|
|
67
449
|
export interface Action<P extends Record<string, any> = Record<string, any>> extends ModuleDefinition {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
450
|
+
type: "action";
|
|
451
|
+
props: P;
|
|
452
|
+
run: (this: DeriveActionInstance<Action<P>>, params: { $: any }) => Promise<unknown>;
|
|
71
453
|
}
|
|
72
454
|
|
|
455
|
+
export interface Signal<P extends Record<string, any> = Record<string, any>> extends ModuleDefinition {
|
|
456
|
+
type: "signal";
|
|
457
|
+
props: P;
|
|
458
|
+
run: (this: DeriveSignalInstance<Signal<P>>, params: { event: SignalEventShape }) => Promise<unknown>;
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
type SignalRun<T> = (this: DeriveSignalInstance<T>, event: SignalEventShape) => Promise<void>;
|
|
462
|
+
|
|
463
|
+
|
|
73
464
|
export type ActionInstance<A extends Action> = DeriveActionInstance<A>;
|
|
465
|
+
export type SignalInstance<S extends Signal> = DeriveSignalInstance<S>;
|
|
74
466
|
|
|
467
|
+
export type SignalMethod<S extends Signal> = (this: SignalInstance<S>, params: SignalEventShape) => Promise<unknown>;
|
|
75
468
|
export type ActionMethod<A extends Action> = (this: ActionInstance<A>, params: { $: any }) => Promise<unknown>;
|
|
76
469
|
|
|
77
470
|
// Prop definition type
|
|
78
471
|
export type PropDefinition = {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
472
|
+
label: string;
|
|
473
|
+
description: string;
|
|
474
|
+
type: string;
|
|
475
|
+
ui?: any;
|
|
83
476
|
};
|
|
84
477
|
|
|
85
478
|
// Helper to provide ThisType context for app definitions
|
|
86
479
|
export function defineApp<T extends object>(app: T & ThisType<DeriveAppInstance<T>>): T {
|
|
87
|
-
|
|
480
|
+
return app;
|
|
88
481
|
}
|
|
89
482
|
|
|
90
483
|
// Helper to provide ThisType context for action definitions
|
|
91
484
|
export function defineAction<T extends object>(action: T & ThisType<DeriveActionInstance<T>>): T {
|
|
92
|
-
|
|
485
|
+
return action;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export function defineSignal<T extends { run: (event: SignalEventShape) => Promise<void> }>(signal: T & ThisType<DeriveSignalInstance<T>>): T {
|
|
489
|
+
return signal;
|
|
490
|
+
}
|
|
491
|
+
export type OnChangeOpts = { layoutShift?: boolean };
|
|
492
|
+
|
|
493
|
+
export type ElementUIProps<T> = {
|
|
494
|
+
onChange: (value: T, opts?: OnChangeOpts) => void;
|
|
495
|
+
onBlur: () => void;
|
|
496
|
+
value: T;
|
|
497
|
+
readonly?: boolean;
|
|
93
498
|
}
|
|
94
499
|
|
|
95
500
|
// Utility type to automatically infer the correct this context for methods
|
|
96
501
|
export type WithThis<T> = T extends { methods: Record<string, any>; props: Record<string, any> }
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
502
|
+
? Omit<T, 'methods'> & {
|
|
503
|
+
methods: {
|
|
504
|
+
[K in keyof T['methods']]: T['methods'][K] extends (...args: infer A) => infer R
|
|
505
|
+
? (this: DeriveActionInstance<T>, ...args: A) => R
|
|
506
|
+
: T['methods'][K];
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
: T;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
name: Publish Element Types
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [published]
|
|
6
|
-
workflow_dispatch:
|
|
7
|
-
inputs:
|
|
8
|
-
registry:
|
|
9
|
-
description: 'NPM Registry URL'
|
|
10
|
-
required: false
|
|
11
|
-
type: string
|
|
12
|
-
default: 'https://registry.npmjs.org'
|
|
13
|
-
|
|
14
|
-
jobs:
|
|
15
|
-
publish:
|
|
16
|
-
runs-on: ubuntu-latest
|
|
17
|
-
|
|
18
|
-
steps:
|
|
19
|
-
- name: Checkout repository
|
|
20
|
-
uses: actions/checkout@v3
|
|
21
|
-
with:
|
|
22
|
-
fetch-depth: 0
|
|
23
|
-
|
|
24
|
-
- name: Setup Node.js
|
|
25
|
-
uses: actions/setup-node@v3
|
|
26
|
-
with:
|
|
27
|
-
node-version: 18
|
|
28
|
-
registry-url: ${{ github.event.inputs.registry || 'https://registry.npmjs.org' }}
|
|
29
|
-
|
|
30
|
-
- name: Install pnpm
|
|
31
|
-
uses: pnpm/action-setup@v2
|
|
32
|
-
with:
|
|
33
|
-
version: 10
|
|
34
|
-
|
|
35
|
-
- name: Install dependencies
|
|
36
|
-
run: pnpm install --no-frozen-lockfile
|
|
37
|
-
|
|
38
|
-
- name: Get version from tag
|
|
39
|
-
id: get_version
|
|
40
|
-
run: |
|
|
41
|
-
if [[ "${{ github.event_name }}" == "release" ]]; then
|
|
42
|
-
VERSION=${GITHUB_REF#refs/tags/}
|
|
43
|
-
VERSION=${VERSION#v}
|
|
44
|
-
else
|
|
45
|
-
VERSION=$(node -p "require('./package.json').version")
|
|
46
|
-
fi
|
|
47
|
-
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
|
48
|
-
echo "Using version: $VERSION"
|
|
49
|
-
|
|
50
|
-
- name: Update version in package.json
|
|
51
|
-
run: |
|
|
52
|
-
sed -i 's/"version": "[^"]*"/"version": "${{ steps.get_version.outputs.VERSION }}"/' package.json
|
|
53
|
-
REGISTRY="${{ github.event.inputs.registry || 'https://registry.npmjs.org' }}"
|
|
54
|
-
jq --arg reg "$REGISTRY" '.publishConfig.registry = $reg | .registry = $reg' package.json > package.json.tmp && mv package.json.tmp package.json
|
|
55
|
-
jq '.publishConfig.access = "public"' package.json > package.json.tmp && mv package.json.tmp package.json
|
|
56
|
-
|
|
57
|
-
- name: Verify package structure
|
|
58
|
-
run: |
|
|
59
|
-
echo "Checking package structure..."
|
|
60
|
-
[ -d "dist" ] || (echo "Error: dist directory missing!" && exit 1)
|
|
61
|
-
[ -f "dist/index.js" ] || (echo "Error: dist/index.js missing!" && exit 1)
|
|
62
|
-
[ -f "dist/index.d.ts" ] || (echo "Error: dist/index.d.ts missing!" && exit 1)
|
|
63
|
-
echo "dist/index.js and dist/index.d.ts found."
|
|
64
|
-
echo "Final package.json:"
|
|
65
|
-
cat package.json
|
|
66
|
-
|
|
67
|
-
- name: Publish to npm
|
|
68
|
-
run: pnpm publish --access=public --no-git-checks
|
|
69
|
-
env:
|
|
70
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
71
|
-
NPM_REGISTRY: ${{ github.event.inputs.registry || 'https://registry.npmjs.org' }}
|
package/tsconfig.json
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@repo/config-typescript/library.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"baseUrl": "src",
|
|
5
|
-
"incremental": false,
|
|
6
|
-
"outDir": "dist",
|
|
7
|
-
"noImplicitAny": false,
|
|
8
|
-
"esModuleInterop": true
|
|
9
|
-
},
|
|
10
|
-
"include": ["./src"],
|
|
11
|
-
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
|
|
12
|
-
}
|