@arronqzy/blueprint-dsl 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1682 -111
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +720 -13
- package/dist/index.d.ts +720 -13
- package/dist/index.js +1653 -112
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/readme.md +35 -26
- package/vendor/dayjs/LICENSE +21 -0
- package/vendor/dayjs/esm/constant.js +25 -0
- package/vendor/dayjs/esm/index.d.ts +429 -0
- package/vendor/dayjs/esm/index.js +541 -0
- package/vendor/dayjs/esm/locale/en.js +12 -0
- package/vendor/dayjs/esm/utils.js +58 -0
- package/vendor/dayjs/index.d.ts +429 -0
- package/vendor/dayjs/package.json +85 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference path="../vendor/dayjs/esm/locale/index.d.ts" />
|
|
1
2
|
type Value = any;
|
|
2
3
|
type PortSpec = {
|
|
3
4
|
name: string;
|
|
@@ -26,6 +27,73 @@ type Scope = {
|
|
|
26
27
|
vars: Map<string, Value>;
|
|
27
28
|
};
|
|
28
29
|
|
|
30
|
+
type BlueprintDslLocale = "zh-CN" | "en-US";
|
|
31
|
+
declare const ZH_CN: {
|
|
32
|
+
readonly invalidJson: "不是有效 JSON:{reason}";
|
|
33
|
+
readonly invalidFormat: "格式无效";
|
|
34
|
+
readonly jsonInvalid: "JSON 格式无效";
|
|
35
|
+
readonly jsonEmpty: "JSON 不能为空";
|
|
36
|
+
readonly jsonRootMustBeContainer: "JSON 根节点必须是 object 或 array";
|
|
37
|
+
readonly contentEmpty: "内容为空";
|
|
38
|
+
readonly contentRequired: "内容不能为空";
|
|
39
|
+
readonly codeRequired: "代码不能为空";
|
|
40
|
+
readonly javascriptSyntaxError: "JavaScript 语法错误";
|
|
41
|
+
readonly logicUpdateRequired: "需要定义 update(input) 函数";
|
|
42
|
+
readonly apiItemMustBeObject: "apis[{index}] 必须是对象";
|
|
43
|
+
readonly apiItemFieldRequired: "apis[{index}].{field} 必填且为非空字符串";
|
|
44
|
+
readonly apiItemMethodInvalid: "apis[{index}].method 必须是 {methods} 之一";
|
|
45
|
+
readonly apiItemFieldStringMap: "apis[{index}].{field} 必须是 string 字典";
|
|
46
|
+
readonly apiItemFieldString: "apis[{index}].{field} 必须是字符串";
|
|
47
|
+
readonly apiRootMustBeObject: "根节点必须是对象";
|
|
48
|
+
readonly apiVersionMismatch: "version 必须为 {version}";
|
|
49
|
+
readonly apiNameRequired: "name 必填且为非空字符串";
|
|
50
|
+
readonly apiBaseUrlString: "baseUrl 必须是字符串";
|
|
51
|
+
readonly apiListMustBeArray: "apis 必须是数组";
|
|
52
|
+
readonly apiListEmpty: "apis 至少包含一条接口";
|
|
53
|
+
readonly apiNameDuplicated: "接口名称重复:{name}";
|
|
54
|
+
readonly apiTemplateName: "示例接口集合";
|
|
55
|
+
readonly apiTemplateListUsers: "获取用户列表";
|
|
56
|
+
readonly apiTemplateListUsersDesc: "分页查询用户;page / tenant / token 可用 Scope 模版";
|
|
57
|
+
readonly apiTemplateCreateUser: "创建用户";
|
|
58
|
+
readonly apiTemplateCreateUserDesc: "创建用户;URL 与 body 均支持 Scope 模版";
|
|
59
|
+
readonly apiTemplateGetUser: "获取用户详情";
|
|
60
|
+
readonly apiTemplateGetUserDesc: "按 id 查询;路径里可直接写 Scope 模版";
|
|
61
|
+
readonly fetchUrlMissing: "请求 URL 未配置";
|
|
62
|
+
readonly fetchBodyInvalidJson: "请求体不是有效 JSON:{reason}";
|
|
63
|
+
readonly fetchResponseInvalidJson: "响应不是有效的 JSON";
|
|
64
|
+
readonly fetchAborted: "请求已中止";
|
|
65
|
+
readonly fetchTimeout: "请求超时({ms}ms)";
|
|
66
|
+
readonly headersTemplateNotObject: "请求头模板解析后不是有效的 JSON 对象";
|
|
67
|
+
readonly headersNotObject: "请求头不是有效的 JSON 对象";
|
|
68
|
+
readonly swaggerInvalid: "Swagger 文档格式无效";
|
|
69
|
+
readonly openApiNoOperations: "未在 OpenAPI 文档中找到接口";
|
|
70
|
+
readonly swagger2NoOperations: "未在 Swagger 2.0 文档中找到接口";
|
|
71
|
+
readonly swaggerUnsupported: "仅支持 OpenAPI 3.x 与 Swagger 2.0 文档";
|
|
72
|
+
readonly storageUnsupported: "当前环境不支持 {storage}";
|
|
73
|
+
readonly storageKeyEmpty: "存储写入 key 解析为空";
|
|
74
|
+
readonly clockCountPositive: "输出次数须大于 0";
|
|
75
|
+
readonly clockIntervalPositive: "当前配置下时钟信号间隔须大于 0 秒";
|
|
76
|
+
readonly lifecycleSignalMissing: "生命周期信号缺失";
|
|
77
|
+
readonly blueprintCycle: "蓝图引用存在死循环:{path}";
|
|
78
|
+
readonly debugMustStartFromLifecycle: "调试会话只能从生命周期节点开始";
|
|
79
|
+
readonly nodeRemoved: "节点已从蓝图中移除";
|
|
80
|
+
readonly clockNeedsTrue: "时钟节点需要收到真信号后才会启动";
|
|
81
|
+
readonly blueprintNeedsTrue: "蓝图节点需要收到真信号后才会执行";
|
|
82
|
+
readonly blueprintNotSelected: "未选择蓝图库中的蓝图";
|
|
83
|
+
readonly blueprintResolverMissing: "蓝图库解析器未配置";
|
|
84
|
+
readonly blueprintRecordMissing: "蓝图库记录不存在: {id}";
|
|
85
|
+
readonly fetchNoUpstream: "数据源节点未收到上游输出,请确认连线与上游节点已执行";
|
|
86
|
+
readonly fetchNeedsTrue: "数据源节点需要收到真信号后才会发起请求";
|
|
87
|
+
readonly jsonNeedsTrue: "JSON 节点需要收到真信号后才会解析";
|
|
88
|
+
readonly storageNeedsTrue: "存储节点需要收到真信号后才会读写缓存";
|
|
89
|
+
readonly andNeedsBothTrue: "并运算:两个输入须均为真信号";
|
|
90
|
+
};
|
|
91
|
+
type BlueprintDslMessageKey = keyof typeof ZH_CN;
|
|
92
|
+
/** UI layers call this when the app locale changes; DSL errors are produced in this locale. */
|
|
93
|
+
declare function setBlueprintDslLocale(locale: BlueprintDslLocale): void;
|
|
94
|
+
declare function getBlueprintDslLocale(): BlueprintDslLocale;
|
|
95
|
+
declare function dslMessage(key: BlueprintDslMessageKey, params?: Record<string, string | number>): string;
|
|
96
|
+
|
|
29
97
|
/** 页面生命周期阶段 */
|
|
30
98
|
declare const PAGE_LIFECYCLE_PHASES: readonly ["created", "beforeMount", "mounted", "updated", "beforeDestroy", "destroy", "activated", "deactivated", "blueprintActivated"];
|
|
31
99
|
type PageLifecyclePhase = (typeof PAGE_LIFECYCLE_PHASES)[number];
|
|
@@ -163,7 +231,15 @@ declare const FETCH_CREDENTIALS: readonly ["omit", "same-origin", "include"];
|
|
|
163
231
|
declare const FETCH_MODES: readonly ["cors", "no-cors", "same-origin", "navigate"];
|
|
164
232
|
declare const FETCH_CACHES: readonly ["default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached"];
|
|
165
233
|
declare const FETCH_REDIRECTS: readonly ["follow", "error", "manual"];
|
|
166
|
-
type FetchUrlInputMode = "swagger" | "manual";
|
|
234
|
+
type FetchUrlInputMode = "swagger" | "manual" | "collection";
|
|
235
|
+
type ApiCollectionSyncNotice = {
|
|
236
|
+
source: "api-collection-sync";
|
|
237
|
+
collectionName: string;
|
|
238
|
+
endpointName: string;
|
|
239
|
+
/** 机器字段名:url / method / headers / body / apiBaseUrl */
|
|
240
|
+
changedFields: string[];
|
|
241
|
+
updatedAt: number;
|
|
242
|
+
};
|
|
167
243
|
type FetchRequestConfig = {
|
|
168
244
|
url: string;
|
|
169
245
|
method?: FetchHttpMethod;
|
|
@@ -186,8 +262,17 @@ type FetchRequestConfig = {
|
|
|
186
262
|
apiBaseUrl?: string;
|
|
187
263
|
/** 从 Swagger 文档解析出的接口列表 */
|
|
188
264
|
swaggerEndpoints?: SwaggerApiEndpoint[];
|
|
189
|
-
/** 请求 URL
|
|
265
|
+
/** 请求 URL 输入方式:接口联想、手动输入,或接口集合回填 */
|
|
190
266
|
urlInputMode?: FetchUrlInputMode;
|
|
267
|
+
/** 接口集合记录 id(urlInputMode=collection) */
|
|
268
|
+
apiCollectionId?: string;
|
|
269
|
+
/** 集合内选中的接口名称 */
|
|
270
|
+
apiCollectionEndpointName?: string;
|
|
271
|
+
/**
|
|
272
|
+
* 接口集合同步后的配置区提示;用户可关闭。
|
|
273
|
+
* source 固定为 api-collection-sync,表示来源是数据集合更新。
|
|
274
|
+
*/
|
|
275
|
+
apiCollectionSyncNotice?: ApiCollectionSyncNotice | null;
|
|
191
276
|
};
|
|
192
277
|
declare const DEFAULT_FETCH_REQUEST_CONFIG: FetchRequestConfig;
|
|
193
278
|
/** 合并默认项与节点上保存的 fetch 配置,供运行时发起请求 */
|
|
@@ -207,29 +292,501 @@ type ExecuteFetchOptions = {
|
|
|
207
292
|
};
|
|
208
293
|
declare function executeFetch(config: FetchRequestConfig, options?: ExecuteFetchOptions): Promise<FetchResultValue>;
|
|
209
294
|
|
|
295
|
+
declare function dayjs (date?: dayjs.ConfigType): dayjs.Dayjs
|
|
296
|
+
|
|
297
|
+
declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, strict?: boolean): dayjs.Dayjs
|
|
298
|
+
|
|
299
|
+
declare function dayjs (date?: dayjs.ConfigType, format?: dayjs.OptionType, locale?: string, strict?: boolean): dayjs.Dayjs
|
|
300
|
+
|
|
301
|
+
declare namespace dayjs {
|
|
302
|
+
interface ConfigTypeMap {
|
|
303
|
+
default: string | number | Date | Dayjs | null | undefined
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export type ConfigType = ConfigTypeMap[keyof ConfigTypeMap]
|
|
307
|
+
|
|
308
|
+
export interface FormatObject { locale?: string, format?: string, utc?: boolean }
|
|
309
|
+
|
|
310
|
+
export type OptionType = FormatObject | string | string[]
|
|
311
|
+
|
|
312
|
+
export type UnitTypeShort = 'd' | 'D' | 'M' | 'y' | 'h' | 'm' | 's' | 'ms'
|
|
313
|
+
|
|
314
|
+
export type UnitTypeLong = 'millisecond' | 'second' | 'minute' | 'hour' | 'day' | 'month' | 'year' | 'date'
|
|
315
|
+
|
|
316
|
+
export type UnitTypeLongPlural = 'milliseconds' | 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'years' | 'dates'
|
|
317
|
+
|
|
318
|
+
export type UnitType = UnitTypeLong | UnitTypeLongPlural | UnitTypeShort;
|
|
319
|
+
|
|
320
|
+
export type OpUnitType = UnitType | "week" | "weeks" | 'w';
|
|
321
|
+
export type QUnitType = UnitType | "quarter" | "quarters" | 'Q';
|
|
322
|
+
export type ManipulateType = Exclude<OpUnitType, 'date' | 'dates'>;
|
|
323
|
+
class Dayjs {
|
|
324
|
+
constructor (config?: ConfigType)
|
|
325
|
+
/**
|
|
326
|
+
* All Day.js objects are immutable. Still, `dayjs#clone` can create a clone of the current object if you need one.
|
|
327
|
+
* ```
|
|
328
|
+
* dayjs().clone()// => Dayjs
|
|
329
|
+
* dayjs(dayjs('2019-01-25')) // passing a Dayjs object to a constructor will also clone it
|
|
330
|
+
* ```
|
|
331
|
+
* Docs: https://day.js.org/docs/en/parse/dayjs-clone
|
|
332
|
+
*/
|
|
333
|
+
clone(): Dayjs
|
|
334
|
+
/**
|
|
335
|
+
* This returns a `boolean` indicating whether the Day.js object contains a valid date or not.
|
|
336
|
+
* ```
|
|
337
|
+
* dayjs().isValid()// => boolean
|
|
338
|
+
* ```
|
|
339
|
+
* Docs: https://day.js.org/docs/en/parse/is-valid
|
|
340
|
+
*/
|
|
341
|
+
isValid(): boolean
|
|
342
|
+
/**
|
|
343
|
+
* Get the year.
|
|
344
|
+
* ```
|
|
345
|
+
* dayjs().year()// => 2020
|
|
346
|
+
* ```
|
|
347
|
+
* Docs: https://day.js.org/docs/en/get-set/year
|
|
348
|
+
*/
|
|
349
|
+
year(): number
|
|
350
|
+
/**
|
|
351
|
+
* Set the year.
|
|
352
|
+
* ```
|
|
353
|
+
* dayjs().year(2000)// => Dayjs
|
|
354
|
+
* ```
|
|
355
|
+
* Docs: https://day.js.org/docs/en/get-set/year
|
|
356
|
+
*/
|
|
357
|
+
year(value: number): Dayjs
|
|
358
|
+
/**
|
|
359
|
+
* Get the month.
|
|
360
|
+
*
|
|
361
|
+
* Months are zero indexed, so January is month 0.
|
|
362
|
+
* ```
|
|
363
|
+
* dayjs().month()// => 0-11
|
|
364
|
+
* ```
|
|
365
|
+
* Docs: https://day.js.org/docs/en/get-set/month
|
|
366
|
+
*/
|
|
367
|
+
month(): number
|
|
368
|
+
/**
|
|
369
|
+
* Set the month.
|
|
370
|
+
*
|
|
371
|
+
* Months are zero indexed, so January is month 0.
|
|
372
|
+
*
|
|
373
|
+
* Accepts numbers from 0 to 11. If the range is exceeded, it will bubble up to the next year.
|
|
374
|
+
* ```
|
|
375
|
+
* dayjs().month(0)// => Dayjs
|
|
376
|
+
* ```
|
|
377
|
+
* Docs: https://day.js.org/docs/en/get-set/month
|
|
378
|
+
*/
|
|
379
|
+
month(value: number): Dayjs
|
|
380
|
+
/**
|
|
381
|
+
* Get the date of the month.
|
|
382
|
+
* ```
|
|
383
|
+
* dayjs().date()// => 1-31
|
|
384
|
+
* ```
|
|
385
|
+
* Docs: https://day.js.org/docs/en/get-set/date
|
|
386
|
+
*/
|
|
387
|
+
date(): number
|
|
388
|
+
/**
|
|
389
|
+
* Set the date of the month.
|
|
390
|
+
*
|
|
391
|
+
* Accepts numbers from 1 to 31. If the range is exceeded, it will bubble up to the next months.
|
|
392
|
+
* ```
|
|
393
|
+
* dayjs().date(1)// => Dayjs
|
|
394
|
+
* ```
|
|
395
|
+
* Docs: https://day.js.org/docs/en/get-set/date
|
|
396
|
+
*/
|
|
397
|
+
date(value: number): Dayjs
|
|
398
|
+
/**
|
|
399
|
+
* Get the day of the week.
|
|
400
|
+
*
|
|
401
|
+
* Returns numbers from 0 (Sunday) to 6 (Saturday).
|
|
402
|
+
* ```
|
|
403
|
+
* dayjs().day()// 0-6
|
|
404
|
+
* ```
|
|
405
|
+
* Docs: https://day.js.org/docs/en/get-set/day
|
|
406
|
+
*/
|
|
407
|
+
day(): 0 | 1 | 2 | 3 | 4 | 5 | 6
|
|
408
|
+
/**
|
|
409
|
+
* Set the day of the week.
|
|
410
|
+
*
|
|
411
|
+
* Accepts numbers from 0 (Sunday) to 6 (Saturday). If the range is exceeded, it will bubble up to next weeks.
|
|
412
|
+
* ```
|
|
413
|
+
* dayjs().day(0)// => Dayjs
|
|
414
|
+
* ```
|
|
415
|
+
* Docs: https://day.js.org/docs/en/get-set/day
|
|
416
|
+
*/
|
|
417
|
+
day(value: number): Dayjs
|
|
418
|
+
/**
|
|
419
|
+
* Get the hour.
|
|
420
|
+
* ```
|
|
421
|
+
* dayjs().hour()// => 0-23
|
|
422
|
+
* ```
|
|
423
|
+
* Docs: https://day.js.org/docs/en/get-set/hour
|
|
424
|
+
*/
|
|
425
|
+
hour(): number
|
|
426
|
+
/**
|
|
427
|
+
* Set the hour.
|
|
428
|
+
*
|
|
429
|
+
* Accepts numbers from 0 to 23. If the range is exceeded, it will bubble up to the next day.
|
|
430
|
+
* ```
|
|
431
|
+
* dayjs().hour(12)// => Dayjs
|
|
432
|
+
* ```
|
|
433
|
+
* Docs: https://day.js.org/docs/en/get-set/hour
|
|
434
|
+
*/
|
|
435
|
+
hour(value: number): Dayjs
|
|
436
|
+
/**
|
|
437
|
+
* Get the minutes.
|
|
438
|
+
* ```
|
|
439
|
+
* dayjs().minute()// => 0-59
|
|
440
|
+
* ```
|
|
441
|
+
* Docs: https://day.js.org/docs/en/get-set/minute
|
|
442
|
+
*/
|
|
443
|
+
minute(): number
|
|
444
|
+
/**
|
|
445
|
+
* Set the minutes.
|
|
446
|
+
*
|
|
447
|
+
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next hour.
|
|
448
|
+
* ```
|
|
449
|
+
* dayjs().minute(59)// => Dayjs
|
|
450
|
+
* ```
|
|
451
|
+
* Docs: https://day.js.org/docs/en/get-set/minute
|
|
452
|
+
*/
|
|
453
|
+
minute(value: number): Dayjs
|
|
454
|
+
/**
|
|
455
|
+
* Get the seconds.
|
|
456
|
+
* ```
|
|
457
|
+
* dayjs().second()// => 0-59
|
|
458
|
+
* ```
|
|
459
|
+
* Docs: https://day.js.org/docs/en/get-set/second
|
|
460
|
+
*/
|
|
461
|
+
second(): number
|
|
462
|
+
/**
|
|
463
|
+
* Set the seconds.
|
|
464
|
+
*
|
|
465
|
+
* Accepts numbers from 0 to 59. If the range is exceeded, it will bubble up to the next minutes.
|
|
466
|
+
* ```
|
|
467
|
+
* dayjs().second(1)// Dayjs
|
|
468
|
+
* ```
|
|
469
|
+
*/
|
|
470
|
+
second(value: number): Dayjs
|
|
471
|
+
/**
|
|
472
|
+
* Get the milliseconds.
|
|
473
|
+
* ```
|
|
474
|
+
* dayjs().millisecond()// => 0-999
|
|
475
|
+
* ```
|
|
476
|
+
* Docs: https://day.js.org/docs/en/get-set/millisecond
|
|
477
|
+
*/
|
|
478
|
+
millisecond(): number
|
|
479
|
+
/**
|
|
480
|
+
* Set the milliseconds.
|
|
481
|
+
*
|
|
482
|
+
* Accepts numbers from 0 to 999. If the range is exceeded, it will bubble up to the next seconds.
|
|
483
|
+
* ```
|
|
484
|
+
* dayjs().millisecond(1)// => Dayjs
|
|
485
|
+
* ```
|
|
486
|
+
* Docs: https://day.js.org/docs/en/get-set/millisecond
|
|
487
|
+
*/
|
|
488
|
+
millisecond(value: number): Dayjs
|
|
489
|
+
/**
|
|
490
|
+
* Generic setter, accepting unit as first argument, and value as second, returns a new instance with the applied changes.
|
|
491
|
+
*
|
|
492
|
+
* In general:
|
|
493
|
+
* ```
|
|
494
|
+
* dayjs().set(unit, value) === dayjs()[unit](value)
|
|
495
|
+
* ```
|
|
496
|
+
* Units are case insensitive, and support plural and short forms.
|
|
497
|
+
* ```
|
|
498
|
+
* dayjs().set('date', 1)
|
|
499
|
+
* dayjs().set('month', 3) // April
|
|
500
|
+
* dayjs().set('second', 30)
|
|
501
|
+
* ```
|
|
502
|
+
* Docs: https://day.js.org/docs/en/get-set/set
|
|
503
|
+
*/
|
|
504
|
+
set(unit: UnitType, value: number): Dayjs
|
|
505
|
+
/**
|
|
506
|
+
* String getter, returns the corresponding information getting from Day.js object.
|
|
507
|
+
*
|
|
508
|
+
* In general:
|
|
509
|
+
* ```
|
|
510
|
+
* dayjs().get(unit) === dayjs()[unit]()
|
|
511
|
+
* ```
|
|
512
|
+
* Units are case insensitive, and support plural and short forms.
|
|
513
|
+
* ```
|
|
514
|
+
* dayjs().get('year')
|
|
515
|
+
* dayjs().get('month') // start 0
|
|
516
|
+
* dayjs().get('date')
|
|
517
|
+
* ```
|
|
518
|
+
* Docs: https://day.js.org/docs/en/get-set/get
|
|
519
|
+
*/
|
|
520
|
+
get(unit: UnitType): number
|
|
521
|
+
/**
|
|
522
|
+
* Returns a cloned Day.js object with a specified amount of time added.
|
|
523
|
+
* ```
|
|
524
|
+
* dayjs().add(7, 'day')// => Dayjs
|
|
525
|
+
* ```
|
|
526
|
+
* Units are case insensitive, and support plural and short forms.
|
|
527
|
+
*
|
|
528
|
+
* Docs: https://day.js.org/docs/en/manipulate/add
|
|
529
|
+
*/
|
|
530
|
+
add(value: number, unit?: ManipulateType): Dayjs
|
|
531
|
+
/**
|
|
532
|
+
* Returns a cloned Day.js object with a specified amount of time subtracted.
|
|
533
|
+
* ```
|
|
534
|
+
* dayjs().subtract(7, 'year')// => Dayjs
|
|
535
|
+
* ```
|
|
536
|
+
* Units are case insensitive, and support plural and short forms.
|
|
537
|
+
*
|
|
538
|
+
* Docs: https://day.js.org/docs/en/manipulate/subtract
|
|
539
|
+
*/
|
|
540
|
+
subtract(value: number, unit?: ManipulateType): Dayjs
|
|
541
|
+
/**
|
|
542
|
+
* Returns a cloned Day.js object and set it to the start of a unit of time.
|
|
543
|
+
* ```
|
|
544
|
+
* dayjs().startOf('year')// => Dayjs
|
|
545
|
+
* ```
|
|
546
|
+
* Units are case insensitive, and support plural and short forms.
|
|
547
|
+
*
|
|
548
|
+
* Docs: https://day.js.org/docs/en/manipulate/start-of
|
|
549
|
+
*/
|
|
550
|
+
startOf(unit: OpUnitType): Dayjs
|
|
551
|
+
/**
|
|
552
|
+
* Returns a cloned Day.js object and set it to the end of a unit of time.
|
|
553
|
+
* ```
|
|
554
|
+
* dayjs().endOf('month')// => Dayjs
|
|
555
|
+
* ```
|
|
556
|
+
* Units are case insensitive, and support plural and short forms.
|
|
557
|
+
*
|
|
558
|
+
* Docs: https://day.js.org/docs/en/manipulate/end-of
|
|
559
|
+
*/
|
|
560
|
+
endOf(unit: OpUnitType): Dayjs
|
|
561
|
+
/**
|
|
562
|
+
* Get the formatted date according to the string of tokens passed in.
|
|
563
|
+
*
|
|
564
|
+
* To escape characters, wrap them in square brackets (e.g. [MM]).
|
|
565
|
+
* ```
|
|
566
|
+
* dayjs().format()// => current date in ISO8601, without fraction seconds e.g. '2020-04-02T08:02:17-05:00'
|
|
567
|
+
* dayjs('2019-01-25').format('[YYYYescape] YYYY-MM-DDTHH:mm:ssZ[Z]')// 'YYYYescape 2019-01-25T00:00:00-02:00Z'
|
|
568
|
+
* dayjs('2019-01-25').format('DD/MM/YYYY') // '25/01/2019'
|
|
569
|
+
* ```
|
|
570
|
+
* Docs: https://day.js.org/docs/en/display/format
|
|
571
|
+
*/
|
|
572
|
+
format(template?: string): string
|
|
573
|
+
/**
|
|
574
|
+
* This indicates the difference between two date-time in the specified unit.
|
|
575
|
+
*
|
|
576
|
+
* To get the difference in milliseconds, use `dayjs#diff`
|
|
577
|
+
* ```
|
|
578
|
+
* const date1 = dayjs('2019-01-25')
|
|
579
|
+
* const date2 = dayjs('2018-06-05')
|
|
580
|
+
* date1.diff(date2) // 20214000000 default milliseconds
|
|
581
|
+
* date1.diff() // milliseconds to current time
|
|
582
|
+
* ```
|
|
583
|
+
*
|
|
584
|
+
* To get the difference in another unit of measurement, pass that measurement as the second argument.
|
|
585
|
+
* ```
|
|
586
|
+
* const date1 = dayjs('2019-01-25')
|
|
587
|
+
* date1.diff('2018-06-05', 'month') // 7
|
|
588
|
+
* ```
|
|
589
|
+
* Units are case insensitive, and support plural and short forms.
|
|
590
|
+
*
|
|
591
|
+
* Docs: https://day.js.org/docs/en/display/difference
|
|
592
|
+
*/
|
|
593
|
+
diff(date?: ConfigType, unit?: QUnitType | OpUnitType, float?: boolean): number
|
|
594
|
+
/**
|
|
595
|
+
* This returns the number of **milliseconds** since the Unix Epoch of the Day.js object.
|
|
596
|
+
* ```
|
|
597
|
+
* dayjs('2019-01-25').valueOf() // 1548381600000
|
|
598
|
+
* +dayjs(1548381600000) // 1548381600000
|
|
599
|
+
* ```
|
|
600
|
+
* To get a Unix timestamp (the number of seconds since the epoch) from a Day.js object, you should use Unix Timestamp `dayjs#unix()`.
|
|
601
|
+
*
|
|
602
|
+
* Docs: https://day.js.org/docs/en/display/unix-timestamp-milliseconds
|
|
603
|
+
*/
|
|
604
|
+
valueOf(): number
|
|
605
|
+
/**
|
|
606
|
+
* This returns the Unix timestamp (the number of **seconds** since the Unix Epoch) of the Day.js object.
|
|
607
|
+
* ```
|
|
608
|
+
* dayjs('2019-01-25').unix() // 1548381600
|
|
609
|
+
* ```
|
|
610
|
+
* This value is floored to the nearest second, and does not include a milliseconds component.
|
|
611
|
+
*
|
|
612
|
+
* Docs: https://day.js.org/docs/en/display/unix-timestamp
|
|
613
|
+
*/
|
|
614
|
+
unix(): number
|
|
615
|
+
/**
|
|
616
|
+
* Get the number of days in the current month.
|
|
617
|
+
* ```
|
|
618
|
+
* dayjs('2019-01-25').daysInMonth() // 31
|
|
619
|
+
* ```
|
|
620
|
+
* Docs: https://day.js.org/docs/en/display/days-in-month
|
|
621
|
+
*/
|
|
622
|
+
daysInMonth(): number
|
|
623
|
+
/**
|
|
624
|
+
* To get a copy of the native `Date` object parsed from the Day.js object use `dayjs#toDate`.
|
|
625
|
+
* ```
|
|
626
|
+
* dayjs('2019-01-25').toDate()// => Date
|
|
627
|
+
* ```
|
|
628
|
+
*/
|
|
629
|
+
toDate(): Date
|
|
630
|
+
/**
|
|
631
|
+
* To serialize as an ISO 8601 string.
|
|
632
|
+
* ```
|
|
633
|
+
* dayjs('2019-01-25').toJSON() // '2019-01-25T02:00:00.000Z'
|
|
634
|
+
* ```
|
|
635
|
+
* Docs: https://day.js.org/docs/en/display/as-json
|
|
636
|
+
*/
|
|
637
|
+
toJSON(): string
|
|
638
|
+
/**
|
|
639
|
+
* To format as an ISO 8601 string.
|
|
640
|
+
* ```
|
|
641
|
+
* dayjs('2019-01-25').toISOString() // '2019-01-25T02:00:00.000Z'
|
|
642
|
+
* ```
|
|
643
|
+
* Docs: https://day.js.org/docs/en/display/as-iso-string
|
|
644
|
+
*/
|
|
645
|
+
toISOString(): string
|
|
646
|
+
/**
|
|
647
|
+
* Returns a string representation of the date.
|
|
648
|
+
* ```
|
|
649
|
+
* dayjs('2019-01-25').toString() // 'Fri, 25 Jan 2019 02:00:00 GMT'
|
|
650
|
+
* ```
|
|
651
|
+
* Docs: https://day.js.org/docs/en/display/as-string
|
|
652
|
+
*/
|
|
653
|
+
toString(): string
|
|
654
|
+
/**
|
|
655
|
+
* Get the UTC offset in minutes.
|
|
656
|
+
* ```
|
|
657
|
+
* dayjs().utcOffset()
|
|
658
|
+
* ```
|
|
659
|
+
* Docs: https://day.js.org/docs/en/manipulate/utc-offset
|
|
660
|
+
*/
|
|
661
|
+
utcOffset(): number
|
|
662
|
+
/**
|
|
663
|
+
* This indicates whether the Day.js object is before the other supplied date-time.
|
|
664
|
+
* ```
|
|
665
|
+
* dayjs().isBefore(dayjs('2011-01-01')) // default milliseconds
|
|
666
|
+
* ```
|
|
667
|
+
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.
|
|
668
|
+
* ```
|
|
669
|
+
* dayjs().isBefore('2011-01-01', 'year')// => boolean
|
|
670
|
+
* ```
|
|
671
|
+
* Units are case insensitive, and support plural and short forms.
|
|
672
|
+
*
|
|
673
|
+
* Docs: https://day.js.org/docs/en/query/is-before
|
|
674
|
+
*/
|
|
675
|
+
isBefore(date?: ConfigType, unit?: OpUnitType): boolean
|
|
676
|
+
/**
|
|
677
|
+
* This indicates whether the Day.js object is the same as the other supplied date-time.
|
|
678
|
+
* ```
|
|
679
|
+
* dayjs().isSame(dayjs('2011-01-01')) // default milliseconds
|
|
680
|
+
* ```
|
|
681
|
+
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.
|
|
682
|
+
* ```
|
|
683
|
+
* dayjs().isSame('2011-01-01', 'year')// => boolean
|
|
684
|
+
* ```
|
|
685
|
+
* Docs: https://day.js.org/docs/en/query/is-same
|
|
686
|
+
*/
|
|
687
|
+
isSame(date?: ConfigType, unit?: OpUnitType): boolean
|
|
688
|
+
/**
|
|
689
|
+
* This indicates whether the Day.js object is after the other supplied date-time.
|
|
690
|
+
* ```
|
|
691
|
+
* dayjs().isAfter(dayjs('2011-01-01')) // default milliseconds
|
|
692
|
+
* ```
|
|
693
|
+
* If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter.
|
|
694
|
+
* ```
|
|
695
|
+
* dayjs().isAfter('2011-01-01', 'year')// => boolean
|
|
696
|
+
* ```
|
|
697
|
+
* Units are case insensitive, and support plural and short forms.
|
|
698
|
+
*
|
|
699
|
+
* Docs: https://day.js.org/docs/en/query/is-after
|
|
700
|
+
*/
|
|
701
|
+
isAfter(date?: ConfigType, unit?: OpUnitType): boolean
|
|
702
|
+
|
|
703
|
+
locale(): string
|
|
704
|
+
|
|
705
|
+
locale(preset: string | ILocale, object?: Partial<ILocale>): Dayjs
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
export type PluginFunc<T = unknown> = (option: T, c: typeof Dayjs, d: typeof dayjs) => void
|
|
709
|
+
|
|
710
|
+
export function extend<T = unknown>(plugin: PluginFunc<T>, option?: T): Dayjs
|
|
711
|
+
|
|
712
|
+
export function locale(preset?: string | ILocale, object?: Partial<ILocale>, isLocal?: boolean): string
|
|
713
|
+
|
|
714
|
+
export function isDayjs(d: any): d is Dayjs
|
|
715
|
+
|
|
716
|
+
export function unix(t: number): Dayjs
|
|
717
|
+
|
|
718
|
+
const Ls : { [key: string] : ILocale }
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
/** 模版根:`scope` 为流程数据,`system` 为系统内置工具 */
|
|
722
|
+
type TemplateRootName = "scope" | "system";
|
|
723
|
+
declare const TEMPLATE_ROOT_NAMES: TemplateRootName[];
|
|
724
|
+
/** dayjs 实例常用方法(用于联想;运行时走真实 dayjs 原型) */
|
|
725
|
+
declare const SYSTEM_TIME_METHOD_NAMES: readonly ["add", "subtract", "set", "get", "millisecond", "second", "minute", "hour", "date", "day", "weekday", "isoWeekday", "dayOfYear", "week", "isoWeek", "month", "quarter", "year", "weekYear", "isoWeekYear", "startOf", "endOf", "format", "fromNow", "toNow", "from", "to", "calendar", "diff", "valueOf", "unix", "daysInMonth", "toDate", "toArray", "toJSON", "toISOString", "toObject", "toString", "isBefore", "isSame", "isAfter", "isSameOrBefore", "isSameOrAfter", "isBetween", "isLeapYear", "isValid", "clone", "locale", "utcOffset", "local", "utc", "isUTC"];
|
|
726
|
+
/** Math 静态成员(联想用) */
|
|
727
|
+
declare const SYSTEM_MATH_KEYS: readonly ["E", "LN10", "LN2", "LOG10E", "LOG2E", "PI", "SQRT1_2", "SQRT2", "abs", "acos", "acosh", "asin", "asinh", "atan", "atan2", "atanh", "cbrt", "ceil", "clz32", "cos", "cosh", "exp", "expm1", "floor", "fround", "hypot", "imul", "log", "log10", "log1p", "log2", "max", "min", "pow", "random", "round", "sign", "sin", "sinh", "sqrt", "tan", "tanh", "trunc"];
|
|
728
|
+
/** Location 常用属性 / 方法(联想用) */
|
|
729
|
+
declare const SYSTEM_LOCATION_KEYS: readonly ["href", "protocol", "host", "hostname", "port", "pathname", "search", "hash", "origin", "ancestorOrigins", "assign", "reload", "replace", "toString"];
|
|
730
|
+
type SystemTime = ReturnType<typeof dayjs>;
|
|
731
|
+
type SystemRoot = {
|
|
732
|
+
/** 当前时间的 dayjs 对象(每次 createSystemRoot 取「此刻」) */
|
|
733
|
+
time: SystemTime;
|
|
734
|
+
/** JS Math */
|
|
735
|
+
math: Math;
|
|
736
|
+
/** 当前页 Location;非浏览器环境为只读占位 */
|
|
737
|
+
location: Location | SystemLocationStub;
|
|
738
|
+
};
|
|
739
|
+
type SystemLocationStub = {
|
|
740
|
+
href: string;
|
|
741
|
+
protocol: string;
|
|
742
|
+
host: string;
|
|
743
|
+
hostname: string;
|
|
744
|
+
port: string;
|
|
745
|
+
pathname: string;
|
|
746
|
+
search: string;
|
|
747
|
+
hash: string;
|
|
748
|
+
origin: string;
|
|
749
|
+
assign: (url: string) => void;
|
|
750
|
+
reload: () => void;
|
|
751
|
+
replace: (url: string) => void;
|
|
752
|
+
toString: () => string;
|
|
753
|
+
};
|
|
754
|
+
/** 每次求值新建,保证 `time` 为当前时刻 */
|
|
755
|
+
declare function createSystemRoot(): SystemRoot;
|
|
756
|
+
/** 联想用静态树(不依赖运行时实例) */
|
|
757
|
+
declare function getSystemAutocompleteTree(): Record<string, unknown>;
|
|
758
|
+
declare function isDayjsValue(value: unknown): value is SystemTime;
|
|
759
|
+
|
|
760
|
+
/** @deprecated 名称保留兼容;实际同时识别 scope 与 system */
|
|
210
761
|
declare function hasScopeTemplate(value: string): boolean;
|
|
211
|
-
declare
|
|
762
|
+
declare const hasTemplateExpression: typeof hasScopeTemplate;
|
|
763
|
+
declare function evaluateScopeExpression(expression: string, scope: unknown, system?: SystemRoot): unknown;
|
|
212
764
|
declare function stringifyScopeValue(value: unknown): string;
|
|
213
|
-
/** 将 `{scope
|
|
214
|
-
declare function evaluateScopeTemplate(template: string, scope: unknown): string;
|
|
765
|
+
/** 将 `{scope?...}` / `{system?...}` 替换为求值结果;无模板时原样返回 */
|
|
766
|
+
declare function evaluateScopeTemplate(template: string, scope: unknown, system?: SystemRoot): string;
|
|
215
767
|
/**
|
|
216
|
-
* 在 JSON
|
|
768
|
+
* 在 JSON 文本中替换模板:
|
|
217
769
|
* - 位于字符串内时写入转义后的内容
|
|
218
770
|
* - 位于值位置时写入 JSON 字面量(对象/数组/字符串/数字)
|
|
219
771
|
*/
|
|
220
|
-
declare function evaluateScopeTemplateInJson(template: string, scope: unknown): string;
|
|
772
|
+
declare function evaluateScopeTemplateInJson(template: string, scope: unknown, system?: SystemRoot): string;
|
|
221
773
|
declare function looksLikeJsonText(text: string): boolean;
|
|
774
|
+
/** 编码时保留未解析的 scope/system 模版片段 */
|
|
775
|
+
declare function preserveTemplateTokensInEncode(value: string): boolean;
|
|
222
776
|
|
|
223
777
|
type ScopeAutocompleteState = {
|
|
224
778
|
templateStart: number;
|
|
225
779
|
cursor: number;
|
|
780
|
+
/** 正在补全根名 scope / system */
|
|
781
|
+
suggestingRoot: boolean;
|
|
782
|
+
root: TemplateRootName | null;
|
|
226
783
|
path: string[];
|
|
227
784
|
partialKey: string;
|
|
228
785
|
};
|
|
229
|
-
/** 解析光标处未闭合的 scope 模版表达式 */
|
|
786
|
+
/** 解析光标处未闭合的 scope / system 模版表达式 */
|
|
230
787
|
declare function parseScopeAutocomplete(text: string, cursor: number, scope: unknown): ScopeAutocompleteState | null;
|
|
231
788
|
declare function getScopeAutocompleteSuggestions(scope: unknown, state: ScopeAutocompleteState): string[];
|
|
232
|
-
declare function buildScopeExpression(path: string[], selectedKey: string): string;
|
|
789
|
+
declare function buildScopeExpression(path: string[], selectedKey: string, root?: TemplateRootName): string;
|
|
233
790
|
declare function applyScopeAutocompleteSelection(text: string, state: ScopeAutocompleteState, selectedKey: string): {
|
|
234
791
|
value: string;
|
|
235
792
|
cursor: number;
|
|
@@ -306,26 +863,65 @@ declare function getFetchBodyValidationError(body: string | undefined, resolvedB
|
|
|
306
863
|
declare function getFetchHeadersValidationError(config: FetchRequestConfig, scope?: unknown): string | null;
|
|
307
864
|
/** `{scope?...}` 整段表达式,区别于 JSON 对象 `{ "Authorization": "..." }` */
|
|
308
865
|
declare function isWholeScopeExpression(text: string): boolean;
|
|
309
|
-
/** 将请求头编辑器原文解析为对象;支持 JSON 内模板,也支持整段 `{scope?...}` */
|
|
866
|
+
/** 将请求头编辑器原文解析为对象;支持 JSON 内模板,也支持整段 `{scope?...}` / `{system?...}` */
|
|
310
867
|
declare function parseFetchHeadersJson(text: string, scope?: unknown): Record<string, string> | undefined;
|
|
311
868
|
declare function draftFetchHeadersText(config: FetchRequestConfig): string;
|
|
312
869
|
declare function resolveFetchHeaders(config: FetchRequestConfig, scope?: unknown): Record<string, string> | undefined;
|
|
313
|
-
/** 用上游 scope 解析 fetch 表单中的 URL / Base URL / headers / body */
|
|
870
|
+
/** 用上游 scope / 系统 system 解析 fetch 表单中的 URL / Base URL / headers / body */
|
|
314
871
|
declare function applyFetchConfigScope(config: FetchRequestConfig, scope: unknown): FetchRequestConfig;
|
|
315
872
|
declare function fetchConfigHasScopeTemplate(config: FetchRequestConfig): boolean;
|
|
316
873
|
|
|
874
|
+
/**
|
|
875
|
+
* JSON 文本静态检查:解析失败位置 + 常见全角/中文标点嫌疑字符。
|
|
876
|
+
*/
|
|
877
|
+
type JsonErrorRange = {
|
|
878
|
+
/** 含头不含尾的 UTF-16 下标 */
|
|
879
|
+
start: number;
|
|
880
|
+
end: number;
|
|
881
|
+
/** suspect = 全角/中文标点;parse = 解析器报错位置 */
|
|
882
|
+
kind: "suspect" | "parse";
|
|
883
|
+
};
|
|
884
|
+
type JsonLintResult = {
|
|
885
|
+
ok: true;
|
|
886
|
+
value: unknown;
|
|
887
|
+
} | {
|
|
888
|
+
ok: false;
|
|
889
|
+
error: string;
|
|
890
|
+
ranges: JsonErrorRange[];
|
|
891
|
+
};
|
|
892
|
+
/** 从引擎错误信息中尽量取出出错下标 */
|
|
893
|
+
declare function extractJsonErrorPosition(message: string, text: string): number | null;
|
|
894
|
+
/**
|
|
895
|
+
* 轻量扫描:找到第一个非法 token 的起始下标。
|
|
896
|
+
* 用于 V8 等只报 `Unexpected token 'a'`、不带 position 的场景。
|
|
897
|
+
*/
|
|
898
|
+
declare function findJsonSyntaxErrorOffset(text: string): number | null;
|
|
899
|
+
declare function findSuspectCharRanges(text: string): JsonErrorRange[];
|
|
900
|
+
/**
|
|
901
|
+
* 检查 JSON 文本。失败时尽量给出可高亮的区间(含中文引号等嫌疑字符)。
|
|
902
|
+
*/
|
|
903
|
+
declare function lintJsonString(jsonString: string): JsonLintResult;
|
|
904
|
+
/** 将错误区间应用到文本,生成带 <mark> 的 HTML(调用方需保证样式) */
|
|
905
|
+
declare function renderJsonWithErrorHighlights(text: string, ranges: JsonErrorRange[], markClass?: string): string;
|
|
906
|
+
|
|
317
907
|
type JsonNodeConfig = {
|
|
318
908
|
jsonString: string;
|
|
319
909
|
};
|
|
320
910
|
declare const DEFAULT_JSON_NODE_CONFIG: JsonNodeConfig;
|
|
911
|
+
|
|
321
912
|
declare function validateJsonString(jsonString: string): {
|
|
322
913
|
ok: true;
|
|
323
914
|
value: unknown;
|
|
324
915
|
} | {
|
|
325
916
|
ok: false;
|
|
326
917
|
error: string;
|
|
918
|
+
ranges?: JsonErrorRange[];
|
|
327
919
|
};
|
|
328
|
-
/**
|
|
920
|
+
/**
|
|
921
|
+
* 配置期校验:
|
|
922
|
+
* - 先做语法 lint(含错误区间)
|
|
923
|
+
* - 语法通过且含 scope/system 模版时标记 deferred(运行时再替换)
|
|
924
|
+
*/
|
|
329
925
|
declare function validateJsonStringAllowingScope(jsonString: string): {
|
|
330
926
|
ok: true;
|
|
331
927
|
value: unknown;
|
|
@@ -336,6 +932,7 @@ declare function validateJsonStringAllowingScope(jsonString: string): {
|
|
|
336
932
|
} | {
|
|
337
933
|
ok: false;
|
|
338
934
|
error: string;
|
|
935
|
+
ranges: JsonErrorRange[];
|
|
339
936
|
};
|
|
340
937
|
declare function parseJsonConfig(config: JsonNodeConfig, scope?: unknown): unknown;
|
|
341
938
|
|
|
@@ -547,6 +1144,116 @@ declare function collectViewEventBindings(nodes: Array<{
|
|
|
547
1144
|
eventConfig?: Partial<ViewEventNodeConfig> | null;
|
|
548
1145
|
}>, eventNodeType: string, armedNodeIds?: ReadonlySet<string>): Map<string, Set<ViewEventType>>;
|
|
549
1146
|
|
|
1147
|
+
declare const API_COLLECTION_DOCUMENT_VERSION: 1;
|
|
1148
|
+
/** 集合内单条接口 */
|
|
1149
|
+
type ApiCollectionEndpoint = {
|
|
1150
|
+
/** 下拉展示名,集合内建议唯一 */
|
|
1151
|
+
name: string;
|
|
1152
|
+
/** 请求路径或完整 URL,可含 `{scope?...}` */
|
|
1153
|
+
url: string;
|
|
1154
|
+
method: FetchHttpMethod;
|
|
1155
|
+
/** 查询参数;选中后会拼进 url;value 可含 `{scope?...}` */
|
|
1156
|
+
params?: Record<string, string>;
|
|
1157
|
+
/** 请求头;value 可含 `{scope?...}` */
|
|
1158
|
+
headers?: Record<string, string>;
|
|
1159
|
+
/** 请求体原文(多为 JSON 字符串),可含 `{scope?...}` */
|
|
1160
|
+
body?: string;
|
|
1161
|
+
/** 接口说明;配置侧栏选中时气泡展示 */
|
|
1162
|
+
description?: string;
|
|
1163
|
+
};
|
|
1164
|
+
/** 用户上传 / 编辑的 JSON 文档形状 */
|
|
1165
|
+
type ApiCollectionDocument = {
|
|
1166
|
+
version: typeof API_COLLECTION_DOCUMENT_VERSION;
|
|
1167
|
+
/** 集合显示名 */
|
|
1168
|
+
name: string;
|
|
1169
|
+
/** 可选 API 主机,写入 Fetch 的 apiBaseUrl;可含 `{scope?...}` */
|
|
1170
|
+
baseUrl?: string;
|
|
1171
|
+
apis: ApiCollectionEndpoint[];
|
|
1172
|
+
};
|
|
1173
|
+
/** 运行时 / IndexedDB 记录 */
|
|
1174
|
+
type ApiCollectionRecord = {
|
|
1175
|
+
id: string;
|
|
1176
|
+
name: string;
|
|
1177
|
+
/** true 时写入 IndexedDB;false 仅内存,刷新丢失 */
|
|
1178
|
+
persistLocal: boolean;
|
|
1179
|
+
document: ApiCollectionDocument;
|
|
1180
|
+
/** 编辑器里的原文,便于再编辑 */
|
|
1181
|
+
rawJson: string;
|
|
1182
|
+
createdAt: number;
|
|
1183
|
+
updatedAt: number;
|
|
1184
|
+
};
|
|
1185
|
+
type ApiCollectionListItem = {
|
|
1186
|
+
id: string;
|
|
1187
|
+
name: string;
|
|
1188
|
+
persistLocal: boolean;
|
|
1189
|
+
apiCount: number;
|
|
1190
|
+
updatedAt: number;
|
|
1191
|
+
};
|
|
1192
|
+
type ApiCollectionParseResult = {
|
|
1193
|
+
ok: true;
|
|
1194
|
+
document: ApiCollectionDocument;
|
|
1195
|
+
rawJson: string;
|
|
1196
|
+
} | {
|
|
1197
|
+
ok: false;
|
|
1198
|
+
error: string;
|
|
1199
|
+
};
|
|
1200
|
+
/** 校验并规范化集合文档(对象或已 parse 的 JSON) */
|
|
1201
|
+
declare function validateApiCollectionDocument(input: unknown): {
|
|
1202
|
+
ok: true;
|
|
1203
|
+
document: ApiCollectionDocument;
|
|
1204
|
+
} | {
|
|
1205
|
+
ok: false;
|
|
1206
|
+
error: string;
|
|
1207
|
+
};
|
|
1208
|
+
/** 解析上传 / 编辑框里的 JSON 文本 */
|
|
1209
|
+
declare function parseApiCollectionJson(text: string): ApiCollectionParseResult;
|
|
1210
|
+
declare function createApiCollectionId(): string;
|
|
1211
|
+
declare function apiCollectionToListItem(record: ApiCollectionRecord): ApiCollectionListItem;
|
|
1212
|
+
/** 可下载的示例模版(已通过校验;value 可写 `{scope?...}`) */
|
|
1213
|
+
declare function getApiCollectionTemplateDocument(): ApiCollectionDocument;
|
|
1214
|
+
declare function getApiCollectionTemplateJson(): string;
|
|
1215
|
+
declare function downloadApiCollectionTemplate(filename?: string): void;
|
|
1216
|
+
/** 把 params 拼进 url(params 的 value 支持 Scope 模版) */
|
|
1217
|
+
declare function buildApiCollectionEndpointUrl(endpoint: ApiCollectionEndpoint): string;
|
|
1218
|
+
/** 同步匹配用:去掉 query / hash,忽略末尾斜杠 */
|
|
1219
|
+
declare function normalizeApiCollectionUrlKey(url: string): string;
|
|
1220
|
+
type ApiCollectionFetchNodeLike = {
|
|
1221
|
+
id: string;
|
|
1222
|
+
label?: string;
|
|
1223
|
+
fetchConfig?: FetchRequestConfig | null;
|
|
1224
|
+
};
|
|
1225
|
+
type ApiCollectionSyncChangedField = "url" | "method" | "headers" | "body" | "apiBaseUrl";
|
|
1226
|
+
type ApiCollectionSyncNodePatch = {
|
|
1227
|
+
nodeId: string;
|
|
1228
|
+
nodeLabel: string;
|
|
1229
|
+
changedFields: ApiCollectionSyncChangedField[];
|
|
1230
|
+
fetchConfigPatch: Partial<FetchRequestConfig>;
|
|
1231
|
+
};
|
|
1232
|
+
type ApiCollectionSyncResult = {
|
|
1233
|
+
updatedCount: number;
|
|
1234
|
+
nodes: Array<{
|
|
1235
|
+
id: string;
|
|
1236
|
+
label: string;
|
|
1237
|
+
changedFields: ApiCollectionSyncChangedField[];
|
|
1238
|
+
}>;
|
|
1239
|
+
};
|
|
1240
|
+
/**
|
|
1241
|
+
* 按 URL(忽略 query)匹配 Fetch 节点,生成回填 patch。
|
|
1242
|
+
* URL 对不上的节点不会出现在结果里。
|
|
1243
|
+
*/
|
|
1244
|
+
declare function buildApiCollectionSyncPatches(options: {
|
|
1245
|
+
collectionId: string;
|
|
1246
|
+
document: ApiCollectionDocument;
|
|
1247
|
+
nodes: ApiCollectionFetchNodeLike[];
|
|
1248
|
+
}): ApiCollectionSyncNodePatch[];
|
|
1249
|
+
declare function toApiCollectionSyncResult(patches: ApiCollectionSyncNodePatch[]): ApiCollectionSyncResult;
|
|
1250
|
+
/** 选中集合接口后回填到 Fetch 配置 */
|
|
1251
|
+
declare function applyApiCollectionEndpointToFetchConfig(options: {
|
|
1252
|
+
collectionId: string;
|
|
1253
|
+
document: ApiCollectionDocument;
|
|
1254
|
+
endpoint: ApiCollectionEndpoint;
|
|
1255
|
+
}): Partial<FetchRequestConfig>;
|
|
1256
|
+
|
|
550
1257
|
type ExecutionTraceEntry = {
|
|
551
1258
|
id: string;
|
|
552
1259
|
nodeId: string;
|
|
@@ -800,4 +1507,4 @@ declare function isClockNodeActive(nodeId: string): boolean;
|
|
|
800
1507
|
declare function getActiveClockNodeIds(): string[];
|
|
801
1508
|
declare function subscribeActiveClockNodes(listener: () => void): () => boolean;
|
|
802
1509
|
|
|
803
|
-
export { AND_NODE_TYPE, BLUEPRINT_ACTIVATION_INPUT_KEY, BLUEPRINT_CALL_STACK_KEY, BLUEPRINT_NODE_TYPE, type Behavior, type BehaviorContext, type BehaviorFn, BehaviorRegistry, type BlueprintCycleCheckOptions, type BlueprintCycleCheckResult, BlueprintCycleError, BlueprintGraphRunner, type BlueprintNodeOutputs, type BlueprintRefOutput, CLOCK_NODE_TYPE, type ClockNodeConfig, type ClockSignalOutput, DEFAULT_CLOCK_NODE_CONFIG, DEFAULT_FETCH_REQUEST_CONFIG, DEFAULT_JSON_NODE_CONFIG, DEFAULT_LOGIC_NODE_CONFIG, DEFAULT_LOGIC_NODE_TYPE, DEFAULT_STORAGE_NODE_CONFIG, DEFAULT_VIEW_EVENT_NODE_CONFIG, EVENT_NODE_TYPE, type ExecuteFetchOptions, type ExecutionRunRecord, type ExecutionToken, type ExecutionTraceEntry, Executor, type ExecutorDeps, FETCH_CACHES, FETCH_CREDENTIALS, FETCH_HTTP_METHODS, FETCH_MODES, FETCH_NODE_TYPE, FETCH_REDIRECTS, FETCH_RESPONSE_TYPES, FETCH_SCOPE_AUTOCOMPLETE_FALLBACK, type FalseSignal, type FetchHttpMethod, type FetchRequestConfig, type FetchResponseType, type FetchResultValue, type FetchUrlInputMode, type IncomingGraphEdge, type IncomingNodeScope, type IncomingNodeScopeEntry, type IncomingNodeSource, JSON_NODE_TYPE, type JsonNodeConfig, LIFECYCLE_NODE_TYPE, LIFECYCLE_SIGNAL_KEY, type LibraryBlueprintResolver, type LifecycleSignal, type LogicNodeConfig, type NodeDefinition, type NodeSignal, PAGE_LIFECYCLE_LABELS, PAGE_LIFECYCLE_PHASES, type PageLifecyclePhase, type ParsedSwaggerDocument, type PortSpec, type RunnableGraph, type RunnableGraphEdge, type RunnableGraphNode, STORAGE_KINDS, STORAGE_NODE_TYPE, type Scope, type ScopeAutocompleteState, type StorageAccessors, type StorageKind, type StorageNodeConfig, type StorageReadConfig, type StorageSetConfig, type SwaggerApiEndpoint, type TrueSignal, UI_EVENT_PAYLOAD_KEY, VIEW_EVENT_SIGNAL_KEY, VIEW_EVENT_TYPES, VIEW_NODE_TYPE, type Value, type ViewEventNodeConfig, type ViewEventNodeSnapshot, type ViewEventSignal, type ViewEventSnapshot, type ViewEventType, type ViewScopeUpdateCallback, type WebStorageLike, abortClockNode, abortClockSession, andLogicNodeDefinition, appStorageKey, applyFetchConfigScope, applyScopeAutocompleteSelection, assertNoBlueprintReferenceCycle, blueprintNodeDefinition, buildClockSessionKey, buildClockSignalValue, buildEndpointFullUrl, buildEndpointSuggestions, buildIncomingNodeScope, buildScopeExpression, clearClockSessionAbort, clockNodeDefinition, collectArmedViewEventBindings, collectArmedViewEventNodeIds, collectBlueprintLibraryRefs, collectIncomingNodeScopeEntries, collectViewEventBindings, combinePortSignalsOr, createClockOutputValue, createFalseSignal, createIncomingNodeScopeEntry, createLifecycleSignal, createTraceEntryId, createTrueSignal, createViewEventSignal, defaultLogicNodeDefinition, deserializeStorageValue, detectBlueprintReferenceCycle, detectRuntimeBlueprintCycle, draftFetchHeadersText, evaluateScopeExpression, evaluateScopeTemplate, evaluateScopeTemplateInJson, executeFetch, executeLogicConfig, executeStorageConfig, fetchConfigHasScopeTemplate, fetchNodeDefinition, filterEndpointSuggestions, filterStorageKeySuggestions, formatBlueprintCycleMessage, formatClockTime, getActiveClockNodeIds, getClockTickDelayOffsetMs, getClockTickWaitMs, getFetchBodyValidationError, getFetchHeadersValidationError, getNodeDefinition, getScopeAutocompleteSuggestions, hasScopeTemplate, isClockNodeActive, isClockScheduleActive, isClockSessionAborted, isFalseSignal, isStorageReadConfigured, isStorageSetConfigured, isTrueSignal, isViewEventType, isWholeScopeExpression, jsonNodeDefinition, latestTraceOutputsByNode, lifecycleNodeDefinition, listBrowserStorageKeys, looksLikeJsonText, nodeDefinitionRegistry, normalizeAppNameSpace, normalizeClockConfig, normalizeFetchRequestConfig, normalizeStorageConfig, normalizeViewEventConfig, parseFetchHeadersJson, parseJsonConfig, parseJsonText, parseScopeAutocomplete, parseSwaggerDocument, registerDefaultBehaviors, resolveBlueprintCallStack, resolveFetchBody, resolveFetchHeaders, resolveFetchIncomingScope, resolveFetchRequestUrl, resolveFetchScopeAutocompleteRoot, resolveStorageKey, resolveStorageWriteValue, scheduleClockOutputs, serializeStorageValue, serializeTraceValue, snapshotDomEvent, snapshotViewEventNode, startClockSchedule, stopAllClockSchedules, stopClockSchedule, storageNodeDefinition, stringifyScopeValue, subscribeActiveClockNodes, uniqueStorageKinds, validateClockScheduleConfig, validateFetchJsonText, validateJsonString, validateJsonStringAllowingScope, validateLogicSourceCode, viewBindNodeDefinition, viewEventNodeDefinition };
|
|
1510
|
+
export { AND_NODE_TYPE, API_COLLECTION_DOCUMENT_VERSION, type ApiCollectionDocument, type ApiCollectionEndpoint, type ApiCollectionFetchNodeLike, type ApiCollectionListItem, type ApiCollectionParseResult, type ApiCollectionRecord, type ApiCollectionSyncChangedField, type ApiCollectionSyncNodePatch, type ApiCollectionSyncNotice, type ApiCollectionSyncResult, BLUEPRINT_ACTIVATION_INPUT_KEY, BLUEPRINT_CALL_STACK_KEY, BLUEPRINT_NODE_TYPE, type Behavior, type BehaviorContext, type BehaviorFn, BehaviorRegistry, type BlueprintCycleCheckOptions, type BlueprintCycleCheckResult, BlueprintCycleError, type BlueprintDslLocale, type BlueprintDslMessageKey, BlueprintGraphRunner, type BlueprintNodeOutputs, type BlueprintRefOutput, CLOCK_NODE_TYPE, type ClockNodeConfig, type ClockSignalOutput, DEFAULT_CLOCK_NODE_CONFIG, DEFAULT_FETCH_REQUEST_CONFIG, DEFAULT_JSON_NODE_CONFIG, DEFAULT_LOGIC_NODE_CONFIG, DEFAULT_LOGIC_NODE_TYPE, DEFAULT_STORAGE_NODE_CONFIG, DEFAULT_VIEW_EVENT_NODE_CONFIG, EVENT_NODE_TYPE, type ExecuteFetchOptions, type ExecutionRunRecord, type ExecutionToken, type ExecutionTraceEntry, Executor, type ExecutorDeps, FETCH_CACHES, FETCH_CREDENTIALS, FETCH_HTTP_METHODS, FETCH_MODES, FETCH_NODE_TYPE, FETCH_REDIRECTS, FETCH_RESPONSE_TYPES, FETCH_SCOPE_AUTOCOMPLETE_FALLBACK, type FalseSignal, type FetchHttpMethod, type FetchRequestConfig, type FetchResponseType, type FetchResultValue, type FetchUrlInputMode, type IncomingGraphEdge, type IncomingNodeScope, type IncomingNodeScopeEntry, type IncomingNodeSource, JSON_NODE_TYPE, type JsonErrorRange, type JsonNodeConfig, LIFECYCLE_NODE_TYPE, LIFECYCLE_SIGNAL_KEY, type LibraryBlueprintResolver, type LifecycleSignal, type LogicNodeConfig, type NodeDefinition, type NodeSignal, PAGE_LIFECYCLE_LABELS, PAGE_LIFECYCLE_PHASES, type PageLifecyclePhase, type ParsedSwaggerDocument, type PortSpec, type RunnableGraph, type RunnableGraphEdge, type RunnableGraphNode, STORAGE_KINDS, STORAGE_NODE_TYPE, SYSTEM_LOCATION_KEYS, SYSTEM_MATH_KEYS, SYSTEM_TIME_METHOD_NAMES, type Scope, type ScopeAutocompleteState, type StorageAccessors, type StorageKind, type StorageNodeConfig, type StorageReadConfig, type StorageSetConfig, type SwaggerApiEndpoint, type SystemLocationStub, type SystemRoot, type SystemTime, TEMPLATE_ROOT_NAMES, type TemplateRootName, type TrueSignal, UI_EVENT_PAYLOAD_KEY, VIEW_EVENT_SIGNAL_KEY, VIEW_EVENT_TYPES, VIEW_NODE_TYPE, type Value, type ViewEventNodeConfig, type ViewEventNodeSnapshot, type ViewEventSignal, type ViewEventSnapshot, type ViewEventType, type ViewScopeUpdateCallback, type WebStorageLike, abortClockNode, abortClockSession, andLogicNodeDefinition, apiCollectionToListItem, appStorageKey, applyApiCollectionEndpointToFetchConfig, applyFetchConfigScope, applyScopeAutocompleteSelection, assertNoBlueprintReferenceCycle, blueprintNodeDefinition, buildApiCollectionEndpointUrl, buildApiCollectionSyncPatches, buildClockSessionKey, buildClockSignalValue, buildEndpointFullUrl, buildEndpointSuggestions, buildIncomingNodeScope, buildScopeExpression, clearClockSessionAbort, clockNodeDefinition, collectArmedViewEventBindings, collectArmedViewEventNodeIds, collectBlueprintLibraryRefs, collectIncomingNodeScopeEntries, collectViewEventBindings, combinePortSignalsOr, createApiCollectionId, createClockOutputValue, createFalseSignal, createIncomingNodeScopeEntry, createLifecycleSignal, createSystemRoot, createTraceEntryId, createTrueSignal, createViewEventSignal, defaultLogicNodeDefinition, deserializeStorageValue, detectBlueprintReferenceCycle, detectRuntimeBlueprintCycle, downloadApiCollectionTemplate, draftFetchHeadersText, dslMessage, evaluateScopeExpression, evaluateScopeTemplate, evaluateScopeTemplateInJson, executeFetch, executeLogicConfig, executeStorageConfig, extractJsonErrorPosition, fetchConfigHasScopeTemplate, fetchNodeDefinition, filterEndpointSuggestions, filterStorageKeySuggestions, findJsonSyntaxErrorOffset, findSuspectCharRanges, formatBlueprintCycleMessage, formatClockTime, getActiveClockNodeIds, getApiCollectionTemplateDocument, getApiCollectionTemplateJson, getBlueprintDslLocale, getClockTickDelayOffsetMs, getClockTickWaitMs, getFetchBodyValidationError, getFetchHeadersValidationError, getNodeDefinition, getScopeAutocompleteSuggestions, getSystemAutocompleteTree, hasScopeTemplate, hasTemplateExpression, isClockNodeActive, isClockScheduleActive, isClockSessionAborted, isDayjsValue, isFalseSignal, isStorageReadConfigured, isStorageSetConfigured, isTrueSignal, isViewEventType, isWholeScopeExpression, jsonNodeDefinition, latestTraceOutputsByNode, lifecycleNodeDefinition, lintJsonString, listBrowserStorageKeys, looksLikeJsonText, nodeDefinitionRegistry, normalizeApiCollectionUrlKey, normalizeAppNameSpace, normalizeClockConfig, normalizeFetchRequestConfig, normalizeStorageConfig, normalizeViewEventConfig, parseApiCollectionJson, parseFetchHeadersJson, parseJsonConfig, parseJsonText, parseScopeAutocomplete, parseSwaggerDocument, preserveTemplateTokensInEncode, registerDefaultBehaviors, renderJsonWithErrorHighlights, resolveBlueprintCallStack, resolveFetchBody, resolveFetchHeaders, resolveFetchIncomingScope, resolveFetchRequestUrl, resolveFetchScopeAutocompleteRoot, resolveStorageKey, resolveStorageWriteValue, scheduleClockOutputs, serializeStorageValue, serializeTraceValue, setBlueprintDslLocale, snapshotDomEvent, snapshotViewEventNode, startClockSchedule, stopAllClockSchedules, stopClockSchedule, storageNodeDefinition, stringifyScopeValue, subscribeActiveClockNodes, toApiCollectionSyncResult, uniqueStorageKinds, validateApiCollectionDocument, validateClockScheduleConfig, validateFetchJsonText, validateJsonString, validateJsonStringAllowingScope, validateLogicSourceCode, viewBindNodeDefinition, viewEventNodeDefinition };
|