@blocklet/meta 1.16.23-beta-abdda301 → 1.16.23-beta-035db744

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/lib/parse.js CHANGED
@@ -62,7 +62,7 @@ const parse = (dir, { ensureFiles = false, ensureDist = false, ensureComponentSt
62
62
  (0, fix_1.fixName)(result);
63
63
  (0, fix_1.fixPerson)(result);
64
64
  (0, fix_1.fixService)(result);
65
- ['components', 'staticComponents'].forEach((prop) => {
65
+ ['components'].forEach((prop) => {
66
66
  if (defaultStoreUrl && result[prop]?.length) {
67
67
  result[prop].forEach((x) => {
68
68
  if (isSourceFromStore(x.source)) {
package/lib/payment/v2.js CHANGED
@@ -54,10 +54,7 @@ exports.version = VERSION;
54
54
  const ZeroBN = new util_1.BN(0);
55
55
  const defaultDecimals = 1e6; // we only support 6 decimals on share ratio
56
56
  const defaultDecimalsBN = new util_1.BN(defaultDecimals);
57
- const getComponentConfig = (meta) => []
58
- .concat(meta.components || meta.children)
59
- .concat(meta.staticComponents)
60
- .filter(Boolean);
57
+ const getComponentConfig = (meta) => [].concat(meta.components || meta.children).filter(Boolean);
61
58
  const safeMul = (a, b) => Number((0, util_1.fromUnitToToken)((0, util_1.fromTokenToUnit)(a)
62
59
  .mul(new util_1.BN(b * defaultDecimals))
63
60
  .div(defaultDecimalsBN)));
package/lib/schema.js CHANGED
@@ -336,13 +336,6 @@ const componentSchemaProps = {
336
336
  // backward compatible, useless
337
337
  name: blockletNameSchema,
338
338
  };
339
- const staticComponentSchemaProps = {
340
- source: componentSourceSchema.required(),
341
- name: blockletNameSchema.required(),
342
- title: titleSchema,
343
- description: descriptionSchema,
344
- mountPoint: mountPointSchema.required(),
345
- };
346
339
  const createComponentSchema = (schema, allowEmptyStore) => Joi.object(schema).custom((value, helper) => {
347
340
  if (!allowEmptyStore && value.source && value.source.name && !value.source.store) {
348
341
  // @ts-expect-error
@@ -355,33 +348,13 @@ const componentSchema = createComponentSchema(componentSchemaProps).meta({
355
348
  unknownType: 'any',
356
349
  });
357
350
  exports.componentSchema = componentSchema;
358
- const staticComponentSchema = createComponentSchema(staticComponentSchemaProps).meta({
359
- className: 'TStaticComponent',
360
- unknownType: 'any',
361
- });
362
351
  const componentSchemaWithoutStoreCheck = createComponentSchema(componentSchemaProps, true);
363
- const staticComponentSchemaWithoutStoreCheck = createComponentSchema(staticComponentSchemaProps, true);
364
- const componentsSchema = ({ isStatic, checkStore } = {}) => {
365
- const arr = isStatic
366
- ? [staticComponentSchema, staticComponentSchemaWithoutStoreCheck]
367
- : [componentSchema, componentSchemaWithoutStoreCheck];
368
- let schema = Joi.array()
352
+ const componentsSchema = ({ checkStore } = {}) => {
353
+ const arr = [componentSchema, componentSchemaWithoutStoreCheck];
354
+ const schema = Joi.array()
369
355
  .items(checkStore ? arr[0] : arr[1])
370
356
  .optional()
371
- .custom((value, helper) => {
372
- if (isStatic) {
373
- const names = value.map((x) => x.name);
374
- const duplicateName = names.find((x, i) => names.indexOf(x) !== i);
375
- if (duplicateName) {
376
- // @ts-expect-error
377
- return helper.message(`find duplicate name "${duplicateName}" in components`);
378
- }
379
- }
380
- return value;
381
- });
382
- if (!isStatic) {
383
- schema = schema.default([]);
384
- }
357
+ .default([]);
385
358
  return schema;
386
359
  };
387
360
  const signatureSchema = Joi.object({
@@ -667,7 +640,6 @@ const blockletMetaProps = {
667
640
  lastPublishedAt: Joi.string().isoDate().optional(),
668
641
  // blocklet component support
669
642
  components: componentsSchema(),
670
- staticComponents: componentsSchema({ isStatic: true }),
671
643
  // navigation & theme
672
644
  navigation: navigationSchema,
673
645
  theme: themeSchema,
@@ -702,7 +674,6 @@ const createBlockletSchema = (baseDir, { ensureFiles = false, ensureDist = false
702
674
  .optional(),
703
675
  dist: ensureDist ? distSchema.required() : distSchema.optional(),
704
676
  components: componentsSchema({ checkStore: ensureComponentStore }),
705
- staticComponents: componentsSchema({ isStatic: true, checkStore: ensureComponentStore }),
706
677
  name: ensureName ? Joi.string().optional() : Joi.string().required(),
707
678
  })
708
679
  .options({ stripUnknown: true, noDefaults: false, ...schemaOptions })
@@ -108,20 +108,6 @@ export interface TBlockletMeta {
108
108
  scripts?: TScripts;
109
109
  signatures?: TSignature[];
110
110
  specVersion?: string;
111
- staticComponents?: {
112
- description?: TDescription;
113
- mountPoint: TMountPoint;
114
- name: TBlockletName;
115
- source: {
116
- url: string | string[];
117
- version?: 'latest' | string;
118
- } | {
119
- name: TBlockletName;
120
- store?: string | string[];
121
- version?: 'latest' | string;
122
- };
123
- title?: TTitle;
124
- }[];
125
111
  stats?: TStats;
126
112
  storeId?: string;
127
113
  support?: string | string;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.23-beta-abdda301",
6
+ "version": "1.16.23-beta-035db744",
7
7
  "description": "Library to parse/validate/fix blocklet meta",
8
8
  "main": "./lib/index.js",
9
9
  "typings": "./lib/index.d.ts",
@@ -19,22 +19,23 @@
19
19
  "clean": "rm -fr lib",
20
20
  "types": "ts-node tools/types.js && sed -i.bak 's/unknown/string/g' ./src/types/schema.ts && rm ./src/types/schema.ts.bak && prettier --write ./src/types/*.ts",
21
21
  "prebuild": "npm run clean && npm run types",
22
+ "build:blocklet-meta": "npm run build",
22
23
  "build": "tsc"
23
24
  },
24
25
  "author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
25
26
  "license": "Apache-2.0",
26
27
  "dependencies": {
27
- "@abtnode/constant": "1.16.23-beta-abdda301",
28
- "@arcblock/did": "1.18.108",
29
- "@arcblock/did-ext": "1.18.108",
30
- "@arcblock/did-util": "1.18.108",
31
- "@arcblock/jwt": "1.18.108",
32
- "@blocklet/constant": "1.16.23-beta-abdda301",
33
- "@ocap/asset": "1.18.108",
34
- "@ocap/mcrypto": "1.18.108",
35
- "@ocap/types": "1.18.108",
36
- "@ocap/util": "1.18.108",
37
- "@ocap/wallet": "1.18.108",
28
+ "@abtnode/constant": "1.16.23-beta-035db744",
29
+ "@arcblock/did": "1.18.110",
30
+ "@arcblock/did-ext": "1.18.110",
31
+ "@arcblock/did-util": "1.18.110",
32
+ "@arcblock/jwt": "1.18.110",
33
+ "@blocklet/constant": "1.16.23-beta-035db744",
34
+ "@ocap/asset": "1.18.110",
35
+ "@ocap/mcrypto": "1.18.110",
36
+ "@ocap/types": "1.18.110",
37
+ "@ocap/util": "1.18.110",
38
+ "@ocap/wallet": "1.18.110",
38
39
  "ajv": "^8.11.0",
39
40
  "axios": "^0.27.2",
40
41
  "cjk-length": "^1.0.0",
@@ -78,5 +79,5 @@
78
79
  "ts-node": "^10.9.1",
79
80
  "typescript": "^5.0.4"
80
81
  },
81
- "gitHead": "2b064df15b34007f6145170ee691ae9e91ff1528"
82
+ "gitHead": "43b1f85fa413b81be8b8015031ac271a9d9f3456"
82
83
  }