@anov/cic-standard-sdk 0.0.6 → 0.0.8
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/cic-sdk.cjs.js +6 -6
- package/dist/cic-sdk.es.js +2657 -2555
- package/dist/cic-sdk.umd.js +6 -6
- package/dist/sdk/CICSDK.d.ts +10 -10
- package/dist/sdk/generators/ajv.d.ts +7 -0
- package/dist/sdk/generators/common.d.ts +13 -9
- package/dist/sdk/generators/dependency.d.ts +3 -3
- package/dist/sdk/generators/meta.d.ts +5 -5
- package/dist/sdk/generators/registry.d.ts +3 -3
- package/dist/sdk/generators/variables.d.ts +3 -3
- package/package.json +1 -1
package/dist/sdk/CICSDK.d.ts
CHANGED
|
@@ -49,22 +49,22 @@ export declare class CICSDK implements ICICSDK {
|
|
|
49
49
|
static validatePage: (input: unknown) => import("./generators/common").Result<null>;
|
|
50
50
|
static normalizePage: (input: unknown, options?: import("./generators/common").CreateOptions) => CICPage;
|
|
51
51
|
/** 创建 Meta/Layout */
|
|
52
|
-
static createMeta: (input: unknown) => import("./generators/common").Result<import("../types").Meta>;
|
|
53
|
-
static createLayout: (input: unknown) => import("./generators/common").Result<import("../types").Layout>;
|
|
52
|
+
static createMeta: (input: unknown, options?: import("./generators/common").CreateOptions) => import("./generators/common").Result<import("../types").Meta>;
|
|
53
|
+
static createLayout: (input: unknown, options?: import("./generators/common").CreateOptions) => import("./generators/common").Result<import("../types").Layout>;
|
|
54
54
|
static validateMeta: (input: unknown) => import("./generators/common").Result<null>;
|
|
55
55
|
static validateLayout: (input: unknown) => import("./generators/common").Result<null>;
|
|
56
|
-
static normalizeMeta: (input: unknown) => import("../types").Meta;
|
|
57
|
-
static normalizeLayout: (input: unknown) => import("../types").Layout;
|
|
56
|
+
static normalizeMeta: (input: unknown, options?: import("./generators/common").CreateOptions) => import("../types").Meta;
|
|
57
|
+
static normalizeLayout: (input: unknown, options?: import("./generators/common").CreateOptions) => import("../types").Layout;
|
|
58
58
|
/** 创建 Variables */
|
|
59
|
-
static createVariables: (input: unknown) => import("./generators/common").Result<import("../types").Variables>;
|
|
59
|
+
static createVariables: (input: unknown, options?: import("./generators/common").CreateOptions) => import("./generators/common").Result<import("../types").Variables>;
|
|
60
60
|
static validateVariables: (input: unknown) => import("./generators/common").Result<null>;
|
|
61
|
-
static normalizeVariables: (input: unknown) => import("../types").Variables;
|
|
61
|
+
static normalizeVariables: (input: unknown, options?: import("./generators/common").CreateOptions) => import("../types").Variables;
|
|
62
62
|
/** 创建 Dependency */
|
|
63
|
-
static createDependency: (input: unknown) => import("./generators/common").Result<import("../types").Dependency>;
|
|
63
|
+
static createDependency: (input: unknown, options?: import("./generators/common").CreateOptions) => import("./generators/common").Result<import("../types").Dependency>;
|
|
64
64
|
static validateDependency: (input: unknown) => import("./generators/common").Result<null>;
|
|
65
|
-
static normalizeDependency: (input: unknown) => import("../types").Dependency;
|
|
65
|
+
static normalizeDependency: (input: unknown, options?: import("./generators/common").CreateOptions) => import("../types").Dependency;
|
|
66
66
|
/** 创建 Registry 组件项 */
|
|
67
|
-
static createRegistryComponent: (input: unknown) => import("./generators/common").Result<import("../types").RegistryComponents>;
|
|
67
|
+
static createRegistryComponent: (input: unknown, options?: import("./generators/common").CreateOptions) => import("./generators/common").Result<import("../types").RegistryComponents>;
|
|
68
68
|
static validateRegistryComponent: (input: unknown) => import("./generators/common").Result<null>;
|
|
69
|
-
static normalizeRegistryComponent: (input: unknown) => import("../types").RegistryComponents;
|
|
69
|
+
static normalizeRegistryComponent: (input: unknown, options?: import("./generators/common").CreateOptions) => import("../types").RegistryComponents;
|
|
70
70
|
}
|
|
@@ -7,3 +7,10 @@ import Ajv from 'ajv';
|
|
|
7
7
|
export declare const getAjv: () => Ajv;
|
|
8
8
|
export declare const getValidator: (ref: string) => any;
|
|
9
9
|
export declare const getValidatorByType: (typeName: string) => any;
|
|
10
|
+
export declare const validateByType: (typeName: string, data: unknown) => {
|
|
11
|
+
ok: boolean;
|
|
12
|
+
errors?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
ok: boolean;
|
|
15
|
+
errors: import("./common").FormattedError[];
|
|
16
|
+
};
|
|
@@ -6,21 +6,25 @@
|
|
|
6
6
|
export type Result<T> = {
|
|
7
7
|
ok: boolean;
|
|
8
8
|
value?: T;
|
|
9
|
-
errors?:
|
|
9
|
+
errors?: FormattedError[];
|
|
10
10
|
};
|
|
11
|
-
export type CreateOptions = {
|
|
12
|
-
defaults?:
|
|
11
|
+
export type CreateOptions<T = any> = {
|
|
12
|
+
defaults?: Partial<T>;
|
|
13
13
|
generateId?: boolean;
|
|
14
14
|
strict?: boolean;
|
|
15
|
-
|
|
15
|
+
};
|
|
16
|
+
export type FormattedError = {
|
|
17
|
+
path: string;
|
|
18
|
+
message: string;
|
|
19
|
+
keyword?: string;
|
|
20
|
+
params?: Record<string, any>;
|
|
16
21
|
};
|
|
17
22
|
/** 将值规范为数组 */
|
|
18
23
|
export declare const ensureArray: <T>(v: any) => T[];
|
|
19
24
|
/** 判断为有限正数 */
|
|
20
25
|
export declare const isPositive: (n: any) => boolean;
|
|
21
|
-
/** 生成 uuid
|
|
26
|
+
/** 生成 uuid */
|
|
22
27
|
export declare const uuid: () => any;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export declare const wsUrl: (s: any, fallback?: string) => string;
|
|
28
|
+
export declare const formatAjvErrors: (errs: any[]) => FormattedError[];
|
|
29
|
+
/** 仅对缺失字段应用默认值(浅合并);不覆盖已有值 */
|
|
30
|
+
export declare const applyDefaults: <T>(target: any, defaults?: Partial<T>) => any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Result } from './common';
|
|
1
|
+
import { Result, CreateOptions } from './common';
|
|
2
2
|
import { Dependency } from '../../types/deps';
|
|
3
3
|
export declare const validateDependency: (input: unknown) => Result<null>;
|
|
4
|
-
export declare const createDependency: (input: unknown) => Result<Dependency>;
|
|
5
|
-
export declare const normalizeDependency: (input: unknown) => Dependency;
|
|
4
|
+
export declare const createDependency: (input: unknown, options?: CreateOptions) => Result<Dependency>;
|
|
5
|
+
export declare const normalizeDependency: (input: unknown, options?: CreateOptions) => Dependency;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Result } from './common';
|
|
1
|
+
import { Result, CreateOptions } from './common';
|
|
2
2
|
import { Meta, Layout } from '../../types/meta';
|
|
3
3
|
export declare const validateMeta: (input: unknown) => Result<null>;
|
|
4
4
|
export declare const validateLayout: (input: unknown) => Result<null>;
|
|
5
|
-
export declare const createMeta: (input: unknown) => Result<Meta>;
|
|
6
|
-
export declare const createLayout: (input: unknown) => Result<Layout>;
|
|
7
|
-
export declare const normalizeMeta: (input: unknown) => Meta;
|
|
8
|
-
export declare const normalizeLayout: (input: unknown) => Layout;
|
|
5
|
+
export declare const createMeta: (input: unknown, options?: CreateOptions) => Result<Meta>;
|
|
6
|
+
export declare const createLayout: (input: unknown, options?: CreateOptions) => Result<Layout>;
|
|
7
|
+
export declare const normalizeMeta: (input: unknown, options?: CreateOptions) => Meta;
|
|
8
|
+
export declare const normalizeLayout: (input: unknown, options?: CreateOptions) => Layout;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Result } from './common';
|
|
1
|
+
import { Result, CreateOptions } from './common';
|
|
2
2
|
import { RegistryComponents } from '../../types/registry';
|
|
3
3
|
export declare const validateRegistryComponent: (input: unknown) => Result<null>;
|
|
4
|
-
export declare const createRegistryComponent: (input: unknown) => Result<RegistryComponents>;
|
|
5
|
-
export declare const normalizeRegistryComponent: (input: unknown) => RegistryComponents;
|
|
4
|
+
export declare const createRegistryComponent: (input: unknown, options?: CreateOptions) => Result<RegistryComponents>;
|
|
5
|
+
export declare const normalizeRegistryComponent: (input: unknown, options?: CreateOptions) => RegistryComponents;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Result } from './common';
|
|
1
|
+
import { Result, CreateOptions } from './common';
|
|
2
2
|
import { Variables } from '../../types/variables';
|
|
3
3
|
export declare const validateVariables: (input: unknown) => Result<null>;
|
|
4
|
-
export declare const createVariables: (input: unknown) => Result<Variables>;
|
|
5
|
-
export declare const normalizeVariables: (input: unknown) => Variables;
|
|
4
|
+
export declare const createVariables: (input: unknown, options?: CreateOptions) => Result<Variables>;
|
|
5
|
+
export declare const normalizeVariables: (input: unknown, options?: CreateOptions) => Variables;
|