@jsb188/app 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +29 -29
- package/src/constants/agent.ts +49 -0
- package/src/constants/app.ts +20 -19
- package/src/constants/wsActions.ts +2 -1
- package/src/i18n/account.ts +40 -17
- package/src/i18n/{ai_agent.ts → agent.ts} +60 -10
- package/src/i18n/app.ts +31 -4
- package/src/i18n/auth.ts +32 -32
- package/src/i18n/billing.ts +1 -1
- package/src/i18n/error.ts +48 -20
- package/src/i18n/form.ts +86 -6
- package/src/i18n/index.ts +9 -3
- package/src/i18n/log.ts +121 -73
- package/src/i18n/message.ts +4 -1
- package/src/i18n/org.ts +96 -10
- package/src/i18n/product.ts +22 -21
- package/src/i18n/sheet.ts +10 -0
- package/src/i18n/workflow.ts +25 -0
- package/src/types/ai.d.ts +2 -1
- package/src/types/app.d.ts +3 -1
- package/src/types/form.d.ts +56 -21
- package/src/types/node-polyglot.d.ts +23 -0
- package/src/types/other.d.ts +15 -0
- package/src/utils/api.ts +30 -19
- package/src/utils/cron.ts +279 -0
- package/src/utils/datetime.ts +206 -83
- package/src/utils/logic.ts +110 -0
- package/src/utils/number.ts +1 -1
- package/src/utils/object.ts +87 -18
- package/src/utils/string.test.ts +281 -0
- package/src/utils/string.ts +532 -292
- package/src/utils/timeZone.ts +6 -3
- package/src/utils/url_client.ts +11 -11
- package/tsconfig.json +0 -1
- package/src/constants/storage.ts +0 -4
- package/src/types/account.d.ts +0 -63
- package/src/types/storage.d.ts +0 -70
package/src/utils/timeZone.ts
CHANGED
|
@@ -2499,6 +2499,7 @@ export function getDayLightSavingsInfo(tz: string, d?: Date) {
|
|
|
2499
2499
|
* @param date - Date object or date string to extract time from if hhmmStr is not provided
|
|
2500
2500
|
* @param addAMPM - If true, return time in "HH:MM AM/PM" format, otherwise "HH:MM" format
|
|
2501
2501
|
* @param timeZone - Timezone string (IANA format), defaults to DEFAULT_TIMEZONE
|
|
2502
|
+
* @param short - If true, hide ":00" minutes (e.g. "5 PM" instead of "5:00 PM")
|
|
2502
2503
|
* @returns {string} - Formatted time string
|
|
2503
2504
|
*/
|
|
2504
2505
|
|
|
@@ -2507,6 +2508,7 @@ export function hhmmFromDateOrTime(
|
|
|
2507
2508
|
dVal: Date | string | null,
|
|
2508
2509
|
addAMPM: boolean,
|
|
2509
2510
|
timeZone?: string | null,
|
|
2511
|
+
short?: boolean,
|
|
2510
2512
|
): string {
|
|
2511
2513
|
let hhmm: string = '';
|
|
2512
2514
|
if (hhmmStr && /^[0-9]{3,4}$/.test(String(hhmmStr))) {
|
|
@@ -2533,13 +2535,14 @@ export function hhmmFromDateOrTime(
|
|
|
2533
2535
|
}
|
|
2534
2536
|
|
|
2535
2537
|
if (hh) {
|
|
2538
|
+
const minuteText = short && mm === '00' ? '' : `:${mm}`;
|
|
2536
2539
|
if (addAMPM) {
|
|
2537
2540
|
const hourNum = parseInt(hh, 10);
|
|
2538
2541
|
const ampm = hourNum >= 12 ? 'PM' : 'AM';
|
|
2539
2542
|
const hour12 = hourNum % 12 === 0 ? 12 : hourNum % 12;
|
|
2540
|
-
return `${hour12}
|
|
2543
|
+
return `${hour12}${minuteText} ${ampm}`;
|
|
2541
2544
|
}
|
|
2542
|
-
return `${hh}
|
|
2545
|
+
return `${hh}${minuteText}`;
|
|
2543
2546
|
}
|
|
2544
2547
|
|
|
2545
2548
|
return '';
|
|
@@ -2584,4 +2587,4 @@ export function getDayOfWeekInTimeZone(date: Date, timeZone: string | null): num
|
|
|
2584
2587
|
Fri: 5,
|
|
2585
2588
|
Sat: 6,
|
|
2586
2589
|
}[day as 'Sun'];
|
|
2587
|
-
}
|
|
2590
|
+
}
|
package/src/utils/url_client.ts
CHANGED
|
@@ -17,24 +17,24 @@ type LinkType = 'USER' | 'KAJI' | 'DATASET' | 'VOICE' | 'FEED' | 'ROOM' | 'THREA
|
|
|
17
17
|
|
|
18
18
|
export function makeUploadsUrl(
|
|
19
19
|
urlPath?: string | null,
|
|
20
|
-
size?:
|
|
21
|
-
|
|
20
|
+
size?: 'small' | 'medium' | 'original',
|
|
21
|
+
download?: boolean,
|
|
22
22
|
): string {
|
|
23
23
|
if (!urlPath) {
|
|
24
24
|
return '';
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
} else {
|
|
34
|
-
// Do size paths here
|
|
27
|
+
const searchParams: string[] = [];
|
|
28
|
+
if (size) {
|
|
29
|
+
searchParams.push(`size=${encodeURIComponent(size)}`);
|
|
30
|
+
}
|
|
31
|
+
if (download) {
|
|
32
|
+
searchParams.push('download=1');
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
|
|
35
|
+
const searchPath = searchParams.length ? `?${searchParams.join('&')}` : '';
|
|
36
|
+
|
|
37
|
+
return 'https://assets.chiefhappiness.co/marketday/' + urlPath + searchPath;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
/**
|
package/tsconfig.json
CHANGED
package/src/constants/storage.ts
DELETED
package/src/types/account.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import type { OrganizationACL, OrganizationRoleEnum } from './organization.d.ts';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Account; phone
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export interface AccountPhoneObj {
|
|
8
|
-
id: number;
|
|
9
|
-
number: string;
|
|
10
|
-
verified: boolean;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Account
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
export interface AccountObj {
|
|
18
|
-
id: number;
|
|
19
|
-
settings: Record<string, any>;
|
|
20
|
-
profile: Partial<{
|
|
21
|
-
firstName: string;
|
|
22
|
-
lastName: string;
|
|
23
|
-
storageId: number | null;
|
|
24
|
-
// phone: AccountPhoneObj | null; // ?? This is a coding mistake, I think
|
|
25
|
-
}>;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface AccountData extends AccountObj {
|
|
29
|
-
__table: 'accounts';
|
|
30
|
-
phone: {
|
|
31
|
-
id: number;
|
|
32
|
-
number: string;
|
|
33
|
-
verified: boolean;
|
|
34
|
-
banned: boolean;
|
|
35
|
-
editAt: Date;
|
|
36
|
-
};
|
|
37
|
-
email: {
|
|
38
|
-
id: number;
|
|
39
|
-
address: string;
|
|
40
|
-
verified: boolean;
|
|
41
|
-
banned: boolean;
|
|
42
|
-
editAt: Date;
|
|
43
|
-
};
|
|
44
|
-
createdAt: Date;
|
|
45
|
-
updatedAt: Date;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Account with membership
|
|
50
|
-
*/
|
|
51
|
-
|
|
52
|
-
export interface AccountMembershipData {
|
|
53
|
-
id: number;
|
|
54
|
-
accountId: number;
|
|
55
|
-
organizationId: number;
|
|
56
|
-
role: OrganizationRoleEnum;
|
|
57
|
-
acl: OrganizationACL;
|
|
58
|
-
notes?: string;
|
|
59
|
-
primary: boolean;
|
|
60
|
-
createdAt: Date;
|
|
61
|
-
updatedAt: Date;
|
|
62
|
-
account: AccountData;
|
|
63
|
-
}
|
package/src/types/storage.d.ts
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { STORAGE_INTENT_ENUMS } from '../constants/storage.ts';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Enums
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export type StorageIntentEnum = typeof STORAGE_INTENT_ENUMS[number];
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Storage
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
export interface StorageData {
|
|
14
|
-
__table: 'storage';
|
|
15
|
-
id: number;
|
|
16
|
-
organizationId: number | null;
|
|
17
|
-
accountId: number | null;
|
|
18
|
-
uri: string;
|
|
19
|
-
size: number;
|
|
20
|
-
checked: boolean;
|
|
21
|
-
at: Date;
|
|
22
|
-
contentType: string;
|
|
23
|
-
values: Record<string, any> | null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface StorageGQL {
|
|
27
|
-
__deleted?: boolean;
|
|
28
|
-
|
|
29
|
-
id: string;
|
|
30
|
-
organizationId: string | null;
|
|
31
|
-
accountId: string | null;
|
|
32
|
-
uri: string;
|
|
33
|
-
size: number;
|
|
34
|
-
checked: boolean;
|
|
35
|
-
at: Date;
|
|
36
|
-
contentType: string;
|
|
37
|
-
|
|
38
|
-
// client-side only
|
|
39
|
-
uploadStatus?: 'ERROR' | 'UPLOADING' | null;
|
|
40
|
-
|
|
41
|
-
// metadata
|
|
42
|
-
name: string | null;
|
|
43
|
-
description: string | null;
|
|
44
|
-
aiNote: string | null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export type StorageUploadObj = Partial<{
|
|
48
|
-
uploaderAccountId: number;
|
|
49
|
-
values: Partial<{
|
|
50
|
-
name: string;
|
|
51
|
-
description: string;
|
|
52
|
-
aiNote: string;
|
|
53
|
-
}>;
|
|
54
|
-
uploadIntent: {
|
|
55
|
-
intent: StorageIntentEnum;
|
|
56
|
-
entries: [string, string][];
|
|
57
|
-
};
|
|
58
|
-
upsertQuery?: RelatedDocumentUpsertQuery;
|
|
59
|
-
realTimeUpdate?: string; // JSON.stringified object; "{{storageId}}" will be replaced with actual storage ID after upload
|
|
60
|
-
}>;
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Post-upload related document query execution object
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
export interface RelatedDocumentUpsertQuery {
|
|
67
|
-
__table: string;
|
|
68
|
-
conflictKeys: string[];
|
|
69
|
-
data: Record<string, any>;
|
|
70
|
-
}
|