@kmlckj/licos-ai-cli 1.0.27 → 1.1.1

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.
@@ -11,8 +11,8 @@
11
11
  "start:prod": "node dist/main"
12
12
  },
13
13
  "dependencies": {
14
- "@kmlckj/licos-dev-sdk": "0.2.5",
15
- "@kmlckj/licos-platform-sdk": "0.6.7",
14
+ "@kmlckj/licos-dev-sdk": "0.2.6",
15
+ "@kmlckj/licos-platform-sdk": "0.6.8",
16
16
  "@nestjs/common": "^10.4.15",
17
17
  "@nestjs/core": "^10.4.15",
18
18
  "@nestjs/platform-express": "^10.4.15",
@@ -1,64 +1,64 @@
1
- import Taro from '@tarojs/taro'
2
-
3
- /**
4
- * 网络请求模块
5
- * 封装 Taro.request、Taro.uploadFile、Taro.downloadFile,自动添加项目域名前缀
6
- * 如果请求的 url 以 http:// 或 https:// 开头,则不会添加域名前缀
7
- *
8
- * IMPORTANT: 项目已经全局注入 PROJECT_DOMAIN
9
- * IMPORTANT: 除非你需要添加全局参数,如给所有请求加上 header,否则不能修改此文件
10
- */
11
- export namespace Network {
12
- const normalizeBase = (value?: string): string => {
13
- const trimmed = (value || '').trim()
14
- if (!trimmed || trimmed === '/') {
15
- return ''
16
- }
17
- return trimmed.replace(/\/+$/g, '')
18
- }
19
-
20
- const inferH5BasePath = (): string => {
21
- if (typeof window === 'undefined') {
22
- return ''
23
- }
24
- const pathname = window.location?.pathname || ''
25
- const matched = pathname.match(/^(\/p\/[^/]+)(?:\/|$)/)
26
- return matched ? matched[1] : ''
27
- }
28
-
29
- const requestBase = (): string => {
30
- return normalizeBase(PROJECT_DOMAIN)
31
- || normalizeBase(LICOS_H5_BASE_PATH)
32
- || normalizeBase(inferH5BasePath())
33
- }
34
-
35
- const createUrl = (url: string): string => {
36
- if (url.startsWith('http://') || url.startsWith('https://')) {
37
- return url
38
- }
39
- const path = url.startsWith('/') ? url : `/${url}`
40
- const base = requestBase()
41
- return base ? `${base}${path}` : path
42
- }
43
-
44
- export const request: typeof Taro.request = option => {
45
- return Taro.request({
46
- ...option,
47
- url: createUrl(option.url),
48
- })
49
- }
50
-
51
- export const uploadFile: typeof Taro.uploadFile = option => {
52
- return Taro.uploadFile({
53
- ...option,
54
- url: createUrl(option.url),
55
- })
56
- }
57
-
58
- export const downloadFile: typeof Taro.downloadFile = option => {
59
- return Taro.downloadFile({
60
- ...option,
61
- url: createUrl(option.url),
62
- })
63
- }
64
- }
1
+ import Taro from '@tarojs/taro'
2
+
3
+ /**
4
+ * 网络请求模块
5
+ * 封装 Taro.request、Taro.uploadFile、Taro.downloadFile,自动添加项目域名前缀
6
+ * 如果请求的 url 以 http:// 或 https:// 开头,则不会添加域名前缀
7
+ *
8
+ * IMPORTANT: 项目已经全局注入 PROJECT_DOMAIN
9
+ * IMPORTANT: 除非你需要添加全局参数,如给所有请求加上 header,否则不能修改此文件
10
+ */
11
+ export namespace Network {
12
+ const normalizeBase = (value?: string): string => {
13
+ const trimmed = (value || '').trim()
14
+ if (!trimmed || trimmed === '/') {
15
+ return ''
16
+ }
17
+ return trimmed.replace(/\/+$/g, '')
18
+ }
19
+
20
+ const inferH5BasePath = (): string => {
21
+ if (typeof window === 'undefined') {
22
+ return ''
23
+ }
24
+ const pathname = window.location?.pathname || ''
25
+ const matched = pathname.match(/^(\/p\/[^/]+)(?:\/|$)/)
26
+ return matched ? matched[1] : ''
27
+ }
28
+
29
+ const requestBase = (): string => {
30
+ return normalizeBase(PROJECT_DOMAIN)
31
+ || normalizeBase(LICOS_H5_BASE_PATH)
32
+ || normalizeBase(inferH5BasePath())
33
+ }
34
+
35
+ const createUrl = (url: string): string => {
36
+ if (url.startsWith('http://') || url.startsWith('https://')) {
37
+ return url
38
+ }
39
+ const path = url.startsWith('/') ? url : `/${url}`
40
+ const base = requestBase()
41
+ return base ? `${base}${path}` : path
42
+ }
43
+
44
+ export const request: typeof Taro.request = option => {
45
+ return Taro.request({
46
+ ...option,
47
+ url: createUrl(option.url),
48
+ })
49
+ }
50
+
51
+ export const uploadFile: typeof Taro.uploadFile = option => {
52
+ return Taro.uploadFile({
53
+ ...option,
54
+ url: createUrl(option.url),
55
+ })
56
+ }
57
+
58
+ export const downloadFile: typeof Taro.downloadFile = option => {
59
+ return Taro.downloadFile({
60
+ ...option,
61
+ url: createUrl(option.url),
62
+ })
63
+ }
64
+ }
@@ -1,31 +1,31 @@
1
- /// <reference types="@tarojs/taro" />
2
-
3
- declare const PROJECT_DOMAIN: string | undefined;
4
- declare const LICOS_H5_BASE_PATH: string | undefined;
5
- declare const LICOS_TARO_ENV: "weapp" | "h5" | "tt" | string | undefined;
6
-
7
- declare module '*.png';
8
- declare module '*.gif';
9
- declare module '*.jpg';
10
- declare module '*.jpeg';
11
- declare module '*.svg';
12
- declare module '*.css';
13
- declare module '*.less';
14
- declare module '*.scss';
15
- declare module '*.sass';
16
- declare module '*.styl';
17
-
18
- declare namespace NodeJS {
19
- interface ProcessEnv {
20
- /** NODE 内置环境变量, 会影响到最终构建生成产物 */
21
- NODE_ENV: 'development' | 'production',
22
- /** 当前构建的平台 */
23
- TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'qq' | 'jd' | 'harmony' | 'jdrn'
24
- /**
25
- * 当前构建的小程序 appid
26
- * @description 若不同环境有不同的小程序,可通过在 env 文件中配置环境变量`TARO_APP_ID`来方便快速切换 appid, 而不必手动去修改 dist/project.config.json 文件
27
- * @see https://taro-docs.jd.com/docs/next/env-mode-config#特殊环境变量-taro_app_id
28
- */
29
- TARO_APP_ID: string
30
- }
31
- }
1
+ /// <reference types="@tarojs/taro" />
2
+
3
+ declare const PROJECT_DOMAIN: string | undefined;
4
+ declare const LICOS_H5_BASE_PATH: string | undefined;
5
+ declare const LICOS_TARO_ENV: "weapp" | "h5" | "tt" | string | undefined;
6
+
7
+ declare module '*.png';
8
+ declare module '*.gif';
9
+ declare module '*.jpg';
10
+ declare module '*.jpeg';
11
+ declare module '*.svg';
12
+ declare module '*.css';
13
+ declare module '*.less';
14
+ declare module '*.scss';
15
+ declare module '*.sass';
16
+ declare module '*.styl';
17
+
18
+ declare namespace NodeJS {
19
+ interface ProcessEnv {
20
+ /** NODE 内置环境变量, 会影响到最终构建生成产物 */
21
+ NODE_ENV: 'development' | 'production',
22
+ /** 当前构建的平台 */
23
+ TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'qq' | 'jd' | 'harmony' | 'jdrn'
24
+ /**
25
+ * 当前构建的小程序 appid
26
+ * @description 若不同环境有不同的小程序,可通过在 env 文件中配置环境变量`TARO_APP_ID`来方便快速切换 appid, 而不必手动去修改 dist/project.config.json 文件
27
+ * @see https://taro-docs.jd.com/docs/next/env-mode-config#特殊环境变量-taro_app_id
28
+ */
29
+ TARO_APP_ID: string
30
+ }
31
+ }
@@ -14,8 +14,8 @@
14
14
  "ts-check": "tsc -p tsconfig.json"
15
15
  },
16
16
  "dependencies": {
17
- "@kmlckj/licos-dev-sdk": "0.2.5",
18
- "@kmlckj/licos-platform-sdk": "0.6.7",
17
+ "@kmlckj/licos-dev-sdk": "0.2.6",
18
+ "@kmlckj/licos-platform-sdk": "0.6.8",
19
19
  "dotenv": "^17.2.3",
20
20
  "express": "^4.21.2"
21
21
  },