@blocklet/sdk 1.16.15-beta-74505f06 → 1.16.15-beta-e3a24907

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.
@@ -2,10 +2,12 @@ import user from './user';
2
2
  import auth from './auth';
3
3
  import component from './component';
4
4
  import fallback from './fallback';
5
+ import sitemap from './sitemap';
5
6
  export { user };
6
7
  export { auth };
7
8
  export { component };
8
9
  export { fallback };
10
+ export { sitemap };
9
11
  declare const _default: {
10
12
  user: () => (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>> & {
11
13
  user?: {
@@ -28,5 +30,39 @@ declare const _default: {
28
30
  maxAge?: string | number;
29
31
  root?: string;
30
32
  }) => (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: import("express").Response<any, Record<string, any>>, next: import("express").NextFunction) => void;
33
+ sitemap: (generatorFn: (fn: (item: {
34
+ url: string;
35
+ img?: {
36
+ url: string;
37
+ caption: string;
38
+ title: string;
39
+ geoLocation: string;
40
+ license: string;
41
+ }[];
42
+ video?: {
43
+ thumbnail_loc: string;
44
+ title: string;
45
+ description: string;
46
+ player_loc?: string;
47
+ 'player_loc:autoplay'?: string;
48
+ 'player_loc:allow_embed'?: string;
49
+ }[];
50
+ links?: {
51
+ lang: string;
52
+ url: string;
53
+ }[];
54
+ androidLink?: string;
55
+ news?: {
56
+ publication: {
57
+ name: string;
58
+ language: string;
59
+ };
60
+ genres: string;
61
+ publication_date: string;
62
+ title: string;
63
+ keywords: string;
64
+ stock_tickers: string;
65
+ };
66
+ }) => void) => Promise<void>) => (req: import("express").Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: import("express").Response<any, Record<string, any>>) => Promise<void>;
31
67
  };
32
68
  export default _default;
@@ -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.fallback = exports.component = exports.auth = exports.user = void 0;
6
+ exports.sitemap = exports.fallback = exports.component = exports.auth = exports.user = void 0;
7
7
  const user_1 = __importDefault(require("./user"));
8
8
  exports.user = user_1.default;
9
9
  const auth_1 = __importDefault(require("./auth"));
@@ -12,9 +12,12 @@ const component_1 = __importDefault(require("./component"));
12
12
  exports.component = component_1.default;
13
13
  const fallback_1 = __importDefault(require("./fallback"));
14
14
  exports.fallback = fallback_1.default;
15
+ const sitemap_1 = __importDefault(require("./sitemap"));
16
+ exports.sitemap = sitemap_1.default;
15
17
  exports.default = {
16
18
  user: user_1.default,
17
19
  auth: auth_1.default,
18
20
  component: component_1.default,
19
21
  fallback: fallback_1.default,
22
+ sitemap: sitemap_1.default,
20
23
  };
@@ -0,0 +1,43 @@
1
+ import { Request, Response } from 'express';
2
+ type Image = {
3
+ url: string;
4
+ caption: string;
5
+ title: string;
6
+ geoLocation: string;
7
+ license: string;
8
+ };
9
+ type Video = {
10
+ thumbnail_loc: string;
11
+ title: string;
12
+ description: string;
13
+ player_loc?: string;
14
+ 'player_loc:autoplay'?: string;
15
+ 'player_loc:allow_embed'?: string;
16
+ };
17
+ type Link = {
18
+ lang: string;
19
+ url: string;
20
+ };
21
+ type Publication = {
22
+ name: string;
23
+ language: string;
24
+ };
25
+ type News = {
26
+ publication: Publication;
27
+ genres: string;
28
+ publication_date: string;
29
+ title: string;
30
+ keywords: string;
31
+ stock_tickers: string;
32
+ };
33
+ type SitemapItem = {
34
+ url: string;
35
+ img?: Image[];
36
+ video?: Video[];
37
+ links?: Link[];
38
+ androidLink?: string;
39
+ news?: News;
40
+ };
41
+ type GeneratorFn = (fn: (item: SitemapItem) => void) => Promise<void>;
42
+ declare const sitemap: (generatorFn: GeneratorFn) => (req: Request, res: Response) => Promise<void>;
43
+ export = sitemap;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ const sitemap_1 = require("sitemap");
3
+ const config_1 = require("../config");
4
+ const sitemap = (generatorFn) => {
5
+ return async (req, res) => {
6
+ res.header('Content-Type', 'application/xml');
7
+ try {
8
+ const stream = new sitemap_1.SitemapStream({ hostname: config_1.env.appUrl });
9
+ await generatorFn(stream.write.bind(stream));
10
+ stream.end();
11
+ const result = await (0, sitemap_1.streamToPromise)(stream).then((data) => data.toString());
12
+ res.send(result);
13
+ }
14
+ catch (err) {
15
+ console.error('Failed to generate sitemap', err);
16
+ res.status(500);
17
+ res.send(err.message);
18
+ }
19
+ };
20
+ };
21
+ module.exports = sitemap;
@@ -24,6 +24,11 @@ interface AuthService {
24
24
  }): Promise<Client.ResponseUser>;
25
25
  getUsers(args?: OmitTeamDid<Client.RequestUsersInput>): Promise<Client.ResponseUsers>;
26
26
  getOwner(): Promise<Client.ResponseUser>;
27
+ switchProfile(did: string, profile: {
28
+ avatar?: string;
29
+ email?: string;
30
+ fullName?: string;
31
+ }): Promise<Client.ResponseUser>;
27
32
  updateUserApproval(did: string, approved: boolean): Promise<Client.ResponseUser>;
28
33
  issuePassportToUser(args: OmitTeamDid<Client.RequestIssuePassportToUserInput>): Promise<Client.ResponseUser>;
29
34
  enableUserPassport(args: OmitTeamDid<Client.RequestRevokeUserPassportInput>): Promise<Client.ResponseUser>;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.15-beta-74505f06",
6
+ "version": "1.16.15-beta-e3a24907",
7
7
  "description": "graphql client to read/write data on abt node",
8
8
  "main": "lib/index.js",
9
9
  "typings": "lib/index.d.ts",
@@ -26,15 +26,15 @@
26
26
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
27
27
  "license": "Apache-2.0",
28
28
  "dependencies": {
29
- "@abtnode/client": "1.16.15-beta-74505f06",
30
- "@abtnode/constant": "1.16.15-beta-74505f06",
29
+ "@abtnode/client": "1.16.15-beta-e3a24907",
30
+ "@abtnode/constant": "1.16.15-beta-e3a24907",
31
31
  "@arcblock/did": "1.18.89",
32
32
  "@arcblock/did-auth": "1.18.89",
33
33
  "@arcblock/jwt": "1.18.89",
34
34
  "@arcblock/ws": "1.18.89",
35
- "@blocklet/constant": "1.16.15-beta-74505f06",
36
- "@blocklet/env": "1.16.15-beta-74505f06",
37
- "@blocklet/meta": "1.16.15-beta-74505f06",
35
+ "@blocklet/constant": "1.16.15-beta-e3a24907",
36
+ "@blocklet/env": "1.16.15-beta-e3a24907",
37
+ "@blocklet/meta": "1.16.15-beta-e3a24907",
38
38
  "@did-connect/authenticator": "^2.2.0",
39
39
  "@did-connect/handler": "^2.2.0",
40
40
  "@nedb/core": "^2.1.5",
@@ -48,6 +48,7 @@
48
48
  "lodash": "^4.17.21",
49
49
  "lru-cache": "^6.0.0",
50
50
  "semver": "^7.3.8",
51
+ "sitemap": "^7.1.1",
51
52
  "ufo": "^1.1.1",
52
53
  "url-join": "^4.0.1"
53
54
  },
@@ -73,5 +74,5 @@
73
74
  "ts-node": "^10.9.1",
74
75
  "typescript": "^5.0.4"
75
76
  },
76
- "gitHead": "344ae4a65afe846111eb1f901e09e0f59f333861"
77
+ "gitHead": "b87c810902571b8cdb8f12ef497286b1549888e9"
77
78
  }