@jointhedots/core 0.0.0 → 2.0.21
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/bundle.manifest.json +17 -0
- package/chunk.3AAAY44Q.js +1 -0
- package/chunk.H26D4GQC.js +1 -0
- package/chunk.LFHCE3KB.js +8 -0
- package/chunk.YVZWYQZG.js +1 -0
- package/export.commands.js +1 -0
- package/export.js +2 -0
- package/export.react.js +17 -0
- package/export.rest.js +1 -0
- package/export.storage.js +1 -0
- package/export.view.js +1 -0
- package/package.json +50 -4
- package/types.d.ts +2264 -0
- package/README.md +0 -1
- package/index.js +0 -1
package/types.d.ts
ADDED
|
@@ -0,0 +1,2264 @@
|
|
|
1
|
+
declare module '@jointhedots/core/src/common/types' {
|
|
2
|
+
export interface MapLike<T> {
|
|
3
|
+
[index: string]: T;
|
|
4
|
+
}
|
|
5
|
+
export type ObjectClass<T extends Object = any> = new (...args: any[]) => T;
|
|
6
|
+
export type Overwrite<Base, Overrides> = Omit<Base, keyof Overrides> & Overrides;
|
|
7
|
+
export type Async<T> = T | Promise<T>;
|
|
8
|
+
export type OneOrMany<T> = T | T[];
|
|
9
|
+
export function areSimilarObjects(x: Record<string, any>, y: Record<string, any>): boolean;
|
|
10
|
+
export function listOneOrMany<T>(cnt: OneOrMany<T>): Generator<T>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
declare module '@jointhedots/core/src/schema/schema' {
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
export const JSONSchema7TypeNameSchema: z.ZodEnum<{
|
|
16
|
+
string: "string";
|
|
17
|
+
number: "number";
|
|
18
|
+
boolean: "boolean";
|
|
19
|
+
object: "object";
|
|
20
|
+
integer: "integer";
|
|
21
|
+
array: "array";
|
|
22
|
+
null: "null";
|
|
23
|
+
}>;
|
|
24
|
+
export const JSONSchema7TypeNameCustomSchema: z.ZodEnum<{
|
|
25
|
+
function: "function";
|
|
26
|
+
module: "module";
|
|
27
|
+
service: "service";
|
|
28
|
+
}>;
|
|
29
|
+
export const JSONSchema7TypeSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>;
|
|
30
|
+
export const ChapterSchema: z.ZodObject<{
|
|
31
|
+
title: z.ZodOptional<z.ZodString>;
|
|
32
|
+
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
secondaryProperties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
34
|
+
patternProperties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
additionalProperties: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export const DocumentationSchema: z.ZodObject<{
|
|
38
|
+
description: z.ZodOptional<z.ZodString>;
|
|
39
|
+
chapters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
40
|
+
title: z.ZodOptional<z.ZodString>;
|
|
41
|
+
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
42
|
+
secondaryProperties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
43
|
+
patternProperties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
44
|
+
additionalProperties: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
}, z.core.$strip>>>;
|
|
46
|
+
additionalChapter: z.ZodOptional<z.ZodBoolean>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export const BindingSchema: z.ZodObject<{
|
|
49
|
+
source: z.ZodString;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export const ExpressionSchema: z.ZodObject<{
|
|
52
|
+
type: z.ZodString;
|
|
53
|
+
}, z.core.$loose>;
|
|
54
|
+
export const JSONSchema7DefinitionSchema: z.ZodType<any>;
|
|
55
|
+
export const TemplateSchema: z.ZodObject<{
|
|
56
|
+
title: z.ZodOptional<z.ZodString>;
|
|
57
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
58
|
+
description: z.ZodOptional<z.ZodString>;
|
|
59
|
+
args: z.ZodOptional<z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
60
|
+
content: z.ZodObject<{
|
|
61
|
+
type: z.ZodString;
|
|
62
|
+
}, z.core.$loose>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export const DockingSchema: z.ZodObject<{
|
|
65
|
+
view: z.ZodString;
|
|
66
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
67
|
+
}, z.core.$strip>;
|
|
68
|
+
export const SecurityRuleSchema: z.ZodObject<{
|
|
69
|
+
check: z.ZodAny;
|
|
70
|
+
}, z.core.$strip>;
|
|
71
|
+
export const SecurityGuardSchema: z.ZodUnion<readonly [z.ZodLiteral<"safe">, z.ZodString, z.ZodObject<{
|
|
72
|
+
rule: z.ZodString;
|
|
73
|
+
}, z.core.$loose>]>;
|
|
74
|
+
export const ResourceLinkSchema: z.ZodString;
|
|
75
|
+
export const ResourceEntrySchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
76
|
+
type: z.ZodString;
|
|
77
|
+
data: z.ZodOptional<z.ZodAny>;
|
|
78
|
+
}, z.core.$strip>]>;
|
|
79
|
+
export const JSONSchemaStandardSchema: z.ZodObject<{
|
|
80
|
+
$id: z.ZodOptional<z.ZodString>;
|
|
81
|
+
$ref: z.ZodOptional<z.ZodString>;
|
|
82
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
83
|
+
$comment: z.ZodOptional<z.ZodString>;
|
|
84
|
+
$defs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
85
|
+
type: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
86
|
+
string: "string";
|
|
87
|
+
number: "number";
|
|
88
|
+
boolean: "boolean";
|
|
89
|
+
object: "object";
|
|
90
|
+
integer: "integer";
|
|
91
|
+
array: "array";
|
|
92
|
+
null: "null";
|
|
93
|
+
}>, z.ZodEnum<{
|
|
94
|
+
function: "function";
|
|
95
|
+
module: "module";
|
|
96
|
+
service: "service";
|
|
97
|
+
}>]>>;
|
|
98
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>>;
|
|
99
|
+
const: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>;
|
|
100
|
+
multipleOf: z.ZodOptional<z.ZodNumber>;
|
|
101
|
+
maximum: z.ZodOptional<z.ZodNumber>;
|
|
102
|
+
exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
|
|
103
|
+
minimum: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
|
|
105
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
106
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
108
|
+
items: z.ZodOptional<z.ZodUnion<readonly [z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>, z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>]>>;
|
|
109
|
+
additionalItems: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
110
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
111
|
+
minItems: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
uniqueItems: z.ZodOptional<z.ZodBoolean>;
|
|
113
|
+
contains: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
114
|
+
maxProperties: z.ZodOptional<z.ZodNumber>;
|
|
115
|
+
minProperties: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
117
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
118
|
+
patternProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
119
|
+
additionalProperties: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
120
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>, z.ZodArray<z.ZodString>]>>>;
|
|
121
|
+
propertyNames: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
122
|
+
if: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
123
|
+
then: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
124
|
+
else: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
125
|
+
allOf: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
126
|
+
anyOf: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
127
|
+
oneOf: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
128
|
+
not: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
129
|
+
format: z.ZodOptional<z.ZodString>;
|
|
130
|
+
contentMediaType: z.ZodOptional<z.ZodString>;
|
|
131
|
+
contentEncoding: z.ZodOptional<z.ZodString>;
|
|
132
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
133
|
+
title: z.ZodOptional<z.ZodString>;
|
|
134
|
+
description: z.ZodOptional<z.ZodString>;
|
|
135
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>;
|
|
136
|
+
readOnly: z.ZodOptional<z.ZodBoolean>;
|
|
137
|
+
writeOnly: z.ZodOptional<z.ZodBoolean>;
|
|
138
|
+
examples: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>;
|
|
139
|
+
}, z.core.$strip>;
|
|
140
|
+
export const JSONSchemaCustomSchema: z.ZodObject<{
|
|
141
|
+
title: z.ZodOptional<z.ZodString>;
|
|
142
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
143
|
+
doc: z.ZodOptional<z.ZodObject<{
|
|
144
|
+
description: z.ZodOptional<z.ZodString>;
|
|
145
|
+
chapters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
146
|
+
title: z.ZodOptional<z.ZodString>;
|
|
147
|
+
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
148
|
+
secondaryProperties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
149
|
+
patternProperties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
150
|
+
additionalProperties: z.ZodOptional<z.ZodBoolean>;
|
|
151
|
+
}, z.core.$strip>>>;
|
|
152
|
+
additionalChapter: z.ZodOptional<z.ZodBoolean>;
|
|
153
|
+
}, z.core.$strip>>;
|
|
154
|
+
$error: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Error, Error>]>>;
|
|
155
|
+
args: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
156
|
+
placeholder: z.ZodOptional<z.ZodBoolean>;
|
|
157
|
+
resources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
158
|
+
type: z.ZodString;
|
|
159
|
+
data: z.ZodOptional<z.ZodAny>;
|
|
160
|
+
}, z.core.$strip>]>>>;
|
|
161
|
+
security: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"safe">, z.ZodString, z.ZodObject<{
|
|
162
|
+
rule: z.ZodString;
|
|
163
|
+
}, z.core.$loose>]>>;
|
|
164
|
+
"allow-origin": z.ZodOptional<z.ZodString>;
|
|
165
|
+
docking: z.ZodOptional<z.ZodObject<{
|
|
166
|
+
view: z.ZodString;
|
|
167
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
168
|
+
}, z.core.$strip>>;
|
|
169
|
+
templates: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
170
|
+
title: z.ZodOptional<z.ZodString>;
|
|
171
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
172
|
+
description: z.ZodOptional<z.ZodString>;
|
|
173
|
+
args: z.ZodOptional<z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
174
|
+
content: z.ZodObject<{
|
|
175
|
+
type: z.ZodString;
|
|
176
|
+
}, z.core.$loose>;
|
|
177
|
+
}, z.core.$strip>>>;
|
|
178
|
+
binding: z.ZodOptional<z.ZodObject<{
|
|
179
|
+
source: z.ZodString;
|
|
180
|
+
}, z.core.$strip>>;
|
|
181
|
+
aliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export const ServiceSchemaSchema: z.ZodObject<{
|
|
184
|
+
$id: z.ZodOptional<z.ZodString>;
|
|
185
|
+
$ref: z.ZodOptional<z.ZodString>;
|
|
186
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
187
|
+
$comment: z.ZodOptional<z.ZodString>;
|
|
188
|
+
$defs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
189
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>>;
|
|
190
|
+
const: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>;
|
|
191
|
+
multipleOf: z.ZodOptional<z.ZodNumber>;
|
|
192
|
+
maximum: z.ZodOptional<z.ZodNumber>;
|
|
193
|
+
exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
|
|
194
|
+
minimum: z.ZodOptional<z.ZodNumber>;
|
|
195
|
+
exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
|
|
196
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
197
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
198
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
199
|
+
items: z.ZodOptional<z.ZodUnion<readonly [z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>, z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>]>>;
|
|
200
|
+
additionalItems: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
201
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
202
|
+
minItems: z.ZodOptional<z.ZodNumber>;
|
|
203
|
+
uniqueItems: z.ZodOptional<z.ZodBoolean>;
|
|
204
|
+
contains: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
205
|
+
maxProperties: z.ZodOptional<z.ZodNumber>;
|
|
206
|
+
minProperties: z.ZodOptional<z.ZodNumber>;
|
|
207
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
208
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
209
|
+
patternProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
210
|
+
additionalProperties: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
211
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>, z.ZodArray<z.ZodString>]>>>;
|
|
212
|
+
propertyNames: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
213
|
+
if: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
214
|
+
then: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
215
|
+
else: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
216
|
+
allOf: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
217
|
+
anyOf: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
218
|
+
oneOf: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
219
|
+
not: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
220
|
+
format: z.ZodOptional<z.ZodString>;
|
|
221
|
+
contentMediaType: z.ZodOptional<z.ZodString>;
|
|
222
|
+
contentEncoding: z.ZodOptional<z.ZodString>;
|
|
223
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
224
|
+
description: z.ZodOptional<z.ZodString>;
|
|
225
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>;
|
|
226
|
+
readOnly: z.ZodOptional<z.ZodBoolean>;
|
|
227
|
+
writeOnly: z.ZodOptional<z.ZodBoolean>;
|
|
228
|
+
examples: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>;
|
|
229
|
+
title: z.ZodOptional<z.ZodString>;
|
|
230
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
231
|
+
doc: z.ZodOptional<z.ZodObject<{
|
|
232
|
+
description: z.ZodOptional<z.ZodString>;
|
|
233
|
+
chapters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
234
|
+
title: z.ZodOptional<z.ZodString>;
|
|
235
|
+
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
236
|
+
secondaryProperties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
237
|
+
patternProperties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
238
|
+
additionalProperties: z.ZodOptional<z.ZodBoolean>;
|
|
239
|
+
}, z.core.$strip>>>;
|
|
240
|
+
additionalChapter: z.ZodOptional<z.ZodBoolean>;
|
|
241
|
+
}, z.core.$strip>>;
|
|
242
|
+
$error: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Error, Error>]>>;
|
|
243
|
+
args: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
244
|
+
placeholder: z.ZodOptional<z.ZodBoolean>;
|
|
245
|
+
resources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
246
|
+
type: z.ZodString;
|
|
247
|
+
data: z.ZodOptional<z.ZodAny>;
|
|
248
|
+
}, z.core.$strip>]>>>;
|
|
249
|
+
security: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"safe">, z.ZodString, z.ZodObject<{
|
|
250
|
+
rule: z.ZodString;
|
|
251
|
+
}, z.core.$loose>]>>;
|
|
252
|
+
"allow-origin": z.ZodOptional<z.ZodString>;
|
|
253
|
+
docking: z.ZodOptional<z.ZodObject<{
|
|
254
|
+
view: z.ZodString;
|
|
255
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
256
|
+
}, z.core.$strip>>;
|
|
257
|
+
templates: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
258
|
+
title: z.ZodOptional<z.ZodString>;
|
|
259
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
260
|
+
description: z.ZodOptional<z.ZodString>;
|
|
261
|
+
args: z.ZodOptional<z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
262
|
+
content: z.ZodObject<{
|
|
263
|
+
type: z.ZodString;
|
|
264
|
+
}, z.core.$loose>;
|
|
265
|
+
}, z.core.$strip>>>;
|
|
266
|
+
binding: z.ZodOptional<z.ZodObject<{
|
|
267
|
+
source: z.ZodString;
|
|
268
|
+
}, z.core.$strip>>;
|
|
269
|
+
aliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
270
|
+
type: z.ZodLiteral<"service">;
|
|
271
|
+
$spec: z.ZodString;
|
|
272
|
+
version: z.ZodOptional<z.ZodString>;
|
|
273
|
+
}, z.core.$strip>;
|
|
274
|
+
export const FunctionSchemaSchema: z.ZodObject<{
|
|
275
|
+
$id: z.ZodOptional<z.ZodString>;
|
|
276
|
+
$ref: z.ZodOptional<z.ZodString>;
|
|
277
|
+
$schema: z.ZodOptional<z.ZodString>;
|
|
278
|
+
$comment: z.ZodOptional<z.ZodString>;
|
|
279
|
+
$defs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
280
|
+
enum: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>>;
|
|
281
|
+
const: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>;
|
|
282
|
+
multipleOf: z.ZodOptional<z.ZodNumber>;
|
|
283
|
+
maximum: z.ZodOptional<z.ZodNumber>;
|
|
284
|
+
exclusiveMaximum: z.ZodOptional<z.ZodNumber>;
|
|
285
|
+
minimum: z.ZodOptional<z.ZodNumber>;
|
|
286
|
+
exclusiveMinimum: z.ZodOptional<z.ZodNumber>;
|
|
287
|
+
maxLength: z.ZodOptional<z.ZodNumber>;
|
|
288
|
+
minLength: z.ZodOptional<z.ZodNumber>;
|
|
289
|
+
pattern: z.ZodOptional<z.ZodString>;
|
|
290
|
+
items: z.ZodOptional<z.ZodUnion<readonly [z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>, z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>]>>;
|
|
291
|
+
additionalItems: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
292
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
293
|
+
minItems: z.ZodOptional<z.ZodNumber>;
|
|
294
|
+
uniqueItems: z.ZodOptional<z.ZodBoolean>;
|
|
295
|
+
contains: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
296
|
+
maxProperties: z.ZodOptional<z.ZodNumber>;
|
|
297
|
+
minProperties: z.ZodOptional<z.ZodNumber>;
|
|
298
|
+
required: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
299
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
300
|
+
patternProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
301
|
+
additionalProperties: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
302
|
+
dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>, z.ZodArray<z.ZodString>]>>>;
|
|
303
|
+
propertyNames: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
304
|
+
if: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
305
|
+
then: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
306
|
+
else: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
307
|
+
allOf: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
308
|
+
anyOf: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
309
|
+
oneOf: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
310
|
+
not: z.ZodOptional<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
311
|
+
format: z.ZodOptional<z.ZodString>;
|
|
312
|
+
contentMediaType: z.ZodOptional<z.ZodString>;
|
|
313
|
+
contentEncoding: z.ZodOptional<z.ZodString>;
|
|
314
|
+
definitions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
315
|
+
description: z.ZodOptional<z.ZodString>;
|
|
316
|
+
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>;
|
|
317
|
+
readOnly: z.ZodOptional<z.ZodBoolean>;
|
|
318
|
+
writeOnly: z.ZodOptional<z.ZodBoolean>;
|
|
319
|
+
examples: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodArray<z.ZodAny>]>>;
|
|
320
|
+
title: z.ZodOptional<z.ZodString>;
|
|
321
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
322
|
+
doc: z.ZodOptional<z.ZodObject<{
|
|
323
|
+
description: z.ZodOptional<z.ZodString>;
|
|
324
|
+
chapters: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
325
|
+
title: z.ZodOptional<z.ZodString>;
|
|
326
|
+
properties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
327
|
+
secondaryProperties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
328
|
+
patternProperties: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
329
|
+
additionalProperties: z.ZodOptional<z.ZodBoolean>;
|
|
330
|
+
}, z.core.$strip>>>;
|
|
331
|
+
additionalChapter: z.ZodOptional<z.ZodBoolean>;
|
|
332
|
+
}, z.core.$strip>>;
|
|
333
|
+
$error: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Error, Error>]>>;
|
|
334
|
+
args: z.ZodOptional<z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>>;
|
|
335
|
+
placeholder: z.ZodOptional<z.ZodBoolean>;
|
|
336
|
+
resources: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
337
|
+
type: z.ZodString;
|
|
338
|
+
data: z.ZodOptional<z.ZodAny>;
|
|
339
|
+
}, z.core.$strip>]>>>;
|
|
340
|
+
security: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"safe">, z.ZodString, z.ZodObject<{
|
|
341
|
+
rule: z.ZodString;
|
|
342
|
+
}, z.core.$loose>]>>;
|
|
343
|
+
"allow-origin": z.ZodOptional<z.ZodString>;
|
|
344
|
+
docking: z.ZodOptional<z.ZodObject<{
|
|
345
|
+
view: z.ZodString;
|
|
346
|
+
properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
347
|
+
}, z.core.$strip>>;
|
|
348
|
+
templates: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
349
|
+
title: z.ZodOptional<z.ZodString>;
|
|
350
|
+
icon: z.ZodOptional<z.ZodString>;
|
|
351
|
+
description: z.ZodOptional<z.ZodString>;
|
|
352
|
+
args: z.ZodOptional<z.ZodArray<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>;
|
|
353
|
+
content: z.ZodObject<{
|
|
354
|
+
type: z.ZodString;
|
|
355
|
+
}, z.core.$loose>;
|
|
356
|
+
}, z.core.$strip>>>;
|
|
357
|
+
binding: z.ZodOptional<z.ZodObject<{
|
|
358
|
+
source: z.ZodString;
|
|
359
|
+
}, z.core.$strip>>;
|
|
360
|
+
aliases: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
361
|
+
type: z.ZodLiteral<"function">;
|
|
362
|
+
input: z.ZodOptional<z.ZodUnion<readonly [z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>, z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>]>>;
|
|
363
|
+
output: z.ZodOptional<z.ZodUnion<readonly [z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>, z.ZodArray<z.ZodLazy<z.ZodType<any, unknown, z.core.$ZodTypeInternals<any, unknown>>>>]>>;
|
|
364
|
+
}, z.core.$strip>;
|
|
365
|
+
export const JSONSchemaSchema: z.ZodType<any>;
|
|
366
|
+
export type JSONSchema7TypeName = z.infer<typeof JSONSchema7TypeNameSchema>;
|
|
367
|
+
export type JSONSchema7TypeNameCustom = z.infer<typeof JSONSchema7TypeNameCustomSchema>;
|
|
368
|
+
export type JSONSchema7 = z.infer<typeof JSONSchema7TypeSchema>;
|
|
369
|
+
export type JSONSchema7Definition = z.infer<typeof JSONSchema7DefinitionSchema>;
|
|
370
|
+
export type ChapterSchema = z.infer<typeof ChapterSchema>;
|
|
371
|
+
export type DocumentationSchema = z.infer<typeof DocumentationSchema>;
|
|
372
|
+
export type BindingSchema = z.infer<typeof BindingSchema>;
|
|
373
|
+
export type ExpressionSchema = z.infer<typeof ExpressionSchema>;
|
|
374
|
+
export type TemplateSchema = z.infer<typeof TemplateSchema>;
|
|
375
|
+
export type DockingSchema = z.infer<typeof DockingSchema>;
|
|
376
|
+
export type SecurityRule = z.infer<typeof SecurityRuleSchema>;
|
|
377
|
+
export type SecurityGuard = z.infer<typeof SecurityGuardSchema>;
|
|
378
|
+
export type ResourceEntry = z.infer<typeof ResourceEntrySchema>;
|
|
379
|
+
export type ResourceImport = {
|
|
380
|
+
type: string;
|
|
381
|
+
location?: string;
|
|
382
|
+
identifier?: string;
|
|
383
|
+
[key: string]: any;
|
|
384
|
+
};
|
|
385
|
+
export type JSONSchemaStandard = z.infer<typeof JSONSchemaStandardSchema>;
|
|
386
|
+
export type JSONSchemaCustom = z.infer<typeof JSONSchemaCustomSchema>;
|
|
387
|
+
export type ServiceSchema = z.infer<typeof ServiceSchemaSchema>;
|
|
388
|
+
export type FunctionSchema = z.infer<typeof FunctionSchemaSchema>;
|
|
389
|
+
export type JSONSchema = z.infer<typeof JSONSchemaSchema>;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
declare module '@jointhedots/core/src/services/service-entry' {
|
|
393
|
+
import type { ComponentEntry } from '@jointhedots/core/src/components/manifold';
|
|
394
|
+
export type ServiceType = string;
|
|
395
|
+
export class ServiceEntry<Instance extends any, Spec extends any> {
|
|
396
|
+
resource: string;
|
|
397
|
+
definition: any;
|
|
398
|
+
constructor(resource: string, definition?: any);
|
|
399
|
+
defintiion(): void;
|
|
400
|
+
get(entry: ComponentEntry): Instance;
|
|
401
|
+
fetch(entry: ComponentEntry): Promise<Instance>;
|
|
402
|
+
spec(entry: ComponentEntry): Spec;
|
|
403
|
+
subservice<T extends any>(name: string): ServiceEntry<T, Spec>;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
declare module '@jointhedots/core/src/components/components' {
|
|
408
|
+
import { URI } from 'vscode-uri';
|
|
409
|
+
import type { DocumentationSchema, JSONSchema, ResourceEntry } from '@jointhedots/core/src/schema/schema';
|
|
410
|
+
import type { ComponentEntry } from '@jointhedots/core/src/components/manifold';
|
|
411
|
+
import { ServiceEntry, type ServiceType } from '@jointhedots/core/src/services/service-entry';
|
|
412
|
+
export type ComponentID = string;
|
|
413
|
+
export interface ComponentPublication {
|
|
414
|
+
id: ComponentID;
|
|
415
|
+
ref?: string;
|
|
416
|
+
type?: string;
|
|
417
|
+
title: string;
|
|
418
|
+
icon?: string;
|
|
419
|
+
description?: string;
|
|
420
|
+
services?: string[];
|
|
421
|
+
keywords?: string[];
|
|
422
|
+
tags?: string[];
|
|
423
|
+
}
|
|
424
|
+
export type ComponentManifest<Data extends any = unknown> = {
|
|
425
|
+
$id: string;
|
|
426
|
+
type?: string;
|
|
427
|
+
title?: string;
|
|
428
|
+
icon?: string;
|
|
429
|
+
description?: string;
|
|
430
|
+
keywords?: string[];
|
|
431
|
+
tags?: string[];
|
|
432
|
+
doc?: DocumentationSchema;
|
|
433
|
+
specs?: Record<string, any>;
|
|
434
|
+
services?: Record<string, ResourceEntry>;
|
|
435
|
+
data?: Data;
|
|
436
|
+
};
|
|
437
|
+
/** Configuration for a distributed package */
|
|
438
|
+
export interface DistributedConfig {
|
|
439
|
+
/** Version specifier (e.g., "*", "^18.0.0") */
|
|
440
|
+
version?: string;
|
|
441
|
+
/** Interop type: 'esm' | 'cjs-default' | 'cjs-named' */
|
|
442
|
+
interop?: 'esm' | 'cjs-default' | 'cjs-named';
|
|
443
|
+
/** List of named exports to re-export (required for cjs-named interop) */
|
|
444
|
+
exports?: string[];
|
|
445
|
+
}
|
|
446
|
+
export type BundleManifest = ComponentManifest<{
|
|
447
|
+
alias?: string;
|
|
448
|
+
package?: string;
|
|
449
|
+
baseline?: string;
|
|
450
|
+
namespaces?: string[];
|
|
451
|
+
dependencies?: string[];
|
|
452
|
+
redistribueds?: string[] | {
|
|
453
|
+
[packageName: string]: string | DistributedConfig;
|
|
454
|
+
};
|
|
455
|
+
exports?: {
|
|
456
|
+
[id: string]: string;
|
|
457
|
+
};
|
|
458
|
+
components?: ComponentPublication[];
|
|
459
|
+
}>;
|
|
460
|
+
export type ComponentSchema = {
|
|
461
|
+
readonly name: ServiceType;
|
|
462
|
+
readonly title: string;
|
|
463
|
+
readonly icon: string;
|
|
464
|
+
readonly attributes: Record<string, JSONSchema>;
|
|
465
|
+
};
|
|
466
|
+
export interface ComponentManifestIssue {
|
|
467
|
+
level: "error" | "warn" | "info";
|
|
468
|
+
message: string;
|
|
469
|
+
fix?(descriptor: ComponentManifest): Promise<ComponentManifest>;
|
|
470
|
+
}
|
|
471
|
+
export interface ComponentChecking {
|
|
472
|
+
fixed?: ComponentManifest;
|
|
473
|
+
issues?: ComponentManifestIssue[];
|
|
474
|
+
}
|
|
475
|
+
export interface ComponentController {
|
|
476
|
+
createComponent(component: ComponentEntry, descriptor: ComponentManifest): Promise<void>;
|
|
477
|
+
updateComponent(component: ComponentEntry, descriptor: ComponentManifest): Promise<void>;
|
|
478
|
+
checkDescriptor(descriptor: ComponentManifest): Promise<ComponentChecking>;
|
|
479
|
+
}
|
|
480
|
+
export const ComponentControllerKey: ServiceEntry<ComponentController, ComponentSchema>;
|
|
481
|
+
export type ComponentEditorProps<T extends ComponentManifest = ComponentManifest> = {
|
|
482
|
+
descriptor: ComponentSchema;
|
|
483
|
+
schema: JSONSchema;
|
|
484
|
+
manifest: T;
|
|
485
|
+
created?: boolean;
|
|
486
|
+
onChange: (manifest: T) => void;
|
|
487
|
+
onValidate: (manifest: T) => void;
|
|
488
|
+
onCancel: () => void;
|
|
489
|
+
};
|
|
490
|
+
export type ComponentPreviewProps<T extends ComponentManifest = ComponentManifest> = {
|
|
491
|
+
manifest: T;
|
|
492
|
+
};
|
|
493
|
+
export type ComponentEditor<T extends ComponentManifest = ComponentManifest> = {
|
|
494
|
+
creator: React.ComponentType<ComponentEditorProps<T>>;
|
|
495
|
+
editor: React.ComponentType<ComponentEditorProps<T>>;
|
|
496
|
+
preview?: React.ComponentType<ComponentPreviewProps<T>>;
|
|
497
|
+
};
|
|
498
|
+
export const EditorKey: ServiceEntry<ComponentEditor<ComponentManifest<unknown>>, unknown>;
|
|
499
|
+
export type ComponentFilter = {
|
|
500
|
+
query: string;
|
|
501
|
+
pattern: RegExp;
|
|
502
|
+
keywords: string[];
|
|
503
|
+
tags: string[];
|
|
504
|
+
types: string[];
|
|
505
|
+
services: string[];
|
|
506
|
+
};
|
|
507
|
+
export interface IResourceLoader {
|
|
508
|
+
load_resource(uri: string): Promise<any>;
|
|
509
|
+
}
|
|
510
|
+
export interface IComponentPublisher {
|
|
511
|
+
search_component_publications(filter: ComponentFilter): Promise<ComponentPublication[]>;
|
|
512
|
+
get_component_publication(component_id: string): Promise<ComponentPublication>;
|
|
513
|
+
}
|
|
514
|
+
export interface IComponentProvider extends IComponentPublisher {
|
|
515
|
+
get_component_manifest(component_id: string): Promise<ComponentManifest>;
|
|
516
|
+
set_component_manifest(component_id: string, manifest: ComponentManifest): Promise<boolean>;
|
|
517
|
+
add_component(manifest: ComponentManifest): Promise<ComponentPublication>;
|
|
518
|
+
delete_component(component_id: string): Promise<boolean>;
|
|
519
|
+
}
|
|
520
|
+
export interface IContentProvider {
|
|
521
|
+
check_content(uri: URI): Promise<string>;
|
|
522
|
+
load_content(uri: URI): Promise<Blob>;
|
|
523
|
+
store_content(content: Blob, uri: URI): Promise<boolean>;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
declare module '@jointhedots/core/src/common/contents' {
|
|
528
|
+
export type ContentBlob = Blob;
|
|
529
|
+
export const ContentBlob: {
|
|
530
|
+
object: {
|
|
531
|
+
read<T = any>(blob: Blob): Promise<T>;
|
|
532
|
+
write<T = any>(data: T): Promise<Blob>;
|
|
533
|
+
};
|
|
534
|
+
text: {
|
|
535
|
+
read(blob: Blob): Promise<string>;
|
|
536
|
+
write(text: string): Promise<Blob>;
|
|
537
|
+
};
|
|
538
|
+
};
|
|
539
|
+
export function b64_blob(base64: string): Blob;
|
|
540
|
+
export function b64_format(base64: string): string;
|
|
541
|
+
export function blob_b64(blob: Blob): Promise<string>;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
declare module '@jointhedots/core/src/components/helpers' {
|
|
545
|
+
import { URI } from 'vscode-uri';
|
|
546
|
+
import { type ComponentFilter, type ComponentManifest, type ComponentPublication } from '@jointhedots/core/src/components/components';
|
|
547
|
+
import type { ResourceEntry, ResourceImport } from '@jointhedots/core/src/schema/schema';
|
|
548
|
+
export function parseComponentURI(ref: string): URI;
|
|
549
|
+
export function getComponentServicesList(manif: ComponentManifest): Promise<string[]>;
|
|
550
|
+
export function createComponentPublication(manif: ComponentManifest): Promise<ComponentPublication>;
|
|
551
|
+
export function createComponentFilter(filter?: Partial<ComponentFilter>): ComponentFilter;
|
|
552
|
+
export function matchComponentFilter(pub: ComponentPublication, filter?: Partial<ComponentFilter>): boolean;
|
|
553
|
+
export function parseResourceEntry(entry: ResourceEntry): ResourceImport;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
declare module '@jointhedots/core/src/providers/resources/CommonResourceProvider' {
|
|
557
|
+
import { URI } from 'vscode-uri';
|
|
558
|
+
import { type IContentProvider, type IResourceLoader } from '@jointhedots/core/src/components/components';
|
|
559
|
+
export class CommonResourceProvider implements IResourceLoader {
|
|
560
|
+
readonly storage: IContentProvider;
|
|
561
|
+
modules_exports: Map<string, any>;
|
|
562
|
+
baseUrl: string;
|
|
563
|
+
constructor(storage: IContentProvider);
|
|
564
|
+
load_resource(ref: string): Promise<any>;
|
|
565
|
+
import_module_json(ref: string, uri: URI): Promise<any>;
|
|
566
|
+
import_module_esm(ref: string, uri: URI): Promise<any>;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
declare module '@jointhedots/core/src/providers/resources/StaticContentProvider' {
|
|
571
|
+
import { URI } from 'vscode-uri';
|
|
572
|
+
import type { IContentProvider } from '@jointhedots/core/src/components/components';
|
|
573
|
+
export class StaticContentProvider implements IContentProvider {
|
|
574
|
+
check_url_content(ref: string): Promise<string>;
|
|
575
|
+
load_url_content(ref: string): Promise<Blob>;
|
|
576
|
+
check_content(uri: URI): Promise<string>;
|
|
577
|
+
load_content(uri: URI): Promise<Blob>;
|
|
578
|
+
store_content(content: Blob, uri: URI): Promise<boolean>;
|
|
579
|
+
}
|
|
580
|
+
export function contentLocalURI(id: string, norm: string, key?: string): URI;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
declare module '@jointhedots/core/src/providers/components/InMemComponentProvider' {
|
|
584
|
+
import { type ComponentFilter, type ComponentManifest, type ComponentPublication, type IComponentProvider, type IComponentPublisher } from '@jointhedots/core/src/components/components';
|
|
585
|
+
export class InMemComponentPublisher implements IComponentPublisher {
|
|
586
|
+
pubs: Map<string, ComponentPublication>;
|
|
587
|
+
constructor(catalog?: ComponentPublication[]);
|
|
588
|
+
get_component_publication(id: string): Promise<ComponentPublication>;
|
|
589
|
+
search_component_publications(filter: ComponentFilter): Promise<ComponentPublication[]>;
|
|
590
|
+
}
|
|
591
|
+
export class InMemComponentProvider extends InMemComponentPublisher implements IComponentProvider {
|
|
592
|
+
manifests: Map<string, ComponentManifest>;
|
|
593
|
+
add_component(manifest: ComponentManifest): Promise<ComponentPublication>;
|
|
594
|
+
delete_component(component_id: string): Promise<boolean>;
|
|
595
|
+
get_component_manifest(component_id: string): Promise<ComponentManifest>;
|
|
596
|
+
set_component_manifest(component_id: string, manifest: ComponentManifest): Promise<boolean>;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
declare module '@jointhedots/core/src/providers/components/StaticComponentProvider' {
|
|
601
|
+
import { type BundleManifest, type ComponentFilter, type ComponentManifest, type ComponentPublication, type IComponentProvider, type IContentProvider } from '@jointhedots/core/src/components/components';
|
|
602
|
+
import { InMemComponentPublisher } from '@jointhedots/core/src/providers/components/InMemComponentProvider';
|
|
603
|
+
export class StaticComponentProvider implements IComponentProvider {
|
|
604
|
+
readonly content_provider: IContentProvider;
|
|
605
|
+
manifest: BundleManifest;
|
|
606
|
+
catalog: InMemComponentPublisher;
|
|
607
|
+
constructor(content_provider: IContentProvider);
|
|
608
|
+
get_provider_bundle(): Promise<BundleManifest>;
|
|
609
|
+
get_component_catalog(): Promise<InMemComponentPublisher>;
|
|
610
|
+
get_component_publication(id: string): Promise<ComponentPublication>;
|
|
611
|
+
search_component_publications(filter: ComponentFilter): Promise<ComponentPublication[]>;
|
|
612
|
+
get_component_manifest(id: string): Promise<ComponentManifest>;
|
|
613
|
+
set_component_manifest(component_id: string, manifest: ComponentManifest): Promise<boolean>;
|
|
614
|
+
add_component(manifest: ComponentManifest): Promise<ComponentPublication>;
|
|
615
|
+
delete_component(component_id: string): Promise<boolean>;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
declare module '@jointhedots/core/src/providers/components/CombinedComponentProvider' {
|
|
620
|
+
import { type ComponentFilter, type ComponentManifest, type ComponentPublication, type IComponentProvider } from '@jointhedots/core/src/components/components';
|
|
621
|
+
export class CombinedComponentProvider implements IComponentProvider {
|
|
622
|
+
readonly providers: IComponentProvider[];
|
|
623
|
+
constructor(providers?: IComponentProvider[]);
|
|
624
|
+
add_provider(provider: IComponentProvider): void;
|
|
625
|
+
get_component_publication(id: string): Promise<ComponentPublication>;
|
|
626
|
+
search_component_publications(filter: ComponentFilter): Promise<ComponentPublication[]>;
|
|
627
|
+
get_component_manifest(id: string): Promise<ComponentManifest>;
|
|
628
|
+
set_component_manifest(component_id: string, manifest: ComponentManifest): Promise<boolean>;
|
|
629
|
+
add_component(manifest: ComponentManifest): Promise<ComponentPublication>;
|
|
630
|
+
delete_component(component_id: string): Promise<boolean>;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
declare module '@jointhedots/core/src/providers/components/LocalComponentProvider' {
|
|
635
|
+
import { type IComponentProvider } from '@jointhedots/core/src/components/components';
|
|
636
|
+
export function createLocalComponentProvider(): IComponentProvider;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
declare module '@jointhedots/core/rest' {
|
|
640
|
+
import { URI } from 'vscode-uri';
|
|
641
|
+
import { ComponentEntry } from '@jointhedots/core/src/components/manifold';
|
|
642
|
+
import { ServiceEntry } from '@jointhedots/core/src/services/service-entry';
|
|
643
|
+
export interface RESTService {
|
|
644
|
+
getUrl(path: string): string;
|
|
645
|
+
invoke(path: string, init?: RequestInit): Promise<Response>;
|
|
646
|
+
}
|
|
647
|
+
export const RESTServiceKey: ServiceEntry<RESTService, unknown>;
|
|
648
|
+
export type RESTServiceImport = {
|
|
649
|
+
type?: "api.rest";
|
|
650
|
+
endpoint?: string;
|
|
651
|
+
path?: string;
|
|
652
|
+
};
|
|
653
|
+
export function __import_RESTService(entry: RESTServiceImport, component: ComponentEntry): RESTService;
|
|
654
|
+
export const REST: {
|
|
655
|
+
fetch(link: string | URI, init?: RequestInit): Promise<Response>;
|
|
656
|
+
getUri(link: string | URI): Promise<URI>;
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
declare module '@jointhedots/core/src/components/manifold' {
|
|
661
|
+
import { type ComponentFilter, type ComponentManifest, type ComponentPublication, type IContentProvider, type IResourceLoader } from '@jointhedots/core/src/components/components';
|
|
662
|
+
import { CombinedComponentProvider } from '@jointhedots/core/src/providers/components/CombinedComponentProvider';
|
|
663
|
+
import { type QueryLogResult } from 'src/logging';
|
|
664
|
+
export type ComponentErrorManifest = ComponentManifest & {
|
|
665
|
+
type: "<error>";
|
|
666
|
+
message: string;
|
|
667
|
+
stack?: string;
|
|
668
|
+
};
|
|
669
|
+
export type ComponentServiceGetter<Service = any> = (entry: ComponentEntry) => Service;
|
|
670
|
+
export class ComponentEntry<Instance extends Object = any> {
|
|
671
|
+
readonly id: string;
|
|
672
|
+
protected __instance__?: Instance;
|
|
673
|
+
manifest?: ComponentManifest;
|
|
674
|
+
constructor(id: string);
|
|
675
|
+
get title(): string;
|
|
676
|
+
get namespace(): string;
|
|
677
|
+
get valid(): boolean;
|
|
678
|
+
get loaded(): boolean;
|
|
679
|
+
get installed(): boolean;
|
|
680
|
+
get instance(): Instance;
|
|
681
|
+
set instance(value: Instance);
|
|
682
|
+
get<Manifest extends ComponentManifest = ComponentManifest>(): Manifest;
|
|
683
|
+
set<Manifest extends ComponentManifest = ComponentManifest>(manifest: Manifest): this;
|
|
684
|
+
fetch<Manifest extends ComponentManifest = ComponentManifest>(): Promise<Manifest>;
|
|
685
|
+
install(): Promise<ComponentEntry>;
|
|
686
|
+
acquireResource(identifier: string): ComponentResource;
|
|
687
|
+
getResource(identifier: string): ComponentResource;
|
|
688
|
+
hasResource(identifier: string): boolean;
|
|
689
|
+
getResourceAsync(identifier: string): Promise<ComponentResource>;
|
|
690
|
+
fetchResource<T = any>(identifier: string): Promise<T>;
|
|
691
|
+
getLogStats(): import( '@jointhedots/core').LogInfos;
|
|
692
|
+
getLogs(count: number): QueryLogResult;
|
|
693
|
+
}
|
|
694
|
+
export class ComponentResource {
|
|
695
|
+
readonly component: ComponentEntry;
|
|
696
|
+
readonly resource: string;
|
|
697
|
+
entry: any;
|
|
698
|
+
identifier: string;
|
|
699
|
+
constructor(component: ComponentEntry, resource: string);
|
|
700
|
+
get valid(): boolean;
|
|
701
|
+
get loaded(): boolean;
|
|
702
|
+
fetch<T = any>(): Promise<T>;
|
|
703
|
+
get<T = any>(): T;
|
|
704
|
+
set(data: any): void;
|
|
705
|
+
get spec(): any;
|
|
706
|
+
get url(): string;
|
|
707
|
+
}
|
|
708
|
+
export type ComponentsListener = (target: ComponentEntry) => void;
|
|
709
|
+
export class ComponentsManifold {
|
|
710
|
+
components: Map<string, ComponentEntry<any>>;
|
|
711
|
+
resources: Map<string, ComponentResource>;
|
|
712
|
+
datamap: WeakMap<any, ComponentEntry<any> | ComponentResource>;
|
|
713
|
+
loadings: Map<any, Promise<any>>;
|
|
714
|
+
installings: Map<any, Promise<ComponentEntry<any>>>;
|
|
715
|
+
listeners: Set<ComponentsListener>;
|
|
716
|
+
components_provider: CombinedComponentProvider;
|
|
717
|
+
resources_loader: IResourceLoader;
|
|
718
|
+
content_provider: IContentProvider;
|
|
719
|
+
constructor();
|
|
720
|
+
listen(l: ComponentsListener): ComponentsListener;
|
|
721
|
+
unlisten(l: ComponentsListener): void;
|
|
722
|
+
notifyError(subject: ComponentEntry, error: Error): void;
|
|
723
|
+
}
|
|
724
|
+
export const ComponentsRegistry: ComponentsManifold;
|
|
725
|
+
export function getDefaultComponent(): ComponentEntry<any>;
|
|
726
|
+
export function getComponentFromData(data: any, is_static?: boolean): ComponentEntry;
|
|
727
|
+
export function acquireComponent(id: string): ComponentEntry;
|
|
728
|
+
export function acquireFutureComponent(manifest: ComponentManifest): ComponentEntry;
|
|
729
|
+
export function acquireResource(ref: string): ComponentResource;
|
|
730
|
+
export function resolveRelativeComponent(ref: string, from: ComponentEntry): ComponentEntry;
|
|
731
|
+
export function saveComponentManifest(manifest: ComponentManifest): Promise<ComponentEntry<any>>;
|
|
732
|
+
export function saveComponent(component: ComponentEntry): Promise<ComponentEntry<any>>;
|
|
733
|
+
export function deleteComponent(id: string): Promise<void>;
|
|
734
|
+
export function unregisterComponent(id: string): void;
|
|
735
|
+
export function searchComponentsPublications(filter: ComponentFilter): Promise<ComponentPublication[]>;
|
|
736
|
+
export function fetchComponentsPublications(components_ids: string[]): Promise<ComponentPublication[]>;
|
|
737
|
+
export function failedComponentPublication(id: string, title?: string): ComponentPublication;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
declare module '@jointhedots/core/commands' {
|
|
741
|
+
import type { Serializable } from 'child_process';
|
|
742
|
+
export type Cmdlet<CmdPayload extends Serializable = Serializable, CmdResult extends Serializable = Serializable> = {
|
|
743
|
+
payload: CmdPayload;
|
|
744
|
+
result: CmdResult;
|
|
745
|
+
};
|
|
746
|
+
export type CmdPayload<C extends Cmdlet> = C extends {
|
|
747
|
+
payload: infer P;
|
|
748
|
+
} ? P : void;
|
|
749
|
+
export type CmdResult<C extends Cmdlet> = C extends {
|
|
750
|
+
result: infer P;
|
|
751
|
+
} ? P : void;
|
|
752
|
+
export interface Command<C extends Cmdlet = Cmdlet> {
|
|
753
|
+
target: string;
|
|
754
|
+
payload?: CmdPayload<C>;
|
|
755
|
+
icon?: string;
|
|
756
|
+
title?: string;
|
|
757
|
+
summary?: string;
|
|
758
|
+
identity?: string;
|
|
759
|
+
signature?: string;
|
|
760
|
+
}
|
|
761
|
+
export interface CommandsService {
|
|
762
|
+
execute<C extends Cmdlet>(cmd: string, data: CmdPayload<C>): Promise<CmdResult<C>>;
|
|
763
|
+
}
|
|
764
|
+
export function executeCommand(cmd: Command): Promise<void>;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
declare module 'src/logging' {
|
|
768
|
+
import type { Command } from '@jointhedots/core/commands';
|
|
769
|
+
export type LogObjectID = string;
|
|
770
|
+
export type LogStatus = "error" | "warn" | "notify" | "info";
|
|
771
|
+
export type LogKind = "event" | "ticket";
|
|
772
|
+
export interface ILogDispatcher {
|
|
773
|
+
notifyError(error: Error, subject?: any): any;
|
|
774
|
+
notifyObject(object: LogObject): any;
|
|
775
|
+
}
|
|
776
|
+
export interface ILogSubject {
|
|
777
|
+
getSubject(): string;
|
|
778
|
+
}
|
|
779
|
+
export interface LogAction extends Command {
|
|
780
|
+
optional?: boolean;
|
|
781
|
+
doc_uri?: string;
|
|
782
|
+
callback?: Command;
|
|
783
|
+
}
|
|
784
|
+
export interface LogObject {
|
|
785
|
+
id: LogObjectID;
|
|
786
|
+
kind: LogKind;
|
|
787
|
+
status: LogStatus;
|
|
788
|
+
message: string;
|
|
789
|
+
component_id: string;
|
|
790
|
+
doc_uri?: string;
|
|
791
|
+
icon?: string;
|
|
792
|
+
title?: string;
|
|
793
|
+
attributes?: Record<string, string | number>;
|
|
794
|
+
actions?: LogAction[];
|
|
795
|
+
}
|
|
796
|
+
export function registerLogCollector(collector: ILogDispatcher): void;
|
|
797
|
+
export function unregisterLogCollector(collector: ILogDispatcher): void;
|
|
798
|
+
export function queryLogCount(): number;
|
|
799
|
+
export type QueryLogResult = {
|
|
800
|
+
objects: LogObject[];
|
|
801
|
+
hasMore: boolean;
|
|
802
|
+
};
|
|
803
|
+
export function queryLogObjects(count: number, component_id?: string): QueryLogResult;
|
|
804
|
+
export type LogInfos = {
|
|
805
|
+
action_expected_count: number;
|
|
806
|
+
error_count: number;
|
|
807
|
+
warn_count: number;
|
|
808
|
+
notify_count: number;
|
|
809
|
+
info_count: number;
|
|
810
|
+
};
|
|
811
|
+
export function queryLogInfos(component_id?: string): LogInfos;
|
|
812
|
+
export const Log: {
|
|
813
|
+
send(object: LogObject): void;
|
|
814
|
+
error(error: Error, target?: any): void;
|
|
815
|
+
event(target: any, options?: Partial<LogObject>): void;
|
|
816
|
+
openTicket(target: any, name: string, options?: Partial<LogObject>): void;
|
|
817
|
+
closeTicket(target: any, name: string): void;
|
|
818
|
+
};
|
|
819
|
+
export function createLogFromError(error: Error, target?: any): LogObject;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
declare module '@jointhedots/core/src/observable/attributes' {
|
|
823
|
+
export const ObservableAttribute: unique symbol;
|
|
824
|
+
export const HttpStatusAttribute: unique symbol;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
declare module '@jointhedots/core/src/observable/observable' {
|
|
828
|
+
export type Observer = (target: any, key: PropertyKey) => void;
|
|
829
|
+
export class Observable<T extends Object> implements ProxyHandler<T> {
|
|
830
|
+
observers: (Observer | string[])[];
|
|
831
|
+
state: T;
|
|
832
|
+
image: T;
|
|
833
|
+
constructor();
|
|
834
|
+
subscribe(observer: Observer, keys?: string[]): void;
|
|
835
|
+
unsubscribe(observer: Observer): void;
|
|
836
|
+
notify(key?: PropertyKey): void;
|
|
837
|
+
use(keys?: string[]): Promise<T>;
|
|
838
|
+
get(target: T, key: PropertyKey): any;
|
|
839
|
+
set(target: T, key: PropertyKey, value: any): boolean;
|
|
840
|
+
ownKeys(target: T): (string | symbol)[];
|
|
841
|
+
has(target: T, key: PropertyKey): boolean;
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
declare module '@jointhedots/core/src/observable/listenable' {
|
|
846
|
+
type ListenersArray = (Function | string)[];
|
|
847
|
+
export type ListenableContexts = {
|
|
848
|
+
[contextName: string]: any;
|
|
849
|
+
};
|
|
850
|
+
export type ListenableResult = Promise<Listenable> | Listenable | null;
|
|
851
|
+
export class Listenable<S = any> {
|
|
852
|
+
".events": any[];
|
|
853
|
+
".listeners": ListenersArray;
|
|
854
|
+
addEventListener(callback: Function): boolean;
|
|
855
|
+
addEventListener(eventType: string | string[], callback: Function): boolean;
|
|
856
|
+
removeEventListener(callback: Function): boolean;
|
|
857
|
+
removeEventListener(eventType: string, callback: Function): boolean;
|
|
858
|
+
synchronizeStateInContext(contexts: ListenableContexts, // Collection of data, the listenable can access to it environment variable by key
|
|
859
|
+
writable: boolean, // true when a writable listenable is required for the resulting listenable
|
|
860
|
+
fields?: string[] | boolean, // fields required in the resulting listenable
|
|
861
|
+
previousResult?: Listenable): Promise<Listenable> | Listenable;
|
|
862
|
+
addStateListener(callback: Function, fields?: string[]): boolean;
|
|
863
|
+
removeStateListener(callback: Function): boolean;
|
|
864
|
+
setState(): void;
|
|
865
|
+
setState(key: keyof S, value: any): void;
|
|
866
|
+
setState(values: Partial<S>): void;
|
|
867
|
+
dispatchEvent(type: string, data?: any): void;
|
|
868
|
+
executeEvent(type: string, data?: any): Promise<any[]>;
|
|
869
|
+
static setState(): void;
|
|
870
|
+
static setState(key: string, value: any): void;
|
|
871
|
+
static setState(values: {
|
|
872
|
+
[key: string]: any;
|
|
873
|
+
}): void;
|
|
874
|
+
}
|
|
875
|
+
export {};
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
declare module '@jointhedots/core/src/logging/console' {
|
|
879
|
+
export const print: {
|
|
880
|
+
log(...args: any[]): any;
|
|
881
|
+
debug(...args: any[]): any;
|
|
882
|
+
warning(...args: any[]): any;
|
|
883
|
+
error(...args: any[]): any;
|
|
884
|
+
success(...args: any[]): any;
|
|
885
|
+
title(...args: any[]): any;
|
|
886
|
+
info(...args: any[]): any;
|
|
887
|
+
exception(exception: Error): any;
|
|
888
|
+
};
|
|
889
|
+
export class ConsoleTable {
|
|
890
|
+
readonly sizes: number[];
|
|
891
|
+
constructor(sizes: number[]);
|
|
892
|
+
head(...cells: any[]): void;
|
|
893
|
+
row(...cells: any[]): void;
|
|
894
|
+
end(): void;
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
declare module '@jointhedots/core/src/observable/RestResource' {
|
|
899
|
+
import { Observable } from '@jointhedots/core/src/observable/observable';
|
|
900
|
+
export class RestResource<T extends Object> extends Observable<T> {
|
|
901
|
+
readonly url: string;
|
|
902
|
+
loaded: boolean;
|
|
903
|
+
query: Promise<T>;
|
|
904
|
+
status: number;
|
|
905
|
+
constructor(url: string);
|
|
906
|
+
use(): Promise<T>;
|
|
907
|
+
get(target: T, key: PropertyKey): any;
|
|
908
|
+
set(target: T, key: PropertyKey, value: any): boolean;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
declare module 'src/observable' {
|
|
913
|
+
export * from '@jointhedots/core/src/observable/attributes';
|
|
914
|
+
export * from '@jointhedots/core/src/observable/observable';
|
|
915
|
+
export * from '@jointhedots/core/src/observable/listenable';
|
|
916
|
+
export * from '@jointhedots/core/src/observable/RestResource';
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
declare module '@jointhedots/core/src/schema/helpers' {
|
|
920
|
+
import { type JSONSchema } from '@jointhedots/core/src/schema/schema';
|
|
921
|
+
export const CommonTypes: {
|
|
922
|
+
boolean: JSONSchema;
|
|
923
|
+
string: JSONSchema;
|
|
924
|
+
number: JSONSchema;
|
|
925
|
+
object: JSONSchema;
|
|
926
|
+
view: JSONSchema;
|
|
927
|
+
display: JSONSchema;
|
|
928
|
+
function: JSONSchema;
|
|
929
|
+
null: JSONSchema;
|
|
930
|
+
unknown: JSONSchema;
|
|
931
|
+
any: JSONSchema;
|
|
932
|
+
};
|
|
933
|
+
export const CommonMakers: {
|
|
934
|
+
enums(base: JSONSchema, ...values: string[]): JSONSchema;
|
|
935
|
+
array(base: JSONSchema): JSONSchema;
|
|
936
|
+
record(fields: Record<string, JSONSchema>): JSONSchema;
|
|
937
|
+
collection(items: JSONSchema): JSONSchema;
|
|
938
|
+
event_fn(event?: JSONSchema): JSONSchema;
|
|
939
|
+
};
|
|
940
|
+
export const ErrorTypes: Record<string, JSONSchema>; function getPropertyTyping(propertyName: string, schema: JSONSchema): JSONSchema; function getItemTyping(index: number, schema: JSONSchema): JSONSchema; function getValueTyping(value: any): JSONSchema; function isType(typing: JSONSchema, kind: string): boolean; function typeAsString(type: JSONSchema["type"]): string; function generateTypescript(schema: JSONSchema): string;
|
|
941
|
+
export const Schema: {
|
|
942
|
+
getPropertyTyping: typeof getPropertyTyping;
|
|
943
|
+
getItemTyping: typeof getItemTyping;
|
|
944
|
+
getValueTyping: typeof getValueTyping;
|
|
945
|
+
isType: typeof isType;
|
|
946
|
+
typeAsString: typeof typeAsString;
|
|
947
|
+
generateTypescript: typeof generateTypescript;
|
|
948
|
+
};
|
|
949
|
+
export {};
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
declare module '@jointhedots/core/src/schema/zod' {
|
|
953
|
+
import { z, type ZodType } from 'zod';
|
|
954
|
+
import { type JSONSchema, type ServiceSchema } from '@jointhedots/core/src/schema/schema';
|
|
955
|
+
export class ZodService<T = unknown> {
|
|
956
|
+
readonly $spec: string;
|
|
957
|
+
readonly version?: string;
|
|
958
|
+
readonly _type: "ZodService";
|
|
959
|
+
constructor($spec: string, version?: string);
|
|
960
|
+
parse(data: unknown): T;
|
|
961
|
+
safeParse(data: unknown): {
|
|
962
|
+
success: true;
|
|
963
|
+
data: T;
|
|
964
|
+
error?: undefined;
|
|
965
|
+
} | {
|
|
966
|
+
success: false;
|
|
967
|
+
error: Error;
|
|
968
|
+
data?: undefined;
|
|
969
|
+
};
|
|
970
|
+
toJSONSchema(): ServiceSchema;
|
|
971
|
+
static create<T = unknown>($spec: string, version?: string): ZodService<T>;
|
|
972
|
+
}
|
|
973
|
+
export const zService: typeof ZodService.create;
|
|
974
|
+
export function zodToJSONSchema(schema: ZodType | ZodService): JSONSchema;
|
|
975
|
+
export function jsonSchemaToZod(schema: JSONSchema): ZodType;
|
|
976
|
+
export type ValidationResult<T = unknown> = {
|
|
977
|
+
success: true;
|
|
978
|
+
data: T;
|
|
979
|
+
} | {
|
|
980
|
+
success: false;
|
|
981
|
+
errors: ValidationError[];
|
|
982
|
+
};
|
|
983
|
+
export type ValidationError = {
|
|
984
|
+
path: string[];
|
|
985
|
+
message: string;
|
|
986
|
+
code?: string;
|
|
987
|
+
};
|
|
988
|
+
export function validate<T>(schema: JSONSchema | ZodType, data: unknown): ValidationResult<T>;
|
|
989
|
+
export function validateOrThrow<T>(schema: JSONSchema | ZodType, data: unknown): T;
|
|
990
|
+
export type TSGenOptions = {
|
|
991
|
+
comments?: boolean;
|
|
992
|
+
indent?: string;
|
|
993
|
+
export?: boolean;
|
|
994
|
+
};
|
|
995
|
+
export function generateTypeScript(schema: JSONSchema, name: string, opts?: TSGenOptions): string;
|
|
996
|
+
export { z };
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
declare module 'src/schema' {
|
|
1000
|
+
export * from '@jointhedots/core/src/schema/helpers';
|
|
1001
|
+
export * from '@jointhedots/core/src/schema/schema';
|
|
1002
|
+
export * from '@jointhedots/core/src/schema/zod';
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
declare module 'src/components' {
|
|
1006
|
+
export * from '@jointhedots/core/src/components/components';
|
|
1007
|
+
export * from '@jointhedots/core/src/components/manifold';
|
|
1008
|
+
export * from '@jointhedots/core/src/components/helpers';
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
declare module '@jointhedots/core/src/services/service-specification' {
|
|
1012
|
+
import type { JSONSchema } from '@jointhedots/core/src/schema/schema';
|
|
1013
|
+
import type { ZodType } from 'zod';
|
|
1014
|
+
/**
|
|
1015
|
+
* ServiceSpecification defines the metadata and schema for a service interface.
|
|
1016
|
+
* It describes the contract that providers must implement and consumers can rely on.
|
|
1017
|
+
*
|
|
1018
|
+
* @template I - The TypeScript interface type this service represents
|
|
1019
|
+
* @template P - The type of properties (hyperparameters) for service specialization
|
|
1020
|
+
*/
|
|
1021
|
+
export interface ServiceSpecification<I = unknown, P = unknown> {
|
|
1022
|
+
/** Unique identifier for the service specification (URI or qualified name) */
|
|
1023
|
+
$spec: string;
|
|
1024
|
+
/** Semantic version of the specification (e.g., "1.0.0") */
|
|
1025
|
+
version: string;
|
|
1026
|
+
/**
|
|
1027
|
+
* JSON Schema defining the service interface including:
|
|
1028
|
+
* - title, description (metadata)
|
|
1029
|
+
* - properties (hyperparameters for service specialization)
|
|
1030
|
+
* - All standard JSON Schema validation rules
|
|
1031
|
+
*/
|
|
1032
|
+
schema?: JSONSchema;
|
|
1033
|
+
/**
|
|
1034
|
+
* Zod schema for runtime validation and compile-time type inference.
|
|
1035
|
+
* Bridges runtime validation with TypeScript's static type system.
|
|
1036
|
+
*/
|
|
1037
|
+
properties?: ZodType<P>;
|
|
1038
|
+
/** Category or domain the service belongs to */
|
|
1039
|
+
category?: string;
|
|
1040
|
+
/** Tags for discovery and filtering */
|
|
1041
|
+
tags?: string[];
|
|
1042
|
+
/** Minimum compatible version for consumers */
|
|
1043
|
+
minCompatibleVersion?: string;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Result of checking compatibility between consumer and provider
|
|
1047
|
+
*/
|
|
1048
|
+
export interface ServiceCompatibility {
|
|
1049
|
+
/** Whether the service is compatible */
|
|
1050
|
+
compatible: boolean;
|
|
1051
|
+
/** Reason for incompatibility if not compatible */
|
|
1052
|
+
reason?: string;
|
|
1053
|
+
/** Warnings about potential issues */
|
|
1054
|
+
warnings?: string[];
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* Check if a provider version is compatible with a consumer's required version
|
|
1058
|
+
*/
|
|
1059
|
+
export function checkVersionCompatibility(requiredVersion: string, providedVersion: string, minCompatibleVersion?: string): ServiceCompatibility;
|
|
1060
|
+
/**
|
|
1061
|
+
* Create a service specification with full metadata
|
|
1062
|
+
*/
|
|
1063
|
+
export function defineServiceSpec<I = unknown, P = unknown>(spec: ServiceSpecification<I, P>): ServiceSpecification<I, P>;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
declare module '@jointhedots/core/src/services/service-definitions' {
|
|
1067
|
+
import type { ServiceSchema } from '@jointhedots/core/src/schema/schema';
|
|
1068
|
+
import { ZodService } from '@jointhedots/core/src/schema/zod';
|
|
1069
|
+
import type { ZodType } from 'zod';
|
|
1070
|
+
import { type ServiceSpecification, type ServiceCompatibility } from '@jointhedots/core/src/services/service-specification';
|
|
1071
|
+
/**
|
|
1072
|
+
* ServiceDefinition is a concrete definition linking a specification to implementation.
|
|
1073
|
+
*
|
|
1074
|
+
* @template I - The TypeScript interface type this service implements
|
|
1075
|
+
* @template P - The type of properties (hyperparameters) for service speci alization
|
|
1076
|
+
*/
|
|
1077
|
+
export interface ServiceDefinition<I, P = unknown> {
|
|
1078
|
+
/** Reference to the service specification */
|
|
1079
|
+
$spec: string;
|
|
1080
|
+
/** Version of the specification this definition implements */
|
|
1081
|
+
version: string;
|
|
1082
|
+
/** Zod schema for validating properties */
|
|
1083
|
+
properties?: ZodType<P>;
|
|
1084
|
+
/** Check if the service is compatible for assignement with an other definition */
|
|
1085
|
+
isAssignable(from: ServiceDefinition<I>): any;
|
|
1086
|
+
}
|
|
1087
|
+
export type ServiceInterface<T> = T extends ServiceDefinition<infer I, any> ? I : never;
|
|
1088
|
+
/**
|
|
1089
|
+
* Get ZodService type from a service definition
|
|
1090
|
+
*/
|
|
1091
|
+
export function getServiceZod<I>(def: ServiceDefinition<I>): ZodService<I>;
|
|
1092
|
+
/**
|
|
1093
|
+
* Get ServiceSchema (JSON Schema representation) from a service definition
|
|
1094
|
+
*/
|
|
1095
|
+
export function getServiceSchema<I, P>(def: ServiceDefinition<I, P>): ServiceSchema;
|
|
1096
|
+
/**
|
|
1097
|
+
* Get full ServiceSchema including attributes schema from a specification
|
|
1098
|
+
*/
|
|
1099
|
+
export function getServiceSchemaFromSpec<I, A>(spec: ServiceSpecification<I, A>): ServiceSchema;
|
|
1100
|
+
/**
|
|
1101
|
+
* Check if a service definition matches a specification
|
|
1102
|
+
*/
|
|
1103
|
+
export function matchesSpecification<I, A>(def: ServiceDefinition<I, A>, spec: ServiceSpecification<I, A>): ServiceCompatibility;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
declare module '@jointhedots/core/src/services/settings' {
|
|
1107
|
+
export type CommonSetting = Record<string, any>;
|
|
1108
|
+
export type SettingGroup = "service_points" | "components" | "shareds";
|
|
1109
|
+
export type SettingStores<T> = {
|
|
1110
|
+
[id in SettingGroup]: Record<string, T>;
|
|
1111
|
+
};
|
|
1112
|
+
export enum WriteMode {
|
|
1113
|
+
Default = 0,
|
|
1114
|
+
Reset = 1,
|
|
1115
|
+
Temporary = 2
|
|
1116
|
+
}
|
|
1117
|
+
export class AccountSettings {
|
|
1118
|
+
readonly name: string;
|
|
1119
|
+
key: string;
|
|
1120
|
+
stores: SettingStores<string>;
|
|
1121
|
+
temporaries: SettingStores<string>;
|
|
1122
|
+
settings: SettingStores<CommonSetting>;
|
|
1123
|
+
constructor(name: string);
|
|
1124
|
+
get<T = any>(group: SettingGroup, key: string): T;
|
|
1125
|
+
set<T = any>(group: SettingGroup, key: string, descriptor: T, mode?: WriteMode): boolean;
|
|
1126
|
+
list(group: SettingGroup): string[];
|
|
1127
|
+
read(key: string): string;
|
|
1128
|
+
write(group: SettingGroup, key: string, data: string, mode: WriteMode): boolean;
|
|
1129
|
+
restore(stores: SettingStores<string>): void;
|
|
1130
|
+
}
|
|
1131
|
+
type SettingsChangeHandler = (group: SettingGroup, id: string) => void;
|
|
1132
|
+
export function getSettings(): AccountSettings;
|
|
1133
|
+
export function listenSettings(handler: SettingsChangeHandler): SettingsChangeHandler;
|
|
1134
|
+
export function unlistenSettings(handler: SettingsChangeHandler): void;
|
|
1135
|
+
export {};
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
declare module '@jointhedots/core/src/services/service-points' {
|
|
1139
|
+
import { type ComponentID } from '@jointhedots/core/src/components/components';
|
|
1140
|
+
import { type ILogDispatcher, type LogObject } from 'src/logging';
|
|
1141
|
+
import { ServiceEntry, type ServiceType } from '@jointhedots/core/src/services/service-entry';
|
|
1142
|
+
export const ServicePoints: Map<string, ServicePoint>;
|
|
1143
|
+
export type ServicePointID = string;
|
|
1144
|
+
export type ServicePointProperties = {
|
|
1145
|
+
title?: string;
|
|
1146
|
+
multiple?: boolean;
|
|
1147
|
+
alternative?: ServicePointID;
|
|
1148
|
+
};
|
|
1149
|
+
export type ServicePointSetting = {
|
|
1150
|
+
id: ServicePointID;
|
|
1151
|
+
providers: ComponentID[];
|
|
1152
|
+
properties: ServicePointProperties;
|
|
1153
|
+
};
|
|
1154
|
+
export type ServiceChangeHandler = (service: ServicePoint) => void;
|
|
1155
|
+
export class ServicePoint<IService = unknown> implements ILogDispatcher {
|
|
1156
|
+
descriptor: ServicePointSetting;
|
|
1157
|
+
service: ServiceType;
|
|
1158
|
+
name: string;
|
|
1159
|
+
services: IService[];
|
|
1160
|
+
loading: Promise<IService[]>;
|
|
1161
|
+
ready: boolean;
|
|
1162
|
+
failure: Error;
|
|
1163
|
+
constructor(descriptor: ServicePointSetting);
|
|
1164
|
+
get id(): string;
|
|
1165
|
+
get multiple(): boolean;
|
|
1166
|
+
fetch(): Promise<IService[]>;
|
|
1167
|
+
reset(descriptor: ServicePointSetting): Promise<this>;
|
|
1168
|
+
override(providers: ComponentID[]): void;
|
|
1169
|
+
notifyError(error: Error): void;
|
|
1170
|
+
notifyObject(object: LogObject): void;
|
|
1171
|
+
}
|
|
1172
|
+
export function listenServicePoints(handler: ServiceChangeHandler): ServiceChangeHandler;
|
|
1173
|
+
export function unlistenServicePoints(handler: ServiceChangeHandler): void;
|
|
1174
|
+
export function acquireServicePointDescriptor(id: string): ServicePointSetting;
|
|
1175
|
+
export function updateServicePointDescriptor(id: string, properties: ServicePointProperties): ServicePointSetting;
|
|
1176
|
+
export function getServicePoint<IService>(id: string): ServicePoint<IService>;
|
|
1177
|
+
export function acquireServicePoint<IService>(id: string): ServicePoint<IService>;
|
|
1178
|
+
export function createServicePoint<S extends any, D extends any>(service: ServiceEntry<S, D>, name: ServicePointID, properties?: ServicePointProperties): ServicePoint<S>;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
declare module 'src/services' {
|
|
1182
|
+
export * from '@jointhedots/core/src/services/service-definitions';
|
|
1183
|
+
export * from '@jointhedots/core/src/services/service-points';
|
|
1184
|
+
export * from '@jointhedots/core/src/services/service-specification';
|
|
1185
|
+
export * from '@jointhedots/core/src/services/service-entry';
|
|
1186
|
+
export * from '@jointhedots/core/src/services/settings';
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
declare module '@jointhedots/core/src/scripting/ast/primitives' {
|
|
1190
|
+
import * as Acorn from 'acorn';
|
|
1191
|
+
export * from 'acorn';
|
|
1192
|
+
/******************************************************
|
|
1193
|
+
// # Primitive
|
|
1194
|
+
/******************************************************/
|
|
1195
|
+
export type NodeKey = number;
|
|
1196
|
+
export interface Node extends Partial<Acorn.Node> {
|
|
1197
|
+
$id?: NodeKey;
|
|
1198
|
+
$owner?: NodeKey;
|
|
1199
|
+
annotations?: CompositePrimitive[];
|
|
1200
|
+
}
|
|
1201
|
+
export interface Primitive extends Node {
|
|
1202
|
+
type: string;
|
|
1203
|
+
}
|
|
1204
|
+
export interface Additional extends Node {
|
|
1205
|
+
type?: undefined;
|
|
1206
|
+
}
|
|
1207
|
+
export type SourceLink = {
|
|
1208
|
+
start: number;
|
|
1209
|
+
end?: number;
|
|
1210
|
+
fragment?: string;
|
|
1211
|
+
src?: number | string;
|
|
1212
|
+
};
|
|
1213
|
+
export type SourceLocation = SourceLink | SourceLink[];
|
|
1214
|
+
export type ExpressiveValue = boolean | number | string | AnyPrimitive | AnyPrimitive[];
|
|
1215
|
+
export type AnyPrimitive = Partial<Acorn.AnyNode> & Primitive | CompositePrimitive | ProceduralPrimitive | ElementPrimitive | DocumentPrimitive | ElementAttribute | RefPrimitive;
|
|
1216
|
+
export type Any = AnyPrimitive;
|
|
1217
|
+
interface RefPrimitive extends Additional {
|
|
1218
|
+
$ref: string | number;
|
|
1219
|
+
}
|
|
1220
|
+
/******************************************************
|
|
1221
|
+
// # Behavior/Procedural primitives
|
|
1222
|
+
/******************************************************/
|
|
1223
|
+
export interface RecallPrimitive extends Primitive {
|
|
1224
|
+
type: "Recall";
|
|
1225
|
+
intend: AnyPrimitive;
|
|
1226
|
+
}
|
|
1227
|
+
export interface SamplingPrimitive extends Primitive {
|
|
1228
|
+
type: "Sampling";
|
|
1229
|
+
items: AnyPrimitive;
|
|
1230
|
+
}
|
|
1231
|
+
export interface CommandPrimitive extends Primitive {
|
|
1232
|
+
type: "Command";
|
|
1233
|
+
cmd: string;
|
|
1234
|
+
}
|
|
1235
|
+
export type ProceduralPrimitive = SamplingPrimitive | CommandPrimitive;
|
|
1236
|
+
/******************************************************
|
|
1237
|
+
// # Semantic/Information primitives
|
|
1238
|
+
/******************************************************/
|
|
1239
|
+
export interface TextPrimitive extends Primitive {
|
|
1240
|
+
type: "Text";
|
|
1241
|
+
lang?: string;
|
|
1242
|
+
text: string;
|
|
1243
|
+
}
|
|
1244
|
+
export interface ImagePrimitive extends Primitive {
|
|
1245
|
+
type: "Image";
|
|
1246
|
+
name?: string;
|
|
1247
|
+
pixels: Blob;
|
|
1248
|
+
}
|
|
1249
|
+
export interface AudioPrimitive extends Primitive {
|
|
1250
|
+
type: "Audio";
|
|
1251
|
+
name?: string;
|
|
1252
|
+
data: Blob;
|
|
1253
|
+
}
|
|
1254
|
+
export interface VideoPrimitive extends Primitive {
|
|
1255
|
+
type: "Video";
|
|
1256
|
+
name?: string;
|
|
1257
|
+
data: Blob;
|
|
1258
|
+
}
|
|
1259
|
+
export enum BlockFormat {
|
|
1260
|
+
Paragraph = "paragraph",
|
|
1261
|
+
Tip = "tip",
|
|
1262
|
+
Quote = "quote",
|
|
1263
|
+
Code = "code",
|
|
1264
|
+
Section = "section",
|
|
1265
|
+
Figure = "figure",
|
|
1266
|
+
Association = "pair",// Association: associate a content to a label, ex: **{{label}}**: {{content}}
|
|
1267
|
+
Fragment = "fragment"
|
|
1268
|
+
}
|
|
1269
|
+
export enum BlockEmphasis {
|
|
1270
|
+
Important = "important",
|
|
1271
|
+
Information = "info",
|
|
1272
|
+
Warning = "warning",
|
|
1273
|
+
Danger = "danger"
|
|
1274
|
+
}
|
|
1275
|
+
export type BlockContent = AnyPrimitive[];
|
|
1276
|
+
export interface BlockPrimitive extends Primitive {
|
|
1277
|
+
type: "Block";
|
|
1278
|
+
format: BlockFormat;
|
|
1279
|
+
lang?: string;
|
|
1280
|
+
metadata?: string;
|
|
1281
|
+
label?: BlockContent;
|
|
1282
|
+
content: BlockContent;
|
|
1283
|
+
}
|
|
1284
|
+
export interface ListPrimitive extends Primitive {
|
|
1285
|
+
type: "List";
|
|
1286
|
+
items: AnyPrimitive[];
|
|
1287
|
+
}
|
|
1288
|
+
export interface TablePrimitive extends Primitive {
|
|
1289
|
+
type: "Table";
|
|
1290
|
+
subjects: AnyPrimitive[];
|
|
1291
|
+
items: AnyPrimitive[][];
|
|
1292
|
+
}
|
|
1293
|
+
/******************************************************
|
|
1294
|
+
// # Element: Generic procedural primitives
|
|
1295
|
+
/******************************************************/
|
|
1296
|
+
export interface ElementAttribute extends Additional {
|
|
1297
|
+
ns?: string;
|
|
1298
|
+
name: string;
|
|
1299
|
+
value: AnyPrimitive;
|
|
1300
|
+
}
|
|
1301
|
+
export interface ElementPrimitive extends Primitive {
|
|
1302
|
+
type: "Element";
|
|
1303
|
+
tag: string;
|
|
1304
|
+
attributes?: ElementAttribute[];
|
|
1305
|
+
content?: BlockContent;
|
|
1306
|
+
}
|
|
1307
|
+
export interface DocumentPrimitive extends Primitive {
|
|
1308
|
+
type: "Document";
|
|
1309
|
+
metadata?: Record<string, any>;
|
|
1310
|
+
content: AnyPrimitive[];
|
|
1311
|
+
}
|
|
1312
|
+
export type BasicPrimitive = TextPrimitive | ImagePrimitive | AudioPrimitive | VideoPrimitive;
|
|
1313
|
+
export type CompositePrimitive = BasicPrimitive | BlockPrimitive | ListPrimitive | TablePrimitive;
|
|
1314
|
+
}
|
|
1315
|
+
|
|
1316
|
+
declare module '@jointhedots/core/src/scripting/ast/serde/tokenizer' {
|
|
1317
|
+
export type MatchRule<P> = {
|
|
1318
|
+
name: string;
|
|
1319
|
+
parse: P;
|
|
1320
|
+
entry: RegExp;
|
|
1321
|
+
};
|
|
1322
|
+
export class TokenPattern {
|
|
1323
|
+
readonly id: number;
|
|
1324
|
+
readonly name: string;
|
|
1325
|
+
readonly marker: string;
|
|
1326
|
+
readonly parse?: (token: Token) => boolean;
|
|
1327
|
+
readonly pattern?: RegExp;
|
|
1328
|
+
constructor(id: number, name: string, marker: string, parse?: (token: Token) => boolean, pattern?: RegExp);
|
|
1329
|
+
createToken(source: TokenStream): Token;
|
|
1330
|
+
}
|
|
1331
|
+
export enum TokenBaseId {
|
|
1332
|
+
EOF = 0,
|
|
1333
|
+
Chunk = 1
|
|
1334
|
+
}
|
|
1335
|
+
export class Token {
|
|
1336
|
+
readonly rule: TokenPattern;
|
|
1337
|
+
readonly source: TokenStream;
|
|
1338
|
+
id: number;
|
|
1339
|
+
chunk: Token;
|
|
1340
|
+
start: number;
|
|
1341
|
+
end: number;
|
|
1342
|
+
data: any;
|
|
1343
|
+
match: RegExpExecArray;
|
|
1344
|
+
constructor(rule: TokenPattern, source: TokenStream);
|
|
1345
|
+
get raw(): string;
|
|
1346
|
+
fork(format: TokenizerFormat): TokenStream;
|
|
1347
|
+
toString(): string;
|
|
1348
|
+
print(): this;
|
|
1349
|
+
} function matchSpaceChunkInto(token: Token, chunk: Token): void;
|
|
1350
|
+
export class TokenizerFormat {
|
|
1351
|
+
readonly rules: TokenPattern[];
|
|
1352
|
+
charmap: Map<number, TokenPattern[]>;
|
|
1353
|
+
matchChunkInto: typeof matchSpaceChunkInto;
|
|
1354
|
+
constructor(rules?: TokenPattern[]);
|
|
1355
|
+
allowAnyChunk(): this;
|
|
1356
|
+
add(rule: TokenPattern): void;
|
|
1357
|
+
complete(): this;
|
|
1358
|
+
}
|
|
1359
|
+
export enum MergeKind {
|
|
1360
|
+
StreamPosition = 0,
|
|
1361
|
+
ChunkStart = 1,
|
|
1362
|
+
ChunkEnd = 2,
|
|
1363
|
+
TokenStart = 3,
|
|
1364
|
+
TokenEnd = 4
|
|
1365
|
+
}
|
|
1366
|
+
export class TokenStream {
|
|
1367
|
+
origin: Token;
|
|
1368
|
+
input: string;
|
|
1369
|
+
format: TokenizerFormat;
|
|
1370
|
+
matches: Token[];
|
|
1371
|
+
pos: number;
|
|
1372
|
+
end: number;
|
|
1373
|
+
last: Token;
|
|
1374
|
+
EOF: Token;
|
|
1375
|
+
chunk: Token;
|
|
1376
|
+
retainLast: boolean;
|
|
1377
|
+
constructor(input: string, format: TokenizerFormat);
|
|
1378
|
+
isEOF(): boolean;
|
|
1379
|
+
fork(format: TokenizerFormat, pos: number, end?: number): TokenStream;
|
|
1380
|
+
reset(pos: number): void;
|
|
1381
|
+
merge(kind: MergeKind): void;
|
|
1382
|
+
retain(): void;
|
|
1383
|
+
next<P>(): Token;
|
|
1384
|
+
}
|
|
1385
|
+
export {};
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
declare module '@jointhedots/core/src/logging/trace' {
|
|
1389
|
+
export const originalConsole: {
|
|
1390
|
+
assert(condition?: boolean, ...data: any[]): void;
|
|
1391
|
+
assert(value: any, message?: string, ...optionalParams: any[]): void;
|
|
1392
|
+
clear(): void;
|
|
1393
|
+
clear(): void;
|
|
1394
|
+
count(label?: string): void;
|
|
1395
|
+
count(label?: string): void;
|
|
1396
|
+
countReset(label?: string): void;
|
|
1397
|
+
countReset(label?: string): void;
|
|
1398
|
+
debug(...data: any[]): void;
|
|
1399
|
+
debug(message?: any, ...optionalParams: any[]): void;
|
|
1400
|
+
dir(item?: any, options?: any): void;
|
|
1401
|
+
dir(obj: any, options?: import( 'util').InspectOptions): void;
|
|
1402
|
+
dirxml(...data: any[]): void;
|
|
1403
|
+
dirxml(...data: any[]): void;
|
|
1404
|
+
error(...data: any[]): void;
|
|
1405
|
+
error(message?: any, ...optionalParams: any[]): void;
|
|
1406
|
+
group(...data: any[]): void;
|
|
1407
|
+
group(...label: any[]): void;
|
|
1408
|
+
groupCollapsed(...data: any[]): void;
|
|
1409
|
+
groupCollapsed(...label: any[]): void;
|
|
1410
|
+
groupEnd(): void;
|
|
1411
|
+
groupEnd(): void;
|
|
1412
|
+
info(...data: any[]): void;
|
|
1413
|
+
info(message?: any, ...optionalParams: any[]): void;
|
|
1414
|
+
log(...data: any[]): void;
|
|
1415
|
+
log(message?: any, ...optionalParams: any[]): void;
|
|
1416
|
+
table(tabularData?: any, properties?: string[]): void;
|
|
1417
|
+
table(tabularData: any, properties?: readonly string[]): void;
|
|
1418
|
+
time(label?: string): void;
|
|
1419
|
+
time(label?: string): void;
|
|
1420
|
+
timeEnd(label?: string): void;
|
|
1421
|
+
timeEnd(label?: string): void;
|
|
1422
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
1423
|
+
timeLog(label?: string, ...data: any[]): void;
|
|
1424
|
+
timeStamp(label?: string): void;
|
|
1425
|
+
timeStamp(label?: string): void;
|
|
1426
|
+
trace(...data: any[]): void;
|
|
1427
|
+
trace(message?: any, ...optionalParams: any[]): void;
|
|
1428
|
+
warn(...data: any[]): void;
|
|
1429
|
+
warn(message?: any, ...optionalParams: any[]): void;
|
|
1430
|
+
Console: console.ConsoleConstructor;
|
|
1431
|
+
profile(label?: string): void;
|
|
1432
|
+
profileEnd(label?: string): void;
|
|
1433
|
+
};
|
|
1434
|
+
export const logError: (...args: any[]) => void;
|
|
1435
|
+
export const logWarning: (...args: any[]) => void;
|
|
1436
|
+
export const logInfo: (...args: any[]) => void;
|
|
1437
|
+
export const logTrace: (...args: any[]) => void;
|
|
1438
|
+
export const logDebug: (...args: any[]) => void;
|
|
1439
|
+
export const print: Console;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
declare module '@jointhedots/core/src/scripting/ast/serde/parser' {
|
|
1443
|
+
import * as AST from '@jointhedots/core/src/scripting/ast/primitives';
|
|
1444
|
+
export function parseDocumentFromMDX(text: string): AST.DocumentPrimitive;
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
declare module '@jointhedots/core/src/scripting/ast/loader' {
|
|
1448
|
+
/***********
|
|
1449
|
+
* Flow Document: Editable/readable flow representation
|
|
1450
|
+
**********/
|
|
1451
|
+
import type { AST } from '@jointhedots/core/src/scripting/ast/api';
|
|
1452
|
+
import { type ElementPrimitive } from '@jointhedots/core/src/scripting/ast/primitives';
|
|
1453
|
+
export type FlowAny = ElementPrimitive;
|
|
1454
|
+
export function loadScriptASTFromText(text: string): AST.DocumentPrimitive;
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
declare module '@jointhedots/core/src/scripting/ast/api' {
|
|
1458
|
+
export * as AST from '@jointhedots/core/src/scripting/ast/primitives';
|
|
1459
|
+
export * from '@jointhedots/core/src/scripting/ast/loader';
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
declare module '@jointhedots/core/src/scripting/interpreter' {
|
|
1463
|
+
import type { AST } from '@jointhedots/core/src/scripting/ast/api';
|
|
1464
|
+
export interface InterpreterScope {
|
|
1465
|
+
getThis(): unknown;
|
|
1466
|
+
getValue(id: string): unknown;
|
|
1467
|
+
setValue(id: string, value: unknown): void;
|
|
1468
|
+
}
|
|
1469
|
+
export class LocalScope<C = unknown> implements InterpreterScope {
|
|
1470
|
+
readonly $parentScope: InterpreterScope | null;
|
|
1471
|
+
readonly $thisScope: unknown;
|
|
1472
|
+
readonly locals: Record<string, unknown>;
|
|
1473
|
+
constructor($parentScope: InterpreterScope | null, $thisScope: unknown, locals?: Record<string, unknown>);
|
|
1474
|
+
getThis(): unknown;
|
|
1475
|
+
getValue(id: string): unknown;
|
|
1476
|
+
setValue(id: string, value: unknown): void;
|
|
1477
|
+
setArguments(args: unknown[], params: AST.Pattern[]): void;
|
|
1478
|
+
}
|
|
1479
|
+
export const EmptyScope: LocalScope<unknown>;
|
|
1480
|
+
export const BINARY_OPERATIONS: Map<string, (l: unknown, r: unknown) => unknown>;
|
|
1481
|
+
export const UNARY_OPERATIONS: Map<string, (v: unknown) => unknown>;
|
|
1482
|
+
export const ASSIGNMENT_OPERATIONS: Map<string, (current: unknown, right: unknown) => unknown>;
|
|
1483
|
+
export const ENHANCED_BINARY_OPERATIONS: Map<string, (l: unknown, r: unknown) => unknown>;
|
|
1484
|
+
export const ENHANCED_ASSIGNMENT_OPERATIONS: Map<string, (current: unknown, right: unknown) => unknown>;
|
|
1485
|
+
export const ENHANCED_LOGICAL_OPERATIONS: Map<string, (l: unknown, r: unknown, scope: InterpreterScope) => unknown>;
|
|
1486
|
+
export function evaluateExpression(node: AST.Any, scope: InterpreterScope): unknown;
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
declare module '@jointhedots/core/src/scripting/template' {
|
|
1490
|
+
import * as ACorn from 'acorn';
|
|
1491
|
+
import { type InterpreterScope } from '@jointhedots/core/src/scripting/interpreter';
|
|
1492
|
+
export enum EmbedSyntax {
|
|
1493
|
+
DollarBracket = 0,// Embed: $(expr) | Escaping: \$(expr)
|
|
1494
|
+
DollarCurly = 1,// Embed: ${expr} | Escaping: \${expr}
|
|
1495
|
+
CurlyCurly = 2
|
|
1496
|
+
}
|
|
1497
|
+
export type TextContext = {
|
|
1498
|
+
vars: {
|
|
1499
|
+
[key: string]: any;
|
|
1500
|
+
};
|
|
1501
|
+
encoder?: (value: any) => string;
|
|
1502
|
+
};
|
|
1503
|
+
export class TextBinding {
|
|
1504
|
+
start: number;
|
|
1505
|
+
end: number;
|
|
1506
|
+
node: ACorn.AnyNode;
|
|
1507
|
+
constructor(start: number, end: number, node: ACorn.AnyNode);
|
|
1508
|
+
evaluate(scope: InterpreterScope): unknown;
|
|
1509
|
+
toString(): string;
|
|
1510
|
+
}
|
|
1511
|
+
export class TextTemplate {
|
|
1512
|
+
pattern: string;
|
|
1513
|
+
bindings: Record<string, TextBinding>;
|
|
1514
|
+
issues: Error[];
|
|
1515
|
+
constructor(pattern: string, bindings: Record<string, TextBinding>, issues: Error[]);
|
|
1516
|
+
evaluate(context: TextContext): string;
|
|
1517
|
+
getBindingAt(position: number): TextBinding;
|
|
1518
|
+
toString(): string;
|
|
1519
|
+
}
|
|
1520
|
+
export type PlaceholderGenerator = (text: string) => (index: number) => string;
|
|
1521
|
+
export function parseTextTemplate(code: string, syntax: EmbedSyntax, placeholder?: PlaceholderGenerator): TextTemplate;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
declare module 'src/scripting' {
|
|
1525
|
+
export * from '@jointhedots/core/src/scripting/interpreter';
|
|
1526
|
+
export * from '@jointhedots/core/src/scripting/template';
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
declare module '@jointhedots/core' {
|
|
1530
|
+
export * from '@jointhedots/core/src/common/types';
|
|
1531
|
+
export * from 'src/logging';
|
|
1532
|
+
export * from 'src/observable';
|
|
1533
|
+
export * from 'src/schema';
|
|
1534
|
+
export * from 'src/components';
|
|
1535
|
+
export * from 'src/services';
|
|
1536
|
+
export * from 'src/scripting';
|
|
1537
|
+
export * from '@jointhedots/core/src/providers/resources/StaticContentProvider';
|
|
1538
|
+
export * from '@jointhedots/core/src/providers/resources/CommonResourceProvider';
|
|
1539
|
+
export * from '@jointhedots/core/src/providers/components/CombinedComponentProvider';
|
|
1540
|
+
export * from '@jointhedots/core/src/providers/components/InMemComponentProvider';
|
|
1541
|
+
export * from '@jointhedots/core/src/providers/components/StaticComponentProvider';
|
|
1542
|
+
export * from '@jointhedots/core/src/providers/components/LocalComponentProvider';
|
|
1543
|
+
}
|
|
1544
|
+
|
|
1545
|
+
declare module '@jointhedots/core/src/interfaces/react/ErrorBoundary' {
|
|
1546
|
+
import React from 'react';
|
|
1547
|
+
import 'src/interfaces/react/style.scss';
|
|
1548
|
+
export type ErrorDisplayerType<E extends Error = Error> = React.ComponentType<{
|
|
1549
|
+
error: E;
|
|
1550
|
+
onRetry?: () => void;
|
|
1551
|
+
}>;
|
|
1552
|
+
export class ErrorDisplayer extends React.Component<{
|
|
1553
|
+
error: Error;
|
|
1554
|
+
onRetry?: () => void;
|
|
1555
|
+
}> {
|
|
1556
|
+
render(): import( 'react/jsx-runtime').JSX.Element;
|
|
1557
|
+
}
|
|
1558
|
+
export class ErrorBoundary extends React.Component<{
|
|
1559
|
+
children: React.ReactNode;
|
|
1560
|
+
}> {
|
|
1561
|
+
static contextType: React.Context<ErrorReconcilier>;
|
|
1562
|
+
context: ErrorReconcilier;
|
|
1563
|
+
state: {
|
|
1564
|
+
error?: Error;
|
|
1565
|
+
displayer?: ErrorDisplayerType;
|
|
1566
|
+
};
|
|
1567
|
+
componentDidCatch(error: Error): void;
|
|
1568
|
+
render(): string | number | true | Iterable<React.ReactNode> | import( 'react/jsx-runtime').JSX.Element;
|
|
1569
|
+
}
|
|
1570
|
+
export class ErrorReconcilier extends React.Component<{
|
|
1571
|
+
errorClass: new () => Error;
|
|
1572
|
+
errorDisplayer: ErrorDisplayerType;
|
|
1573
|
+
children: React.ReactNode;
|
|
1574
|
+
}> {
|
|
1575
|
+
static contextType: React.Context<ErrorReconcilier>;
|
|
1576
|
+
context: ErrorReconcilier;
|
|
1577
|
+
getErrorDisplayer(error: Error): ErrorDisplayerType<Error>;
|
|
1578
|
+
render(): string | number | true | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>;
|
|
1579
|
+
}
|
|
1580
|
+
export function registerErrorDisplayer<E extends Error>(errorClass: new (...args: any[]) => E, displayer: ErrorDisplayerType<E>): void;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
declare module '@jointhedots/core/view' {
|
|
1584
|
+
import { ComponentEntry } from '@jointhedots/core/src/components/manifold';
|
|
1585
|
+
import { ServiceEntry } from '@jointhedots/core/src/services/service-entry';
|
|
1586
|
+
export const ViewServiceKey: ServiceEntry<any, any>;
|
|
1587
|
+
export type ViewInfos = {
|
|
1588
|
+
name: string;
|
|
1589
|
+
params?: Record<string, ViewParam | ViewParam[] | Record<string, ViewParam>>;
|
|
1590
|
+
content?: string;
|
|
1591
|
+
nested?: ViewInfos;
|
|
1592
|
+
};
|
|
1593
|
+
export type ViewParam = string | boolean | number;
|
|
1594
|
+
export type ViewInvokable = {
|
|
1595
|
+
component: ComponentEntry;
|
|
1596
|
+
properties?: Record<string, string>;
|
|
1597
|
+
};
|
|
1598
|
+
export function getViewReferenceFrom(data: string | ViewInfos): string;
|
|
1599
|
+
export function getViewInfosFrom(data: string | ViewInfos, content?: string): ViewInfos;
|
|
1600
|
+
export function evaluateViewInfos(view: string | ViewInfos, origin?: string): Promise<ViewInvokable>;
|
|
1601
|
+
export function getViewURL(view: string | ViewInfos, inside?: string | ViewInfos): string;
|
|
1602
|
+
export function gotoURLView(view: string | ViewInfos, inside?: string | ViewInfos): void;
|
|
1603
|
+
export function updateURLView(view: string | ViewInfos): void;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
declare module '@jointhedots/core/src/interfaces/react/useLocation' {
|
|
1607
|
+
export function useLocation(): Location;
|
|
1608
|
+
export function useLocationHash(): string;
|
|
1609
|
+
export function getLocationQuery(): Record<string, string>;
|
|
1610
|
+
}
|
|
1611
|
+
|
|
1612
|
+
declare module '@jointhedots/core/src/interfaces/react/interface' {
|
|
1613
|
+
import { z, type ZodObject, type ZodRawShape } from 'zod';
|
|
1614
|
+
import { ServiceEntry, type ServiceDefinition, type ServiceInterface } from 'src/services';
|
|
1615
|
+
export type ViewServicePoint = {
|
|
1616
|
+
service?: string;
|
|
1617
|
+
cardinality?: number;
|
|
1618
|
+
};
|
|
1619
|
+
export type ViewRequirements = {
|
|
1620
|
+
servicePoints?: Record<string, ViewServicePoint>;
|
|
1621
|
+
};
|
|
1622
|
+
/**
|
|
1623
|
+
* Creates a ServiceDefinition for a React view component with typed props.
|
|
1624
|
+
*
|
|
1625
|
+
* This factory function generates a service definition that can be used to register
|
|
1626
|
+
* React components within the service system. It provides type-safe props validation
|
|
1627
|
+
* using Zod schemas and supports dependency injection through service points.
|
|
1628
|
+
*
|
|
1629
|
+
* @param props - Optional Zod schema defining the component's props structure.
|
|
1630
|
+
* If not provided, defaults to a record accepting any string keys.
|
|
1631
|
+
* @returns A ServiceDefinition specialized for React view components
|
|
1632
|
+
*
|
|
1633
|
+
* @example
|
|
1634
|
+
* ```typescript
|
|
1635
|
+
* // Define a component with typed props
|
|
1636
|
+
* const UserCardSchema = ReactComponentSchema(z.object({
|
|
1637
|
+
* userId: z.string(),
|
|
1638
|
+
* showAvatar: z.boolean().optional(),
|
|
1639
|
+
* }))
|
|
1640
|
+
*
|
|
1641
|
+
* // Use in component registration
|
|
1642
|
+
* const UserCard: ReactComponentType<typeof UserCardSchema> = ({ userId, showAvatar }) => {
|
|
1643
|
+
* return <div>{userId}</div>
|
|
1644
|
+
* }
|
|
1645
|
+
* ```
|
|
1646
|
+
*
|
|
1647
|
+
* @example
|
|
1648
|
+
* ```typescript
|
|
1649
|
+
* // Define a component with service requirements
|
|
1650
|
+
* const DashboardSchema = ReactComponentSchema(z.object({
|
|
1651
|
+
* title: z.string(),
|
|
1652
|
+
* }))
|
|
1653
|
+
*
|
|
1654
|
+
* // Component descriptor with service points
|
|
1655
|
+
* const descriptor: ReactComponentDescriptor = {
|
|
1656
|
+
* props: { title: "My Dashboard" },
|
|
1657
|
+
* requirements: {
|
|
1658
|
+
* servicePoints: {
|
|
1659
|
+
* dataService: { service: "spec://data-provider", cardinality: 1 },
|
|
1660
|
+
* },
|
|
1661
|
+
* },
|
|
1662
|
+
* }
|
|
1663
|
+
* ```
|
|
1664
|
+
*/
|
|
1665
|
+
export function ReactComponentSchema<T extends ZodRawShape>(props?: ZodObject<T>): ServiceDefinition<z.infer<z.ZodRecord<z.ZodString, z.ZodAny> | z.ZodObject<T, z.core.$strip>>, ReactComponentDescriptor<T>>;
|
|
1666
|
+
/**
|
|
1667
|
+
* Type alias for React components that integrate with the service system.
|
|
1668
|
+
*
|
|
1669
|
+
* Components of this type receive their props through `ServiceInterface<T>`,
|
|
1670
|
+
* which provides both the declared props and access to injected services.
|
|
1671
|
+
*
|
|
1672
|
+
* @template T - The props type, typically inferred from a Zod schema
|
|
1673
|
+
*
|
|
1674
|
+
* @example
|
|
1675
|
+
* ```typescript
|
|
1676
|
+
* const MyComponent: ReactComponentType<{ name: string }> = (props) => {
|
|
1677
|
+
* return <span>Hello, {props.name}!</span>
|
|
1678
|
+
* }
|
|
1679
|
+
* ```
|
|
1680
|
+
*/
|
|
1681
|
+
export type ReactComponentType<T = {}> = React.ComponentType<ServiceInterface<T>>;
|
|
1682
|
+
/**
|
|
1683
|
+
* Descriptor object for configuring a React component within the service system.
|
|
1684
|
+
*
|
|
1685
|
+
* This type defines the structure for declaring component properties and
|
|
1686
|
+
* service dependencies that will be injected at runtime.
|
|
1687
|
+
*
|
|
1688
|
+
* @template T - Zod shape type for props validation
|
|
1689
|
+
*
|
|
1690
|
+
* @property props - Initial props values matching the component's schema
|
|
1691
|
+
* @property requirements - Service injection configuration
|
|
1692
|
+
* @property requirements.servicePoints - Map of named service injection points,
|
|
1693
|
+
* each specifying the service spec URI and optional cardinality
|
|
1694
|
+
*
|
|
1695
|
+
* @example
|
|
1696
|
+
* ```typescript
|
|
1697
|
+
* const descriptor: ReactComponentDescriptor<{ count: z.ZodNumber }> = {
|
|
1698
|
+
* props: { count: 0 },
|
|
1699
|
+
* requirements: {
|
|
1700
|
+
* servicePoints: {
|
|
1701
|
+
* counter: { service: "spec://counter-service", cardinality: 1 },
|
|
1702
|
+
* logger: { service: "spec://logger" },
|
|
1703
|
+
* },
|
|
1704
|
+
* },
|
|
1705
|
+
* }
|
|
1706
|
+
* ```
|
|
1707
|
+
*/
|
|
1708
|
+
export type ReactComponentDescriptor<T extends ZodRawShape = ZodRawShape> = {
|
|
1709
|
+
props?: z.infer<ZodObject<T>>;
|
|
1710
|
+
requirements?: ViewRequirements;
|
|
1711
|
+
};
|
|
1712
|
+
export type ViewReactService<T = any> = React.ComponentType<T>;
|
|
1713
|
+
export const ViewReactKey: ServiceEntry<ViewReactService<any>, any>;
|
|
1714
|
+
export type ViewWebComponentService = new (...props: any[]) => HTMLElement;
|
|
1715
|
+
export const ViewWebComponentKey: ServiceEntry<ViewWebComponentService, any>;
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
declare module '@jointhedots/core/src/interfaces/react/useServices' {
|
|
1719
|
+
import React from 'react';
|
|
1720
|
+
import { ServicePoint, type ServiceChangeHandler } from '@jointhedots/core/src/services/service-points';
|
|
1721
|
+
import type { ViewRequirements } from '@jointhedots/core/src/interfaces/react/interface';
|
|
1722
|
+
export type IService = unknown;
|
|
1723
|
+
export type ServicePointsMap = Map<ServicePoint, IService[]>;
|
|
1724
|
+
export enum ServiceStatus {
|
|
1725
|
+
NotReady = 0,
|
|
1726
|
+
Loading = 1,
|
|
1727
|
+
Ready = 2,
|
|
1728
|
+
Failed = 3
|
|
1729
|
+
}
|
|
1730
|
+
export interface IServicePointsProvider {
|
|
1731
|
+
getService<IService>(svc: ServicePoint): IService[];
|
|
1732
|
+
}
|
|
1733
|
+
export interface IServicePointsController {
|
|
1734
|
+
readonly provider: IServicePointsProvider;
|
|
1735
|
+
readonly error: MissingServiceError;
|
|
1736
|
+
readonly status: ServiceStatus;
|
|
1737
|
+
notifyChange(svc: ServicePoint): any;
|
|
1738
|
+
dispose(): any;
|
|
1739
|
+
}
|
|
1740
|
+
export interface IServicePointsSupport extends IServicePointsProvider {
|
|
1741
|
+
addController(c: IServicePointsController): any;
|
|
1742
|
+
removeController(c: IServicePointsController): any;
|
|
1743
|
+
}
|
|
1744
|
+
export class MissingServiceError extends Error {
|
|
1745
|
+
missings: ServicePoint[];
|
|
1746
|
+
requireds?: ServicePoint[];
|
|
1747
|
+
constructor(missings: ServicePoint[], requireds?: ServicePoint[]);
|
|
1748
|
+
}
|
|
1749
|
+
export const ServicePointsSupportContext: React.Context<IServicePointsSupport>;
|
|
1750
|
+
export const ServicePointsProviderContext: React.Context<IServicePointsProvider>;
|
|
1751
|
+
export function useServicesListener(listener: ServiceChangeHandler): void;
|
|
1752
|
+
export function useServices<IService>(servicePoint: ServicePoint<IService>, cardinality?: number): IService[];
|
|
1753
|
+
export function useService<IService>(servicePoint: ServicePoint<IService>, optional?: boolean): IService;
|
|
1754
|
+
export function useServicesController(requireds: ServicePoint[], requirements: ViewRequirements): IServicePointsController | null;
|
|
1755
|
+
export type ServiceConfiguratorComponent = React.ComponentType<{
|
|
1756
|
+
services: ServicePoint[];
|
|
1757
|
+
}>;
|
|
1758
|
+
export function UseServicePoints(props: {
|
|
1759
|
+
requireds?: ServicePoint[];
|
|
1760
|
+
requirements?: ViewRequirements;
|
|
1761
|
+
configurator: ServiceConfiguratorComponent;
|
|
1762
|
+
children: any;
|
|
1763
|
+
}): import( 'react/jsx-runtime').JSX.Element;
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
declare module '@jointhedots/core/src/interfaces/react/ViewUrl' {
|
|
1767
|
+
import React, { type ReactElement } from 'react';
|
|
1768
|
+
import { type ViewInfos } from '@jointhedots/core/view';
|
|
1769
|
+
export function useCurrentView(): ViewInfos;
|
|
1770
|
+
export function InvokeView(props: {
|
|
1771
|
+
view: string | ViewInfos;
|
|
1772
|
+
origin?: string;
|
|
1773
|
+
fallback?: ReactElement;
|
|
1774
|
+
}): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
|
|
1775
|
+
export function InvokeUrlHashView(props: {
|
|
1776
|
+
hash: string;
|
|
1777
|
+
fallback?: ReactElement;
|
|
1778
|
+
}): import( 'react/jsx-runtime').JSX.Element;
|
|
1779
|
+
export function InvokeURLView(props: {
|
|
1780
|
+
fallback?: ReactElement;
|
|
1781
|
+
}): import( 'react/jsx-runtime').JSX.Element;
|
|
1782
|
+
export function InvokeNestedView(props: {
|
|
1783
|
+
fallback?: ReactElement;
|
|
1784
|
+
}): import( 'react/jsx-runtime').JSX.Element;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
declare module '@jointhedots/core/src/interfaces/react/useAsyncMemo' {
|
|
1788
|
+
export function useAsyncMemo<T extends any>(loader: () => Promise<T>, init: T, deps: any[]): T;
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
declare module '@jointhedots/core/src/interfaces/react/useAsyncState' {
|
|
1792
|
+
import React from 'react';
|
|
1793
|
+
export class AsyncState<T> {
|
|
1794
|
+
private value;
|
|
1795
|
+
private updateTimeout;
|
|
1796
|
+
private promise;
|
|
1797
|
+
private dispatch;
|
|
1798
|
+
private updateTimer;
|
|
1799
|
+
private shallUpdate;
|
|
1800
|
+
private updater;
|
|
1801
|
+
private deps;
|
|
1802
|
+
constructor(value: T, updateTimeout: number);
|
|
1803
|
+
use(updater: () => Promise<T>, deps: any[]): void;
|
|
1804
|
+
initiate(dispatch: (x: T) => void): void;
|
|
1805
|
+
private cancelAutoUpdate;
|
|
1806
|
+
private scheduleAutoUpdate;
|
|
1807
|
+
get isWaiting(): boolean;
|
|
1808
|
+
get hasState(): boolean;
|
|
1809
|
+
get autoUpdate(): number;
|
|
1810
|
+
set autoUpdate(timeout: number);
|
|
1811
|
+
set(value: T): void;
|
|
1812
|
+
get(): T;
|
|
1813
|
+
update(): void;
|
|
1814
|
+
cancel(): void;
|
|
1815
|
+
waiting(render: (data: T) => React.ReactNode): React.ReactNode;
|
|
1816
|
+
using(render: (data: T) => React.ReactNode): React.ReactNode;
|
|
1817
|
+
}
|
|
1818
|
+
export function useAsyncState<T>(updater: () => Promise<T>, deps: any[], initialState?: T, updateTime?: number): AsyncState<T>;
|
|
1819
|
+
export function waiting(render: () => React.ReactElement, ...waiteds: AsyncState<any>[]): React.ReactElement;
|
|
1820
|
+
export function using(render: () => React.ReactElement, ...waiteds: AsyncState<any>[]): React.ReactElement;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1823
|
+
declare module '@jointhedots/core/src/interfaces/react/useLocalStorage' {
|
|
1824
|
+
type Initier<S> = S | (() => S);
|
|
1825
|
+
export function useLocalStorage<T = any>(key: string, initier: Initier<T>): [T, (x: T) => void];
|
|
1826
|
+
export {};
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
declare module '@jointhedots/core/src/interfaces/react/useSessionStorage' {
|
|
1830
|
+
type Initier<S> = S | (() => S);
|
|
1831
|
+
export function useSessionStorage<T = any>(key: string, initier: Initier<T>): [T, (x: T) => void];
|
|
1832
|
+
export {};
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
declare module '@jointhedots/core/src/interfaces/react/useForceUpdate' {
|
|
1836
|
+
export function useForceUpdate(): () => void;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
declare module '@jointhedots/core/react' {
|
|
1840
|
+
export * from '@jointhedots/core/src/interfaces/react/interface';
|
|
1841
|
+
export * from '@jointhedots/core/src/interfaces/react/useAsyncMemo';
|
|
1842
|
+
export * from '@jointhedots/core/src/interfaces/react/useAsyncState';
|
|
1843
|
+
export * from '@jointhedots/core/src/interfaces/react/useServices';
|
|
1844
|
+
export * from '@jointhedots/core/src/interfaces/react/useLocation';
|
|
1845
|
+
export * from '@jointhedots/core/src/interfaces/react/useLocalStorage';
|
|
1846
|
+
export * from '@jointhedots/core/src/interfaces/react/useSessionStorage';
|
|
1847
|
+
export * from '@jointhedots/core/src/interfaces/react/useForceUpdate';
|
|
1848
|
+
export * from '@jointhedots/core/src/interfaces/react/ErrorBoundary';
|
|
1849
|
+
export * from '@jointhedots/core/src/interfaces/react/ViewUrl';
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
declare module '@jointhedots/core/src/interfaces/rest/decorators' {
|
|
1853
|
+
import type { Handler } from 'hono';
|
|
1854
|
+
export type RESTClass<T extends Object = any> = new (...args: any[]) => T;
|
|
1855
|
+
export type RESTResourceInfos = {
|
|
1856
|
+
path?: string;
|
|
1857
|
+
public?: boolean;
|
|
1858
|
+
};
|
|
1859
|
+
export type RESTMethodInfos = {
|
|
1860
|
+
public?: boolean;
|
|
1861
|
+
};
|
|
1862
|
+
export class RESTApi {
|
|
1863
|
+
readonly target: RESTClass;
|
|
1864
|
+
readonly descriptor: RESTResourceInfos;
|
|
1865
|
+
constructor(target: RESTClass, descriptor: RESTResourceInfos);
|
|
1866
|
+
setDescriptor(descriptor: RESTResourceInfos): void;
|
|
1867
|
+
getMethods(): Generator<RESTMethod, void, unknown>;
|
|
1868
|
+
create(): any;
|
|
1869
|
+
}
|
|
1870
|
+
export class RESTMethod {
|
|
1871
|
+
readonly name: string;
|
|
1872
|
+
readonly invoked: Function;
|
|
1873
|
+
readonly descriptor: RESTMethodInfos;
|
|
1874
|
+
constructor(name: string, invoked: Function, descriptor: RESTMethodInfos);
|
|
1875
|
+
}
|
|
1876
|
+
export function getRESTApis(): {
|
|
1877
|
+
Resources: Map<RESTClass<any>, RESTApi>;
|
|
1878
|
+
Methods: Map<Function, RESTMethod>;
|
|
1879
|
+
};
|
|
1880
|
+
export const REST: {
|
|
1881
|
+
Resource<T extends RESTClass>(infos?: RESTResourceInfos): (target: T) => T;
|
|
1882
|
+
Method(infos?: RESTMethodInfos): (target: Handler, context: ClassMethodDecoratorContext) => void;
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
declare module '@jointhedots/core/storage' {
|
|
1887
|
+
import { ServiceEntry } from 'src/services';
|
|
1888
|
+
export type NameSpaceId = string;
|
|
1889
|
+
export type FileKey = string;
|
|
1890
|
+
export type ChangeSetId = string;
|
|
1891
|
+
export type FilePatch = {
|
|
1892
|
+
start: number;
|
|
1893
|
+
end: number;
|
|
1894
|
+
data: string;
|
|
1895
|
+
};
|
|
1896
|
+
export type FileChange = {
|
|
1897
|
+
key: FileKey;
|
|
1898
|
+
prev_key?: FileKey;
|
|
1899
|
+
removed?: boolean;
|
|
1900
|
+
changes: FilePatch[];
|
|
1901
|
+
};
|
|
1902
|
+
export type Author = {
|
|
1903
|
+
name: string;
|
|
1904
|
+
email?: string;
|
|
1905
|
+
};
|
|
1906
|
+
export type StorageChangeInfos = {
|
|
1907
|
+
message?: string;
|
|
1908
|
+
authors?: Author[];
|
|
1909
|
+
};
|
|
1910
|
+
export type StorageChangeStatus = StorageChangeInfos & {
|
|
1911
|
+
id: ChangeSetId;
|
|
1912
|
+
from?: ChangeSetId | ChangeSetId[];
|
|
1913
|
+
emitted_at?: Date;
|
|
1914
|
+
};
|
|
1915
|
+
export type StorageChangeSet = StorageChangeStatus & {
|
|
1916
|
+
changes?: FileChange[];
|
|
1917
|
+
};
|
|
1918
|
+
export type StorageChangeLog = {
|
|
1919
|
+
changes: StorageChangeStatus[];
|
|
1920
|
+
};
|
|
1921
|
+
export type StorageStats = {
|
|
1922
|
+
file_count?: number;
|
|
1923
|
+
used_bytes?: number;
|
|
1924
|
+
limit_used_bytes?: number;
|
|
1925
|
+
limit_file_count?: number;
|
|
1926
|
+
};
|
|
1927
|
+
export type StorageTransaction = StorageChangeInfos & {
|
|
1928
|
+
files: {
|
|
1929
|
+
[key: FileKey]: {
|
|
1930
|
+
prev_key?: string;
|
|
1931
|
+
remove?: boolean;
|
|
1932
|
+
data?: Blob | string;
|
|
1933
|
+
};
|
|
1934
|
+
};
|
|
1935
|
+
};
|
|
1936
|
+
export interface StorageService {
|
|
1937
|
+
readonly location: string;
|
|
1938
|
+
list(): Promise<FileKey[]>;
|
|
1939
|
+
stats(): Promise<StorageStats>;
|
|
1940
|
+
read(key: FileKey): Promise<Blob>;
|
|
1941
|
+
write(key: FileKey, data: Blob): Promise<void>;
|
|
1942
|
+
recall(key: FileKey, at: ChangeSetId): Promise<Blob>;
|
|
1943
|
+
commit(transaction: StorageTransaction): Promise<ChangeSetId>;
|
|
1944
|
+
getChangeSet(id: ChangeSetId): Promise<StorageChangeSet>;
|
|
1945
|
+
getChangeLog(): Promise<StorageChangeLog>;
|
|
1946
|
+
getFileLog(key: FileKey): Promise<StorageChangeLog>;
|
|
1947
|
+
}
|
|
1948
|
+
export type StorageDescriptor = void;
|
|
1949
|
+
export const StorageServiceKey: ServiceEntry<StorageService, void>;
|
|
1950
|
+
}
|
|
1951
|
+
|
|
1952
|
+
declare module '@jointhedots/core/src/scripting/graph/log' {
|
|
1953
|
+
import type { AST } from '@jointhedots/core/src/scripting/ast/api';
|
|
1954
|
+
export class DocumentData {
|
|
1955
|
+
nodes: Map<number, AST.AnyPrimitive>;
|
|
1956
|
+
main: string;
|
|
1957
|
+
seq: number;
|
|
1958
|
+
createKey(): number;
|
|
1959
|
+
serialize(): {};
|
|
1960
|
+
}
|
|
1961
|
+
export function createDocumentFromAST(n: AST.Any): DocumentData;
|
|
1962
|
+
}
|
|
1963
|
+
|
|
1964
|
+
declare module '@jointhedots/core/src/scripting/graph/uses' {
|
|
1965
|
+
import type { AST } from '@jointhedots/core/src/scripting/ast/api';
|
|
1966
|
+
import { type Node, type ContextInstance, type FeatureID } from '@jointhedots/core/src/scripting/graph/model';
|
|
1967
|
+
export type ValueRecast = (x: any) => any;
|
|
1968
|
+
export class ValueType {
|
|
1969
|
+
accept(ty: ValueType): boolean;
|
|
1970
|
+
recastTo(ty: ValueType): ValueRecast;
|
|
1971
|
+
}
|
|
1972
|
+
export class ValueConstraint {
|
|
1973
|
+
readonly accepteds: ValueType[];
|
|
1974
|
+
constructor(accepteds: ValueType[]);
|
|
1975
|
+
accept(ty: ValueType): boolean;
|
|
1976
|
+
}
|
|
1977
|
+
export abstract class BasicType extends ValueType {
|
|
1978
|
+
accept(ty: ValueType): boolean;
|
|
1979
|
+
recastTo(ty: ValueType): ValueRecast;
|
|
1980
|
+
}
|
|
1981
|
+
export class NumberType extends BasicType {
|
|
1982
|
+
static Self: NumberType;
|
|
1983
|
+
accept(ty: ValueType): boolean;
|
|
1984
|
+
recastTo(ty: ValueType): ValueRecast;
|
|
1985
|
+
}
|
|
1986
|
+
export class StringType extends BasicType {
|
|
1987
|
+
static Self: StringType;
|
|
1988
|
+
accept(ty: ValueType): boolean;
|
|
1989
|
+
recastTo(ty: ValueType): ValueRecast;
|
|
1990
|
+
}
|
|
1991
|
+
export class AnyType extends ValueType {
|
|
1992
|
+
static Self: AnyType;
|
|
1993
|
+
static Constraint: ValueConstraint;
|
|
1994
|
+
accept(ty: ValueType): boolean;
|
|
1995
|
+
recastTo(ty: ValueType): ValueRecast;
|
|
1996
|
+
}
|
|
1997
|
+
export type ObjectClass = new (...args: any[]) => any;
|
|
1998
|
+
export class ObjectType extends ValueType {
|
|
1999
|
+
readonly ctor: ObjectClass;
|
|
2000
|
+
static Self: ObjectType;
|
|
2001
|
+
constructor(ctor: ObjectClass);
|
|
2002
|
+
accept(ty: ValueType): boolean;
|
|
2003
|
+
}
|
|
2004
|
+
export class JSXType extends ValueType {
|
|
2005
|
+
static Self: JSXType;
|
|
2006
|
+
static Constraint: ValueConstraint;
|
|
2007
|
+
accept(ty: ValueType): any;
|
|
2008
|
+
}
|
|
2009
|
+
export enum UseLink {
|
|
2010
|
+
Strong = 0,
|
|
2011
|
+
Weak = 1
|
|
2012
|
+
}
|
|
2013
|
+
export interface Use<T = any> {
|
|
2014
|
+
readonly link: UseLink;
|
|
2015
|
+
get(ctx: ContextInstance): T;
|
|
2016
|
+
}
|
|
2017
|
+
export class UseList<T = any> extends Array<Use<T>> {
|
|
2018
|
+
get(ctx: ContextInstance): T[];
|
|
2019
|
+
static create(user: Node, items: AST.Any[], constraint?: ValueConstraint): UseList;
|
|
2020
|
+
}
|
|
2021
|
+
export class UseAggregate extends Array<Use> {
|
|
2022
|
+
readonly buckets: FeatureID[];
|
|
2023
|
+
mapping: Uint8Array;
|
|
2024
|
+
constructor(length: number, buckets: FeatureID[]);
|
|
2025
|
+
get(ctx: ContextInstance): any[][];
|
|
2026
|
+
static create(user: Node, items: AST.Any[], buckets: FeatureID[]): UseAggregate;
|
|
2027
|
+
}
|
|
2028
|
+
export function isInheritedOf(cls: ObjectClass, parent: ObjectClass): boolean;
|
|
2029
|
+
export interface Displayable {
|
|
2030
|
+
display(ctx: ContextInstance): React.ReactNode;
|
|
2031
|
+
}
|
|
2032
|
+
export class UseDisplayable implements Use {
|
|
2033
|
+
readonly node: Displayable;
|
|
2034
|
+
constructor(node: Displayable, constraint: ValueConstraint);
|
|
2035
|
+
get link(): UseLink;
|
|
2036
|
+
get(ctx: ContextInstance): React.ReactNode;
|
|
2037
|
+
}
|
|
2038
|
+
export interface Readable {
|
|
2039
|
+
read(ctx: ContextInstance): any;
|
|
2040
|
+
}
|
|
2041
|
+
export class UseReadable implements Use {
|
|
2042
|
+
readonly node: Readable;
|
|
2043
|
+
constructor(node: Readable, constraint: ValueConstraint);
|
|
2044
|
+
get link(): UseLink;
|
|
2045
|
+
get(ctx: ContextInstance): React.ReactNode;
|
|
2046
|
+
}
|
|
2047
|
+
}
|
|
2048
|
+
|
|
2049
|
+
declare module '@jointhedots/core/src/scripting/graph/model' {
|
|
2050
|
+
import type { AST } from '@jointhedots/core/src/scripting/ast/api';
|
|
2051
|
+
import type { NodeKey } from '@jointhedots/core/src/scripting/ast/primitives';
|
|
2052
|
+
import type { GraphBuilder } from '@jointhedots/core/src/scripting/graph/builder';
|
|
2053
|
+
import type { DocumentData } from '@jointhedots/core/src/scripting/graph/log';
|
|
2054
|
+
import { type Use, type ValueConstraint } from '@jointhedots/core/src/scripting/graph/uses';
|
|
2055
|
+
export type NodeSymbol = string | Symbol;
|
|
2056
|
+
export type NodeCtor<T extends Node = Node> = new ($key: NodeKey, $class: NodeClass, model: DocumentModel) => T;
|
|
2057
|
+
export interface NodeClass {
|
|
2058
|
+
getConstructor(): NodeCtor;
|
|
2059
|
+
updateNode(n: Node): Promise<void>;
|
|
2060
|
+
linkNode(n: Node): void;
|
|
2061
|
+
}
|
|
2062
|
+
export interface NodeNamespace {
|
|
2063
|
+
resolveIdentifier(symbol: NodeSymbol): Node;
|
|
2064
|
+
}
|
|
2065
|
+
export type ResultValue<T> = T | Promise<T>;
|
|
2066
|
+
export type FeatureID = string | symbol;
|
|
2067
|
+
export const GetterFeature: unique symbol;
|
|
2068
|
+
export const SetterFeature: unique symbol;
|
|
2069
|
+
export const DisplayFeature: unique symbol;
|
|
2070
|
+
export class Node<Data extends AST.Node = AST.Any> {
|
|
2071
|
+
readonly $key: NodeKey;
|
|
2072
|
+
readonly $class: NodeClass;
|
|
2073
|
+
readonly model: DocumentModel;
|
|
2074
|
+
$owner: Node;
|
|
2075
|
+
constructor($key: NodeKey, $class: NodeClass, model: DocumentModel);
|
|
2076
|
+
get data(): Data;
|
|
2077
|
+
get symbol(): NodeSymbol;
|
|
2078
|
+
get $namespace(): NodeNamespace;
|
|
2079
|
+
get $context(): ContextModel;
|
|
2080
|
+
use(feature: FeatureID, constraint?: ValueConstraint): Use;
|
|
2081
|
+
toString(): string;
|
|
2082
|
+
}
|
|
2083
|
+
export class State<T extends any> {
|
|
2084
|
+
index: number;
|
|
2085
|
+
initial: any;
|
|
2086
|
+
constructor(index: number, initial: any);
|
|
2087
|
+
read(ctx: ContextInstance): T;
|
|
2088
|
+
write(ctx: ContextInstance, value: T): T;
|
|
2089
|
+
}
|
|
2090
|
+
export interface Executor {
|
|
2091
|
+
init(ctx: ContextInstance): any;
|
|
2092
|
+
update(ctx: ContextInstance): any;
|
|
2093
|
+
}
|
|
2094
|
+
export class Task {
|
|
2095
|
+
index: number;
|
|
2096
|
+
executor: Executor;
|
|
2097
|
+
constructor(index: number, executor: Executor);
|
|
2098
|
+
}
|
|
2099
|
+
export interface ContextController {
|
|
2100
|
+
getControllerNode(): Node;
|
|
2101
|
+
apply(ctx: ContextInstance): any;
|
|
2102
|
+
}
|
|
2103
|
+
export class ContextModel {
|
|
2104
|
+
readonly controller: ContextController;
|
|
2105
|
+
members: Map<NodeSymbol, Node<AST.AnyPrimitive>>;
|
|
2106
|
+
states: State<any>[];
|
|
2107
|
+
tasks: Task[];
|
|
2108
|
+
statements: Node[];
|
|
2109
|
+
output: State<any>;
|
|
2110
|
+
constructor(controller: ContextController);
|
|
2111
|
+
addMember(symbol: NodeSymbol, node: Node): void;
|
|
2112
|
+
addState<T>(initial: T): State<T>;
|
|
2113
|
+
addTask(executor: Executor): Task;
|
|
2114
|
+
addOutput(): State<any>;
|
|
2115
|
+
}
|
|
2116
|
+
export enum FlowControl {
|
|
2117
|
+
Execute = 0,
|
|
2118
|
+
Return = 1,// For return
|
|
2119
|
+
Exit = 2,// For continue
|
|
2120
|
+
Break = 3
|
|
2121
|
+
}
|
|
2122
|
+
export class ContextInstance {
|
|
2123
|
+
readonly model: ContextModel;
|
|
2124
|
+
readonly parent: ContextInstance;
|
|
2125
|
+
layers: Set<ContextInstance>;
|
|
2126
|
+
state_values: any[];
|
|
2127
|
+
state_times: Uint32Array;
|
|
2128
|
+
tasks_statuses: Uint32Array;
|
|
2129
|
+
control: FlowControl;
|
|
2130
|
+
timecode: number;
|
|
2131
|
+
constructor(model: ContextModel, parent: ContextInstance);
|
|
2132
|
+
execute(): Promise<void>;
|
|
2133
|
+
schedule(task: Task): void;
|
|
2134
|
+
run(): void;
|
|
2135
|
+
dispose(): void;
|
|
2136
|
+
}
|
|
2137
|
+
export class DocumentModel implements ContextController {
|
|
2138
|
+
readonly data: DocumentData;
|
|
2139
|
+
readonly nodes: Map<number, Node<AST.AnyPrimitive>>;
|
|
2140
|
+
controller: ContextController;
|
|
2141
|
+
builder: GraphBuilder;
|
|
2142
|
+
globalModel: ContextModel;
|
|
2143
|
+
globalInstance: ContextInstance;
|
|
2144
|
+
constructor(data: DocumentData);
|
|
2145
|
+
getControllerNode(): Node;
|
|
2146
|
+
apply(ctx: ContextInstance): any;
|
|
2147
|
+
getNode(data: any): Node<AST.AnyPrimitive>;
|
|
2148
|
+
createInstance(): any;
|
|
2149
|
+
createCallback(): (...args: any[]) => any;
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
|
|
2153
|
+
declare module '@jointhedots/core/src/scripting/graph/register' {
|
|
2154
|
+
import type { Node, NodeClass, NodeCtor } from '@jointhedots/core/src/scripting/graph/model';
|
|
2155
|
+
type NodeTag = string | symbol; class ModelRegister {
|
|
2156
|
+
classes: Map<NodeTag, NodeClass>;
|
|
2157
|
+
Node<T extends Node>(config: {
|
|
2158
|
+
type: NodeTag;
|
|
2159
|
+
linkNode?: (n: T) => void;
|
|
2160
|
+
updateNode?: (n: T) => Promise<void>;
|
|
2161
|
+
}): (constructor: NodeCtor<T>) => NodeCtor<T>;
|
|
2162
|
+
getNodeClassOf(ctor: any): NodeClass;
|
|
2163
|
+
}
|
|
2164
|
+
export const Model: ModelRegister;
|
|
2165
|
+
export {};
|
|
2166
|
+
}
|
|
2167
|
+
|
|
2168
|
+
declare module '@jointhedots/core/src/scripting/graph/builder' {
|
|
2169
|
+
import type { DocumentData } from '@jointhedots/core/src/scripting/graph/log';
|
|
2170
|
+
import { DocumentModel, type Node, type NodeClass } from '@jointhedots/core/src/scripting/graph/model';
|
|
2171
|
+
export interface GraphScriptResolver {
|
|
2172
|
+
resolveNodeClass(type: string): NodeClass;
|
|
2173
|
+
}
|
|
2174
|
+
export class GraphBuilder {
|
|
2175
|
+
readonly model: DocumentModel;
|
|
2176
|
+
readonly data: DocumentData;
|
|
2177
|
+
readonly resolver: GraphScriptResolver;
|
|
2178
|
+
unconsolidatedElements: Set<Node<import( '@jointhedots/core/src/scripting/ast/primitives').AnyPrimitive>>;
|
|
2179
|
+
constructor(model: DocumentModel, data: DocumentData, resolver: GraphScriptResolver);
|
|
2180
|
+
revise(target: Node): void;
|
|
2181
|
+
}
|
|
2182
|
+
export function createGlobalResolver(): GraphScriptResolver;
|
|
2183
|
+
export function updateModel(b: GraphBuilder): void;
|
|
2184
|
+
}
|
|
2185
|
+
|
|
2186
|
+
declare module '@jointhedots/core/src/scripting/graph/values' {
|
|
2187
|
+
export class Pipeline<T> implements PromiseLike<T> {
|
|
2188
|
+
private resolvers;
|
|
2189
|
+
private value;
|
|
2190
|
+
private paused;
|
|
2191
|
+
emit(value: T): this;
|
|
2192
|
+
then<R = T>(onfulfilled?: ((value: T) => R | PromiseLike<R>) | null): Promise<any>;
|
|
2193
|
+
map<R>(fn: (value: T) => R): Pipeline<R>;
|
|
2194
|
+
filter(fn: (value: T) => boolean): Pipeline<T>;
|
|
2195
|
+
pipe<R>(fn: (pipeline: Pipeline<T>) => Pipeline<R>): Pipeline<R>;
|
|
2196
|
+
pause(): this;
|
|
2197
|
+
resume(): this;
|
|
2198
|
+
getValue(): T;
|
|
2199
|
+
subscribe(listener: (value: T) => void): () => boolean;
|
|
2200
|
+
private listeners;
|
|
2201
|
+
}
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
declare module '@jointhedots/core/src/scripting/graph/nodes/nodes-expr' {
|
|
2205
|
+
import type { AST } from '@jointhedots/core/src/scripting/ast/api';
|
|
2206
|
+
import { ContextInstance, Node, type FeatureID } from '@jointhedots/core/src/scripting/graph/model';
|
|
2207
|
+
import { ValueConstraint, type Use } from '@jointhedots/core/src/scripting/graph/uses';
|
|
2208
|
+
export abstract class DXExpr<Data extends AST.Node = AST.Any, Value = any> extends Node<Data> {
|
|
2209
|
+
abstract evaluate(ctx: ContextInstance): any;
|
|
2210
|
+
use(feature: FeatureID, constraint: ValueConstraint): Use;
|
|
2211
|
+
}
|
|
2212
|
+
export class Literal extends DXExpr<AST.Literal> {
|
|
2213
|
+
value: any;
|
|
2214
|
+
evaluate(ctx: ContextInstance): any;
|
|
2215
|
+
}
|
|
2216
|
+
export class Identifier extends Node<AST.Identifier> {
|
|
2217
|
+
target: Node;
|
|
2218
|
+
use(feature: FeatureID, constraint: ValueConstraint): Use;
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
|
|
2222
|
+
declare module '@jointhedots/core/src/scripting/graph/nodes/nodes-states' {
|
|
2223
|
+
import type { AST } from '@jointhedots/core/src/scripting/ast/api';
|
|
2224
|
+
import { Node, type NodeSymbol, type FeatureID } from '@jointhedots/core/src/scripting/graph/model';
|
|
2225
|
+
import { ValueConstraint, type Use } from '@jointhedots/core/src/scripting/graph/uses';
|
|
2226
|
+
export class DXElement extends Node<AST.ElementPrimitive> {
|
|
2227
|
+
get symbol(): NodeSymbol;
|
|
2228
|
+
getAttribut(name: string, ns?: string): Node;
|
|
2229
|
+
use(fature: FeatureID, constraint: ValueConstraint): Use;
|
|
2230
|
+
toString(): string;
|
|
2231
|
+
}
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
declare module '@jointhedots/core/src/scripting/graph/nodes/nodes-render' {
|
|
2235
|
+
export {};
|
|
2236
|
+
}
|
|
2237
|
+
|
|
2238
|
+
declare module '@jointhedots/core/src/scripting/graph/api' {
|
|
2239
|
+
/***********
|
|
2240
|
+
* Flow Graph: Intermediate flow representation, consolidate basic syntax and connect element from document
|
|
2241
|
+
**********/
|
|
2242
|
+
import { DocumentModel } from '@jointhedots/core/src/scripting/graph/model';
|
|
2243
|
+
import '@jointhedots/core/src/scripting/graph/nodes/nodes-states';
|
|
2244
|
+
import '@jointhedots/core/src/scripting/graph/nodes/nodes-expr';
|
|
2245
|
+
import '@jointhedots/core/src/scripting/graph/nodes/nodes-render';
|
|
2246
|
+
import type { AST } from '@jointhedots/core/src/scripting/ast/api';
|
|
2247
|
+
export function loadScriptGraphFromAST(ast: AST.DocumentPrimitive): Promise<DocumentModel>;
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
declare module '@jointhedots/core/src/scripting/builder' {
|
|
2251
|
+
export function createFlowFromMdx(text: string): Promise<import( '@jointhedots/core/src/scripting/graph/model').DocumentModel>;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
declare module '@jointhedots/core/src/scripting/ast/serde/printer' {
|
|
2255
|
+
import * as AST from '@jointhedots/core/src/scripting/ast/primitives';
|
|
2256
|
+
export function stringify_node_jsx(n: AST.Any): string;
|
|
2257
|
+
export function stringify_document(n: AST.Any): string;
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2260
|
+
declare module '@jointhedots/core/src/scripting/graph/helpers' {
|
|
2261
|
+
import { Node } from '@jointhedots/core/src/scripting/graph/model';
|
|
2262
|
+
export function stringifyGraph(n: Node): string;
|
|
2263
|
+
}
|
|
2264
|
+
|