opensoma 0.5.1 → 0.6.0
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/dist/package.json +5 -1
- package/dist/src/agent-browser-launcher.d.ts +43 -0
- package/dist/src/agent-browser-launcher.d.ts.map +1 -0
- package/dist/src/agent-browser-launcher.js +97 -0
- package/dist/src/agent-browser-launcher.js.map +1 -0
- package/dist/src/cli.d.ts.map +1 -1
- package/dist/src/cli.js +3 -2
- package/dist/src/cli.js.map +1 -1
- package/dist/src/client.d.ts +30 -7
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +218 -52
- package/dist/src/client.js.map +1 -1
- package/dist/src/commands/agent-browser.d.ts +3 -0
- package/dist/src/commands/agent-browser.d.ts.map +1 -0
- package/dist/src/commands/agent-browser.js +27 -0
- package/dist/src/commands/agent-browser.js.map +1 -0
- package/dist/src/commands/auth.d.ts +1 -1
- package/dist/src/commands/auth.d.ts.map +1 -1
- package/dist/src/commands/auth.js +4 -2
- package/dist/src/commands/auth.js.map +1 -1
- package/dist/src/commands/dashboard.d.ts +13 -0
- package/dist/src/commands/dashboard.d.ts.map +1 -1
- package/dist/src/commands/dashboard.js +10 -18
- package/dist/src/commands/dashboard.js.map +1 -1
- package/dist/src/commands/helpers.d.ts +1 -1
- package/dist/src/commands/helpers.d.ts.map +1 -1
- package/dist/src/commands/helpers.js +2 -2
- package/dist/src/commands/helpers.js.map +1 -1
- package/dist/src/commands/index.d.ts +2 -1
- package/dist/src/commands/index.d.ts.map +1 -1
- package/dist/src/commands/index.js +2 -1
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/mentoring.d.ts.map +1 -1
- package/dist/src/commands/mentoring.js +54 -29
- package/dist/src/commands/mentoring.js.map +1 -1
- package/dist/src/commands/notice.d.ts.map +1 -1
- package/dist/src/commands/notice.js +2 -1
- package/dist/src/commands/notice.js.map +1 -1
- package/dist/src/commands/report.d.ts.map +1 -1
- package/dist/src/commands/report.js +4 -2
- package/dist/src/commands/report.js.map +1 -1
- package/dist/src/commands/room.d.ts.map +1 -1
- package/dist/src/commands/room.js +125 -2
- package/dist/src/commands/room.js.map +1 -1
- package/dist/src/commands/schedule.d.ts +3 -0
- package/dist/src/commands/schedule.d.ts.map +1 -0
- package/dist/src/commands/schedule.js +27 -0
- package/dist/src/commands/schedule.js.map +1 -0
- package/dist/src/commands/team.d.ts.map +1 -1
- package/dist/src/commands/team.js +55 -4
- package/dist/src/commands/team.js.map +1 -1
- package/dist/src/constants.d.ts +5 -5
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +20 -8
- package/dist/src/constants.js.map +1 -1
- package/dist/src/credential-manager.d.ts +9 -0
- package/dist/src/credential-manager.d.ts.map +1 -1
- package/dist/src/credential-manager.js +24 -0
- package/dist/src/credential-manager.js.map +1 -1
- package/dist/src/formatters.d.ts +11 -3
- package/dist/src/formatters.d.ts.map +1 -1
- package/dist/src/formatters.js +281 -52
- package/dist/src/formatters.js.map +1 -1
- package/dist/src/http.d.ts +8 -0
- package/dist/src/http.d.ts.map +1 -1
- package/dist/src/http.js +29 -1
- package/dist/src/http.js.map +1 -1
- package/dist/src/index.d.ts +4 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/shared/utils/swmaestro.d.ts +34 -1
- package/dist/src/shared/utils/swmaestro.d.ts.map +1 -1
- package/dist/src/shared/utils/swmaestro.js +102 -39
- package/dist/src/shared/utils/swmaestro.js.map +1 -1
- package/dist/src/shared/utils/team-action-params.d.ts +3 -0
- package/dist/src/shared/utils/team-action-params.d.ts.map +1 -0
- package/dist/src/shared/utils/team-action-params.js +10 -0
- package/dist/src/shared/utils/team-action-params.js.map +1 -0
- package/dist/src/shared/utils/team-params.d.ts +12 -0
- package/dist/src/shared/utils/team-params.d.ts.map +1 -0
- package/dist/src/shared/utils/team-params.js +38 -0
- package/dist/src/shared/utils/team-params.js.map +1 -0
- package/dist/src/types.d.ts +147 -10
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +74 -6
- package/dist/src/types.js.map +1 -1
- package/package.json +5 -1
- package/src/agent-browser-launcher.test.ts +263 -0
- package/src/agent-browser-launcher.ts +159 -0
- package/src/cli.ts +4 -2
- package/src/client.test.ts +673 -30
- package/src/client.ts +277 -67
- package/src/commands/agent-browser.ts +33 -0
- package/src/commands/auth.test.ts +77 -26
- package/src/commands/auth.ts +5 -3
- package/src/commands/dashboard.test.ts +57 -0
- package/src/commands/dashboard.ts +22 -19
- package/src/commands/helpers.test.ts +72 -25
- package/src/commands/helpers.ts +3 -3
- package/src/commands/index.ts +2 -1
- package/src/commands/mentoring.ts +60 -29
- package/src/commands/notice.ts +2 -1
- package/src/commands/report.ts +4 -2
- package/src/commands/room.ts +160 -1
- package/src/commands/schedule.ts +32 -0
- package/src/commands/team.ts +73 -5
- package/src/constants.ts +20 -8
- package/src/credential-manager.test.ts +44 -0
- package/src/credential-manager.ts +27 -0
- package/src/formatters.test.ts +528 -33
- package/src/formatters.ts +309 -55
- package/src/http.test.ts +71 -2
- package/src/http.ts +41 -2
- package/src/index.ts +10 -1
- package/src/shared/utils/swmaestro.test.ts +245 -9
- package/src/shared/utils/swmaestro.ts +150 -47
- package/src/shared/utils/team-action-params.test.ts +32 -0
- package/src/shared/utils/team-action-params.ts +10 -0
- package/src/shared/utils/team-params.test.ts +141 -0
- package/src/shared/utils/team-params.ts +53 -0
- package/src/types.test.ts +26 -13
- package/src/types.ts +87 -7
- package/dist/src/commands/event.d.ts +0 -3
- package/dist/src/commands/event.d.ts.map +0 -1
- package/dist/src/commands/event.js +0 -58
- package/dist/src/commands/event.js.map +0 -1
- package/src/commands/event.ts +0 -73
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
|
+
|
|
3
|
+
import { MENU_NO } from '../../constants'
|
|
4
|
+
import { buildTeamListParams, parseTeamSearchQuery } from './team-params'
|
|
5
|
+
|
|
6
|
+
describe('parseTeamSearchQuery', () => {
|
|
7
|
+
it('defaults plain text to an all-fields search', () => {
|
|
8
|
+
expect(parseTeamSearchQuery('전수열')).toEqual({ field: 'all', value: '전수열' })
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
it('parses the "team:" prefix as a team-name search', () => {
|
|
12
|
+
expect(parseTeamSearchQuery('team:오픈소마')).toEqual({ field: 'team', value: '오픈소마' })
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
it('parses the "member:" prefix as a member-name search', () => {
|
|
16
|
+
expect(parseTeamSearchQuery('member:김철수')).toEqual({ field: 'member', value: '김철수' })
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('parses the "mentor:" prefix as a mentor-name search', () => {
|
|
20
|
+
expect(parseTeamSearchQuery('mentor:전수열')).toEqual({ field: 'mentor', value: '전수열' })
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('parses the "project:" prefix as a project-name search', () => {
|
|
24
|
+
expect(parseTeamSearchQuery('project:Previzion')).toEqual({ field: 'project', value: 'Previzion' })
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('parses the "all:" prefix as an all-fields search', () => {
|
|
28
|
+
expect(parseTeamSearchQuery('all:전수열')).toEqual({ field: 'all', value: '전수열' })
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it('sets the "me" flag when parsing "mentor:@me"', () => {
|
|
32
|
+
expect(parseTeamSearchQuery('mentor:@me')).toEqual({ field: 'mentor', value: '@me', me: true })
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('sets the "me" flag when parsing "member:@me"', () => {
|
|
36
|
+
expect(parseTeamSearchQuery('member:@me')).toEqual({ field: 'member', value: '@me', me: true })
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('does not set the "me" flag for "team:@me" or "project:@me"', () => {
|
|
40
|
+
expect(parseTeamSearchQuery('team:@me')).toEqual({ field: 'team', value: '@me' })
|
|
41
|
+
expect(parseTeamSearchQuery('project:@me')).toEqual({ field: 'project', value: '@me' })
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('treats an unknown prefix as a plain all-fields search', () => {
|
|
45
|
+
expect(parseTeamSearchQuery('foo:bar')).toEqual({ field: 'all', value: 'foo:bar' })
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it('preserves everything after the first colon when the value contains colons', () => {
|
|
49
|
+
expect(parseTeamSearchQuery('team:foo:bar')).toEqual({ field: 'team', value: 'foo:bar' })
|
|
50
|
+
})
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
describe('buildTeamListParams', () => {
|
|
54
|
+
it('returns only menuNo when no options are passed', () => {
|
|
55
|
+
expect(buildTeamListParams()).toEqual({ menuNo: MENU_NO.TEAM })
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
it('omits search params when search is not provided', () => {
|
|
59
|
+
expect(buildTeamListParams({})).toEqual({ menuNo: MENU_NO.TEAM })
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('sets searchCnd="" for an all-fields search', () => {
|
|
63
|
+
expect(buildTeamListParams({ search: { field: 'all', value: '전수열' } })).toEqual({
|
|
64
|
+
menuNo: MENU_NO.TEAM,
|
|
65
|
+
searchCnd: '',
|
|
66
|
+
searchWrd: '전수열',
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('sets searchCnd=1 for a member-name search', () => {
|
|
71
|
+
expect(buildTeamListParams({ search: { field: 'member', value: '김철수' } })).toEqual({
|
|
72
|
+
menuNo: MENU_NO.TEAM,
|
|
73
|
+
searchCnd: '1',
|
|
74
|
+
searchWrd: '김철수',
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
it('sets searchCnd=2 for a mentor-name search', () => {
|
|
79
|
+
expect(buildTeamListParams({ search: { field: 'mentor', value: '전수열' } })).toEqual({
|
|
80
|
+
menuNo: MENU_NO.TEAM,
|
|
81
|
+
searchCnd: '2',
|
|
82
|
+
searchWrd: '전수열',
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('sets searchCnd=3 for a project-name search', () => {
|
|
87
|
+
expect(buildTeamListParams({ search: { field: 'project', value: 'Previzion' } })).toEqual({
|
|
88
|
+
menuNo: MENU_NO.TEAM,
|
|
89
|
+
searchCnd: '3',
|
|
90
|
+
searchWrd: 'Previzion',
|
|
91
|
+
})
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
it('sets searchCnd=4 for a team-name search', () => {
|
|
95
|
+
expect(buildTeamListParams({ search: { field: 'team', value: '오픈소마' } })).toEqual({
|
|
96
|
+
menuNo: MENU_NO.TEAM,
|
|
97
|
+
searchCnd: '4',
|
|
98
|
+
searchWrd: '오픈소마',
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('substitutes the current user name when "mentor:@me" is used', () => {
|
|
103
|
+
expect(
|
|
104
|
+
buildTeamListParams({
|
|
105
|
+
search: { field: 'mentor', value: '@me', me: true },
|
|
106
|
+
user: { userId: 'neo@example.com', userNm: '전수열' },
|
|
107
|
+
}),
|
|
108
|
+
).toEqual({
|
|
109
|
+
menuNo: MENU_NO.TEAM,
|
|
110
|
+
searchCnd: '2',
|
|
111
|
+
searchWrd: '전수열',
|
|
112
|
+
})
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
it('substitutes the current user name when "member:@me" is used', () => {
|
|
116
|
+
expect(
|
|
117
|
+
buildTeamListParams({
|
|
118
|
+
search: { field: 'member', value: '@me', me: true },
|
|
119
|
+
user: { userId: 'neo@example.com', userNm: '강동우' },
|
|
120
|
+
}),
|
|
121
|
+
).toEqual({
|
|
122
|
+
menuNo: MENU_NO.TEAM,
|
|
123
|
+
searchCnd: '1',
|
|
124
|
+
searchWrd: '강동우',
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('does not emit a searchId param (the native team page does not accept it)', () => {
|
|
129
|
+
const params = buildTeamListParams({
|
|
130
|
+
search: { field: 'mentor', value: '@me', me: true },
|
|
131
|
+
user: { userId: 'neo@example.com', userNm: '전수열' },
|
|
132
|
+
})
|
|
133
|
+
expect(params).not.toHaveProperty('searchId')
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
it('omits search params when "@me" is requested but the user identity is unavailable', () => {
|
|
137
|
+
expect(buildTeamListParams({ search: { field: 'mentor', value: '@me', me: true } })).toEqual({
|
|
138
|
+
menuNo: MENU_NO.TEAM,
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
})
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { MENU_NO } from '../../constants'
|
|
2
|
+
import type { UserIdentity } from '../../http'
|
|
3
|
+
|
|
4
|
+
const SEARCH_FIELD_MAP: Record<string, string> = {
|
|
5
|
+
all: '',
|
|
6
|
+
member: '1',
|
|
7
|
+
mentor: '2',
|
|
8
|
+
project: '3',
|
|
9
|
+
team: '4',
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface TeamSearchQuery {
|
|
13
|
+
field: 'all' | 'member' | 'mentor' | 'project' | 'team'
|
|
14
|
+
value: string
|
|
15
|
+
me?: boolean
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function parseTeamSearchQuery(raw: string): TeamSearchQuery {
|
|
19
|
+
const colonIndex = raw.indexOf(':')
|
|
20
|
+
if (colonIndex === -1) {
|
|
21
|
+
return { field: 'all', value: raw }
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const field = raw.slice(0, colonIndex) as TeamSearchQuery['field']
|
|
25
|
+
if (!(field in SEARCH_FIELD_MAP)) {
|
|
26
|
+
return { field: 'all', value: raw }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const value = raw.slice(colonIndex + 1)
|
|
30
|
+
const me = (field === 'mentor' || field === 'member') && value === '@me'
|
|
31
|
+
return me ? { field, value, me } : { field, value }
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function buildTeamListParams(options?: {
|
|
35
|
+
search?: TeamSearchQuery
|
|
36
|
+
user?: UserIdentity
|
|
37
|
+
}): Record<string, string> {
|
|
38
|
+
const params: Record<string, string> = { menuNo: MENU_NO.TEAM }
|
|
39
|
+
|
|
40
|
+
if (options?.search) {
|
|
41
|
+
if (options.search.me) {
|
|
42
|
+
if (options.user) {
|
|
43
|
+
params.searchCnd = SEARCH_FIELD_MAP[options.search.field]
|
|
44
|
+
params.searchWrd = options.user.userNm
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
params.searchCnd = SEARCH_FIELD_MAP[options.search.field]
|
|
48
|
+
params.searchWrd = options.search.value
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return params
|
|
53
|
+
}
|
package/src/types.test.ts
CHANGED
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
ApprovalListItemSchema,
|
|
6
6
|
CredentialsSchema,
|
|
7
7
|
DashboardSchema,
|
|
8
|
-
EventListItemSchema,
|
|
9
8
|
MemberInfoSchema,
|
|
10
9
|
MentoringDetailSchema,
|
|
11
10
|
MentoringListItemSchema,
|
|
@@ -16,6 +15,7 @@ import {
|
|
|
16
15
|
ReportDetailSchema,
|
|
17
16
|
ReportListItemSchema,
|
|
18
17
|
RoomCardSchema,
|
|
18
|
+
ScheduleListItemSchema,
|
|
19
19
|
TeamInfoSchema,
|
|
20
20
|
} from './types'
|
|
21
21
|
|
|
@@ -79,6 +79,7 @@ describe('schemas', () => {
|
|
|
79
79
|
organization: 'Indent',
|
|
80
80
|
position: '',
|
|
81
81
|
team: { name: '오픈소마', members: '전수열, 김개발', mentor: '전수열' },
|
|
82
|
+
teams: [],
|
|
82
83
|
mentoringSessions: [{ title: 'AI 멘토링', url: '/mentoring/1', status: '접수중' }],
|
|
83
84
|
roomReservations: [{ title: 'A1 회의', url: '/room/1', status: '예약완료' }],
|
|
84
85
|
}
|
|
@@ -109,8 +110,23 @@ describe('schemas', () => {
|
|
|
109
110
|
it('preserves valid TeamInfo values through parse', () => {
|
|
110
111
|
const input = {
|
|
111
112
|
teams: [
|
|
112
|
-
{
|
|
113
|
-
|
|
113
|
+
{
|
|
114
|
+
name: '오픈소마',
|
|
115
|
+
projectName: 'Previzion',
|
|
116
|
+
ownerId: 'owner-1',
|
|
117
|
+
teamId: 'team-a',
|
|
118
|
+
leader: '전수열',
|
|
119
|
+
members: [
|
|
120
|
+
{ name: '전수열', userId: 'uid-1' },
|
|
121
|
+
{ name: '강동우', userId: 'uid-2' },
|
|
122
|
+
],
|
|
123
|
+
mentors: [{ name: '문승현', userId: 'uid-m1' }],
|
|
124
|
+
ictCategoryMajor: 'SW·SI',
|
|
125
|
+
ictCategoryMinor: '응용SW',
|
|
126
|
+
teamCompleted: true,
|
|
127
|
+
mentorCompleted: false,
|
|
128
|
+
joinStatus: '완료',
|
|
129
|
+
},
|
|
114
130
|
],
|
|
115
131
|
currentTeams: 1,
|
|
116
132
|
maxTeams: 100,
|
|
@@ -131,17 +147,14 @@ describe('schemas', () => {
|
|
|
131
147
|
expect(MemberInfoSchema.parse(input)).toEqual(input)
|
|
132
148
|
})
|
|
133
149
|
|
|
134
|
-
it('preserves valid
|
|
150
|
+
it('preserves valid ScheduleListItem values through parse', () => {
|
|
135
151
|
const input = {
|
|
136
|
-
id:
|
|
137
|
-
category: '
|
|
138
|
-
title: '
|
|
139
|
-
|
|
140
|
-
eventPeriod: { start: '2026-04-10', end: '2026-04-10' },
|
|
141
|
-
status: '접수중',
|
|
142
|
-
createdAt: '2026-03-30',
|
|
152
|
+
id: 1,
|
|
153
|
+
category: '교육',
|
|
154
|
+
title: '[교육] 디자인씽킹 교육',
|
|
155
|
+
period: { start: '2026-04-21', end: '2026-04-26' },
|
|
143
156
|
}
|
|
144
|
-
expect(
|
|
157
|
+
expect(ScheduleListItemSchema.parse(input)).toEqual(input)
|
|
145
158
|
})
|
|
146
159
|
|
|
147
160
|
it('preserves valid ApplicationHistoryItem values through parse', () => {
|
|
@@ -266,7 +279,7 @@ describe('schemas', () => {
|
|
|
266
279
|
).toThrow()
|
|
267
280
|
expect(() => TeamInfoSchema.parse({ teams: [{ name: '김개발' }], currentTeams: 1, maxTeams: 100 })).toThrow()
|
|
268
281
|
expect(() => MemberInfoSchema.parse({ email: 1, name: '전수열' })).toThrow()
|
|
269
|
-
expect(() =>
|
|
282
|
+
expect(() => ScheduleListItemSchema.parse({ id: 1, category: '교육', title: '강의' })).toThrow()
|
|
270
283
|
expect(() => ApplicationHistoryItemSchema.parse({ id: 1, status: '신청완료' })).toThrow()
|
|
271
284
|
expect(() => PaginationSchema.parse({ total: '23', currentPage: 2, totalPages: 3 })).toThrow()
|
|
272
285
|
expect(() => CredentialsSchema.parse({ sessionCookie: 'cookie' })).toThrow()
|
package/src/types.ts
CHANGED
|
@@ -18,9 +18,22 @@ const DashboardStatusItemSchema = z.object({
|
|
|
18
18
|
venue: z.string().optional(),
|
|
19
19
|
type: z.enum(['자유 멘토링', '멘토 특강']).optional(),
|
|
20
20
|
})
|
|
21
|
+
const TeamMemberSchema = z.object({
|
|
22
|
+
name: z.string(),
|
|
23
|
+
userId: z.string(),
|
|
24
|
+
})
|
|
21
25
|
const TeamListItemSchema = z.object({
|
|
22
26
|
name: z.string(),
|
|
23
|
-
|
|
27
|
+
projectName: z.string(),
|
|
28
|
+
ownerId: z.string(),
|
|
29
|
+
teamId: z.string(),
|
|
30
|
+
leader: z.string(),
|
|
31
|
+
members: z.array(TeamMemberSchema),
|
|
32
|
+
mentors: z.array(TeamMemberSchema),
|
|
33
|
+
ictCategoryMajor: z.string(),
|
|
34
|
+
ictCategoryMinor: z.string(),
|
|
35
|
+
teamCompleted: z.boolean(),
|
|
36
|
+
mentorCompleted: z.boolean(),
|
|
24
37
|
joinStatus: z.string(),
|
|
25
38
|
})
|
|
26
39
|
|
|
@@ -54,6 +67,23 @@ export const MentoringDetailSchema = MentoringListItemSchema.extend({
|
|
|
54
67
|
})
|
|
55
68
|
export type MentoringDetail = z.infer<typeof MentoringDetailSchema>
|
|
56
69
|
|
|
70
|
+
export const MentoringEditFormSchema = z.object({
|
|
71
|
+
id: z.number(),
|
|
72
|
+
title: z.string(),
|
|
73
|
+
reportCd: z.string(),
|
|
74
|
+
receiptType: z.enum(['UNTIL_LECTURE', 'DIRECT']),
|
|
75
|
+
bgndeDate: z.string(),
|
|
76
|
+
bgndeTime: z.string(),
|
|
77
|
+
enddeDate: z.string(),
|
|
78
|
+
enddeTime: z.string(),
|
|
79
|
+
eventDt: z.string(),
|
|
80
|
+
eventStime: z.string(),
|
|
81
|
+
eventEtime: z.string(),
|
|
82
|
+
applyCnt: z.number(),
|
|
83
|
+
place: z.string(),
|
|
84
|
+
})
|
|
85
|
+
export type MentoringEditForm = z.infer<typeof MentoringEditFormSchema>
|
|
86
|
+
|
|
57
87
|
export const RoomCardSchema = z.object({
|
|
58
88
|
itemId: z.number(),
|
|
59
89
|
name: z.string(),
|
|
@@ -64,11 +94,55 @@ export const RoomCardSchema = z.object({
|
|
|
64
94
|
})
|
|
65
95
|
export type RoomCard = z.infer<typeof RoomCardSchema>
|
|
66
96
|
|
|
97
|
+
export const RoomReservationStatusSchema = z.enum(['confirmed', 'cancelled', 'unknown'])
|
|
98
|
+
export type RoomReservationStatus = z.infer<typeof RoomReservationStatusSchema>
|
|
99
|
+
|
|
100
|
+
export const RoomReservationDetailSchema = z.object({
|
|
101
|
+
rentId: z.number(),
|
|
102
|
+
itemId: z.number(),
|
|
103
|
+
title: z.string(),
|
|
104
|
+
date: z.string(),
|
|
105
|
+
startTime: z.string(),
|
|
106
|
+
endTime: z.string(),
|
|
107
|
+
attendees: z.number(),
|
|
108
|
+
notes: z.string(),
|
|
109
|
+
status: RoomReservationStatusSchema,
|
|
110
|
+
statusCode: z.string(),
|
|
111
|
+
})
|
|
112
|
+
export type RoomReservationDetail = z.infer<typeof RoomReservationDetailSchema>
|
|
113
|
+
|
|
114
|
+
export const RoomReservationListItemSchema = z.object({
|
|
115
|
+
rentId: z.number(),
|
|
116
|
+
venue: z.string(),
|
|
117
|
+
title: z.string(),
|
|
118
|
+
date: z.string(),
|
|
119
|
+
startTime: z.string(),
|
|
120
|
+
endTime: z.string(),
|
|
121
|
+
author: z.string(),
|
|
122
|
+
status: RoomReservationStatusSchema,
|
|
123
|
+
statusLabel: z.string(),
|
|
124
|
+
registeredAt: z.string(),
|
|
125
|
+
})
|
|
126
|
+
export type RoomReservationListItem = z.infer<typeof RoomReservationListItemSchema>
|
|
127
|
+
|
|
128
|
+
export const RoomUpdateOptionsSchema = z.object({
|
|
129
|
+
title: z.string().optional(),
|
|
130
|
+
roomId: z.number().optional(),
|
|
131
|
+
date: z.string().optional(),
|
|
132
|
+
slots: z.array(z.string()).optional(),
|
|
133
|
+
attendees: z.number().optional(),
|
|
134
|
+
notes: z.string().optional(),
|
|
135
|
+
})
|
|
136
|
+
export type RoomUpdateOptions = z.infer<typeof RoomUpdateOptionsSchema>
|
|
137
|
+
|
|
67
138
|
export const DashboardSchema = z.object({
|
|
68
139
|
name: z.string(),
|
|
69
140
|
role: z.string(),
|
|
70
141
|
organization: z.string(),
|
|
71
142
|
position: z.string(),
|
|
143
|
+
// Mirrors the single team the native dashboard HTML renders in `ul.dash-box`.
|
|
144
|
+
// The native page only ever surfaces one team here even when the user belongs
|
|
145
|
+
// to multiple. For the full set, see `teams` below.
|
|
72
146
|
team: z
|
|
73
147
|
.object({
|
|
74
148
|
name: z.string(),
|
|
@@ -76,6 +150,9 @@ export const DashboardSchema = z.object({
|
|
|
76
150
|
mentor: z.string(),
|
|
77
151
|
})
|
|
78
152
|
.optional(),
|
|
153
|
+
// Enriched from `team.list()` so consumers see every team the user belongs to,
|
|
154
|
+
// not just the one the native dashboard chose to render.
|
|
155
|
+
teams: z.array(TeamListItemSchema),
|
|
79
156
|
mentoringSessions: z.array(DashboardStatusItemSchema),
|
|
80
157
|
roomReservations: z.array(DashboardStatusItemSchema),
|
|
81
158
|
})
|
|
@@ -94,6 +171,8 @@ export const NoticeDetailSchema = NoticeListItemSchema.extend({
|
|
|
94
171
|
})
|
|
95
172
|
export type NoticeDetail = z.infer<typeof NoticeDetailSchema>
|
|
96
173
|
|
|
174
|
+
export type TeamMember = z.infer<typeof TeamMemberSchema>
|
|
175
|
+
export type TeamListItem = z.infer<typeof TeamListItemSchema>
|
|
97
176
|
export const TeamInfoSchema = z.object({
|
|
98
177
|
teams: z.array(TeamListItemSchema),
|
|
99
178
|
currentTeams: z.number(),
|
|
@@ -112,21 +191,19 @@ export const MemberInfoSchema = z.object({
|
|
|
112
191
|
})
|
|
113
192
|
export type MemberInfo = z.infer<typeof MemberInfoSchema>
|
|
114
193
|
|
|
115
|
-
export const
|
|
194
|
+
export const ScheduleListItemSchema = z.object({
|
|
116
195
|
id: z.number(),
|
|
117
196
|
category: z.string(),
|
|
118
197
|
title: z.string(),
|
|
119
|
-
|
|
120
|
-
eventPeriod: DateRangeSchema,
|
|
121
|
-
status: z.string(),
|
|
122
|
-
createdAt: z.string(),
|
|
198
|
+
period: DateRangeSchema,
|
|
123
199
|
})
|
|
124
|
-
export type
|
|
200
|
+
export type ScheduleListItem = z.infer<typeof ScheduleListItemSchema>
|
|
125
201
|
|
|
126
202
|
export const ApplicationHistoryItemSchema = z.object({
|
|
127
203
|
id: z.number(),
|
|
128
204
|
category: z.string(),
|
|
129
205
|
title: z.string(),
|
|
206
|
+
url: z.string().optional(),
|
|
130
207
|
author: z.string(),
|
|
131
208
|
sessionDate: z.string(),
|
|
132
209
|
appliedAt: z.string(),
|
|
@@ -294,8 +371,11 @@ export const MentoringCreateOptionsSchema = z.object({
|
|
|
294
371
|
endTime: z.string(),
|
|
295
372
|
venue: z.string(),
|
|
296
373
|
maxAttendees: z.number().optional(),
|
|
374
|
+
receiptType: z.enum(['UNTIL_LECTURE', 'DIRECT']).optional(),
|
|
297
375
|
regStart: z.string().optional(),
|
|
376
|
+
regStartTime: z.string().optional(),
|
|
298
377
|
regEnd: z.string().optional(),
|
|
378
|
+
regEndTime: z.string().optional(),
|
|
299
379
|
content: z.string().optional(),
|
|
300
380
|
})
|
|
301
381
|
export type MentoringCreateOptions = z.infer<typeof MentoringCreateOptionsSchema>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../../src/commands/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAkDnC,eAAO,MAAM,YAAY,SAsBtB,CAAA"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { MENU_NO } from '../constants.js';
|
|
3
|
-
import * as formatters from '../formatters.js';
|
|
4
|
-
import { handleError } from '../shared/utils/error-handler.js';
|
|
5
|
-
import { formatOutput } from '../shared/utils/output.js';
|
|
6
|
-
import { buildApplicationPayload, parseEventDetail } from '../shared/utils/swmaestro.js';
|
|
7
|
-
import { getHttpOrExit } from './helpers.js';
|
|
8
|
-
async function listAction(options) {
|
|
9
|
-
try {
|
|
10
|
-
const http = await getHttpOrExit();
|
|
11
|
-
const html = await http.get('/mypage/applicants/list.do', {
|
|
12
|
-
menuNo: MENU_NO.EVENT,
|
|
13
|
-
...(options.page ? { pageIndex: options.page } : {}),
|
|
14
|
-
});
|
|
15
|
-
console.log(formatOutput({ items: formatters.parseEventList(html), pagination: formatters.parsePagination(html) }, options.pretty));
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
handleError(error);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
async function getAction(id, options) {
|
|
22
|
-
try {
|
|
23
|
-
const http = await getHttpOrExit();
|
|
24
|
-
const html = await http.get('/mypage/applicants/view.do', { menuNo: MENU_NO.EVENT, bbsId: id });
|
|
25
|
-
console.log(formatOutput(parseEventDetail(html), options.pretty));
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
handleError(error);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
async function applyAction(id, options) {
|
|
32
|
-
try {
|
|
33
|
-
const http = await getHttpOrExit();
|
|
34
|
-
await http.post('/application/application/application.do', buildApplicationPayload(Number.parseInt(id, 10)));
|
|
35
|
-
console.log(formatOutput({ ok: true }, options.pretty));
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
handleError(error);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export const eventCommand = new Command('event')
|
|
42
|
-
.description('Browse and apply to events')
|
|
43
|
-
.addCommand(new Command('list')
|
|
44
|
-
.description('List events')
|
|
45
|
-
.option('--page <n>', 'Page number')
|
|
46
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
47
|
-
.action(listAction))
|
|
48
|
-
.addCommand(new Command('get')
|
|
49
|
-
.description('Get event detail')
|
|
50
|
-
.argument('<id>')
|
|
51
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
52
|
-
.action(getAction))
|
|
53
|
-
.addCommand(new Command('apply')
|
|
54
|
-
.description('Apply to an event')
|
|
55
|
-
.argument('<id>')
|
|
56
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
57
|
-
.action(applyAction));
|
|
58
|
-
//# sourceMappingURL=event.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event.js","sourceRoot":"","sources":["../../../src/commands/event.ts"],"names":[],"mappings":"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"}
|
package/src/commands/event.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander'
|
|
2
|
-
|
|
3
|
-
import { MENU_NO } from '../constants'
|
|
4
|
-
import * as formatters from '../formatters'
|
|
5
|
-
import { handleError } from '../shared/utils/error-handler'
|
|
6
|
-
import { formatOutput } from '../shared/utils/output'
|
|
7
|
-
import { buildApplicationPayload, parseEventDetail } from '../shared/utils/swmaestro'
|
|
8
|
-
import { getHttpOrExit } from './helpers'
|
|
9
|
-
|
|
10
|
-
type ListOptions = { page?: string; pretty?: boolean }
|
|
11
|
-
type GetOptions = { pretty?: boolean }
|
|
12
|
-
|
|
13
|
-
async function listAction(options: ListOptions): Promise<void> {
|
|
14
|
-
try {
|
|
15
|
-
const http = await getHttpOrExit()
|
|
16
|
-
const html = await http.get('/mypage/applicants/list.do', {
|
|
17
|
-
menuNo: MENU_NO.EVENT,
|
|
18
|
-
...(options.page ? { pageIndex: options.page } : {}),
|
|
19
|
-
})
|
|
20
|
-
console.log(
|
|
21
|
-
formatOutput(
|
|
22
|
-
{ items: formatters.parseEventList(html), pagination: formatters.parsePagination(html) },
|
|
23
|
-
options.pretty,
|
|
24
|
-
),
|
|
25
|
-
)
|
|
26
|
-
} catch (error) {
|
|
27
|
-
handleError(error)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
async function getAction(id: string, options: GetOptions): Promise<void> {
|
|
32
|
-
try {
|
|
33
|
-
const http = await getHttpOrExit()
|
|
34
|
-
const html = await http.get('/mypage/applicants/view.do', { menuNo: MENU_NO.EVENT, bbsId: id })
|
|
35
|
-
console.log(formatOutput(parseEventDetail(html), options.pretty))
|
|
36
|
-
} catch (error) {
|
|
37
|
-
handleError(error)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async function applyAction(id: string, options: GetOptions): Promise<void> {
|
|
42
|
-
try {
|
|
43
|
-
const http = await getHttpOrExit()
|
|
44
|
-
await http.post('/application/application/application.do', buildApplicationPayload(Number.parseInt(id, 10)))
|
|
45
|
-
console.log(formatOutput({ ok: true }, options.pretty))
|
|
46
|
-
} catch (error) {
|
|
47
|
-
handleError(error)
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const eventCommand = new Command('event')
|
|
52
|
-
.description('Browse and apply to events')
|
|
53
|
-
.addCommand(
|
|
54
|
-
new Command('list')
|
|
55
|
-
.description('List events')
|
|
56
|
-
.option('--page <n>', 'Page number')
|
|
57
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
58
|
-
.action(listAction),
|
|
59
|
-
)
|
|
60
|
-
.addCommand(
|
|
61
|
-
new Command('get')
|
|
62
|
-
.description('Get event detail')
|
|
63
|
-
.argument('<id>')
|
|
64
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
65
|
-
.action(getAction),
|
|
66
|
-
)
|
|
67
|
-
.addCommand(
|
|
68
|
-
new Command('apply')
|
|
69
|
-
.description('Apply to an event')
|
|
70
|
-
.argument('<id>')
|
|
71
|
-
.option('--pretty', 'Pretty print JSON output')
|
|
72
|
-
.action(applyAction),
|
|
73
|
-
)
|