@blocklet/meta 1.15.17 → 1.16.0-beta-8ee536d7

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.
Files changed (62) hide show
  1. package/lib/channel.d.ts +32 -0
  2. package/lib/channel.js +54 -0
  3. package/lib/constants.d.ts +2 -0
  4. package/lib/constants.js +5 -152
  5. package/lib/did.d.ts +3 -0
  6. package/lib/did.js +9 -9
  7. package/lib/engine.d.ts +7 -0
  8. package/lib/engine.js +21 -25
  9. package/lib/entry.d.ts +3 -0
  10. package/lib/entry.js +51 -64
  11. package/lib/extension.d.ts +14 -0
  12. package/lib/extension.js +82 -77
  13. package/lib/file.d.ts +23 -0
  14. package/lib/file.js +51 -36
  15. package/lib/fix.d.ts +36 -0
  16. package/lib/fix.js +231 -228
  17. package/lib/get-component-process-id.d.ts +5 -0
  18. package/lib/get-component-process-id.js +16 -0
  19. package/lib/has-reserved-key.d.ts +3 -0
  20. package/lib/has-reserved-key.js +15 -0
  21. package/lib/index.d.ts +86 -0
  22. package/lib/index.js +55 -34
  23. package/lib/info.d.ts +15 -0
  24. package/lib/info.js +70 -38
  25. package/lib/name.d.ts +15 -0
  26. package/lib/name.js +41 -8
  27. package/lib/nft-templates.d.ts +86 -0
  28. package/lib/nft-templates.js +52 -0
  29. package/lib/parse-navigation-from-blocklet.d.ts +92 -0
  30. package/lib/parse-navigation-from-blocklet.js +539 -0
  31. package/lib/parse-navigation.d.ts +3 -0
  32. package/lib/parse-navigation.js +197 -0
  33. package/lib/parse.d.ts +22 -0
  34. package/lib/parse.js +100 -89
  35. package/lib/payment/index.d.ts +254 -0
  36. package/lib/payment/index.js +14 -0
  37. package/lib/payment/v1.d.ts +185 -0
  38. package/lib/payment/v1.js +84 -0
  39. package/lib/payment/v2.d.ts +242 -0
  40. package/lib/payment/v2.js +576 -0
  41. package/lib/schema.d.ts +63 -0
  42. package/lib/schema.js +669 -283
  43. package/lib/service.d.ts +27 -0
  44. package/lib/service.js +71 -0
  45. package/lib/types/index.d.ts +1 -0
  46. package/lib/types/index.js +18 -0
  47. package/lib/types/schema.d.ts +284 -0
  48. package/lib/types/schema.js +3 -0
  49. package/lib/url-friendly.d.ts +6 -0
  50. package/lib/url-friendly.js +20 -0
  51. package/lib/util-meta.d.ts +42 -0
  52. package/lib/util-meta.js +146 -0
  53. package/lib/util.d.ts +201 -0
  54. package/lib/util.js +501 -82
  55. package/lib/validate.d.ts +13 -0
  56. package/lib/validate.js +37 -61
  57. package/lib/verify-multi-sig.d.ts +3 -0
  58. package/lib/verify-multi-sig.js +86 -59
  59. package/lib/wallet.d.ts +9 -0
  60. package/lib/wallet.js +19 -30
  61. package/package.json +59 -20
  62. package/lib/payment.js +0 -114
package/lib/util.d.ts ADDED
@@ -0,0 +1,201 @@
1
+ import type { BlockletState, ComponentState } from '@abtnode/client';
2
+ import type { Request } from 'express';
3
+ import type { TBlockletMeta, TEnvironment } from './types';
4
+ type TConfig = TEnvironment & {
5
+ key: string;
6
+ };
7
+ type Component = BlockletState | ComponentState;
8
+ declare const getComponentId: (component?: {
9
+ meta?: {
10
+ did?: string;
11
+ };
12
+ }, ancestors?: Array<{
13
+ meta?: {
14
+ did?: string;
15
+ };
16
+ }>) => string;
17
+ declare const getComponentName: (component?: {
18
+ meta?: {
19
+ name?: string;
20
+ };
21
+ }, ancestors?: Array<{
22
+ meta?: {
23
+ name?: string;
24
+ };
25
+ }>) => string;
26
+ declare const getComponentBundleId: (component: {
27
+ meta: {
28
+ bundleName: string;
29
+ version: string;
30
+ };
31
+ }) => string;
32
+ /**
33
+ * a => ''
34
+ * @a/b => ''
35
+ * a/b => a
36
+ * @a/b/c => @a/b
37
+ * a/@b/c => a
38
+ * @a/b/@c/d => @a/b
39
+ * @a/b/@c/d/e => @a/b/@c/d
40
+ * @a/b/@c/d/@e/f => @a/b/@c/d
41
+ */
42
+ declare const getParentComponentName: (name?: string) => string;
43
+ declare const forEachBlocklet: (blocklet: BlockletState | ComponentState, cb: Function, { parallel, concurrencyLimit, sync, params: inputParams, _parent, _root, _level, _tasks: inputTasks, _ancestors, _limit, }?: {
44
+ parallel?: boolean;
45
+ concurrencyLimit?: number;
46
+ sync?: boolean;
47
+ params?: any;
48
+ _parent?: any;
49
+ _root?: any;
50
+ _level?: number;
51
+ _tasks?: any;
52
+ _ancestors?: any[];
53
+ _limit?: (fn: () => void) => void;
54
+ }) => Promise<unknown>;
55
+ declare const forEachBlockletSync: (blocklet: any, cb: Function) => Promise<unknown>;
56
+ declare const forEachChild: (blocklet: any, cb: Function, params?: any) => Promise<any>;
57
+ declare const forEachChildSync: (blocklet: BlockletState, cb: Function) => Promise<any>;
58
+ declare const findComponent: (blocklet: Component, isEqualFn: (component: Component, context: {
59
+ ancestors: Array<Component>;
60
+ }) => boolean, { _ancestors, returnAncestors, }?: {
61
+ _ancestors?: Array<Component>;
62
+ returnAncestors?: boolean;
63
+ }) => Component | {
64
+ component: Component;
65
+ ancestors: Array<Component>;
66
+ };
67
+ declare const findComponentById: (blocklet: BlockletState | ComponentState, componentId: string | Array<string>, { returnAncestors, }?: {
68
+ returnAncestors?: boolean;
69
+ }) => Component | {
70
+ component: Component;
71
+ ancestors: Array<Component>;
72
+ };
73
+ declare const isEnvShareable: (env?: TConfig) => boolean;
74
+ declare const getSharedConfigObj: (component: BlockletState, ancestors?: any[]) => any;
75
+ declare const isPreferenceKey: (x: TConfig) => Boolean;
76
+ declare const getAppMissingConfigs: (blocklet?: any) => any[];
77
+ declare const getComponentMissingConfigs: (component?: any, ancestors?: any[]) => any[];
78
+ declare const isFreeBlocklet: (meta: TBlockletMeta) => boolean;
79
+ declare const isFreeComponent: (meta: TBlockletMeta) => boolean;
80
+ declare const isComponentBlocklet: (meta?: TBlockletMeta) => boolean;
81
+ declare const wipeSensitiveData: (blocklet?: BlockletState) => BlockletState;
82
+ declare const isDeletableBlocklet: (blocklet?: BlockletState) => boolean;
83
+ declare const hasRunnableComponent: (blocklet: BlockletState) => boolean;
84
+ /**
85
+ * 获取 blocklet 的 name
86
+ * @param {Object} blocklet 应用数据
87
+ * @param {Boolean} onlyUseMeta 优先使用应用元数据的name
88
+ * @returns blocklet display name
89
+ */
90
+ declare const getAppName: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
91
+ /**
92
+ * 获取 blocklet 的 description
93
+ * @param {Object} blocklet 应用数据
94
+ * @param {Boolean} onlyUseMeta 优先使用应用元数据的name
95
+ * @returns blocklet display description
96
+ */
97
+ declare const getAppDescription: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
98
+ declare const fixBlockletStatus: (blocklet?: BlockletState) => void;
99
+ declare const findWebInterface: (blocklet?: BlockletState | TBlockletMeta) => any;
100
+ declare const findWebInterfacePort: (blocklet?: BlockletState) => any;
101
+ declare const findServiceFromMeta: (meta?: TBlockletMeta, ServiceName?: string) => any;
102
+ declare const getWhoCanAccess: (blocklet?: BlockletState) => any;
103
+ declare const getConnectAppUrl: ({ request, baseUrl }: {
104
+ request: Partial<Request>;
105
+ baseUrl: string;
106
+ }) => string;
107
+ declare const replaceSlotToIp: (url?: string, ip?: string) => string;
108
+ declare const getChainInfo: (env: Record<string, string>) => Record<string, string>;
109
+ declare const isExternalBlocklet: (blocklet?: BlockletState) => boolean;
110
+ declare const getRolesFromAuthConfig: (config: {
111
+ whoCanAccess: string;
112
+ }) => Array<string>;
113
+ declare const getBlockletAppIdList: (blocklet: Partial<BlockletState>) => string[];
114
+ export { isFreeBlocklet, isFreeComponent, isComponentBlocklet, forEachBlocklet, forEachBlockletSync, forEachChild, forEachChildSync, isDeletableBlocklet, getSharedConfigObj, getAppMissingConfigs, getComponentMissingConfigs, isEnvShareable, wipeSensitiveData, hasRunnableComponent, getAppName, getAppName as getDisplayName, getAppDescription, fixBlockletStatus, findWebInterface, findWebInterfacePort, findServiceFromMeta, getWhoCanAccess, replaceSlotToIp, getComponentId, getComponentName, getComponentBundleId, findComponent, findComponentById, getParentComponentName, getConnectAppUrl, getChainInfo, isExternalBlocklet, isPreferenceKey, getRolesFromAuthConfig, getBlockletAppIdList, };
115
+ declare const _default: {
116
+ isFreeBlocklet: (meta: TBlockletMeta) => boolean;
117
+ isFreeComponent: (meta: TBlockletMeta) => boolean;
118
+ isComponentBlocklet: (meta?: TBlockletMeta) => boolean;
119
+ forEachBlocklet: (blocklet: BlockletState | ComponentState, cb: Function, { parallel, concurrencyLimit, sync, params: inputParams, _parent, _root, _level, _tasks: inputTasks, _ancestors, _limit, }?: {
120
+ parallel?: boolean;
121
+ concurrencyLimit?: number;
122
+ sync?: boolean;
123
+ params?: any;
124
+ _parent?: any;
125
+ _root?: any;
126
+ _level?: number;
127
+ _tasks?: any;
128
+ _ancestors?: any[];
129
+ _limit?: (fn: () => void) => void;
130
+ }) => Promise<unknown>;
131
+ forEachBlockletSync: (blocklet: any, cb: Function) => Promise<unknown>;
132
+ forEachChild: (blocklet: any, cb: Function, params?: any) => Promise<any>;
133
+ forEachChildSync: (blocklet: BlockletState, cb: Function) => Promise<any>;
134
+ isDeletableBlocklet: (blocklet?: BlockletState) => boolean;
135
+ getSharedConfigObj: (component: BlockletState, ancestors?: any[]) => any;
136
+ getAppMissingConfigs: (blocklet?: any) => any[];
137
+ getComponentMissingConfigs: (component?: any, ancestors?: any[]) => any[];
138
+ isEnvShareable: (env?: TConfig) => boolean;
139
+ wipeSensitiveData: (blocklet?: BlockletState) => BlockletState;
140
+ hasRunnableComponent: (blocklet: BlockletState) => boolean;
141
+ getAppName: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
142
+ getAppDescription: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
143
+ getDisplayName: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
144
+ fixBlockletStatus: (blocklet?: BlockletState) => void;
145
+ findWebInterface: (blocklet?: TBlockletMeta | BlockletState) => any;
146
+ findWebInterfacePort: (blocklet?: BlockletState) => any;
147
+ findServiceFromMeta: (meta?: TBlockletMeta, ServiceName?: string) => any;
148
+ getWhoCanAccess: (blocklet?: BlockletState) => any;
149
+ replaceSlotToIp: (url?: string, ip?: string) => string;
150
+ getComponentId: (component?: {
151
+ meta?: {
152
+ did?: string;
153
+ };
154
+ }, ancestors?: {
155
+ meta?: {
156
+ did?: string;
157
+ };
158
+ }[]) => string;
159
+ getComponentName: (component?: {
160
+ meta?: {
161
+ name?: string;
162
+ };
163
+ }, ancestors?: {
164
+ meta?: {
165
+ name?: string;
166
+ };
167
+ }[]) => string;
168
+ getComponentBundleId: (component: {
169
+ meta: {
170
+ bundleName: string;
171
+ version: string;
172
+ };
173
+ }) => string;
174
+ findComponent: (blocklet: Component, isEqualFn: (component: Component, context: {
175
+ ancestors: Component[];
176
+ }) => boolean, { _ancestors, returnAncestors, }?: {
177
+ _ancestors?: Component[];
178
+ returnAncestors?: boolean;
179
+ }) => Component | {
180
+ component: Component;
181
+ ancestors: Component[];
182
+ };
183
+ findComponentById: (blocklet: BlockletState | ComponentState, componentId: string | string[], { returnAncestors, }?: {
184
+ returnAncestors?: boolean;
185
+ }) => Component | {
186
+ component: Component;
187
+ ancestors: Component[];
188
+ };
189
+ getParentComponentName: (name?: string) => string;
190
+ getConnectAppUrl: ({ request, baseUrl }: {
191
+ request: Partial<Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>>;
192
+ baseUrl: string;
193
+ }) => string;
194
+ getChainInfo: (env: Record<string, string>) => Record<string, string>;
195
+ isExternalBlocklet: (blocklet?: BlockletState) => boolean;
196
+ isPreferenceKey: (x: TConfig) => Boolean;
197
+ getRolesFromAuthConfig: (config: {
198
+ whoCanAccess: string;
199
+ }) => string[];
200
+ };
201
+ export default _default;