@did-space/core 1.0.39 → 1.0.40

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 (45) hide show
  1. package/dist/cjs/meta/template/preview/app.d.ts +1 -1
  2. package/dist/cjs/meta/template/preview/base.d.ts +8 -4
  3. package/dist/cjs/meta/template/preview/base.js +6 -2
  4. package/dist/cjs/meta/template/preview/blog.d.ts +3 -3
  5. package/dist/cjs/meta/template/preview/blog.js +3 -3
  6. package/dist/cjs/meta/template/preview/bookmark.d.ts +3 -3
  7. package/dist/cjs/meta/template/preview/bookmark.js +3 -3
  8. package/dist/cjs/meta/template/preview/default.d.ts +18 -18
  9. package/dist/cjs/meta/template/preview/default.js +2 -2
  10. package/dist/cjs/meta/template/preview/index.d.ts +1 -1
  11. package/dist/cjs/meta/template/preview/index.js +1 -1
  12. package/dist/cjs/meta/template/preview/nft.d.ts +1 -1
  13. package/dist/cjs/meta/template/preview/passport.d.ts +1 -1
  14. package/dist/cjs/meta/template/preview/post.d.ts +26 -0
  15. package/dist/cjs/meta/template/preview/post.js +12 -0
  16. package/dist/cjs/meta/template/preview/profile.d.ts +1 -1
  17. package/dist/cjs/meta/template/preview/project.d.ts +1 -1
  18. package/dist/cjs/meta/template/preview/project.js +1 -1
  19. package/dist/cjs/space/object-space.js +2 -2
  20. package/dist/cjs/utils/common.js +8 -3
  21. package/dist/es/meta/template/preview/app.d.ts +1 -1
  22. package/dist/es/meta/template/preview/base.d.ts +8 -4
  23. package/dist/es/meta/template/preview/base.js +5 -1
  24. package/dist/es/meta/template/preview/blog.d.ts +3 -3
  25. package/dist/es/meta/template/preview/blog.js +4 -4
  26. package/dist/es/meta/template/preview/bookmark.d.ts +3 -3
  27. package/dist/es/meta/template/preview/bookmark.js +4 -4
  28. package/dist/es/meta/template/preview/default.d.ts +18 -18
  29. package/dist/es/meta/template/preview/default.js +2 -2
  30. package/dist/es/meta/template/preview/index.d.ts +1 -1
  31. package/dist/es/meta/template/preview/index.js +1 -1
  32. package/dist/es/meta/template/preview/nft.d.ts +1 -1
  33. package/dist/es/meta/template/preview/passport.d.ts +1 -1
  34. package/dist/es/meta/template/preview/post.d.ts +26 -0
  35. package/dist/es/meta/template/preview/post.js +9 -0
  36. package/dist/es/meta/template/preview/profile.d.ts +1 -1
  37. package/dist/es/meta/template/preview/project.d.ts +1 -1
  38. package/dist/es/meta/template/preview/project.js +2 -2
  39. package/dist/es/space/object-space.js +1 -1
  40. package/dist/es/utils/common.js +3 -1
  41. package/package.json +2 -2
  42. package/dist/cjs/meta/template/preview/discuss.d.ts +0 -26
  43. package/dist/cjs/meta/template/preview/discuss.js +0 -12
  44. package/dist/es/meta/template/preview/discuss.d.ts +0 -26
  45. package/dist/es/meta/template/preview/discuss.js +0 -9
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const AppPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"app">;
@@ -1,16 +1,20 @@
1
1
  import { z } from 'zod';
2
2
  export declare const DidSchema: z.ZodEffects<z.ZodString, string, string>;
3
3
  export declare const DateSchema: z.ZodEffects<z.ZodString, string, string>;
4
- export declare const TemplateTypeSchema: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
+ export declare const TemplateTypeSchema: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
5
5
  export declare const BasePreviewTemplateSchema: z.ZodObject<{
6
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
6
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
7
7
  did: z.ZodEffects<z.ZodString, string, string>;
8
8
  }, "strip", z.ZodTypeAny, {
9
- template: "app" | "nft" | "profile" | "passport" | "discuss" | "blog" | "bookmark" | "project";
9
+ template: "app" | "nft" | "profile" | "passport" | "post" | "blog" | "bookmark" | "project";
10
10
  did: string;
11
11
  }, {
12
- template: "app" | "nft" | "profile" | "passport" | "discuss" | "blog" | "bookmark" | "project";
12
+ template: "app" | "nft" | "profile" | "passport" | "post" | "blog" | "bookmark" | "project";
13
13
  did: string;
14
14
  }>;
15
+ export declare const TagSchema: z.ZodString;
16
+ export declare const TagsSchema: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
17
+ export declare const UrlSchema: z.ZodString;
18
+ export declare const TitleSchema: z.ZodString;
15
19
  export type TemplateType = z.infer<typeof TemplateTypeSchema>;
16
20
  export type BasePreviewTemplate = z.infer<typeof BasePreviewTemplateSchema>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.BasePreviewTemplateSchema = exports.TemplateTypeSchema = exports.DateSchema = exports.DidSchema = void 0;
6
+ exports.TitleSchema = exports.UrlSchema = exports.TagsSchema = exports.TagSchema = exports.BasePreviewTemplateSchema = exports.TemplateTypeSchema = exports.DateSchema = exports.DidSchema = void 0;
7
7
  const did_1 = require("@arcblock/did");
8
8
  const dayjs_1 = __importDefault(require("dayjs"));
9
9
  const zod_1 = require("zod");
@@ -23,7 +23,7 @@ exports.TemplateTypeSchema = zod_1.z.union([
23
23
  zod_1.z.literal('nft'),
24
24
  zod_1.z.literal('profile'),
25
25
  zod_1.z.literal('passport'),
26
- zod_1.z.literal('discuss'),
26
+ zod_1.z.literal('post'),
27
27
  zod_1.z.literal('blog'),
28
28
  zod_1.z.literal('bookmark'),
29
29
  zod_1.z.literal('project'),
@@ -33,3 +33,7 @@ exports.BasePreviewTemplateSchema = zod_1.z.object({
33
33
  template: exports.TemplateTypeSchema,
34
34
  did: exports.DidSchema,
35
35
  });
36
+ exports.TagSchema = zod_1.z.string().min(1).max(32);
37
+ exports.TagsSchema = zod_1.z.array(exports.TagSchema).max(16).optional().default([]);
38
+ exports.UrlSchema = zod_1.z.string().url().max(2048);
39
+ exports.TitleSchema = zod_1.z.string().min(1).max(128);
@@ -1,12 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  export declare const BlogPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"blog">;
7
7
  title: z.ZodString;
8
8
  image: z.ZodString;
9
- tags: z.ZodArray<z.ZodString, "many">;
9
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
10
10
  url: z.ZodString;
11
11
  createdAt: z.ZodEffects<z.ZodString, string, string>;
12
12
  }>, "strip", z.ZodTypeAny, {
@@ -22,8 +22,8 @@ export declare const BlogPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendS
22
22
  did: string;
23
23
  title: string;
24
24
  image: string;
25
- tags: string[];
26
25
  url: string;
27
26
  createdAt: string;
27
+ tags?: string[] | undefined;
28
28
  }>;
29
29
  export type BlogPreviewTemplate = z.TypeOf<typeof BlogPreviewTemplateSchema>;
@@ -6,13 +6,13 @@ const base_1 = require("./base");
6
6
  exports.BlogPreviewTemplateSchema = base_1.BasePreviewTemplateSchema.extend({
7
7
  template: zod_1.z.literal('blog'),
8
8
  // 标题
9
- title: zod_1.z.string().min(1),
9
+ title: base_1.TitleSchema,
10
10
  // 封面
11
11
  image: zod_1.z.string().min(1),
12
12
  // 标签
13
- tags: zod_1.z.array(zod_1.z.string().min(1)),
13
+ tags: base_1.TagsSchema,
14
14
  // 链接,必须是应用本身的链接 @TODO: 需要验证
15
- url: zod_1.z.string().url(),
15
+ url: base_1.UrlSchema,
16
16
  // 创建时间
17
17
  createdAt: base_1.DateSchema,
18
18
  });
@@ -1,12 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  export declare const BookmarkPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"bookmark">;
7
7
  title: z.ZodString;
8
8
  image: z.ZodString;
9
- tags: z.ZodArray<z.ZodString, "many">;
9
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
10
10
  url: z.ZodString;
11
11
  createdAt: z.ZodEffects<z.ZodString, string, string>;
12
12
  }>, "strip", z.ZodTypeAny, {
@@ -22,8 +22,8 @@ export declare const BookmarkPreviewTemplateSchema: z.ZodObject<z.objectUtil.ext
22
22
  did: string;
23
23
  title: string;
24
24
  image: string;
25
- tags: string[];
26
25
  url: string;
27
26
  createdAt: string;
27
+ tags?: string[] | undefined;
28
28
  }>;
29
29
  export type BookmarkPreviewTemplate = z.TypeOf<typeof BookmarkPreviewTemplateSchema>;
@@ -6,13 +6,13 @@ const base_1 = require("./base");
6
6
  exports.BookmarkPreviewTemplateSchema = base_1.BasePreviewTemplateSchema.extend({
7
7
  template: zod_1.z.literal('bookmark'),
8
8
  // 标题
9
- title: zod_1.z.string().min(1),
9
+ title: base_1.TitleSchema,
10
10
  // 封面
11
11
  image: zod_1.z.string().min(1),
12
12
  // 标签
13
- tags: zod_1.z.array(zod_1.z.string().min(1)),
13
+ tags: base_1.TagsSchema,
14
14
  // 链接,必须是应用本身的链接 @TODO: 需要验证
15
- url: zod_1.z.string().url(),
15
+ url: base_1.UrlSchema,
16
16
  // 创建时间
17
17
  createdAt: base_1.DateSchema,
18
18
  });
@@ -1,6 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"app">;
@@ -17,7 +17,7 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
17
17
  name: string;
18
18
  logo: string;
19
19
  }>, z.ZodObject<z.objectUtil.extendShape<{
20
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
20
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
21
21
  did: z.ZodEffects<z.ZodString, string, string>;
22
22
  }, {
23
23
  template: z.ZodLiteral<"nft">;
@@ -37,7 +37,7 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
37
37
  image: string;
38
38
  chainHost: string;
39
39
  }>, z.ZodObject<z.objectUtil.extendShape<{
40
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
40
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
41
41
  did: z.ZodEffects<z.ZodString, string, string>;
42
42
  }, {
43
43
  template: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"profile">>>;
@@ -57,7 +57,7 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
57
57
  email: string;
58
58
  template?: "profile" | undefined;
59
59
  }>, z.ZodObject<z.objectUtil.extendShape<{
60
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
60
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
61
61
  did: z.ZodEffects<z.ZodString, string, string>;
62
62
  }, {
63
63
  template: z.ZodLiteral<"passport">;
@@ -89,36 +89,36 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
89
89
  issuedTo: string;
90
90
  verified: boolean;
91
91
  }>, z.ZodObject<z.objectUtil.extendShape<{
92
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
92
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
93
93
  did: z.ZodEffects<z.ZodString, string, string>;
94
94
  }, {
95
- template: z.ZodLiteral<"discuss">;
95
+ template: z.ZodLiteral<"post">;
96
96
  title: z.ZodString;
97
- tags: z.ZodArray<z.ZodString, "many">;
97
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
98
98
  url: z.ZodString;
99
- createdAt: z.ZodString;
99
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
100
100
  }>, "strip", z.ZodTypeAny, {
101
- template: "discuss";
101
+ template: "post";
102
102
  did: string;
103
103
  title: string;
104
104
  tags: string[];
105
105
  url: string;
106
106
  createdAt: string;
107
107
  }, {
108
- template: "discuss";
108
+ template: "post";
109
109
  did: string;
110
110
  title: string;
111
- tags: string[];
112
111
  url: string;
113
112
  createdAt: string;
113
+ tags?: string[] | undefined;
114
114
  }>, z.ZodObject<z.objectUtil.extendShape<{
115
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
115
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
116
116
  did: z.ZodEffects<z.ZodString, string, string>;
117
117
  }, {
118
118
  template: z.ZodLiteral<"blog">;
119
119
  title: z.ZodString;
120
120
  image: z.ZodString;
121
- tags: z.ZodArray<z.ZodString, "many">;
121
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
122
122
  url: z.ZodString;
123
123
  createdAt: z.ZodEffects<z.ZodString, string, string>;
124
124
  }>, "strip", z.ZodTypeAny, {
@@ -134,17 +134,17 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
134
134
  did: string;
135
135
  title: string;
136
136
  image: string;
137
- tags: string[];
138
137
  url: string;
139
138
  createdAt: string;
139
+ tags?: string[] | undefined;
140
140
  }>, z.ZodObject<z.objectUtil.extendShape<{
141
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
141
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
142
142
  did: z.ZodEffects<z.ZodString, string, string>;
143
143
  }, {
144
144
  template: z.ZodLiteral<"bookmark">;
145
145
  title: z.ZodString;
146
146
  image: z.ZodString;
147
- tags: z.ZodArray<z.ZodString, "many">;
147
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
148
148
  url: z.ZodString;
149
149
  createdAt: z.ZodEffects<z.ZodString, string, string>;
150
150
  }>, "strip", z.ZodTypeAny, {
@@ -160,11 +160,11 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
160
160
  did: string;
161
161
  title: string;
162
162
  image: string;
163
- tags: string[];
164
163
  url: string;
165
164
  createdAt: string;
165
+ tags?: string[] | undefined;
166
166
  }>, z.ZodObject<z.objectUtil.extendShape<{
167
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
167
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
168
168
  did: z.ZodEffects<z.ZodString, string, string>;
169
169
  }, {
170
170
  template: z.ZodLiteral<"project">;
@@ -8,7 +8,7 @@ const zod_1 = __importDefault(require("zod"));
8
8
  const nft_1 = require("./nft");
9
9
  const profile_1 = require("./profile");
10
10
  const passport_1 = require("./passport");
11
- const discuss_1 = require("./discuss");
11
+ const post_1 = require("./post");
12
12
  const blog_1 = require("./blog");
13
13
  const bookmark_1 = require("./bookmark");
14
14
  const project_1 = require("./project");
@@ -18,7 +18,7 @@ exports.PreviewTemplateSchema = zod_1.default.union([
18
18
  nft_1.NftPreviewTemplateSchema,
19
19
  profile_1.ProfilePreviewTemplateSchema,
20
20
  passport_1.PassportPreviewTemplateSchema,
21
- discuss_1.DiscussPreviewTemplateSchema,
21
+ post_1.PostPreviewTemplateSchema,
22
22
  blog_1.BlogPreviewTemplateSchema,
23
23
  bookmark_1.BookmarkPreviewTemplateSchema,
24
24
  project_1.ProjectPreviewTemplateSchema,
@@ -3,7 +3,7 @@ export * from './base';
3
3
  export * from './blog';
4
4
  export * from './bookmark';
5
5
  export * from './default';
6
- export * from './discuss';
6
+ export * from './post';
7
7
  export * from './nft';
8
8
  export * from './passport';
9
9
  export * from './profile';
@@ -19,7 +19,7 @@ __exportStar(require("./base"), exports);
19
19
  __exportStar(require("./blog"), exports);
20
20
  __exportStar(require("./bookmark"), exports);
21
21
  __exportStar(require("./default"), exports);
22
- __exportStar(require("./discuss"), exports);
22
+ __exportStar(require("./post"), exports);
23
23
  __exportStar(require("./nft"), exports);
24
24
  __exportStar(require("./passport"), exports);
25
25
  __exportStar(require("./profile"), exports);
@@ -1,6 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const NftPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"nft">;
@@ -1,6 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const PassportPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"passport">;
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ export declare const PostPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"post">;
7
+ title: z.ZodString;
8
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
9
+ url: z.ZodString;
10
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
11
+ }>, "strip", z.ZodTypeAny, {
12
+ template: "post";
13
+ did: string;
14
+ title: string;
15
+ tags: string[];
16
+ url: string;
17
+ createdAt: string;
18
+ }, {
19
+ template: "post";
20
+ did: string;
21
+ title: string;
22
+ url: string;
23
+ createdAt: string;
24
+ tags?: string[] | undefined;
25
+ }>;
26
+ export type PostPreviewTemplate = z.TypeOf<typeof PostPreviewTemplateSchema>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PostPreviewTemplateSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const base_1 = require("./base");
6
+ exports.PostPreviewTemplateSchema = base_1.BasePreviewTemplateSchema.extend({
7
+ template: zod_1.z.literal('post'),
8
+ title: base_1.TitleSchema,
9
+ tags: base_1.TagsSchema,
10
+ url: base_1.UrlSchema,
11
+ createdAt: base_1.DateSchema,
12
+ });
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const ProfilePreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"profile">>>;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const ProjectPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"project">;
@@ -12,7 +12,7 @@ exports.ProjectPreviewTemplateSchema = base_1.BasePreviewTemplateSchema.extend({
12
12
  // 封面
13
13
  image: zod_1.z.string().min(1),
14
14
  // 链接,必须是应用本身的链接 @TODO: 需要验证
15
- url: zod_1.z.string().url(),
15
+ url: base_1.UrlSchema,
16
16
  // 创建时间
17
17
  createdAt: base_1.DateSchema,
18
18
  });
@@ -20,7 +20,7 @@ const path_1 = require("path");
20
20
  const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
21
21
  const isUndefined_1 = __importDefault(require("lodash/isUndefined"));
22
22
  const omit_1 = __importDefault(require("lodash/omit"));
23
- const lodash_1 = require("lodash");
23
+ const isNumber_1 = __importDefault(require("lodash/isNumber"));
24
24
  const events_1 = __importDefault(require("events"));
25
25
  const configuration_1 = require("../configuration");
26
26
  const model_1 = require("../model");
@@ -365,7 +365,7 @@ class ObjectSpace extends events_1.default {
365
365
  options.hash = options.hash || (yield (0, utils_1.getHash)(data));
366
366
  options.size = options.size || (yield (0, utils_1.getSize)(data));
367
367
  // @note: size 可能是空的
368
- if (!options.hash || !(0, lodash_1.isNumber)(options.size)) {
368
+ if (!options.hash || !(0, isNumber_1.default)(options.size)) {
369
369
  throw new Error('Hash and size cannot be empty');
370
370
  }
371
371
  }
@@ -8,12 +8,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
11
14
  Object.defineProperty(exports, "__esModule", { value: true });
12
15
  exports.isValidData = exports.isDirectory = exports.getSize = exports.isStream = void 0;
13
- const lodash_1 = require("lodash");
16
+ const isBuffer_1 = __importDefault(require("lodash/isBuffer"));
17
+ const isFunction_1 = __importDefault(require("lodash/isFunction"));
18
+ const isString_1 = __importDefault(require("lodash/isString"));
14
19
  const stream_1 = require("stream");
15
20
  function isStream(data) {
16
- return data instanceof stream_1.Stream || data instanceof stream_1.Readable || (0, lodash_1.isFunction)(data === null || data === void 0 ? void 0 : data.pipe);
21
+ return data instanceof stream_1.Stream || data instanceof stream_1.Readable || (0, isFunction_1.default)(data === null || data === void 0 ? void 0 : data.pipe);
17
22
  }
18
23
  exports.isStream = isStream;
19
24
  // eslint-disable-next-line require-await
@@ -51,6 +56,6 @@ function isDirectory(key) {
51
56
  }
52
57
  exports.isDirectory = isDirectory;
53
58
  function isValidData(data) {
54
- return (0, lodash_1.isString)(data) || (0, lodash_1.isBuffer)(data) || isStream(data);
59
+ return (0, isString_1.default)(data) || (0, isBuffer_1.default)(data) || isStream(data);
55
60
  }
56
61
  exports.isValidData = isValidData;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const AppPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"app">;
@@ -1,16 +1,20 @@
1
1
  import { z } from 'zod';
2
2
  export declare const DidSchema: z.ZodEffects<z.ZodString, string, string>;
3
3
  export declare const DateSchema: z.ZodEffects<z.ZodString, string, string>;
4
- export declare const TemplateTypeSchema: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
+ export declare const TemplateTypeSchema: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
5
5
  export declare const BasePreviewTemplateSchema: z.ZodObject<{
6
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
6
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
7
7
  did: z.ZodEffects<z.ZodString, string, string>;
8
8
  }, "strip", z.ZodTypeAny, {
9
- template: "app" | "nft" | "profile" | "passport" | "discuss" | "blog" | "bookmark" | "project";
9
+ template: "app" | "nft" | "profile" | "passport" | "post" | "blog" | "bookmark" | "project";
10
10
  did: string;
11
11
  }, {
12
- template: "app" | "nft" | "profile" | "passport" | "discuss" | "blog" | "bookmark" | "project";
12
+ template: "app" | "nft" | "profile" | "passport" | "post" | "blog" | "bookmark" | "project";
13
13
  did: string;
14
14
  }>;
15
+ export declare const TagSchema: z.ZodString;
16
+ export declare const TagsSchema: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
17
+ export declare const UrlSchema: z.ZodString;
18
+ export declare const TitleSchema: z.ZodString;
15
19
  export type TemplateType = z.infer<typeof TemplateTypeSchema>;
16
20
  export type BasePreviewTemplate = z.infer<typeof BasePreviewTemplateSchema>;
@@ -17,7 +17,7 @@ export const TemplateTypeSchema = z.union([
17
17
  z.literal('nft'),
18
18
  z.literal('profile'),
19
19
  z.literal('passport'),
20
- z.literal('discuss'),
20
+ z.literal('post'),
21
21
  z.literal('blog'),
22
22
  z.literal('bookmark'),
23
23
  z.literal('project'),
@@ -27,3 +27,7 @@ export const BasePreviewTemplateSchema = z.object({
27
27
  template: TemplateTypeSchema,
28
28
  did: DidSchema,
29
29
  });
30
+ export const TagSchema = z.string().min(1).max(32);
31
+ export const TagsSchema = z.array(TagSchema).max(16).optional().default([]);
32
+ export const UrlSchema = z.string().url().max(2048);
33
+ export const TitleSchema = z.string().min(1).max(128);
@@ -1,12 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  export declare const BlogPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"blog">;
7
7
  title: z.ZodString;
8
8
  image: z.ZodString;
9
- tags: z.ZodArray<z.ZodString, "many">;
9
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
10
10
  url: z.ZodString;
11
11
  createdAt: z.ZodEffects<z.ZodString, string, string>;
12
12
  }>, "strip", z.ZodTypeAny, {
@@ -22,8 +22,8 @@ export declare const BlogPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendS
22
22
  did: string;
23
23
  title: string;
24
24
  image: string;
25
- tags: string[];
26
25
  url: string;
27
26
  createdAt: string;
27
+ tags?: string[] | undefined;
28
28
  }>;
29
29
  export type BlogPreviewTemplate = z.TypeOf<typeof BlogPreviewTemplateSchema>;
@@ -1,15 +1,15 @@
1
1
  import { z } from 'zod';
2
- import { BasePreviewTemplateSchema, DateSchema } from './base';
2
+ import { BasePreviewTemplateSchema, DateSchema, TagsSchema, TitleSchema, UrlSchema } from './base';
3
3
  export const BlogPreviewTemplateSchema = BasePreviewTemplateSchema.extend({
4
4
  template: z.literal('blog'),
5
5
  // 标题
6
- title: z.string().min(1),
6
+ title: TitleSchema,
7
7
  // 封面
8
8
  image: z.string().min(1),
9
9
  // 标签
10
- tags: z.array(z.string().min(1)),
10
+ tags: TagsSchema,
11
11
  // 链接,必须是应用本身的链接 @TODO: 需要验证
12
- url: z.string().url(),
12
+ url: UrlSchema,
13
13
  // 创建时间
14
14
  createdAt: DateSchema,
15
15
  });
@@ -1,12 +1,12 @@
1
1
  import { z } from 'zod';
2
2
  export declare const BookmarkPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"bookmark">;
7
7
  title: z.ZodString;
8
8
  image: z.ZodString;
9
- tags: z.ZodArray<z.ZodString, "many">;
9
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
10
10
  url: z.ZodString;
11
11
  createdAt: z.ZodEffects<z.ZodString, string, string>;
12
12
  }>, "strip", z.ZodTypeAny, {
@@ -22,8 +22,8 @@ export declare const BookmarkPreviewTemplateSchema: z.ZodObject<z.objectUtil.ext
22
22
  did: string;
23
23
  title: string;
24
24
  image: string;
25
- tags: string[];
26
25
  url: string;
27
26
  createdAt: string;
27
+ tags?: string[] | undefined;
28
28
  }>;
29
29
  export type BookmarkPreviewTemplate = z.TypeOf<typeof BookmarkPreviewTemplateSchema>;
@@ -1,15 +1,15 @@
1
1
  import { z } from 'zod';
2
- import { BasePreviewTemplateSchema, DateSchema } from './base';
2
+ import { BasePreviewTemplateSchema, DateSchema, TagsSchema, TitleSchema, UrlSchema } from './base';
3
3
  export const BookmarkPreviewTemplateSchema = BasePreviewTemplateSchema.extend({
4
4
  template: z.literal('bookmark'),
5
5
  // 标题
6
- title: z.string().min(1),
6
+ title: TitleSchema,
7
7
  // 封面
8
8
  image: z.string().min(1),
9
9
  // 标签
10
- tags: z.array(z.string().min(1)),
10
+ tags: TagsSchema,
11
11
  // 链接,必须是应用本身的链接 @TODO: 需要验证
12
- url: z.string().url(),
12
+ url: UrlSchema,
13
13
  // 创建时间
14
14
  createdAt: DateSchema,
15
15
  });
@@ -1,6 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"app">;
@@ -17,7 +17,7 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
17
17
  name: string;
18
18
  logo: string;
19
19
  }>, z.ZodObject<z.objectUtil.extendShape<{
20
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
20
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
21
21
  did: z.ZodEffects<z.ZodString, string, string>;
22
22
  }, {
23
23
  template: z.ZodLiteral<"nft">;
@@ -37,7 +37,7 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
37
37
  image: string;
38
38
  chainHost: string;
39
39
  }>, z.ZodObject<z.objectUtil.extendShape<{
40
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
40
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
41
41
  did: z.ZodEffects<z.ZodString, string, string>;
42
42
  }, {
43
43
  template: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"profile">>>;
@@ -57,7 +57,7 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
57
57
  email: string;
58
58
  template?: "profile" | undefined;
59
59
  }>, z.ZodObject<z.objectUtil.extendShape<{
60
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
60
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
61
61
  did: z.ZodEffects<z.ZodString, string, string>;
62
62
  }, {
63
63
  template: z.ZodLiteral<"passport">;
@@ -89,36 +89,36 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
89
89
  issuedTo: string;
90
90
  verified: boolean;
91
91
  }>, z.ZodObject<z.objectUtil.extendShape<{
92
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
92
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
93
93
  did: z.ZodEffects<z.ZodString, string, string>;
94
94
  }, {
95
- template: z.ZodLiteral<"discuss">;
95
+ template: z.ZodLiteral<"post">;
96
96
  title: z.ZodString;
97
- tags: z.ZodArray<z.ZodString, "many">;
97
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
98
98
  url: z.ZodString;
99
- createdAt: z.ZodString;
99
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
100
100
  }>, "strip", z.ZodTypeAny, {
101
- template: "discuss";
101
+ template: "post";
102
102
  did: string;
103
103
  title: string;
104
104
  tags: string[];
105
105
  url: string;
106
106
  createdAt: string;
107
107
  }, {
108
- template: "discuss";
108
+ template: "post";
109
109
  did: string;
110
110
  title: string;
111
- tags: string[];
112
111
  url: string;
113
112
  createdAt: string;
113
+ tags?: string[] | undefined;
114
114
  }>, z.ZodObject<z.objectUtil.extendShape<{
115
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
115
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
116
116
  did: z.ZodEffects<z.ZodString, string, string>;
117
117
  }, {
118
118
  template: z.ZodLiteral<"blog">;
119
119
  title: z.ZodString;
120
120
  image: z.ZodString;
121
- tags: z.ZodArray<z.ZodString, "many">;
121
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
122
122
  url: z.ZodString;
123
123
  createdAt: z.ZodEffects<z.ZodString, string, string>;
124
124
  }>, "strip", z.ZodTypeAny, {
@@ -134,17 +134,17 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
134
134
  did: string;
135
135
  title: string;
136
136
  image: string;
137
- tags: string[];
138
137
  url: string;
139
138
  createdAt: string;
139
+ tags?: string[] | undefined;
140
140
  }>, z.ZodObject<z.objectUtil.extendShape<{
141
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
141
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
142
142
  did: z.ZodEffects<z.ZodString, string, string>;
143
143
  }, {
144
144
  template: z.ZodLiteral<"bookmark">;
145
145
  title: z.ZodString;
146
146
  image: z.ZodString;
147
- tags: z.ZodArray<z.ZodString, "many">;
147
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
148
148
  url: z.ZodString;
149
149
  createdAt: z.ZodEffects<z.ZodString, string, string>;
150
150
  }>, "strip", z.ZodTypeAny, {
@@ -160,11 +160,11 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
160
160
  did: string;
161
161
  title: string;
162
162
  image: string;
163
- tags: string[];
164
163
  url: string;
165
164
  createdAt: string;
165
+ tags?: string[] | undefined;
166
166
  }>, z.ZodObject<z.objectUtil.extendShape<{
167
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
167
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
168
168
  did: z.ZodEffects<z.ZodString, string, string>;
169
169
  }, {
170
170
  template: z.ZodLiteral<"project">;
@@ -2,7 +2,7 @@ import z from 'zod';
2
2
  import { NftPreviewTemplateSchema } from './nft';
3
3
  import { ProfilePreviewTemplateSchema } from './profile';
4
4
  import { PassportPreviewTemplateSchema } from './passport';
5
- import { DiscussPreviewTemplateSchema } from './discuss';
5
+ import { PostPreviewTemplateSchema } from './post';
6
6
  import { BlogPreviewTemplateSchema } from './blog';
7
7
  import { BookmarkPreviewTemplateSchema } from './bookmark';
8
8
  import { ProjectPreviewTemplateSchema } from './project';
@@ -12,7 +12,7 @@ export const PreviewTemplateSchema = z.union([
12
12
  NftPreviewTemplateSchema,
13
13
  ProfilePreviewTemplateSchema,
14
14
  PassportPreviewTemplateSchema,
15
- DiscussPreviewTemplateSchema,
15
+ PostPreviewTemplateSchema,
16
16
  BlogPreviewTemplateSchema,
17
17
  BookmarkPreviewTemplateSchema,
18
18
  ProjectPreviewTemplateSchema,
@@ -3,7 +3,7 @@ export * from './base';
3
3
  export * from './blog';
4
4
  export * from './bookmark';
5
5
  export * from './default';
6
- export * from './discuss';
6
+ export * from './post';
7
7
  export * from './nft';
8
8
  export * from './passport';
9
9
  export * from './profile';
@@ -3,7 +3,7 @@ export * from './base';
3
3
  export * from './blog';
4
4
  export * from './bookmark';
5
5
  export * from './default';
6
- export * from './discuss';
6
+ export * from './post';
7
7
  export * from './nft';
8
8
  export * from './passport';
9
9
  export * from './profile';
@@ -1,6 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const NftPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"nft">;
@@ -1,6 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const PassportPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"passport">;
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ export declare const PostPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"post">;
7
+ title: z.ZodString;
8
+ tags: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
9
+ url: z.ZodString;
10
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
11
+ }>, "strip", z.ZodTypeAny, {
12
+ template: "post";
13
+ did: string;
14
+ title: string;
15
+ tags: string[];
16
+ url: string;
17
+ createdAt: string;
18
+ }, {
19
+ template: "post";
20
+ did: string;
21
+ title: string;
22
+ url: string;
23
+ createdAt: string;
24
+ tags?: string[] | undefined;
25
+ }>;
26
+ export type PostPreviewTemplate = z.TypeOf<typeof PostPreviewTemplateSchema>;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ import { BasePreviewTemplateSchema, DateSchema, TagsSchema, TitleSchema, UrlSchema } from './base';
3
+ export const PostPreviewTemplateSchema = BasePreviewTemplateSchema.extend({
4
+ template: z.literal('post'),
5
+ title: TitleSchema,
6
+ tags: TagsSchema,
7
+ url: UrlSchema,
8
+ createdAt: DateSchema,
9
+ });
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const ProfilePreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"profile">>>;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const ProjectPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
3
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"post">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"project">;
@@ -1,5 +1,5 @@
1
1
  import { z } from 'zod';
2
- import { BasePreviewTemplateSchema, DateSchema } from './base';
2
+ import { BasePreviewTemplateSchema, DateSchema, UrlSchema } from './base';
3
3
  export const ProjectPreviewTemplateSchema = BasePreviewTemplateSchema.extend({
4
4
  template: z.literal('project'),
5
5
  // 名称
@@ -9,7 +9,7 @@ export const ProjectPreviewTemplateSchema = BasePreviewTemplateSchema.extend({
9
9
  // 封面
10
10
  image: z.string().min(1),
11
11
  // 链接,必须是应用本身的链接 @TODO: 需要验证
12
- url: z.string().url(),
12
+ url: UrlSchema,
13
13
  // 创建时间
14
14
  createdAt: DateSchema,
15
15
  });
@@ -5,7 +5,7 @@ import { basename, join } from 'path';
5
5
  import isEmpty from 'lodash/isEmpty';
6
6
  import isUndefined from 'lodash/isUndefined';
7
7
  import omit from 'lodash/omit';
8
- import { isNumber } from 'lodash';
8
+ import isNumber from 'lodash/isNumber';
9
9
  import EventEmitter from 'events';
10
10
  import { Scopes } from '../configuration';
11
11
  import { TreeModelType, } from '../model';
@@ -1,4 +1,6 @@
1
- import { isBuffer, isFunction, isString } from 'lodash';
1
+ import isBuffer from 'lodash/isBuffer';
2
+ import isFunction from 'lodash/isFunction';
3
+ import isString from 'lodash/isString';
2
4
  import { Readable, Stream } from 'stream';
3
5
  export function isStream(data) {
4
6
  return data instanceof Stream || data instanceof Readable || isFunction(data?.pipe);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-space/core",
3
- "version": "1.0.39",
3
+ "version": "1.0.40",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -148,5 +148,5 @@
148
148
  "vite": "^5.4.16",
149
149
  "vitest": "^3.1.1"
150
150
  },
151
- "gitHead": "91f6b51438b570b2c8a244bd3f3a606bbb9b09d7"
151
+ "gitHead": "51edbd8d2d9852cb9b30ff4c12900d5f71272d43"
152
152
  }
@@ -1,26 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const DiscussPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
- did: z.ZodEffects<z.ZodString, string, string>;
5
- }, {
6
- template: z.ZodLiteral<"discuss">;
7
- title: z.ZodString;
8
- tags: z.ZodArray<z.ZodString, "many">;
9
- url: z.ZodString;
10
- createdAt: z.ZodString;
11
- }>, "strip", z.ZodTypeAny, {
12
- template: "discuss";
13
- did: string;
14
- title: string;
15
- tags: string[];
16
- url: string;
17
- createdAt: string;
18
- }, {
19
- template: "discuss";
20
- did: string;
21
- title: string;
22
- tags: string[];
23
- url: string;
24
- createdAt: string;
25
- }>;
26
- export type DiscussPreviewTemplate = z.TypeOf<typeof DiscussPreviewTemplateSchema>;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DiscussPreviewTemplateSchema = void 0;
4
- const zod_1 = require("zod");
5
- const base_1 = require("./base");
6
- exports.DiscussPreviewTemplateSchema = base_1.BasePreviewTemplateSchema.extend({
7
- template: zod_1.z.literal('discuss'),
8
- title: zod_1.z.string().min(1),
9
- tags: zod_1.z.array(zod_1.z.string().min(1)),
10
- url: zod_1.z.string().url(),
11
- createdAt: zod_1.z.string().min(1),
12
- });
@@ -1,26 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const DiscussPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">, z.ZodLiteral<"app">]>;
4
- did: z.ZodEffects<z.ZodString, string, string>;
5
- }, {
6
- template: z.ZodLiteral<"discuss">;
7
- title: z.ZodString;
8
- tags: z.ZodArray<z.ZodString, "many">;
9
- url: z.ZodString;
10
- createdAt: z.ZodString;
11
- }>, "strip", z.ZodTypeAny, {
12
- template: "discuss";
13
- did: string;
14
- title: string;
15
- tags: string[];
16
- url: string;
17
- createdAt: string;
18
- }, {
19
- template: "discuss";
20
- did: string;
21
- title: string;
22
- tags: string[];
23
- url: string;
24
- createdAt: string;
25
- }>;
26
- export type DiscussPreviewTemplate = z.TypeOf<typeof DiscussPreviewTemplateSchema>;
@@ -1,9 +0,0 @@
1
- import { z } from 'zod';
2
- import { BasePreviewTemplateSchema } from './base';
3
- export const DiscussPreviewTemplateSchema = BasePreviewTemplateSchema.extend({
4
- template: z.literal('discuss'),
5
- title: z.string().min(1),
6
- tags: z.array(z.string().min(1)),
7
- url: z.string().url(),
8
- createdAt: z.string().min(1),
9
- });