@did-space/core 1.0.1 → 1.0.3

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 (41) hide show
  1. package/dist/cjs/meta/template/preview/app.d.ts +20 -0
  2. package/dist/cjs/meta/template/preview/app.js +12 -0
  3. package/dist/cjs/meta/template/preview/base.d.ts +4 -3
  4. package/dist/cjs/meta/template/preview/base.js +20 -2
  5. package/dist/cjs/meta/template/preview/blog.d.ts +29 -0
  6. package/dist/cjs/meta/template/preview/blog.js +18 -0
  7. package/dist/cjs/meta/template/preview/bookmark.d.ts +29 -0
  8. package/dist/cjs/meta/template/preview/bookmark.js +18 -0
  9. package/dist/cjs/meta/template/preview/default.d.ts +123 -5
  10. package/dist/cjs/meta/template/preview/default.js +10 -0
  11. package/dist/cjs/meta/template/preview/discuss.d.ts +26 -0
  12. package/dist/cjs/meta/template/preview/discuss.js +12 -0
  13. package/dist/cjs/meta/template/preview/index.d.ts +5 -0
  14. package/dist/cjs/meta/template/preview/index.js +5 -0
  15. package/dist/cjs/meta/template/preview/nft.d.ts +1 -1
  16. package/dist/cjs/meta/template/preview/passport.d.ts +3 -3
  17. package/dist/cjs/meta/template/preview/profile.d.ts +1 -1
  18. package/dist/cjs/meta/template/preview/project.d.ts +29 -0
  19. package/dist/cjs/meta/template/preview/project.js +18 -0
  20. package/dist/cjs/model/audit-log.d.ts +2 -2
  21. package/dist/es/meta/template/preview/app.d.ts +20 -0
  22. package/dist/es/meta/template/preview/app.js +9 -0
  23. package/dist/es/meta/template/preview/base.d.ts +4 -3
  24. package/dist/es/meta/template/preview/base.js +16 -1
  25. package/dist/es/meta/template/preview/blog.d.ts +29 -0
  26. package/dist/es/meta/template/preview/blog.js +15 -0
  27. package/dist/es/meta/template/preview/bookmark.d.ts +29 -0
  28. package/dist/es/meta/template/preview/bookmark.js +15 -0
  29. package/dist/es/meta/template/preview/default.d.ts +123 -5
  30. package/dist/es/meta/template/preview/default.js +10 -0
  31. package/dist/es/meta/template/preview/discuss.d.ts +26 -0
  32. package/dist/es/meta/template/preview/discuss.js +9 -0
  33. package/dist/es/meta/template/preview/index.d.ts +5 -0
  34. package/dist/es/meta/template/preview/index.js +5 -0
  35. package/dist/es/meta/template/preview/nft.d.ts +1 -1
  36. package/dist/es/meta/template/preview/passport.d.ts +3 -3
  37. package/dist/es/meta/template/preview/profile.d.ts +1 -1
  38. package/dist/es/meta/template/preview/project.d.ts +29 -0
  39. package/dist/es/meta/template/preview/project.js +15 -0
  40. package/dist/es/model/audit-log.d.ts +2 -2
  41. package/package.json +6 -5
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
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">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"app">;
7
+ name: z.ZodString;
8
+ logo: z.ZodString;
9
+ }>, "strip", z.ZodTypeAny, {
10
+ template: "app";
11
+ did: string;
12
+ name: string;
13
+ logo: string;
14
+ }, {
15
+ template: "app";
16
+ did: string;
17
+ name: string;
18
+ logo: string;
19
+ }>;
20
+ export type AppPreviewTemplate = z.TypeOf<typeof AppPreviewTemplateSchema>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppPreviewTemplateSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const base_1 = require("./base");
6
+ exports.AppPreviewTemplateSchema = base_1.BasePreviewTemplateSchema.extend({
7
+ template: zod_1.z.literal('app'),
8
+ // 名称
9
+ name: zod_1.z.string().min(1),
10
+ // 链接,必须是应用本身的链接 @TODO: 需要验证
11
+ logo: zod_1.z.string().url(),
12
+ });
@@ -1,13 +1,14 @@
1
1
  import { z } from 'zod';
2
2
  export declare const DidSchema: z.ZodEffects<z.ZodString, string, string>;
3
+ export declare const DateSchema: z.ZodEffects<z.ZodString, string, string>;
3
4
  export declare const BasePreviewTemplateSchema: z.ZodObject<{
4
- template: z.ZodString;
5
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">]>;
5
6
  did: z.ZodEffects<z.ZodString, string, string>;
6
7
  }, "strip", z.ZodTypeAny, {
7
- template: string;
8
+ template: "nft" | "profile" | "passport" | "discuss" | "blog" | "bookmark" | "project";
8
9
  did: string;
9
10
  }, {
10
- template: string;
11
+ template: "nft" | "profile" | "passport" | "discuss" | "blog" | "bookmark" | "project";
11
12
  did: string;
12
13
  }>;
13
14
  export type BasePreviewTemplate = z.infer<typeof BasePreviewTemplateSchema>;
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BasePreviewTemplateSchema = exports.DidSchema = void 0;
6
+ exports.BasePreviewTemplateSchema = exports.DateSchema = exports.DidSchema = void 0;
4
7
  const did_1 = require("@arcblock/did");
8
+ const dayjs_1 = __importDefault(require("dayjs"));
5
9
  const zod_1 = require("zod");
6
10
  exports.DidSchema = zod_1.z.string().refine((value) => (0, did_1.isValid)(value), (value) => {
7
11
  return {
@@ -9,7 +13,21 @@ exports.DidSchema = zod_1.z.string().refine((value) => (0, did_1.isValid)(value)
9
13
  message: `${value} is not a valid DID`,
10
14
  };
11
15
  });
16
+ exports.DateSchema = zod_1.z.string().refine((value) => (0, dayjs_1.default)(value).isValid(), (value) => {
17
+ return {
18
+ code: zod_1.z.ZodIssueCode.custom,
19
+ message: `createdAt(${value}) is not a valid date`,
20
+ };
21
+ });
12
22
  exports.BasePreviewTemplateSchema = zod_1.z.object({
13
- template: zod_1.z.string().min(1),
23
+ template: zod_1.z.union([
24
+ zod_1.z.literal('nft'),
25
+ zod_1.z.literal('profile'),
26
+ zod_1.z.literal('passport'),
27
+ zod_1.z.literal('discuss'),
28
+ zod_1.z.literal('blog'),
29
+ zod_1.z.literal('bookmark'),
30
+ zod_1.z.literal('project'),
31
+ ]),
14
32
  did: exports.DidSchema,
15
33
  });
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
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">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"blog">;
7
+ title: z.ZodString;
8
+ image: z.ZodString;
9
+ tags: z.ZodArray<z.ZodString, "many">;
10
+ url: z.ZodString;
11
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
12
+ }>, "strip", z.ZodTypeAny, {
13
+ template: "blog";
14
+ did: string;
15
+ title: string;
16
+ image: string;
17
+ tags: string[];
18
+ url: string;
19
+ createdAt: string;
20
+ }, {
21
+ template: "blog";
22
+ did: string;
23
+ title: string;
24
+ image: string;
25
+ tags: string[];
26
+ url: string;
27
+ createdAt: string;
28
+ }>;
29
+ export type BlogPreviewTemplate = z.TypeOf<typeof BlogPreviewTemplateSchema>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BlogPreviewTemplateSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const base_1 = require("./base");
6
+ exports.BlogPreviewTemplateSchema = base_1.BasePreviewTemplateSchema.extend({
7
+ template: zod_1.z.literal('blog'),
8
+ // 标题
9
+ title: zod_1.z.string().min(1),
10
+ // 封面
11
+ image: zod_1.z.string().min(1),
12
+ // 标签
13
+ tags: zod_1.z.array(zod_1.z.string().min(1)),
14
+ // 链接,必须是应用本身的链接 @TODO: 需要验证
15
+ url: zod_1.z.string().url(),
16
+ // 创建时间
17
+ createdAt: base_1.DateSchema,
18
+ });
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
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">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"bookmark">;
7
+ title: z.ZodString;
8
+ image: z.ZodString;
9
+ tags: z.ZodArray<z.ZodString, "many">;
10
+ url: z.ZodString;
11
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
12
+ }>, "strip", z.ZodTypeAny, {
13
+ template: "bookmark";
14
+ did: string;
15
+ title: string;
16
+ image: string;
17
+ tags: string[];
18
+ url: string;
19
+ createdAt: string;
20
+ }, {
21
+ template: "bookmark";
22
+ did: string;
23
+ title: string;
24
+ image: string;
25
+ tags: string[];
26
+ url: string;
27
+ createdAt: string;
28
+ }>;
29
+ export type BookmarkPreviewTemplate = z.TypeOf<typeof BookmarkPreviewTemplateSchema>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BookmarkPreviewTemplateSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const base_1 = require("./base");
6
+ exports.BookmarkPreviewTemplateSchema = base_1.BasePreviewTemplateSchema.extend({
7
+ template: zod_1.z.literal('bookmark'),
8
+ // 标题
9
+ title: zod_1.z.string().min(1),
10
+ // 封面
11
+ image: zod_1.z.string().min(1),
12
+ // 标签
13
+ tags: zod_1.z.array(zod_1.z.string().min(1)),
14
+ // 链接,必须是应用本身的链接 @TODO: 需要验证
15
+ url: zod_1.z.string().url(),
16
+ // 创建时间
17
+ createdAt: base_1.DateSchema,
18
+ });
@@ -1,6 +1,23 @@
1
1
  import z from 'zod';
2
2
  export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodString;
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">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"app">;
7
+ name: z.ZodString;
8
+ logo: z.ZodString;
9
+ }>, "strip", z.ZodTypeAny, {
10
+ template: "app";
11
+ did: string;
12
+ name: string;
13
+ logo: string;
14
+ }, {
15
+ template: "app";
16
+ did: string;
17
+ name: string;
18
+ logo: string;
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">]>;
4
21
  did: z.ZodEffects<z.ZodString, string, string>;
5
22
  }, {
6
23
  template: z.ZodLiteral<"nft">;
@@ -20,7 +37,7 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
20
37
  image: string;
21
38
  chainHost: string;
22
39
  }>, z.ZodObject<z.objectUtil.extendShape<{
23
- template: z.ZodString;
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">]>;
24
41
  did: z.ZodEffects<z.ZodString, string, string>;
25
42
  }, {
26
43
  template: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"profile">>>;
@@ -40,7 +57,7 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
40
57
  email: string;
41
58
  template?: "profile" | undefined;
42
59
  }>, z.ZodObject<z.objectUtil.extendShape<{
43
- template: z.ZodString;
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">]>;
44
61
  did: z.ZodEffects<z.ZodString, string, string>;
45
62
  }, {
46
63
  template: z.ZodLiteral<"passport">;
@@ -52,8 +69,8 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
52
69
  issuedTo: z.ZodString;
53
70
  verified: z.ZodBoolean;
54
71
  }>, "strip", z.ZodTypeAny, {
55
- type: string[];
56
72
  template: "passport";
73
+ type: string[];
57
74
  did: string;
58
75
  image: string;
59
76
  issuerDid: string;
@@ -62,8 +79,8 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
62
79
  issuedTo: string;
63
80
  verified: boolean;
64
81
  }, {
65
- type: string[];
66
82
  template: "passport";
83
+ type: string[];
67
84
  did: string;
68
85
  image: string;
69
86
  issuerDid: string;
@@ -71,5 +88,106 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
71
88
  issuedAt: string;
72
89
  issuedTo: string;
73
90
  verified: boolean;
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">]>;
93
+ did: z.ZodEffects<z.ZodString, string, string>;
94
+ }, {
95
+ template: z.ZodLiteral<"discuss">;
96
+ title: z.ZodString;
97
+ tags: z.ZodArray<z.ZodString, "many">;
98
+ url: z.ZodString;
99
+ createdAt: z.ZodString;
100
+ }>, "strip", z.ZodTypeAny, {
101
+ template: "discuss";
102
+ did: string;
103
+ title: string;
104
+ tags: string[];
105
+ url: string;
106
+ createdAt: string;
107
+ }, {
108
+ template: "discuss";
109
+ did: string;
110
+ title: string;
111
+ tags: string[];
112
+ url: string;
113
+ createdAt: string;
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">]>;
116
+ did: z.ZodEffects<z.ZodString, string, string>;
117
+ }, {
118
+ template: z.ZodLiteral<"blog">;
119
+ title: z.ZodString;
120
+ image: z.ZodString;
121
+ tags: z.ZodArray<z.ZodString, "many">;
122
+ url: z.ZodString;
123
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
124
+ }>, "strip", z.ZodTypeAny, {
125
+ template: "blog";
126
+ did: string;
127
+ title: string;
128
+ image: string;
129
+ tags: string[];
130
+ url: string;
131
+ createdAt: string;
132
+ }, {
133
+ template: "blog";
134
+ did: string;
135
+ title: string;
136
+ image: string;
137
+ tags: string[];
138
+ url: string;
139
+ createdAt: string;
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">]>;
142
+ did: z.ZodEffects<z.ZodString, string, string>;
143
+ }, {
144
+ template: z.ZodLiteral<"bookmark">;
145
+ title: z.ZodString;
146
+ image: z.ZodString;
147
+ tags: z.ZodArray<z.ZodString, "many">;
148
+ url: z.ZodString;
149
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
150
+ }>, "strip", z.ZodTypeAny, {
151
+ template: "bookmark";
152
+ did: string;
153
+ title: string;
154
+ image: string;
155
+ tags: string[];
156
+ url: string;
157
+ createdAt: string;
158
+ }, {
159
+ template: "bookmark";
160
+ did: string;
161
+ title: string;
162
+ image: string;
163
+ tags: string[];
164
+ url: string;
165
+ createdAt: string;
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">]>;
168
+ did: z.ZodEffects<z.ZodString, string, string>;
169
+ }, {
170
+ template: z.ZodLiteral<"project">;
171
+ name: z.ZodString;
172
+ description: z.ZodOptional<z.ZodString>;
173
+ image: z.ZodString;
174
+ url: z.ZodString;
175
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
176
+ }>, "strip", z.ZodTypeAny, {
177
+ template: "project";
178
+ did: string;
179
+ name: string;
180
+ image: string;
181
+ url: string;
182
+ createdAt: string;
183
+ description?: string | undefined;
184
+ }, {
185
+ template: "project";
186
+ did: string;
187
+ name: string;
188
+ image: string;
189
+ url: string;
190
+ createdAt: string;
191
+ description?: string | undefined;
74
192
  }>]>;
75
193
  export type PreviewTemplate = z.infer<typeof PreviewTemplateSchema>;
@@ -8,8 +8,18 @@ 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");
12
+ const blog_1 = require("./blog");
13
+ const bookmark_1 = require("./bookmark");
14
+ const project_1 = require("./project");
15
+ const app_1 = require("./app");
11
16
  exports.PreviewTemplateSchema = zod_1.default.union([
17
+ app_1.AppPreviewTemplateSchema,
12
18
  nft_1.NftPreviewTemplateSchema,
13
19
  profile_1.ProfilePreviewTemplateSchema,
14
20
  passport_1.PassportPreviewTemplateSchema,
21
+ discuss_1.DiscussPreviewTemplateSchema,
22
+ blog_1.BlogPreviewTemplateSchema,
23
+ bookmark_1.BookmarkPreviewTemplateSchema,
24
+ project_1.ProjectPreviewTemplateSchema,
15
25
  ]);
@@ -0,0 +1,26 @@
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">]>;
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>;
@@ -0,0 +1,12 @@
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,5 +1,10 @@
1
+ export * from './app';
1
2
  export * from './base';
3
+ export * from './blog';
4
+ export * from './bookmark';
2
5
  export * from './default';
6
+ export * from './discuss';
3
7
  export * from './nft';
4
8
  export * from './passport';
5
9
  export * from './profile';
10
+ export * from './project';
@@ -14,8 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./app"), exports);
17
18
  __exportStar(require("./base"), exports);
19
+ __exportStar(require("./blog"), exports);
20
+ __exportStar(require("./bookmark"), exports);
18
21
  __exportStar(require("./default"), exports);
22
+ __exportStar(require("./discuss"), exports);
19
23
  __exportStar(require("./nft"), exports);
20
24
  __exportStar(require("./passport"), exports);
21
25
  __exportStar(require("./profile"), exports);
26
+ __exportStar(require("./project"), 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.ZodString;
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">]>;
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.ZodString;
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">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"passport">;
@@ -12,8 +12,8 @@ export declare const PassportPreviewTemplateSchema: z.ZodObject<z.objectUtil.ext
12
12
  issuedTo: z.ZodString;
13
13
  verified: z.ZodBoolean;
14
14
  }>, "strip", z.ZodTypeAny, {
15
- type: string[];
16
15
  template: "passport";
16
+ type: string[];
17
17
  did: string;
18
18
  image: string;
19
19
  issuerDid: string;
@@ -22,8 +22,8 @@ export declare const PassportPreviewTemplateSchema: z.ZodObject<z.objectUtil.ext
22
22
  issuedTo: string;
23
23
  verified: boolean;
24
24
  }, {
25
- type: string[];
26
25
  template: "passport";
26
+ type: string[];
27
27
  did: string;
28
28
  image: string;
29
29
  issuerDid: string;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const ProfilePreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodString;
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">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"profile">>>;
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
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">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"project">;
7
+ name: z.ZodString;
8
+ description: z.ZodOptional<z.ZodString>;
9
+ image: z.ZodString;
10
+ url: z.ZodString;
11
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
12
+ }>, "strip", z.ZodTypeAny, {
13
+ template: "project";
14
+ did: string;
15
+ name: string;
16
+ image: string;
17
+ url: string;
18
+ createdAt: string;
19
+ description?: string | undefined;
20
+ }, {
21
+ template: "project";
22
+ did: string;
23
+ name: string;
24
+ image: string;
25
+ url: string;
26
+ createdAt: string;
27
+ description?: string | undefined;
28
+ }>;
29
+ export type ProjectPreviewTemplate = z.TypeOf<typeof ProjectPreviewTemplateSchema>;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProjectPreviewTemplateSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const base_1 = require("./base");
6
+ exports.ProjectPreviewTemplateSchema = base_1.BasePreviewTemplateSchema.extend({
7
+ template: zod_1.z.literal('project'),
8
+ // 名称
9
+ name: zod_1.z.string().min(1),
10
+ // 描述
11
+ description: zod_1.z.string().optional(),
12
+ // 封面
13
+ image: zod_1.z.string().min(1),
14
+ // 链接,必须是应用本身的链接 @TODO: 需要验证
15
+ url: zod_1.z.string().url(),
16
+ // 创建时间
17
+ createdAt: base_1.DateSchema,
18
+ });
@@ -182,8 +182,8 @@ export declare const AuditLogSchema: z.ZodObject<{
182
182
  updatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
183
183
  }, "strip", z.ZodTypeAny, {
184
184
  status: AuditLogStatus;
185
- id: string;
186
185
  createdAt: string;
186
+ id: string;
187
187
  updatedAt: string;
188
188
  actionType: AuditLogAction;
189
189
  entityId: string;
@@ -408,8 +408,8 @@ export declare const CreationAuditLogSchema: z.ZodObject<z.objectUtil.extendShap
408
408
  serverDid: string;
409
409
  };
410
410
  status?: AuditLogStatus | undefined;
411
- id?: string | undefined;
412
411
  createdAt?: string | undefined;
412
+ id?: string | undefined;
413
413
  updatedAt?: string | undefined;
414
414
  entityName?: string | undefined;
415
415
  username?: string | undefined;
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
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">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"app">;
7
+ name: z.ZodString;
8
+ logo: z.ZodString;
9
+ }>, "strip", z.ZodTypeAny, {
10
+ template: "app";
11
+ did: string;
12
+ name: string;
13
+ logo: string;
14
+ }, {
15
+ template: "app";
16
+ did: string;
17
+ name: string;
18
+ logo: string;
19
+ }>;
20
+ export type AppPreviewTemplate = z.TypeOf<typeof AppPreviewTemplateSchema>;
@@ -0,0 +1,9 @@
1
+ import { z } from 'zod';
2
+ import { BasePreviewTemplateSchema } from './base';
3
+ export const AppPreviewTemplateSchema = BasePreviewTemplateSchema.extend({
4
+ template: z.literal('app'),
5
+ // 名称
6
+ name: z.string().min(1),
7
+ // 链接,必须是应用本身的链接 @TODO: 需要验证
8
+ logo: z.string().url(),
9
+ });
@@ -1,13 +1,14 @@
1
1
  import { z } from 'zod';
2
2
  export declare const DidSchema: z.ZodEffects<z.ZodString, string, string>;
3
+ export declare const DateSchema: z.ZodEffects<z.ZodString, string, string>;
3
4
  export declare const BasePreviewTemplateSchema: z.ZodObject<{
4
- template: z.ZodString;
5
+ template: z.ZodUnion<[z.ZodLiteral<"nft">, z.ZodLiteral<"profile">, z.ZodLiteral<"passport">, z.ZodLiteral<"discuss">, z.ZodLiteral<"blog">, z.ZodLiteral<"bookmark">, z.ZodLiteral<"project">]>;
5
6
  did: z.ZodEffects<z.ZodString, string, string>;
6
7
  }, "strip", z.ZodTypeAny, {
7
- template: string;
8
+ template: "nft" | "profile" | "passport" | "discuss" | "blog" | "bookmark" | "project";
8
9
  did: string;
9
10
  }, {
10
- template: string;
11
+ template: "nft" | "profile" | "passport" | "discuss" | "blog" | "bookmark" | "project";
11
12
  did: string;
12
13
  }>;
13
14
  export type BasePreviewTemplate = z.infer<typeof BasePreviewTemplateSchema>;
@@ -1,4 +1,5 @@
1
1
  import { isValid } from '@arcblock/did';
2
+ import dayjs from 'dayjs';
2
3
  import { z } from 'zod';
3
4
  export const DidSchema = z.string().refine((value) => isValid(value), (value) => {
4
5
  return {
@@ -6,7 +7,21 @@ export const DidSchema = z.string().refine((value) => isValid(value), (value) =>
6
7
  message: `${value} is not a valid DID`,
7
8
  };
8
9
  });
10
+ export const DateSchema = z.string().refine((value) => dayjs(value).isValid(), (value) => {
11
+ return {
12
+ code: z.ZodIssueCode.custom,
13
+ message: `createdAt(${value}) is not a valid date`,
14
+ };
15
+ });
9
16
  export const BasePreviewTemplateSchema = z.object({
10
- template: z.string().min(1),
17
+ template: z.union([
18
+ z.literal('nft'),
19
+ z.literal('profile'),
20
+ z.literal('passport'),
21
+ z.literal('discuss'),
22
+ z.literal('blog'),
23
+ z.literal('bookmark'),
24
+ z.literal('project'),
25
+ ]),
11
26
  did: DidSchema,
12
27
  });
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
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">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"blog">;
7
+ title: z.ZodString;
8
+ image: z.ZodString;
9
+ tags: z.ZodArray<z.ZodString, "many">;
10
+ url: z.ZodString;
11
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
12
+ }>, "strip", z.ZodTypeAny, {
13
+ template: "blog";
14
+ did: string;
15
+ title: string;
16
+ image: string;
17
+ tags: string[];
18
+ url: string;
19
+ createdAt: string;
20
+ }, {
21
+ template: "blog";
22
+ did: string;
23
+ title: string;
24
+ image: string;
25
+ tags: string[];
26
+ url: string;
27
+ createdAt: string;
28
+ }>;
29
+ export type BlogPreviewTemplate = z.TypeOf<typeof BlogPreviewTemplateSchema>;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { BasePreviewTemplateSchema, DateSchema } from './base';
3
+ export const BlogPreviewTemplateSchema = BasePreviewTemplateSchema.extend({
4
+ template: z.literal('blog'),
5
+ // 标题
6
+ title: z.string().min(1),
7
+ // 封面
8
+ image: z.string().min(1),
9
+ // 标签
10
+ tags: z.array(z.string().min(1)),
11
+ // 链接,必须是应用本身的链接 @TODO: 需要验证
12
+ url: z.string().url(),
13
+ // 创建时间
14
+ createdAt: DateSchema,
15
+ });
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
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">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"bookmark">;
7
+ title: z.ZodString;
8
+ image: z.ZodString;
9
+ tags: z.ZodArray<z.ZodString, "many">;
10
+ url: z.ZodString;
11
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
12
+ }>, "strip", z.ZodTypeAny, {
13
+ template: "bookmark";
14
+ did: string;
15
+ title: string;
16
+ image: string;
17
+ tags: string[];
18
+ url: string;
19
+ createdAt: string;
20
+ }, {
21
+ template: "bookmark";
22
+ did: string;
23
+ title: string;
24
+ image: string;
25
+ tags: string[];
26
+ url: string;
27
+ createdAt: string;
28
+ }>;
29
+ export type BookmarkPreviewTemplate = z.TypeOf<typeof BookmarkPreviewTemplateSchema>;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { BasePreviewTemplateSchema, DateSchema } from './base';
3
+ export const BookmarkPreviewTemplateSchema = BasePreviewTemplateSchema.extend({
4
+ template: z.literal('bookmark'),
5
+ // 标题
6
+ title: z.string().min(1),
7
+ // 封面
8
+ image: z.string().min(1),
9
+ // 标签
10
+ tags: z.array(z.string().min(1)),
11
+ // 链接,必须是应用本身的链接 @TODO: 需要验证
12
+ url: z.string().url(),
13
+ // 创建时间
14
+ createdAt: DateSchema,
15
+ });
@@ -1,6 +1,23 @@
1
1
  import z from 'zod';
2
2
  export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodString;
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">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"app">;
7
+ name: z.ZodString;
8
+ logo: z.ZodString;
9
+ }>, "strip", z.ZodTypeAny, {
10
+ template: "app";
11
+ did: string;
12
+ name: string;
13
+ logo: string;
14
+ }, {
15
+ template: "app";
16
+ did: string;
17
+ name: string;
18
+ logo: string;
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">]>;
4
21
  did: z.ZodEffects<z.ZodString, string, string>;
5
22
  }, {
6
23
  template: z.ZodLiteral<"nft">;
@@ -20,7 +37,7 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
20
37
  image: string;
21
38
  chainHost: string;
22
39
  }>, z.ZodObject<z.objectUtil.extendShape<{
23
- template: z.ZodString;
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">]>;
24
41
  did: z.ZodEffects<z.ZodString, string, string>;
25
42
  }, {
26
43
  template: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"profile">>>;
@@ -40,7 +57,7 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
40
57
  email: string;
41
58
  template?: "profile" | undefined;
42
59
  }>, z.ZodObject<z.objectUtil.extendShape<{
43
- template: z.ZodString;
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">]>;
44
61
  did: z.ZodEffects<z.ZodString, string, string>;
45
62
  }, {
46
63
  template: z.ZodLiteral<"passport">;
@@ -52,8 +69,8 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
52
69
  issuedTo: z.ZodString;
53
70
  verified: z.ZodBoolean;
54
71
  }>, "strip", z.ZodTypeAny, {
55
- type: string[];
56
72
  template: "passport";
73
+ type: string[];
57
74
  did: string;
58
75
  image: string;
59
76
  issuerDid: string;
@@ -62,8 +79,8 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
62
79
  issuedTo: string;
63
80
  verified: boolean;
64
81
  }, {
65
- type: string[];
66
82
  template: "passport";
83
+ type: string[];
67
84
  did: string;
68
85
  image: string;
69
86
  issuerDid: string;
@@ -71,5 +88,106 @@ export declare const PreviewTemplateSchema: z.ZodUnion<[z.ZodObject<z.objectUtil
71
88
  issuedAt: string;
72
89
  issuedTo: string;
73
90
  verified: boolean;
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">]>;
93
+ did: z.ZodEffects<z.ZodString, string, string>;
94
+ }, {
95
+ template: z.ZodLiteral<"discuss">;
96
+ title: z.ZodString;
97
+ tags: z.ZodArray<z.ZodString, "many">;
98
+ url: z.ZodString;
99
+ createdAt: z.ZodString;
100
+ }>, "strip", z.ZodTypeAny, {
101
+ template: "discuss";
102
+ did: string;
103
+ title: string;
104
+ tags: string[];
105
+ url: string;
106
+ createdAt: string;
107
+ }, {
108
+ template: "discuss";
109
+ did: string;
110
+ title: string;
111
+ tags: string[];
112
+ url: string;
113
+ createdAt: string;
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">]>;
116
+ did: z.ZodEffects<z.ZodString, string, string>;
117
+ }, {
118
+ template: z.ZodLiteral<"blog">;
119
+ title: z.ZodString;
120
+ image: z.ZodString;
121
+ tags: z.ZodArray<z.ZodString, "many">;
122
+ url: z.ZodString;
123
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
124
+ }>, "strip", z.ZodTypeAny, {
125
+ template: "blog";
126
+ did: string;
127
+ title: string;
128
+ image: string;
129
+ tags: string[];
130
+ url: string;
131
+ createdAt: string;
132
+ }, {
133
+ template: "blog";
134
+ did: string;
135
+ title: string;
136
+ image: string;
137
+ tags: string[];
138
+ url: string;
139
+ createdAt: string;
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">]>;
142
+ did: z.ZodEffects<z.ZodString, string, string>;
143
+ }, {
144
+ template: z.ZodLiteral<"bookmark">;
145
+ title: z.ZodString;
146
+ image: z.ZodString;
147
+ tags: z.ZodArray<z.ZodString, "many">;
148
+ url: z.ZodString;
149
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
150
+ }>, "strip", z.ZodTypeAny, {
151
+ template: "bookmark";
152
+ did: string;
153
+ title: string;
154
+ image: string;
155
+ tags: string[];
156
+ url: string;
157
+ createdAt: string;
158
+ }, {
159
+ template: "bookmark";
160
+ did: string;
161
+ title: string;
162
+ image: string;
163
+ tags: string[];
164
+ url: string;
165
+ createdAt: string;
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">]>;
168
+ did: z.ZodEffects<z.ZodString, string, string>;
169
+ }, {
170
+ template: z.ZodLiteral<"project">;
171
+ name: z.ZodString;
172
+ description: z.ZodOptional<z.ZodString>;
173
+ image: z.ZodString;
174
+ url: z.ZodString;
175
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
176
+ }>, "strip", z.ZodTypeAny, {
177
+ template: "project";
178
+ did: string;
179
+ name: string;
180
+ image: string;
181
+ url: string;
182
+ createdAt: string;
183
+ description?: string | undefined;
184
+ }, {
185
+ template: "project";
186
+ did: string;
187
+ name: string;
188
+ image: string;
189
+ url: string;
190
+ createdAt: string;
191
+ description?: string | undefined;
74
192
  }>]>;
75
193
  export type PreviewTemplate = z.infer<typeof PreviewTemplateSchema>;
@@ -2,8 +2,18 @@ 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';
6
+ import { BlogPreviewTemplateSchema } from './blog';
7
+ import { BookmarkPreviewTemplateSchema } from './bookmark';
8
+ import { ProjectPreviewTemplateSchema } from './project';
9
+ import { AppPreviewTemplateSchema } from './app';
5
10
  export const PreviewTemplateSchema = z.union([
11
+ AppPreviewTemplateSchema,
6
12
  NftPreviewTemplateSchema,
7
13
  ProfilePreviewTemplateSchema,
8
14
  PassportPreviewTemplateSchema,
15
+ DiscussPreviewTemplateSchema,
16
+ BlogPreviewTemplateSchema,
17
+ BookmarkPreviewTemplateSchema,
18
+ ProjectPreviewTemplateSchema,
9
19
  ]);
@@ -0,0 +1,26 @@
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">]>;
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>;
@@ -0,0 +1,9 @@
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
+ });
@@ -1,5 +1,10 @@
1
+ export * from './app';
1
2
  export * from './base';
3
+ export * from './blog';
4
+ export * from './bookmark';
2
5
  export * from './default';
6
+ export * from './discuss';
3
7
  export * from './nft';
4
8
  export * from './passport';
5
9
  export * from './profile';
10
+ export * from './project';
@@ -1,5 +1,10 @@
1
+ export * from './app';
1
2
  export * from './base';
3
+ export * from './blog';
4
+ export * from './bookmark';
2
5
  export * from './default';
6
+ export * from './discuss';
3
7
  export * from './nft';
4
8
  export * from './passport';
5
9
  export * from './profile';
10
+ export * from './project';
@@ -1,6 +1,6 @@
1
1
  import z from 'zod';
2
2
  export declare const NftPreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodString;
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">]>;
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.ZodString;
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">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodLiteral<"passport">;
@@ -12,8 +12,8 @@ export declare const PassportPreviewTemplateSchema: z.ZodObject<z.objectUtil.ext
12
12
  issuedTo: z.ZodString;
13
13
  verified: z.ZodBoolean;
14
14
  }>, "strip", z.ZodTypeAny, {
15
- type: string[];
16
15
  template: "passport";
16
+ type: string[];
17
17
  did: string;
18
18
  image: string;
19
19
  issuerDid: string;
@@ -22,8 +22,8 @@ export declare const PassportPreviewTemplateSchema: z.ZodObject<z.objectUtil.ext
22
22
  issuedTo: string;
23
23
  verified: boolean;
24
24
  }, {
25
- type: string[];
26
25
  template: "passport";
26
+ type: string[];
27
27
  did: string;
28
28
  image: string;
29
29
  issuerDid: string;
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  export declare const ProfilePreviewTemplateSchema: z.ZodObject<z.objectUtil.extendShape<{
3
- template: z.ZodString;
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">]>;
4
4
  did: z.ZodEffects<z.ZodString, string, string>;
5
5
  }, {
6
6
  template: z.ZodDefault<z.ZodOptional<z.ZodLiteral<"profile">>>;
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
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">]>;
4
+ did: z.ZodEffects<z.ZodString, string, string>;
5
+ }, {
6
+ template: z.ZodLiteral<"project">;
7
+ name: z.ZodString;
8
+ description: z.ZodOptional<z.ZodString>;
9
+ image: z.ZodString;
10
+ url: z.ZodString;
11
+ createdAt: z.ZodEffects<z.ZodString, string, string>;
12
+ }>, "strip", z.ZodTypeAny, {
13
+ template: "project";
14
+ did: string;
15
+ name: string;
16
+ image: string;
17
+ url: string;
18
+ createdAt: string;
19
+ description?: string | undefined;
20
+ }, {
21
+ template: "project";
22
+ did: string;
23
+ name: string;
24
+ image: string;
25
+ url: string;
26
+ createdAt: string;
27
+ description?: string | undefined;
28
+ }>;
29
+ export type ProjectPreviewTemplate = z.TypeOf<typeof ProjectPreviewTemplateSchema>;
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { BasePreviewTemplateSchema, DateSchema } from './base';
3
+ export const ProjectPreviewTemplateSchema = BasePreviewTemplateSchema.extend({
4
+ template: z.literal('project'),
5
+ // 名称
6
+ name: z.string().min(1),
7
+ // 描述
8
+ description: z.string().optional(),
9
+ // 封面
10
+ image: z.string().min(1),
11
+ // 链接,必须是应用本身的链接 @TODO: 需要验证
12
+ url: z.string().url(),
13
+ // 创建时间
14
+ createdAt: DateSchema,
15
+ });
@@ -182,8 +182,8 @@ export declare const AuditLogSchema: z.ZodObject<{
182
182
  updatedAt: z.ZodDefault<z.ZodOptional<z.ZodString>>;
183
183
  }, "strip", z.ZodTypeAny, {
184
184
  status: AuditLogStatus;
185
- id: string;
186
185
  createdAt: string;
186
+ id: string;
187
187
  updatedAt: string;
188
188
  actionType: AuditLogAction;
189
189
  entityId: string;
@@ -408,8 +408,8 @@ export declare const CreationAuditLogSchema: z.ZodObject<z.objectUtil.extendShap
408
408
  serverDid: string;
409
409
  };
410
410
  status?: AuditLogStatus | undefined;
411
- id?: string | undefined;
412
411
  createdAt?: string | undefined;
412
+ id?: string | undefined;
413
413
  updatedAt?: string | undefined;
414
414
  entityName?: string | undefined;
415
415
  username?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-space/core",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -115,9 +115,9 @@
115
115
  "watch": "npm run build -- -w"
116
116
  },
117
117
  "dependencies": {
118
- "@arcblock/did": "^1.18.165",
118
+ "@arcblock/did": "^1.19.2",
119
119
  "@arcblock/ipfs-only-hash": "^0.0.2",
120
- "@arcblock/validator": "^1.18.165",
120
+ "@arcblock/validator": "^1.19.2",
121
121
  "dayjs": "^1.11.13",
122
122
  "debug": "^4.4.0",
123
123
  "hasha": "^5.2.2",
@@ -128,6 +128,7 @@
128
128
  "multiformats": "9",
129
129
  "p-all": "3.0.0",
130
130
  "sequelize": "^6.37.5",
131
+ "validator": "^13.12.0",
131
132
  "xbytes": "^1.9.1",
132
133
  "zod": "^3.24.1"
133
134
  },
@@ -143,7 +144,7 @@
143
144
  "ts-jest": "^28.0.8",
144
145
  "typescript": "^4.9.5",
145
146
  "vite": "^5.4.11",
146
- "vitest": "^2.1.8"
147
+ "vitest": "^3.0.0-beta.4"
147
148
  },
148
- "gitHead": "b9f748ea6e76c6ed63fe049eb5043c5b2a8a9df9"
149
+ "gitHead": "6f7176f310524bf0c5d2900fc5678a7d3cef66fe"
149
150
  }