@things-factory/ai-dashboard 10.1.278 → 10.1.279
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 +22 -8
- package/client/bootstrap.ts +0 -25
- package/client/components/card-dialogs.ts +0 -445
- package/client/components/card-library.ts +0 -285
- package/client/components/dashboard-card.ts +0 -411
- package/client/components/proposal-preview.ts +0 -95
- package/client/index.ts +0 -5
- package/client/pages/my-dashboard-page.ts +0 -373
- package/client/route.ts +0 -8
- package/client/tsconfig.json +0 -13
- package/client/utils/card-api.ts +0 -99
- package/client/utils/card-words.ts +0 -91
- package/client/utils/examples.ts +0 -15
- package/dist-client/bootstrap.js.map +0 -1
- package/dist-client/components/card-dialogs.js.map +0 -1
- package/dist-client/components/card-library.js.map +0 -1
- package/dist-client/components/dashboard-card.js.map +0 -1
- package/dist-client/components/proposal-preview.js.map +0 -1
- package/dist-client/index.js.map +0 -1
- package/dist-client/pages/my-dashboard-page.js.map +0 -1
- package/dist-client/route.js.map +0 -1
- package/dist-client/tsconfig.tsbuildinfo +0 -1
- package/dist-client/utils/card-api.js.map +0 -1
- package/dist-client/utils/card-words.js.map +0 -1
- package/dist-client/utils/examples.js.map +0 -1
- package/dist-server/index.js.map +0 -1
- package/dist-server/role-tasks.js.map +0 -1
- package/dist-server/service/card/card-access.js.map +0 -1
- package/dist-server/service/card/card-definition.js.map +0 -1
- package/dist-server/service/card/card-names.js.map +0 -1
- package/dist-server/service/card/card-proposal.js.map +0 -1
- package/dist-server/service/card/card-resolver.js.map +0 -1
- package/dist-server/service/card/card-run.js.map +0 -1
- package/dist-server/service/card/card-tool.js.map +0 -1
- package/dist-server/service/card/card-types.js.map +0 -1
- package/dist-server/service/card/dashboard-card.js.map +0 -1
- package/dist-server/service/card/long-text.js.map +0 -1
- package/dist-server/service/index.js.map +0 -1
- package/dist-server/tsconfig.tsbuildinfo +0 -1
- package/server/index.ts +0 -16
- package/server/role-tasks.ts +0 -12
- package/server/service/card/card-access.test.ts +0 -173
- package/server/service/card/card-access.ts +0 -24
- package/server/service/card/card-definition.ts +0 -468
- package/server/service/card/card-intent.test.ts +0 -285
- package/server/service/card/card-names.ts +0 -12
- package/server/service/card/card-proposal.ts +0 -46
- package/server/service/card/card-resolver.ts +0 -440
- package/server/service/card/card-run.test.ts +0 -237
- package/server/service/card/card-run.ts +0 -302
- package/server/service/card/card-tool.ts +0 -368
- package/server/service/card/card-types.ts +0 -145
- package/server/service/card/card-words.test.ts +0 -72
- package/server/service/card/dashboard-card.ts +0 -303
- package/server/service/card/long-text.ts +0 -25
- package/server/service/index.ts +0 -16
- package/test/card-menu.test.ts +0 -50
- package/test/translations.test.ts +0 -42
- package/test/words-not-codes.test.ts +0 -24
- package/tsconfig.json +0 -9
|
@@ -1,303 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* The four tables of the dashboard cards (ADR-0160 decisions 7, 8, 10): a card and its versions, who it is shared
|
|
3
|
-
* with, and where each person placed the cards they use. A card holds its definition only - never values.
|
|
4
|
-
*/
|
|
5
|
-
import { Column, CreateDateColumn, DeleteDateColumn, Entity, Index, ManyToOne, PrimaryGeneratedColumn, RelationId, UpdateDateColumn } from 'typeorm'
|
|
6
|
-
import { Field, ID, Int, ObjectType, registerEnumType } from 'type-graphql'
|
|
7
|
-
import { GraphQLJSON } from 'graphql-scalars'
|
|
8
|
-
|
|
9
|
-
import { Domain } from '@things-factory/shell'
|
|
10
|
-
import { User } from '@things-factory/auth-base'
|
|
11
|
-
|
|
12
|
-
import { LONG_TEXT, parsedJson } from './long-text.js'
|
|
13
|
-
|
|
14
|
-
/** Who a card is shared with besides its owner - nobody when it has no share row. */
|
|
15
|
-
export enum DashboardCardShareScope {
|
|
16
|
-
/** One person, by user id. */
|
|
17
|
-
USER = 'USER',
|
|
18
|
-
/** The active members of one department, by department id (organization). */
|
|
19
|
-
DEPARTMENT = 'DEPARTMENT',
|
|
20
|
-
/** Whoever holds one role of the domain, by role id (auth-base). */
|
|
21
|
-
ROLE = 'ROLE',
|
|
22
|
-
/** Everyone in the domain. */
|
|
23
|
-
DOMAIN = 'DOMAIN'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
registerEnumType(DashboardCardShareScope, { name: 'DashboardCardShareScope', description: 'Who a dashboard card is shared with: a person, a department, a role or the whole domain.' })
|
|
27
|
-
|
|
28
|
-
@Entity('ai_dashboard_cards')
|
|
29
|
-
@Index('ix_ai_dashboard_card_0', (card: DashboardCard) => [card.domain, card.owner])
|
|
30
|
-
@ObjectType({ description: 'A dashboard card - a definition made with the assistant, run as the viewer when drawn.' })
|
|
31
|
-
export class DashboardCard {
|
|
32
|
-
@PrimaryGeneratedColumn('uuid')
|
|
33
|
-
@Field(type => ID, { description: 'Card id.' })
|
|
34
|
-
readonly id: string
|
|
35
|
-
|
|
36
|
-
@ManyToOne(type => Domain)
|
|
37
|
-
@Field(type => Domain, { nullable: true, description: 'The domain the card is in.' })
|
|
38
|
-
domain?: Domain
|
|
39
|
-
|
|
40
|
-
@RelationId((card: DashboardCard) => card.domain)
|
|
41
|
-
domainId?: string
|
|
42
|
-
|
|
43
|
-
@Column()
|
|
44
|
-
@Field({ description: 'The card name.' })
|
|
45
|
-
name: string
|
|
46
|
-
|
|
47
|
-
@Column({ type: 'text', nullable: true })
|
|
48
|
-
@Field({ nullable: true, description: 'What the card shows, in a line.' })
|
|
49
|
-
description?: string
|
|
50
|
-
|
|
51
|
-
@ManyToOne(type => User)
|
|
52
|
-
@Field(type => User, { nullable: true, description: 'The one who made the card - the only one who changes it.' })
|
|
53
|
-
owner?: User
|
|
54
|
-
|
|
55
|
-
@RelationId((card: DashboardCard) => card.owner)
|
|
56
|
-
ownerId?: string
|
|
57
|
-
|
|
58
|
-
@Column('int')
|
|
59
|
-
@Field(type => Int, { description: 'The current version - one more each time the definition or name changes.' })
|
|
60
|
-
version: number
|
|
61
|
-
|
|
62
|
-
@Column({ ...LONG_TEXT, nullable: false })
|
|
63
|
-
definitionJson: string
|
|
64
|
-
|
|
65
|
-
@Field(type => GraphQLJSON, { description: 'The current definition - what is read, how its rows are shaped and drawn.' })
|
|
66
|
-
get definition(): unknown {
|
|
67
|
-
return parsedJson(this.definitionJson)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
@Column({ nullable: true })
|
|
71
|
-
@Field({ nullable: true, description: 'The card this one was copied from.' })
|
|
72
|
-
copiedFromId?: string
|
|
73
|
-
|
|
74
|
-
@ManyToOne(type => User, { nullable: true })
|
|
75
|
-
@Field(type => User, { nullable: true, description: 'Who created the row.' })
|
|
76
|
-
creator?: User
|
|
77
|
-
|
|
78
|
-
@RelationId((card: DashboardCard) => card.creator)
|
|
79
|
-
creatorId?: string
|
|
80
|
-
|
|
81
|
-
@ManyToOne(type => User, { nullable: true })
|
|
82
|
-
@Field(type => User, { nullable: true, description: 'Who changed the row last.' })
|
|
83
|
-
updater?: User
|
|
84
|
-
|
|
85
|
-
@RelationId((card: DashboardCard) => card.updater)
|
|
86
|
-
updaterId?: string
|
|
87
|
-
|
|
88
|
-
@CreateDateColumn()
|
|
89
|
-
@Field({ nullable: true, description: 'When the card was made.' })
|
|
90
|
-
createdAt?: Date
|
|
91
|
-
|
|
92
|
-
@UpdateDateColumn()
|
|
93
|
-
@Field({ nullable: true, description: 'When the card was changed last.' })
|
|
94
|
-
updatedAt?: Date
|
|
95
|
-
|
|
96
|
-
@DeleteDateColumn()
|
|
97
|
-
@Field({ nullable: true, description: 'When the card was deleted.' })
|
|
98
|
-
deletedAt?: Date
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@Entity('ai_dashboard_card_versions')
|
|
102
|
-
@Index('ix_ai_dashboard_card_version_0', (one: DashboardCardVersion) => [one.card, one.version], { unique: true, where: '"deleted_at" IS NULL' })
|
|
103
|
-
/* A proposal saved once - pressing it again finds this row and answers the same card (decision 9). */
|
|
104
|
-
@Index('ix_ai_dashboard_card_version_1', (one: DashboardCardVersion) => [one.domain, one.proposalSessionId, one.proposalKey], { unique: true, where: '"deleted_at" IS NULL AND "proposal_session_id" IS NOT NULL' })
|
|
105
|
-
@ObjectType({ description: 'One version of a dashboard card - its name and definition as saved then.' })
|
|
106
|
-
export class DashboardCardVersion {
|
|
107
|
-
@PrimaryGeneratedColumn('uuid')
|
|
108
|
-
@Field(type => ID, { description: 'Version row id.' })
|
|
109
|
-
readonly id: string
|
|
110
|
-
|
|
111
|
-
@ManyToOne(type => Domain)
|
|
112
|
-
@Field(type => Domain, { nullable: true, description: 'The domain.' })
|
|
113
|
-
domain?: Domain
|
|
114
|
-
|
|
115
|
-
@RelationId((one: DashboardCardVersion) => one.domain)
|
|
116
|
-
domainId?: string
|
|
117
|
-
|
|
118
|
-
@ManyToOne(type => DashboardCard, { onDelete: 'CASCADE' })
|
|
119
|
-
card?: DashboardCard
|
|
120
|
-
|
|
121
|
-
@RelationId((one: DashboardCardVersion) => one.card)
|
|
122
|
-
@Field({ description: 'The card.' })
|
|
123
|
-
cardId?: string
|
|
124
|
-
|
|
125
|
-
@Column('int')
|
|
126
|
-
@Field(type => Int, { description: 'The version number.' })
|
|
127
|
-
version: number
|
|
128
|
-
|
|
129
|
-
@Column()
|
|
130
|
-
@Field({ description: 'The card name in this version.' })
|
|
131
|
-
name: string
|
|
132
|
-
|
|
133
|
-
@Column({ ...LONG_TEXT, nullable: false })
|
|
134
|
-
definitionJson: string
|
|
135
|
-
|
|
136
|
-
@Field(type => GraphQLJSON, { description: 'The definition in this version.' })
|
|
137
|
-
get definition(): unknown {
|
|
138
|
-
return parsedJson(this.definitionJson)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
@Column({ nullable: true })
|
|
142
|
-
@Field({ nullable: true, description: 'The conversation whose proposal made this version.' })
|
|
143
|
-
proposalSessionId?: string
|
|
144
|
-
|
|
145
|
-
@Column({ nullable: true })
|
|
146
|
-
@Field({ nullable: true, description: 'The proposal that made this version.' })
|
|
147
|
-
proposalKey?: string
|
|
148
|
-
|
|
149
|
-
@ManyToOne(type => User, { nullable: true })
|
|
150
|
-
@Field(type => User, { nullable: true, description: 'Who saved this version.' })
|
|
151
|
-
creator?: User
|
|
152
|
-
|
|
153
|
-
@RelationId((one: DashboardCardVersion) => one.creator)
|
|
154
|
-
creatorId?: string
|
|
155
|
-
|
|
156
|
-
@ManyToOne(type => User, { nullable: true })
|
|
157
|
-
@Field(type => User, { nullable: true, description: 'Who changed the row last.' })
|
|
158
|
-
updater?: User
|
|
159
|
-
|
|
160
|
-
@RelationId((one: DashboardCardVersion) => one.updater)
|
|
161
|
-
updaterId?: string
|
|
162
|
-
|
|
163
|
-
@CreateDateColumn()
|
|
164
|
-
@Field({ nullable: true, description: 'When this version was saved.' })
|
|
165
|
-
createdAt?: Date
|
|
166
|
-
|
|
167
|
-
@UpdateDateColumn()
|
|
168
|
-
@Field({ nullable: true, description: 'When the row was changed last.' })
|
|
169
|
-
updatedAt?: Date
|
|
170
|
-
|
|
171
|
-
@DeleteDateColumn()
|
|
172
|
-
@Field({ nullable: true, description: 'When the row was deleted.' })
|
|
173
|
-
deletedAt?: Date
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
@Entity('ai_dashboard_card_shares')
|
|
177
|
-
@Index('ix_ai_dashboard_card_share_0', (one: DashboardCardShare) => [one.card, one.scope, one.targetId], { unique: true, where: '"deleted_at" IS NULL' })
|
|
178
|
-
@Index('ix_ai_dashboard_card_share_1', (one: DashboardCardShare) => [one.domain, one.scope, one.targetId])
|
|
179
|
-
@ObjectType({ description: 'Who one dashboard card is shared with - a person, a department or the domain.' })
|
|
180
|
-
export class DashboardCardShare {
|
|
181
|
-
@PrimaryGeneratedColumn('uuid')
|
|
182
|
-
@Field(type => ID, { description: 'Share id.' })
|
|
183
|
-
readonly id: string
|
|
184
|
-
|
|
185
|
-
@ManyToOne(type => Domain)
|
|
186
|
-
@Field(type => Domain, { nullable: true, description: 'The domain.' })
|
|
187
|
-
domain?: Domain
|
|
188
|
-
|
|
189
|
-
@RelationId((one: DashboardCardShare) => one.domain)
|
|
190
|
-
domainId?: string
|
|
191
|
-
|
|
192
|
-
@ManyToOne(type => DashboardCard, { onDelete: 'CASCADE' })
|
|
193
|
-
card?: DashboardCard
|
|
194
|
-
|
|
195
|
-
@RelationId((one: DashboardCardShare) => one.card)
|
|
196
|
-
@Field({ description: 'The card shared.' })
|
|
197
|
-
cardId?: string
|
|
198
|
-
|
|
199
|
-
@Column()
|
|
200
|
-
@Field(type => DashboardCardShareScope, { description: 'A person, a department, a role or the domain.' })
|
|
201
|
-
scope: DashboardCardShareScope
|
|
202
|
-
|
|
203
|
-
@Column()
|
|
204
|
-
@Field({ description: 'The user, department, role or domain id the scope names.' })
|
|
205
|
-
targetId: string
|
|
206
|
-
|
|
207
|
-
@Column({ nullable: true })
|
|
208
|
-
@Field({ nullable: true, description: 'The name of the person, department or domain when it was shared - shown to the owner.' })
|
|
209
|
-
targetName?: string
|
|
210
|
-
|
|
211
|
-
@ManyToOne(type => User, { nullable: true })
|
|
212
|
-
@Field(type => User, { nullable: true, description: 'Who shared it.' })
|
|
213
|
-
creator?: User
|
|
214
|
-
|
|
215
|
-
@RelationId((one: DashboardCardShare) => one.creator)
|
|
216
|
-
creatorId?: string
|
|
217
|
-
|
|
218
|
-
@ManyToOne(type => User, { nullable: true })
|
|
219
|
-
@Field(type => User, { nullable: true, description: 'Who changed the row last.' })
|
|
220
|
-
updater?: User
|
|
221
|
-
|
|
222
|
-
@RelationId((one: DashboardCardShare) => one.updater)
|
|
223
|
-
updaterId?: string
|
|
224
|
-
|
|
225
|
-
@CreateDateColumn()
|
|
226
|
-
@Field({ nullable: true, description: 'When it was shared.' })
|
|
227
|
-
createdAt?: Date
|
|
228
|
-
|
|
229
|
-
@UpdateDateColumn()
|
|
230
|
-
@Field({ nullable: true, description: 'When the row was changed last.' })
|
|
231
|
-
updatedAt?: Date
|
|
232
|
-
|
|
233
|
-
@DeleteDateColumn()
|
|
234
|
-
@Field({ nullable: true, description: 'When the share was withdrawn.' })
|
|
235
|
-
deletedAt?: Date
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
@Entity('ai_dashboard_card_places')
|
|
239
|
-
@Index('ix_ai_dashboard_card_place_0', (one: DashboardCardPlace) => [one.domain, one.user, one.card], { unique: true, where: '"deleted_at" IS NULL' })
|
|
240
|
-
@ObjectType({ description: 'Where one person placed a card on their dashboard - its order and size.' })
|
|
241
|
-
export class DashboardCardPlace {
|
|
242
|
-
@PrimaryGeneratedColumn('uuid')
|
|
243
|
-
@Field(type => ID, { description: 'Place id.' })
|
|
244
|
-
readonly id: string
|
|
245
|
-
|
|
246
|
-
@ManyToOne(type => Domain)
|
|
247
|
-
@Field(type => Domain, { nullable: true, description: 'The domain.' })
|
|
248
|
-
domain?: Domain
|
|
249
|
-
|
|
250
|
-
@RelationId((one: DashboardCardPlace) => one.domain)
|
|
251
|
-
domainId?: string
|
|
252
|
-
|
|
253
|
-
@ManyToOne(type => User)
|
|
254
|
-
user?: User
|
|
255
|
-
|
|
256
|
-
@RelationId((one: DashboardCardPlace) => one.user)
|
|
257
|
-
userId?: string
|
|
258
|
-
|
|
259
|
-
@ManyToOne(type => DashboardCard, { onDelete: 'CASCADE' })
|
|
260
|
-
card?: DashboardCard
|
|
261
|
-
|
|
262
|
-
@RelationId((one: DashboardCardPlace) => one.card)
|
|
263
|
-
@Field({ description: 'The card placed.' })
|
|
264
|
-
cardId?: string
|
|
265
|
-
|
|
266
|
-
@Column('int')
|
|
267
|
-
@Field(type => Int, { description: 'Its place in the grid, from the top left.' })
|
|
268
|
-
order: number
|
|
269
|
-
|
|
270
|
-
@Column('int')
|
|
271
|
-
@Field(type => Int, { description: 'Columns it spans, 1 to 4.' })
|
|
272
|
-
width: number
|
|
273
|
-
|
|
274
|
-
@Column('int')
|
|
275
|
-
@Field(type => Int, { description: 'Rows it spans, 1 to 2.' })
|
|
276
|
-
height: number
|
|
277
|
-
|
|
278
|
-
@ManyToOne(type => User, { nullable: true })
|
|
279
|
-
@Field(type => User, { nullable: true, description: 'Who created the row.' })
|
|
280
|
-
creator?: User
|
|
281
|
-
|
|
282
|
-
@RelationId((one: DashboardCardPlace) => one.creator)
|
|
283
|
-
creatorId?: string
|
|
284
|
-
|
|
285
|
-
@ManyToOne(type => User, { nullable: true })
|
|
286
|
-
@Field(type => User, { nullable: true, description: 'Who changed the row last.' })
|
|
287
|
-
updater?: User
|
|
288
|
-
|
|
289
|
-
@RelationId((one: DashboardCardPlace) => one.updater)
|
|
290
|
-
updaterId?: string
|
|
291
|
-
|
|
292
|
-
@CreateDateColumn()
|
|
293
|
-
@Field({ nullable: true, description: 'When it was placed.' })
|
|
294
|
-
createdAt?: Date
|
|
295
|
-
|
|
296
|
-
@UpdateDateColumn()
|
|
297
|
-
@Field({ nullable: true, description: 'When it was moved or sized last.' })
|
|
298
|
-
updatedAt?: Date
|
|
299
|
-
|
|
300
|
-
@DeleteDateColumn()
|
|
301
|
-
@Field({ nullable: true, description: 'When it was taken off the dashboard.' })
|
|
302
|
-
deletedAt?: Date
|
|
303
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { config } from '@things-factory/env'
|
|
2
|
-
|
|
3
|
-
const DATABASE_TYPE = config.get('ormconfig', {}).type
|
|
4
|
-
|
|
5
|
-
/** A long text column on every database the framework runs on - a definition kept as JSON text. */
|
|
6
|
-
export const LONG_TEXT = {
|
|
7
|
-
type:
|
|
8
|
-
DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'
|
|
9
|
-
? 'longtext'
|
|
10
|
-
: DATABASE_TYPE == 'oracle'
|
|
11
|
-
? 'clob'
|
|
12
|
-
: DATABASE_TYPE == 'mssql'
|
|
13
|
-
? 'nvarchar'
|
|
14
|
-
: 'text',
|
|
15
|
-
length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined
|
|
16
|
-
} as const
|
|
17
|
-
|
|
18
|
-
export const parsedJson = (text?: string | null) => {
|
|
19
|
-
if (!text) return null
|
|
20
|
-
try {
|
|
21
|
-
return JSON.parse(text)
|
|
22
|
-
} catch {
|
|
23
|
-
return null
|
|
24
|
-
}
|
|
25
|
-
}
|
package/server/service/index.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { DashboardCard, DashboardCardPlace, DashboardCardShare, DashboardCardVersion } from './card/dashboard-card.js'
|
|
2
|
-
import { DashboardCardResolver } from './card/card-resolver.js'
|
|
3
|
-
/* The card tool - in reach of every conversation, in front on the dashboard page. */
|
|
4
|
-
import './card/card-tool.js'
|
|
5
|
-
|
|
6
|
-
export * from './card/card-names.js'
|
|
7
|
-
export * from './card/card-definition.js'
|
|
8
|
-
export * from './card/card-access.js'
|
|
9
|
-
export { runCard, type CardRunResult, type CardCounts, type CardRunDeps } from './card/card-run.js'
|
|
10
|
-
export { DashboardCard, DashboardCardPlace, DashboardCardShare, DashboardCardShareScope, DashboardCardVersion } from './card/dashboard-card.js'
|
|
11
|
-
|
|
12
|
-
export const entities = [DashboardCard, DashboardCardVersion, DashboardCardShare, DashboardCardPlace]
|
|
13
|
-
|
|
14
|
-
export const schema = {
|
|
15
|
-
resolverClasses: [DashboardCardResolver]
|
|
16
|
-
}
|
package/test/card-menu.test.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* A card's ⋯ menu is the platform's popup menu, opened in the body - the menu drawn inside the card was cut by the
|
|
3
|
-
* card's edge and the grid's (2026-10-25). Read from the source: the package has no browser harness.
|
|
4
|
-
*/
|
|
5
|
-
import { readFileSync } from 'fs'
|
|
6
|
-
import { join } from 'path'
|
|
7
|
-
|
|
8
|
-
const card = readFileSync(join(__dirname, '..', 'client', 'components', 'dashboard-card.ts'), 'utf8')
|
|
9
|
-
|
|
10
|
-
describe("a card's menu", () => {
|
|
11
|
-
it('★ opens as the platform popup menu in the body, under its button', () => {
|
|
12
|
-
expect(card).toMatch(/OxPopupMenu\.open\(\{[\s\S]*parent: document\.body[\s\S]*\}\)/)
|
|
13
|
-
expect(card).toMatch(/<ox-popup-menuitem /)
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
it('★ draws no menu of its own inside the card', () => {
|
|
17
|
-
expect(card).not.toMatch(/class="menu"/)
|
|
18
|
-
expect(card).not.toMatch(/\.menu \{/)
|
|
19
|
-
})
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
const dialogs = readFileSync(join(__dirname, '..', 'client', 'components', 'card-dialogs.ts'), 'utf8')
|
|
23
|
-
|
|
24
|
-
describe("a card's dialogs", () => {
|
|
25
|
-
it('★ are the house popup - only the body scrolls and the button row stays put; three people shared pushed 저장 out of view', () => {
|
|
26
|
-
expect(dialogs.match(/static styles = \[CommonPopupStyles, PopupBodyStyles, FormStyles\]/g)).toHaveLength(4)
|
|
27
|
-
expect(dialogs.match(/return html`<div class="body">/g)).toHaveLength(4)
|
|
28
|
-
expect(dialogs.match(/<ox-popup-actions>/g)).toHaveLength(3)
|
|
29
|
-
/* No scroll of their own beside the house one. */
|
|
30
|
-
expect(dialogs).not.toMatch(/overflow-y: auto|position: sticky|class="actions"/)
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('★ a card may be shared with a role', () => {
|
|
34
|
-
expect(dialogs).toMatch(/scope: 'ROLE'/)
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
const library = readFileSync(join(__dirname, '..', 'client', 'components', 'card-library.ts'), 'utf8')
|
|
39
|
-
|
|
40
|
-
describe('the card library', () => {
|
|
41
|
-
it('★ scrolls in the popup\'s height - the popup clips what is past it, and the lower cards were cut', () => {
|
|
42
|
-
expect(library).toMatch(/:host \{[^}]*height: 100%;[^}]*overflow-y: auto;/)
|
|
43
|
-
expect(library).toMatch(/ul \{[^}]*flex-shrink: 0;/)
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
it('★ the library and the dialogs draw the house scrollbar', () => {
|
|
47
|
-
expect(library).toMatch(/static styles = \[\s*ScrollbarStyles,/)
|
|
48
|
-
/* The dialogs have it through PopupBodyStyles. */
|
|
49
|
-
})
|
|
50
|
-
})
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Every word the dashboard says is in every language the module ships - the keys are strings, so neither tsc nor
|
|
3
|
-
* eslint sees one with no entry; this test is the only thing that does. Covers the client's words, the refusals the
|
|
4
|
-
* server says (`ai-dashboard.refusal.<code>`), the reasons a card is not drawn and the role task's words.
|
|
5
|
-
*/
|
|
6
|
-
import { readFileSync, readdirSync } from 'fs'
|
|
7
|
-
import { join } from 'path'
|
|
8
|
-
|
|
9
|
-
const ROOT = join(__dirname, '..')
|
|
10
|
-
const LANGUAGES = ['ko', 'en', 'ja', 'zh', 'es', 'ms']
|
|
11
|
-
|
|
12
|
-
const sources = (dir: string): string[] =>
|
|
13
|
-
readdirSync(dir, { withFileTypes: true }).flatMap(entry => (entry.isDirectory() ? sources(join(dir, entry.name)) : /\.ts$/.test(entry.name) && !/\.test\.ts$/.test(entry.name) ? [join(dir, entry.name)] : []))
|
|
14
|
-
|
|
15
|
-
const text = [...sources(join(ROOT, 'client')), ...sources(join(ROOT, 'server'))].map(file => readFileSync(file, 'utf8')).join('\n')
|
|
16
|
-
const locale = (lang: string): Record<string, string> => JSON.parse(readFileSync(join(ROOT, 'translations', `${lang}.json`), 'utf8'))
|
|
17
|
-
|
|
18
|
-
const used = new Set<string>([...text.matchAll(/'(ai-dashboard\.[a-z0-9.-]+[a-z0-9])'/g)].map(match => match[1]).filter(key => key !== 'ai-dashboard.use'))
|
|
19
|
-
/* Keys built from a code: the refusals (refuse(context, '<code>', ...)), the shares' (share-<code>), the issues a card names, the views. */
|
|
20
|
-
for (const [, code] of text.matchAll(/refuse\(context, '([a-z-]+)'/g)) used.add(`ai-dashboard.refusal.${code}`)
|
|
21
|
-
for (const code of ['unknown-scope', 'no-target', 'another-domain', 'unknown-department', 'unknown-role']) used.add(`ai-dashboard.refusal.share-${code}`)
|
|
22
|
-
const issues = /KNOWN_ISSUES = \[([\s\S]*?)\]/.exec(text)![1]
|
|
23
|
-
for (const [, code] of issues.matchAll(/'([a-z-]+)'/g)) used.add(`ai-dashboard.issue.${code}`)
|
|
24
|
-
for (const view of ['number', 'table', 'bar', 'line']) used.add(`ai-dashboard.view.${view}`)
|
|
25
|
-
used.add('task.ai-dashboard.use.name')
|
|
26
|
-
used.add('task.ai-dashboard.use.description')
|
|
27
|
-
|
|
28
|
-
test('the floor - the parser found the words', () => {
|
|
29
|
-
expect(used.size).toBeGreaterThan(100)
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
test.each(LANGUAGES)('★ every key the dashboard names is in %s', lang => {
|
|
33
|
-
const words = locale(lang)
|
|
34
|
-
expect([...used].filter(key => !(key in words))).toEqual([])
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
test.each(LANGUAGES)('a placeholder said in Korean is said in %s too', lang => {
|
|
38
|
-
const ko = locale('ko')
|
|
39
|
-
const words = locale(lang)
|
|
40
|
-
const holes = (said: string) => [...said.matchAll(/\{(\w+)\}/g)].map(match => match[1]).sort()
|
|
41
|
-
expect(Object.keys(ko).filter(key => key in words && holes(ko[key]).join() !== holes(words[key]).join())).toEqual([])
|
|
42
|
-
})
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* What a Korean reader sees is words, not the dashboard's internal codes - inline help audit 2026-10-30: a card that
|
|
3
|
-
* could not be drawn said 「이 카드를 그릴 수 없습니다(period-unlike-condition)」, a list it could not read
|
|
4
|
-
* 「…({read}/{list})」 with the read keys, a card name was cut at 100 characters, and a proposal without a name was saved
|
|
5
|
-
* as the English word `card`.
|
|
6
|
-
*/
|
|
7
|
-
import { readFileSync } from 'fs'
|
|
8
|
-
import { join } from 'path'
|
|
9
|
-
|
|
10
|
-
const ROOT = join(__dirname, '..')
|
|
11
|
-
const read = (file: string) => readFileSync(join(ROOT, file), 'utf8')
|
|
12
|
-
const ko: Record<string, string> = JSON.parse(read('translations/ko.json'))
|
|
13
|
-
|
|
14
|
-
test('★ no Korean sentence shows an internal code or a read key', () => {
|
|
15
|
-
expect(Object.entries(ko).filter(([, said]) => /\{code\}|\{read\}\/\{list\}/.test(said))).toEqual([])
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
test('★ a card name is refused with its bound on the server, not cut, and never saved as an English word', () => {
|
|
19
|
-
const resolver = read('server/service/card/card-resolver.ts')
|
|
20
|
-
expect(resolver).not.toMatch(/name\b[^\n]*\.slice\(0, 100\)/)
|
|
21
|
-
expect(resolver).not.toMatch(/\|\| 'card'/)
|
|
22
|
-
expect(resolver).toMatch(/refuse\(context, 'name-too-long'/)
|
|
23
|
-
expect(ko['ai-dashboard.refusal.name-too-long']).toBe('카드 이름은 {max}자까지입니다. 지금 {length}자입니다.')
|
|
24
|
-
})
|