@codecks/fetch 1.0.1 → 2.0.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.
- package/README.md +80 -32
- package/dist/_exploration/api-requester.d.ts +3 -4
- package/dist/_exploration/api-requester.js +2 -2
- package/dist/_exploration/create-hooks.d.ts +4313 -13097
- package/dist/_exploration/create-hooks.js +1 -1
- package/dist/_exploration/loader.d.ts +2 -2
- package/dist/_exploration/loader.js +1 -1
- package/dist/_exploration/store.d.ts +5 -4
- package/dist/_exploration/store.js +1 -1
- package/dist/{collection-utils-KmtGUuXm.js → collection-utils-y85xawyq.js} +4 -2
- package/dist/index-iEtXFnkY.d.ts +39 -0
- package/dist/index.d.ts +4 -19
- package/dist/index.js +26 -15
- package/dist/{loader-types-fd5tV0FD.d.ts → loader-types-CIO8hJAv.d.ts} +1 -1
- package/dist/loader-utils-DdrmVo0F.d.ts +2218 -0
- package/dist/query-helpers-DndWBcMF.js +1203 -0
- package/dist/{query-type-BqQ9oX_U.d.ts → query-type-CwrwqxUP.d.ts} +30 -15
- package/dist/store-Dpx1yvWU.d.ts +1203 -0
- package/package.json +2 -1
- package/schema/actions.md +789 -0
- package/schema/models/account.md +57 -90
- package/schema/models/attachment.md +15 -11
- package/schema/models/card.md +91 -65
- package/schema/models/cardHistory.md +15 -9
- package/schema/models/deck.md +41 -36
- package/schema/models/file.md +13 -15
- package/schema/models/handCard.md +8 -5
- package/schema/models/milestone.md +27 -22
- package/schema/models/milestoneProgress.md +9 -3
- package/schema/models/milestoneProject.md +6 -4
- package/schema/models/project.md +15 -39
- package/schema/models/projectTag.md +12 -7
- package/schema/models/queueEntry.md +12 -8
- package/schema/models/release.md +8 -6
- package/schema/models/resolvable.md +19 -15
- package/schema/models/resolvableEntry.md +16 -13
- package/schema/models/resolvableEntryReaction.md +16 -12
- package/schema/models/sprint.md +35 -25
- package/schema/models/sprintConfig.md +24 -20
- package/schema/models/sprintConfigProgress.md +9 -3
- package/schema/models/sprintProgress.md +9 -3
- package/schema/models/sprintProject.md +7 -5
- package/schema/models/user.md +15 -56
- package/schema/models/workflowItem.md +47 -31
- package/schema/overview.md +40 -93
- package/schema/query-syntax.md +1 -1
- package/schema/types.md +103 -0
- package/dist/_root-BW9uzB79.d.ts +0 -34
- package/dist/index-k-KPWV9R.d.ts +0 -2680
- package/dist/loader-utils-hvdC-xsQ.d.ts +0 -42
- package/dist/query-helpers-iX1fiqLv.js +0 -3062
- package/dist/store-BvEJzUVp.d.ts +0 -2667
- package/schema/models/accountOnboarding.md +0 -15
- package/schema/models/accountOnboardingStep.md +0 -14
- package/schema/models/accountRole.md +0 -19
- package/schema/models/accountUserAchievement.md +0 -17
- package/schema/models/accountUserSetting.md +0 -20
- package/schema/models/activeTimeTracker.md +0 -19
- package/schema/models/activity.md +0 -30
- package/schema/models/affiliateCode.md +0 -30
- package/schema/models/affiliateCodeStat.md +0 -19
- package/schema/models/app.md +0 -10
- package/schema/models/appInstallation.md +0 -19
- package/schema/models/assigneeAssignment.md +0 -18
- package/schema/models/assigneeDeckAssignment.md +0 -20
- package/schema/models/autoFinishedTimeTrackingSegment.md +0 -20
- package/schema/models/cardDiffNotification.md +0 -22
- package/schema/models/cardOrder.md +0 -17
- package/schema/models/cardOrderInDeck.md +0 -18
- package/schema/models/cardPreset.md +0 -19
- package/schema/models/cardSubscription.md +0 -19
- package/schema/models/cardUpvote.md +0 -21
- package/schema/models/cardsEffortHistory.md +0 -9
- package/schema/models/cardsFinishedHistory.md +0 -16
- package/schema/models/cardsStatusHistory.md +0 -9
- package/schema/models/cardsTimeToFinished.md +0 -18
- package/schema/models/dailyDiscordGuildVoteMembership.md +0 -15
- package/schema/models/dailyPublicProjectMembership.md +0 -15
- package/schema/models/deckAssignment.md +0 -18
- package/schema/models/deckGuardian.md +0 -17
- package/schema/models/deckSubscription.md +0 -18
- package/schema/models/discordGuild.md +0 -30
- package/schema/models/discordMember.md +0 -21
- package/schema/models/discordProjectNotification.md +0 -19
- package/schema/models/discordSlashCommand.md +0 -28
- package/schema/models/dueCard.md +0 -18
- package/schema/models/integration.md +0 -23
- package/schema/models/invoice.md +0 -21
- package/schema/models/lastSeenCardUpvote.md +0 -17
- package/schema/models/pinnedMilestone.md +0 -22
- package/schema/models/projectOrder.md +0 -18
- package/schema/models/projectSelection.md +0 -18
- package/schema/models/projectUser.md +0 -18
- package/schema/models/projectUserSetting.md +0 -15
- package/schema/models/publicProjectInfo.md +0 -20
- package/schema/models/publicProjectMembership.md +0 -17
- package/schema/models/publicProjectVisit.md +0 -16
- package/schema/models/queueSelection.md +0 -19
- package/schema/models/resolvableEntryHistory.md +0 -20
- package/schema/models/resolvableNotification.md +0 -30
- package/schema/models/resolvableParticipant.md +0 -25
- package/schema/models/resolvableParticipantHistory.md +0 -23
- package/schema/models/savedSearch.md +0 -18
- package/schema/models/stripeAccountSync.md +0 -29
- package/schema/models/timeTrackingSegment.md +0 -24
- package/schema/models/timeTrackingSum.md +0 -18
- package/schema/models/userDismissedHint.md +0 -16
- package/schema/models/userEmail.md +0 -18
- package/schema/models/userInvitation.md +0 -20
- package/schema/models/userInviteCode.md +0 -23
- package/schema/models/userOnboarding.md +0 -14
- package/schema/models/userProjectAccess.md +0 -17
- package/schema/models/userReportEmail.md +0 -19
- package/schema/models/userReportSetting.md +0 -23
- package/schema/models/userReportToken.md +0 -18
- package/schema/models/userTag.md +0 -18
- package/schema/models/visionBoard.md +0 -21
- package/schema/models/visionBoardQuery.md +0 -22
- package/schema/models/wizard.md +0 -19
- package/schema/models/workflowItemHistory.md +0 -18
|
@@ -0,0 +1,1203 @@
|
|
|
1
|
+
//#region src/models/_desc.ts
|
|
2
|
+
const makeModel = (opts) => {
|
|
3
|
+
return opts;
|
|
4
|
+
};
|
|
5
|
+
const relation = (relName, options) => {
|
|
6
|
+
return {
|
|
7
|
+
relName,
|
|
8
|
+
options
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
//#region src/models/_root.ts
|
|
14
|
+
/** The starting point of every query. */
|
|
15
|
+
const _rootDesc = makeModel({
|
|
16
|
+
name: "_root",
|
|
17
|
+
fields: {},
|
|
18
|
+
relations: {
|
|
19
|
+
account: relation("account", { type: "hasOne" }),
|
|
20
|
+
loggedInUser: relation("user", { type: "hasOne" }),
|
|
21
|
+
releases: relation("release", { type: "hasMany" })
|
|
22
|
+
},
|
|
23
|
+
keys: []
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/models/_fields.ts
|
|
28
|
+
const id = () => {
|
|
29
|
+
return { type: "id" };
|
|
30
|
+
};
|
|
31
|
+
const withOpts = (type, opts) => ({
|
|
32
|
+
type,
|
|
33
|
+
...opts
|
|
34
|
+
});
|
|
35
|
+
const string = (opts) => {
|
|
36
|
+
return withOpts("string", opts);
|
|
37
|
+
};
|
|
38
|
+
const int = (opts) => {
|
|
39
|
+
return withOpts("int", opts);
|
|
40
|
+
};
|
|
41
|
+
const bool = (opts) => {
|
|
42
|
+
return withOpts("bool", opts);
|
|
43
|
+
};
|
|
44
|
+
const date = (opts) => {
|
|
45
|
+
return withOpts("date", opts);
|
|
46
|
+
};
|
|
47
|
+
const day = (opts) => {
|
|
48
|
+
return withOpts("day", opts);
|
|
49
|
+
};
|
|
50
|
+
/** A field whose type the reference's schema gives: an enum, a json value, a list of ids, ... */
|
|
51
|
+
const typed = (opts) => ({ type: () => withOpts("typed", opts) });
|
|
52
|
+
const belongsTo = (opts) => {
|
|
53
|
+
return { type: () => {
|
|
54
|
+
return withOpts("belongsTo", opts);
|
|
55
|
+
} };
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/models/Account.ts
|
|
60
|
+
/** An organization and its settings. */
|
|
61
|
+
const accountDesc = makeModel({
|
|
62
|
+
name: "account",
|
|
63
|
+
fields: {
|
|
64
|
+
allowInheritHeroCover: bool({ stability: "preview" }),
|
|
65
|
+
attachmentCoverMode: typed({ stability: "preview" }).type(),
|
|
66
|
+
createdAt: date({}),
|
|
67
|
+
dependenciesEnabled: bool({}),
|
|
68
|
+
dueDateEnabled: bool({}),
|
|
69
|
+
effortScale: typed({}).type(),
|
|
70
|
+
fallbackEffort: int({ stability: "preview" }),
|
|
71
|
+
hideCompletedCardCountForDecks: bool({ stability: "preview" }),
|
|
72
|
+
id: id(),
|
|
73
|
+
maxHandSlotCount: int({ stability: "preview" }),
|
|
74
|
+
milestonesEnabled: bool({}),
|
|
75
|
+
name: string({}),
|
|
76
|
+
priorityLabels: typed({}).type(),
|
|
77
|
+
sprintsEnabled: bool({}),
|
|
78
|
+
startWeekday: typed({}).type(),
|
|
79
|
+
statusChangeDurations: typed({ stability: "preview" }).type(),
|
|
80
|
+
subdomain: string({}),
|
|
81
|
+
timeTrackingMode: typed({ stability: "preview" }).type(),
|
|
82
|
+
timelineScaleType: typed({ stability: "preview" }).type(),
|
|
83
|
+
visionBoardEnabled: bool({ stability: "preview" }),
|
|
84
|
+
workdays: typed({}).type(),
|
|
85
|
+
workflowMode: typed({ stability: "preview" }).type()
|
|
86
|
+
},
|
|
87
|
+
relations: {
|
|
88
|
+
archivedProjects: relation("project", { type: "hasMany" }),
|
|
89
|
+
attachments: relation("attachment", { type: "hasMany" }),
|
|
90
|
+
cards: relation("card", { type: "hasMany" }),
|
|
91
|
+
decks: relation("deck", { type: "hasMany" }),
|
|
92
|
+
files: relation("file", { type: "hasMany" }),
|
|
93
|
+
handCards: relation("handCard", { type: "hasMany" }),
|
|
94
|
+
milestones: relation("milestone", { type: "hasMany" }),
|
|
95
|
+
projects: relation("project", { type: "hasMany" }),
|
|
96
|
+
queueEntries: relation("queueEntry", { type: "hasMany" }),
|
|
97
|
+
resolvables: relation("resolvable", { type: "hasMany" }),
|
|
98
|
+
sprintConfigs: relation("sprintConfig", { type: "hasMany" }),
|
|
99
|
+
sprints: relation("sprint", { type: "hasMany" }),
|
|
100
|
+
workflowItems: relation("workflowItem", {
|
|
101
|
+
type: "hasMany",
|
|
102
|
+
stability: "preview"
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
keys: ["id"]
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/models/Attachment.ts
|
|
110
|
+
/** A file attached to a card. */
|
|
111
|
+
const attachmentDesc = makeModel({
|
|
112
|
+
name: "attachment",
|
|
113
|
+
fields: {
|
|
114
|
+
accountId: belongsTo({}).type(),
|
|
115
|
+
cardId: belongsTo({}).type(),
|
|
116
|
+
content: string({}),
|
|
117
|
+
createdAt: date({}),
|
|
118
|
+
creatorId: belongsTo({ optional: true }).type(),
|
|
119
|
+
fileId: belongsTo({}).type(),
|
|
120
|
+
id: id(),
|
|
121
|
+
title: string({})
|
|
122
|
+
},
|
|
123
|
+
relations: {
|
|
124
|
+
account: relation("account", {
|
|
125
|
+
type: "belongsTo",
|
|
126
|
+
fk: "accountId"
|
|
127
|
+
}),
|
|
128
|
+
card: relation("card", {
|
|
129
|
+
type: "belongsTo",
|
|
130
|
+
fk: "cardId"
|
|
131
|
+
}),
|
|
132
|
+
creator: relation("user", {
|
|
133
|
+
type: "belongsTo",
|
|
134
|
+
fk: "creatorId",
|
|
135
|
+
optional: true
|
|
136
|
+
}),
|
|
137
|
+
file: relation("file", {
|
|
138
|
+
type: "belongsTo",
|
|
139
|
+
fk: "fileId"
|
|
140
|
+
})
|
|
141
|
+
},
|
|
142
|
+
keys: ["id"]
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region src/models/Card.ts
|
|
147
|
+
/**
|
|
148
|
+
* A task or a document card when `isDoc` is set or a hero card if it contains sub cards.
|
|
149
|
+
The card's
|
|
150
|
+
* color is derived from `status`, `visibility`, `isDoc` and whether it has sub cards or open block
|
|
151
|
+
* or review conversations.
|
|
152
|
+
*/
|
|
153
|
+
const cardDesc = makeModel({
|
|
154
|
+
name: "card",
|
|
155
|
+
fields: {
|
|
156
|
+
accountId: belongsTo({}).type(),
|
|
157
|
+
accountSeq: int({}),
|
|
158
|
+
assigneeId: belongsTo({ optional: true }).type(),
|
|
159
|
+
cardId: id(),
|
|
160
|
+
checkboxInfo: typed({ stability: "preview" }).type(),
|
|
161
|
+
checkboxStats: typed({}).type(),
|
|
162
|
+
content: string({}),
|
|
163
|
+
coverFileId: belongsTo({ optional: true }).type(),
|
|
164
|
+
createdAt: date({}),
|
|
165
|
+
creatorId: belongsTo({ optional: true }).type(),
|
|
166
|
+
deckId: belongsTo({ optional: true }).type(),
|
|
167
|
+
derivedStatus: typed({ stability: "preview" }).type(),
|
|
168
|
+
dueDate: day({ optional: true }),
|
|
169
|
+
effort: int({ optional: true }),
|
|
170
|
+
hasBlockingDeps: bool({ stability: "preview" }),
|
|
171
|
+
isBlockingDep: bool({ stability: "preview" }),
|
|
172
|
+
isDoc: bool({ optional: true }),
|
|
173
|
+
lastUpdatedAt: date({}),
|
|
174
|
+
masterTags: typed({}).type(),
|
|
175
|
+
mentionedUsers: typed({ stability: "preview" }).type(),
|
|
176
|
+
milestoneId: belongsTo({ optional: true }).type(),
|
|
177
|
+
parentCardId: belongsTo({ optional: true }).type(),
|
|
178
|
+
priority: typed({ optional: true }).type(),
|
|
179
|
+
sourceWorkflowItemId: belongsTo({
|
|
180
|
+
optional: true,
|
|
181
|
+
stability: "preview"
|
|
182
|
+
}).type(),
|
|
183
|
+
sprintId: belongsTo({ optional: true }).type(),
|
|
184
|
+
status: typed({}).type(),
|
|
185
|
+
tags: typed({}).type(),
|
|
186
|
+
title: string({}),
|
|
187
|
+
version: int({}),
|
|
188
|
+
visibility: typed({}).type()
|
|
189
|
+
},
|
|
190
|
+
relations: {
|
|
191
|
+
account: relation("account", {
|
|
192
|
+
type: "belongsTo",
|
|
193
|
+
fk: "accountId"
|
|
194
|
+
}),
|
|
195
|
+
assignee: relation("user", {
|
|
196
|
+
type: "belongsTo",
|
|
197
|
+
fk: "assigneeId",
|
|
198
|
+
optional: true
|
|
199
|
+
}),
|
|
200
|
+
attachments: relation("attachment", {
|
|
201
|
+
type: "hasMany",
|
|
202
|
+
fkAsArray: true
|
|
203
|
+
}),
|
|
204
|
+
cardReferences: relation("card", {
|
|
205
|
+
type: "hasMany",
|
|
206
|
+
fkAsArray: true,
|
|
207
|
+
stability: "preview"
|
|
208
|
+
}),
|
|
209
|
+
childCards: relation("card", {
|
|
210
|
+
type: "hasMany",
|
|
211
|
+
fkAsArray: true
|
|
212
|
+
}),
|
|
213
|
+
coverFile: relation("file", {
|
|
214
|
+
type: "belongsTo",
|
|
215
|
+
fk: "coverFileId",
|
|
216
|
+
optional: true
|
|
217
|
+
}),
|
|
218
|
+
creator: relation("user", {
|
|
219
|
+
type: "belongsTo",
|
|
220
|
+
fk: "creatorId",
|
|
221
|
+
optional: true
|
|
222
|
+
}),
|
|
223
|
+
deck: relation("deck", {
|
|
224
|
+
type: "belongsTo",
|
|
225
|
+
fk: "deckId",
|
|
226
|
+
optional: true
|
|
227
|
+
}),
|
|
228
|
+
diffs: relation("cardHistory", {
|
|
229
|
+
type: "hasMany",
|
|
230
|
+
stability: "preview"
|
|
231
|
+
}),
|
|
232
|
+
handCards: relation("handCard", { type: "hasMany" }),
|
|
233
|
+
inDeps: relation("card", {
|
|
234
|
+
type: "hasMany",
|
|
235
|
+
fkAsArray: true,
|
|
236
|
+
stability: "preview"
|
|
237
|
+
}),
|
|
238
|
+
milestone: relation("milestone", {
|
|
239
|
+
type: "belongsTo",
|
|
240
|
+
fk: "milestoneId",
|
|
241
|
+
optional: true
|
|
242
|
+
}),
|
|
243
|
+
outDeps: relation("card", {
|
|
244
|
+
type: "hasMany",
|
|
245
|
+
fkAsArray: true,
|
|
246
|
+
stability: "preview"
|
|
247
|
+
}),
|
|
248
|
+
parentCard: relation("card", {
|
|
249
|
+
type: "belongsTo",
|
|
250
|
+
fk: "parentCardId",
|
|
251
|
+
optional: true
|
|
252
|
+
}),
|
|
253
|
+
queueEntries: relation("queueEntry", { type: "hasMany" }),
|
|
254
|
+
resolvableEntries: relation("resolvableEntry", { type: "hasMany" }),
|
|
255
|
+
resolvables: relation("resolvable", { type: "hasMany" }),
|
|
256
|
+
sourceWorkflowItem: relation("workflowItem", {
|
|
257
|
+
type: "belongsTo",
|
|
258
|
+
fk: "sourceWorkflowItemId",
|
|
259
|
+
optional: true,
|
|
260
|
+
stability: "preview"
|
|
261
|
+
}),
|
|
262
|
+
sprint: relation("sprint", {
|
|
263
|
+
type: "belongsTo",
|
|
264
|
+
fk: "sprintId",
|
|
265
|
+
optional: true
|
|
266
|
+
})
|
|
267
|
+
},
|
|
268
|
+
keys: ["cardId"]
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/models/CardHistory.ts
|
|
273
|
+
/**
|
|
274
|
+
* One version of a card and what changed in it. The web app shows these in the card's history.
|
|
275
|
+
* @experimental `preview` in the Codecks API: may change in any release.
|
|
276
|
+
*/
|
|
277
|
+
const cardHistoryDesc = makeModel({
|
|
278
|
+
name: "cardHistory",
|
|
279
|
+
stability: "preview",
|
|
280
|
+
fields: {
|
|
281
|
+
accountId: belongsTo({ stability: "preview" }).type(),
|
|
282
|
+
cardId: belongsTo({ stability: "preview" }).type(),
|
|
283
|
+
changerId: belongsTo({
|
|
284
|
+
optional: true,
|
|
285
|
+
stability: "preview"
|
|
286
|
+
}).type(),
|
|
287
|
+
diff: typed({ stability: "preview" }).type(),
|
|
288
|
+
version: int({ stability: "preview" }),
|
|
289
|
+
versionCreatedAt: date({ stability: "preview" })
|
|
290
|
+
},
|
|
291
|
+
relations: {
|
|
292
|
+
account: relation("account", {
|
|
293
|
+
type: "belongsTo",
|
|
294
|
+
fk: "accountId",
|
|
295
|
+
stability: "preview"
|
|
296
|
+
}),
|
|
297
|
+
card: relation("card", {
|
|
298
|
+
type: "belongsTo",
|
|
299
|
+
fk: "cardId",
|
|
300
|
+
stability: "preview"
|
|
301
|
+
}),
|
|
302
|
+
changer: relation("user", {
|
|
303
|
+
type: "belongsTo",
|
|
304
|
+
fk: "changerId",
|
|
305
|
+
optional: true,
|
|
306
|
+
stability: "preview"
|
|
307
|
+
})
|
|
308
|
+
},
|
|
309
|
+
keys: ["cardId", "version"]
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
//#endregion
|
|
313
|
+
//#region src/models/Deck.ts
|
|
314
|
+
/** A list of cards within a project. `deckType` says which kind of cards it is meant for. */
|
|
315
|
+
const deckDesc = makeModel({
|
|
316
|
+
name: "deck",
|
|
317
|
+
fields: {
|
|
318
|
+
accountId: belongsTo({}).type(),
|
|
319
|
+
accountSeq: int({}),
|
|
320
|
+
coverColor: string({
|
|
321
|
+
optional: true,
|
|
322
|
+
stability: "preview"
|
|
323
|
+
}),
|
|
324
|
+
coverFileId: belongsTo({
|
|
325
|
+
optional: true,
|
|
326
|
+
stability: "preview"
|
|
327
|
+
}).type(),
|
|
328
|
+
createdAt: date({}),
|
|
329
|
+
creatorId: belongsTo({}).type(),
|
|
330
|
+
deckType: typed({}).type(),
|
|
331
|
+
defaultCard: typed({ stability: "preview" }).type(),
|
|
332
|
+
defaultProjectTagId: belongsTo({ optional: true }).type(),
|
|
333
|
+
description: string({}),
|
|
334
|
+
handSyncEnabled: bool({ stability: "preview" }),
|
|
335
|
+
hasGuardians: bool({ stability: "preview" }),
|
|
336
|
+
id: id(),
|
|
337
|
+
isDeleted: bool({}),
|
|
338
|
+
manualOrderLabels: typed({ stability: "preview" }).type(),
|
|
339
|
+
milestoneId: belongsTo({ optional: true }).type(),
|
|
340
|
+
projectId: belongsTo({}).type(),
|
|
341
|
+
sortValue: string({ stability: "preview" }),
|
|
342
|
+
spaceId: int({
|
|
343
|
+
optional: true,
|
|
344
|
+
stability: "preview"
|
|
345
|
+
}),
|
|
346
|
+
title: string({})
|
|
347
|
+
},
|
|
348
|
+
relations: {
|
|
349
|
+
account: relation("account", {
|
|
350
|
+
type: "belongsTo",
|
|
351
|
+
fk: "accountId"
|
|
352
|
+
}),
|
|
353
|
+
cards: relation("card", { type: "hasMany" }),
|
|
354
|
+
coverFile: relation("file", {
|
|
355
|
+
type: "belongsTo",
|
|
356
|
+
fk: "coverFileId",
|
|
357
|
+
optional: true,
|
|
358
|
+
stability: "preview"
|
|
359
|
+
}),
|
|
360
|
+
creator: relation("user", {
|
|
361
|
+
type: "belongsTo",
|
|
362
|
+
fk: "creatorId"
|
|
363
|
+
}),
|
|
364
|
+
defaultProjectTag: relation("projectTag", {
|
|
365
|
+
type: "belongsTo",
|
|
366
|
+
fk: "defaultProjectTagId",
|
|
367
|
+
optional: true
|
|
368
|
+
}),
|
|
369
|
+
milestone: relation("milestone", {
|
|
370
|
+
type: "belongsTo",
|
|
371
|
+
fk: "milestoneId",
|
|
372
|
+
optional: true
|
|
373
|
+
}),
|
|
374
|
+
project: relation("project", {
|
|
375
|
+
type: "belongsTo",
|
|
376
|
+
fk: "projectId"
|
|
377
|
+
}),
|
|
378
|
+
workflowItems: relation("workflowItem", {
|
|
379
|
+
type: "hasMany",
|
|
380
|
+
stability: "preview"
|
|
381
|
+
})
|
|
382
|
+
},
|
|
383
|
+
keys: ["id"]
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
//#endregion
|
|
387
|
+
//#region src/models/File.ts
|
|
388
|
+
/** An uploaded file, like a card attachment or a cover image. */
|
|
389
|
+
const fileDesc = makeModel({
|
|
390
|
+
name: "file",
|
|
391
|
+
fields: {
|
|
392
|
+
accountId: belongsTo({ optional: true }).type(),
|
|
393
|
+
createdAt: date({}),
|
|
394
|
+
id: id(),
|
|
395
|
+
name: string({}),
|
|
396
|
+
size: int({}),
|
|
397
|
+
uploaderId: belongsTo({ optional: true }).type(),
|
|
398
|
+
url: string({})
|
|
399
|
+
},
|
|
400
|
+
relations: {
|
|
401
|
+
account: relation("account", {
|
|
402
|
+
type: "belongsTo",
|
|
403
|
+
fk: "accountId",
|
|
404
|
+
optional: true
|
|
405
|
+
}),
|
|
406
|
+
uploader: relation("user", {
|
|
407
|
+
type: "belongsTo",
|
|
408
|
+
fk: "uploaderId",
|
|
409
|
+
optional: true
|
|
410
|
+
})
|
|
411
|
+
},
|
|
412
|
+
keys: ["id"]
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
//#endregion
|
|
416
|
+
//#region src/models/HandCard.ts
|
|
417
|
+
/** A card a user bookmarked. Deleting the card removes its bookmarks. */
|
|
418
|
+
const handCardDesc = makeModel({
|
|
419
|
+
name: "handCard",
|
|
420
|
+
fields: {
|
|
421
|
+
accountId: belongsTo({}).type(),
|
|
422
|
+
cardId: belongsTo({}).type(),
|
|
423
|
+
sortIndex: int({}),
|
|
424
|
+
userId: belongsTo({}).type()
|
|
425
|
+
},
|
|
426
|
+
relations: {
|
|
427
|
+
account: relation("account", {
|
|
428
|
+
type: "belongsTo",
|
|
429
|
+
fk: "accountId"
|
|
430
|
+
}),
|
|
431
|
+
card: relation("card", {
|
|
432
|
+
type: "belongsTo",
|
|
433
|
+
fk: "cardId"
|
|
434
|
+
}),
|
|
435
|
+
user: relation("user", {
|
|
436
|
+
type: "belongsTo",
|
|
437
|
+
fk: "userId"
|
|
438
|
+
})
|
|
439
|
+
},
|
|
440
|
+
keys: [
|
|
441
|
+
"cardId",
|
|
442
|
+
"userId",
|
|
443
|
+
"accountId"
|
|
444
|
+
]
|
|
445
|
+
});
|
|
446
|
+
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region src/models/Milestone.ts
|
|
449
|
+
/**
|
|
450
|
+
* A date that cards are planned towards. It belongs to a list of projects, or with `isGlobal` to
|
|
451
|
+
* all projects of the organization.
|
|
452
|
+
*/
|
|
453
|
+
const milestoneDesc = makeModel({
|
|
454
|
+
name: "milestone",
|
|
455
|
+
fields: {
|
|
456
|
+
accountId: belongsTo({}).type(),
|
|
457
|
+
accountSeq: int({}),
|
|
458
|
+
color: typed({}).type(),
|
|
459
|
+
coverFileId: belongsTo({
|
|
460
|
+
optional: true,
|
|
461
|
+
stability: "preview"
|
|
462
|
+
}).type(),
|
|
463
|
+
createdAt: date({}),
|
|
464
|
+
creatorId: belongsTo({}).type(),
|
|
465
|
+
date: day({}),
|
|
466
|
+
description: string({ optional: true }),
|
|
467
|
+
handSyncEnabled: bool({ stability: "preview" }),
|
|
468
|
+
id: id(),
|
|
469
|
+
isDeleted: bool({}),
|
|
470
|
+
isGlobal: bool({}),
|
|
471
|
+
manualOrderLabels: typed({ stability: "preview" }).type(),
|
|
472
|
+
name: string({}),
|
|
473
|
+
startDate: day({ optional: true }),
|
|
474
|
+
userCapacities: typed({ stability: "preview" }).type()
|
|
475
|
+
},
|
|
476
|
+
relations: {
|
|
477
|
+
account: relation("account", {
|
|
478
|
+
type: "belongsTo",
|
|
479
|
+
fk: "accountId"
|
|
480
|
+
}),
|
|
481
|
+
cards: relation("card", { type: "hasMany" }),
|
|
482
|
+
coverFile: relation("file", {
|
|
483
|
+
type: "belongsTo",
|
|
484
|
+
fk: "coverFileId",
|
|
485
|
+
optional: true,
|
|
486
|
+
stability: "preview"
|
|
487
|
+
}),
|
|
488
|
+
creator: relation("user", {
|
|
489
|
+
type: "belongsTo",
|
|
490
|
+
fk: "creatorId"
|
|
491
|
+
}),
|
|
492
|
+
milestoneProjects: relation("milestoneProject", { type: "hasMany" }),
|
|
493
|
+
progress: relation("milestoneProgress", {
|
|
494
|
+
type: "hasMany",
|
|
495
|
+
stability: "preview"
|
|
496
|
+
})
|
|
497
|
+
},
|
|
498
|
+
keys: ["id"]
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
//#endregion
|
|
502
|
+
//#region src/models/MilestoneProgress.ts
|
|
503
|
+
/**
|
|
504
|
+
* The state of a milestone's cards on a day (UTC). A row is only written on days when the numbers
|
|
505
|
+
* change, so a day without a row has the numbers of the row before it.
|
|
506
|
+
* @experimental `preview` in the Codecks API: may change in any release.
|
|
507
|
+
*/
|
|
508
|
+
const milestoneProgressDesc = makeModel({
|
|
509
|
+
name: "milestoneProgress",
|
|
510
|
+
stability: "preview",
|
|
511
|
+
fields: {
|
|
512
|
+
date: string({ stability: "preview" }),
|
|
513
|
+
milestoneId: belongsTo({ stability: "preview" }).type(),
|
|
514
|
+
progress: typed({ stability: "preview" }).type()
|
|
515
|
+
},
|
|
516
|
+
relations: { milestone: relation("milestone", {
|
|
517
|
+
type: "belongsTo",
|
|
518
|
+
fk: "milestoneId",
|
|
519
|
+
stability: "preview"
|
|
520
|
+
}) },
|
|
521
|
+
keys: ["milestoneId", "date"]
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region src/models/MilestoneProject.ts
|
|
526
|
+
/**
|
|
527
|
+
* Links a milestone to a project whose cards and decks can use it. A milestone with `isGlobal` is
|
|
528
|
+
* linked to every project.
|
|
529
|
+
*/
|
|
530
|
+
const milestoneProjectDesc = makeModel({
|
|
531
|
+
name: "milestoneProject",
|
|
532
|
+
fields: {
|
|
533
|
+
accountId: belongsTo({}).type(),
|
|
534
|
+
milestoneId: belongsTo({}).type(),
|
|
535
|
+
projectId: belongsTo({}).type()
|
|
536
|
+
},
|
|
537
|
+
relations: {
|
|
538
|
+
account: relation("account", {
|
|
539
|
+
type: "belongsTo",
|
|
540
|
+
fk: "accountId"
|
|
541
|
+
}),
|
|
542
|
+
milestone: relation("milestone", {
|
|
543
|
+
type: "belongsTo",
|
|
544
|
+
fk: "milestoneId"
|
|
545
|
+
}),
|
|
546
|
+
project: relation("project", {
|
|
547
|
+
type: "belongsTo",
|
|
548
|
+
fk: "projectId"
|
|
549
|
+
})
|
|
550
|
+
},
|
|
551
|
+
keys: ["milestoneId", "projectId"]
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
//#endregion
|
|
555
|
+
//#region src/models/Project.ts
|
|
556
|
+
/** Groups decks. A card belongs to the project of its deck. */
|
|
557
|
+
const projectDesc = makeModel({
|
|
558
|
+
name: "project",
|
|
559
|
+
fields: {
|
|
560
|
+
accountId: belongsTo({}).type(),
|
|
561
|
+
coverFileId: belongsTo({ optional: true }).type(),
|
|
562
|
+
createdAt: date({}),
|
|
563
|
+
id: id(),
|
|
564
|
+
name: string({}),
|
|
565
|
+
spaces: typed({ stability: "preview" }).type(),
|
|
566
|
+
visibility: typed({}).type()
|
|
567
|
+
},
|
|
568
|
+
relations: {
|
|
569
|
+
account: relation("account", {
|
|
570
|
+
type: "belongsTo",
|
|
571
|
+
fk: "accountId"
|
|
572
|
+
}),
|
|
573
|
+
coverFile: relation("file", {
|
|
574
|
+
type: "belongsTo",
|
|
575
|
+
fk: "coverFileId",
|
|
576
|
+
optional: true
|
|
577
|
+
}),
|
|
578
|
+
decks: relation("deck", { type: "hasMany" }),
|
|
579
|
+
milestoneProjects: relation("milestoneProject", { type: "hasMany" }),
|
|
580
|
+
sprintProjects: relation("sprintProject", { type: "hasMany" }),
|
|
581
|
+
tags: relation("projectTag", { type: "hasMany" })
|
|
582
|
+
},
|
|
583
|
+
keys: ["id"]
|
|
584
|
+
});
|
|
585
|
+
|
|
586
|
+
//#endregion
|
|
587
|
+
//#region src/models/ProjectTag.ts
|
|
588
|
+
/** A tag in a project's tag list. A card in the project with this tag lists it in `masterTags`. */
|
|
589
|
+
const projectTagDesc = makeModel({
|
|
590
|
+
name: "projectTag",
|
|
591
|
+
fields: {
|
|
592
|
+
color: string({ optional: true }),
|
|
593
|
+
createdAt: date({}),
|
|
594
|
+
description: string({ optional: true }),
|
|
595
|
+
emoji: string({ optional: true }),
|
|
596
|
+
id: id(),
|
|
597
|
+
projectId: belongsTo({}).type(),
|
|
598
|
+
tag: string({})
|
|
599
|
+
},
|
|
600
|
+
relations: { project: relation("project", {
|
|
601
|
+
type: "belongsTo",
|
|
602
|
+
fk: "projectId"
|
|
603
|
+
}) },
|
|
604
|
+
keys: ["id"]
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
//#endregion
|
|
608
|
+
//#region src/models/QueueEntry.ts
|
|
609
|
+
/**
|
|
610
|
+
* A card in a user's Hand. When a card is done, its owner gets an entry in their Hand's done pile,
|
|
611
|
+
* even if the card wasn't in their Hand.
|
|
612
|
+
*/
|
|
613
|
+
const queueEntryDesc = makeModel({
|
|
614
|
+
name: "queueEntry",
|
|
615
|
+
fields: {
|
|
616
|
+
accountId: belongsTo({}).type(),
|
|
617
|
+
cardDoneAt: date({ optional: true }),
|
|
618
|
+
cardId: belongsTo({}).type(),
|
|
619
|
+
createdAt: date({}),
|
|
620
|
+
id: id(),
|
|
621
|
+
sortIndex: int({ optional: true }),
|
|
622
|
+
userId: belongsTo({}).type()
|
|
623
|
+
},
|
|
624
|
+
relations: {
|
|
625
|
+
account: relation("account", {
|
|
626
|
+
type: "belongsTo",
|
|
627
|
+
fk: "accountId"
|
|
628
|
+
}),
|
|
629
|
+
card: relation("card", {
|
|
630
|
+
type: "belongsTo",
|
|
631
|
+
fk: "cardId"
|
|
632
|
+
}),
|
|
633
|
+
user: relation("user", {
|
|
634
|
+
type: "belongsTo",
|
|
635
|
+
fk: "userId"
|
|
636
|
+
})
|
|
637
|
+
},
|
|
638
|
+
keys: ["id"]
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
//#endregion
|
|
642
|
+
//#region src/models/Release.ts
|
|
643
|
+
/** An entry in the Codecks changelog. It's the same for every organization. */
|
|
644
|
+
const releaseDesc = makeModel({
|
|
645
|
+
name: "release",
|
|
646
|
+
fields: {
|
|
647
|
+
content: string({}),
|
|
648
|
+
createdAt: date({}),
|
|
649
|
+
id: id(),
|
|
650
|
+
title: string({}),
|
|
651
|
+
version: string({})
|
|
652
|
+
},
|
|
653
|
+
relations: {},
|
|
654
|
+
keys: ["id"]
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
//#endregion
|
|
658
|
+
//#region src/models/Resolvable.ts
|
|
659
|
+
/**
|
|
660
|
+
* A comment thread on a card. Its `context` says if it's a plain conversation or if it marks the
|
|
661
|
+
* card as blocked or in review.
|
|
662
|
+
*/
|
|
663
|
+
const resolvableDesc = makeModel({
|
|
664
|
+
name: "resolvable",
|
|
665
|
+
fields: {
|
|
666
|
+
accountId: belongsTo({}).type(),
|
|
667
|
+
cardId: belongsTo({}).type(),
|
|
668
|
+
closedAt: date({ optional: true }),
|
|
669
|
+
context: typed({}).type(),
|
|
670
|
+
createdAt: date({}),
|
|
671
|
+
creatorId: belongsTo({}).type(),
|
|
672
|
+
id: id(),
|
|
673
|
+
isClosed: bool({}),
|
|
674
|
+
reopenedAt: date({ optional: true })
|
|
675
|
+
},
|
|
676
|
+
relations: {
|
|
677
|
+
account: relation("account", {
|
|
678
|
+
type: "belongsTo",
|
|
679
|
+
fk: "accountId"
|
|
680
|
+
}),
|
|
681
|
+
card: relation("card", {
|
|
682
|
+
type: "belongsTo",
|
|
683
|
+
fk: "cardId"
|
|
684
|
+
}),
|
|
685
|
+
closedBy: relation("user", {
|
|
686
|
+
type: "belongsTo",
|
|
687
|
+
optional: true
|
|
688
|
+
}),
|
|
689
|
+
creator: relation("user", {
|
|
690
|
+
type: "belongsTo",
|
|
691
|
+
fk: "creatorId"
|
|
692
|
+
}),
|
|
693
|
+
entries: relation("resolvableEntry", { type: "hasMany" }),
|
|
694
|
+
reopenedBy: relation("user", {
|
|
695
|
+
type: "belongsTo",
|
|
696
|
+
optional: true
|
|
697
|
+
})
|
|
698
|
+
},
|
|
699
|
+
keys: ["id"]
|
|
700
|
+
});
|
|
701
|
+
|
|
702
|
+
//#endregion
|
|
703
|
+
//#region src/models/ResolvableEntry.ts
|
|
704
|
+
/** A comment in a comment thread. */
|
|
705
|
+
const resolvableEntryDesc = makeModel({
|
|
706
|
+
name: "resolvableEntry",
|
|
707
|
+
fields: {
|
|
708
|
+
authorId: belongsTo({}).type(),
|
|
709
|
+
cardId: belongsTo({}).type(),
|
|
710
|
+
content: string({}),
|
|
711
|
+
createdAt: date({}),
|
|
712
|
+
entryId: id(),
|
|
713
|
+
lastChangedAt: date({}),
|
|
714
|
+
resolvableId: belongsTo({}).type(),
|
|
715
|
+
version: int({ stability: "preview" })
|
|
716
|
+
},
|
|
717
|
+
relations: {
|
|
718
|
+
author: relation("user", {
|
|
719
|
+
type: "belongsTo",
|
|
720
|
+
fk: "authorId"
|
|
721
|
+
}),
|
|
722
|
+
card: relation("card", {
|
|
723
|
+
type: "belongsTo",
|
|
724
|
+
fk: "cardId"
|
|
725
|
+
}),
|
|
726
|
+
reactions: relation("resolvableEntryReaction", {
|
|
727
|
+
type: "hasMany",
|
|
728
|
+
stability: "preview"
|
|
729
|
+
}),
|
|
730
|
+
resolvable: relation("resolvable", {
|
|
731
|
+
type: "belongsTo",
|
|
732
|
+
fk: "resolvableId"
|
|
733
|
+
})
|
|
734
|
+
},
|
|
735
|
+
keys: ["entryId"]
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
//#endregion
|
|
739
|
+
//#region src/models/ResolvableEntryReaction.ts
|
|
740
|
+
/**
|
|
741
|
+
* An emoji reaction to a comment. A user can add each emoji only once per comment.
|
|
742
|
+
* @experimental `preview` in the Codecks API: may change in any release.
|
|
743
|
+
*/
|
|
744
|
+
const resolvableEntryReactionDesc = makeModel({
|
|
745
|
+
name: "resolvableEntryReaction",
|
|
746
|
+
stability: "preview",
|
|
747
|
+
fields: {
|
|
748
|
+
accountId: belongsTo({ stability: "preview" }).type(),
|
|
749
|
+
createdAt: date({ stability: "preview" }),
|
|
750
|
+
entryId: belongsTo({ stability: "preview" }).type(),
|
|
751
|
+
id: id(),
|
|
752
|
+
resolvableId: belongsTo({ stability: "preview" }).type(),
|
|
753
|
+
userId: belongsTo({ stability: "preview" }).type(),
|
|
754
|
+
value: typed({ stability: "preview" }).type()
|
|
755
|
+
},
|
|
756
|
+
relations: {
|
|
757
|
+
account: relation("account", {
|
|
758
|
+
type: "belongsTo",
|
|
759
|
+
fk: "accountId",
|
|
760
|
+
stability: "preview"
|
|
761
|
+
}),
|
|
762
|
+
resolvable: relation("resolvable", {
|
|
763
|
+
type: "belongsTo",
|
|
764
|
+
fk: "resolvableId",
|
|
765
|
+
stability: "preview"
|
|
766
|
+
}),
|
|
767
|
+
resolvableEntry: relation("resolvableEntry", {
|
|
768
|
+
type: "belongsTo",
|
|
769
|
+
fk: "entryId",
|
|
770
|
+
stability: "preview"
|
|
771
|
+
}),
|
|
772
|
+
user: relation("user", {
|
|
773
|
+
type: "belongsTo",
|
|
774
|
+
fk: "userId",
|
|
775
|
+
stability: "preview"
|
|
776
|
+
})
|
|
777
|
+
},
|
|
778
|
+
keys: ["id"]
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/models/Sprint.ts
|
|
783
|
+
/**
|
|
784
|
+
* A run: one time box of a Run Config, from `startDate` to `endDate`. Codecks creates the upcoming
|
|
785
|
+
* runs ahead of time and completes a run when it ends.
|
|
786
|
+
*/
|
|
787
|
+
const sprintDesc = makeModel({
|
|
788
|
+
name: "sprint",
|
|
789
|
+
fields: {
|
|
790
|
+
accountId: belongsTo({}).type(),
|
|
791
|
+
accountSeq: int({}),
|
|
792
|
+
autoMilestoneId: belongsTo({
|
|
793
|
+
optional: true,
|
|
794
|
+
stability: "preview"
|
|
795
|
+
}).type(),
|
|
796
|
+
completedAt: date({ optional: true }),
|
|
797
|
+
coverFileId: belongsTo({
|
|
798
|
+
optional: true,
|
|
799
|
+
stability: "preview"
|
|
800
|
+
}).type(),
|
|
801
|
+
createdAt: date({}),
|
|
802
|
+
description: string({ optional: true }),
|
|
803
|
+
endDate: day({}),
|
|
804
|
+
handSyncEnabled: bool({ stability: "preview" }),
|
|
805
|
+
id: id(),
|
|
806
|
+
index: int({}),
|
|
807
|
+
isDeleted: bool({}),
|
|
808
|
+
lockedAt: date({
|
|
809
|
+
optional: true,
|
|
810
|
+
stability: "preview"
|
|
811
|
+
}),
|
|
812
|
+
manualOrderLabels: typed({ stability: "preview" }).type(),
|
|
813
|
+
name: string({ optional: true }),
|
|
814
|
+
sprintConfigId: belongsTo({}).type(),
|
|
815
|
+
startDate: day({}),
|
|
816
|
+
userCapacities: typed({ stability: "preview" }).type()
|
|
817
|
+
},
|
|
818
|
+
relations: {
|
|
819
|
+
account: relation("account", {
|
|
820
|
+
type: "belongsTo",
|
|
821
|
+
fk: "accountId"
|
|
822
|
+
}),
|
|
823
|
+
autoMilestone: relation("milestone", {
|
|
824
|
+
type: "belongsTo",
|
|
825
|
+
fk: "autoMilestoneId",
|
|
826
|
+
optional: true,
|
|
827
|
+
stability: "preview"
|
|
828
|
+
}),
|
|
829
|
+
cards: relation("card", { type: "hasMany" }),
|
|
830
|
+
coverFile: relation("file", {
|
|
831
|
+
type: "belongsTo",
|
|
832
|
+
fk: "coverFileId",
|
|
833
|
+
optional: true,
|
|
834
|
+
stability: "preview"
|
|
835
|
+
}),
|
|
836
|
+
progress: relation("sprintProgress", {
|
|
837
|
+
type: "hasMany",
|
|
838
|
+
stability: "preview"
|
|
839
|
+
}),
|
|
840
|
+
sprintConfig: relation("sprintConfig", {
|
|
841
|
+
type: "belongsTo",
|
|
842
|
+
fk: "sprintConfigId"
|
|
843
|
+
})
|
|
844
|
+
},
|
|
845
|
+
keys: ["id"]
|
|
846
|
+
});
|
|
847
|
+
|
|
848
|
+
//#endregion
|
|
849
|
+
//#region src/models/SprintConfig.ts
|
|
850
|
+
/**
|
|
851
|
+
* A Run Config. It creates runs of the same length one after the other, like sprints, for its
|
|
852
|
+
* projects.
|
|
853
|
+
*/
|
|
854
|
+
const sprintConfigDesc = makeModel({
|
|
855
|
+
name: "sprintConfig",
|
|
856
|
+
fields: {
|
|
857
|
+
accountId: belongsTo({}).type(),
|
|
858
|
+
autoAssignNewCard: bool({ stability: "preview" }),
|
|
859
|
+
autoAssignStartedCard: bool({ stability: "preview" }),
|
|
860
|
+
autoBeastModeDurationHours: int({
|
|
861
|
+
optional: true,
|
|
862
|
+
stability: "preview"
|
|
863
|
+
}),
|
|
864
|
+
beastGracePeriodHours: int({ stability: "preview" }),
|
|
865
|
+
color: typed({}).type(),
|
|
866
|
+
createdAt: date({}),
|
|
867
|
+
creatorId: belongsTo({}).type(),
|
|
868
|
+
id: id(),
|
|
869
|
+
isGlobal: bool({}),
|
|
870
|
+
moveOnFinish: typed({ stability: "preview" }).type(),
|
|
871
|
+
name: string({}),
|
|
872
|
+
runLabelTemplate: string({
|
|
873
|
+
optional: true,
|
|
874
|
+
stability: "preview"
|
|
875
|
+
})
|
|
876
|
+
},
|
|
877
|
+
relations: {
|
|
878
|
+
account: relation("account", {
|
|
879
|
+
type: "belongsTo",
|
|
880
|
+
fk: "accountId"
|
|
881
|
+
}),
|
|
882
|
+
creator: relation("user", {
|
|
883
|
+
type: "belongsTo",
|
|
884
|
+
fk: "creatorId"
|
|
885
|
+
}),
|
|
886
|
+
progress: relation("sprintConfigProgress", {
|
|
887
|
+
type: "hasMany",
|
|
888
|
+
stability: "preview"
|
|
889
|
+
}),
|
|
890
|
+
sprintProjects: relation("sprintProject", { type: "hasMany" }),
|
|
891
|
+
sprints: relation("sprint", { type: "hasMany" })
|
|
892
|
+
},
|
|
893
|
+
keys: ["id"]
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
//#endregion
|
|
897
|
+
//#region src/models/SprintConfigProgress.ts
|
|
898
|
+
/**
|
|
899
|
+
* The done cards of all runs of a Run Config on a day (UTC). A row is only written on days when the
|
|
900
|
+
* numbers change, so a day without a row has the numbers of the row before it.
|
|
901
|
+
* @experimental `preview` in the Codecks API: may change in any release.
|
|
902
|
+
*/
|
|
903
|
+
const sprintConfigProgressDesc = makeModel({
|
|
904
|
+
name: "sprintConfigProgress",
|
|
905
|
+
stability: "preview",
|
|
906
|
+
fields: {
|
|
907
|
+
date: string({ stability: "preview" }),
|
|
908
|
+
progress: typed({ stability: "preview" }).type(),
|
|
909
|
+
sprintConfigId: belongsTo({ stability: "preview" }).type()
|
|
910
|
+
},
|
|
911
|
+
relations: { sprintConfig: relation("sprintConfig", {
|
|
912
|
+
type: "belongsTo",
|
|
913
|
+
fk: "sprintConfigId",
|
|
914
|
+
stability: "preview"
|
|
915
|
+
}) },
|
|
916
|
+
keys: ["sprintConfigId", "date"]
|
|
917
|
+
});
|
|
918
|
+
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region src/models/SprintProgress.ts
|
|
921
|
+
/**
|
|
922
|
+
* The state of a run's cards on a day (UTC). A row is only written on days when the numbers change,
|
|
923
|
+
* so a day without a row has the numbers of the row before it.
|
|
924
|
+
* @experimental `preview` in the Codecks API: may change in any release.
|
|
925
|
+
*/
|
|
926
|
+
const sprintProgressDesc = makeModel({
|
|
927
|
+
name: "sprintProgress",
|
|
928
|
+
stability: "preview",
|
|
929
|
+
fields: {
|
|
930
|
+
date: string({ stability: "preview" }),
|
|
931
|
+
progress: typed({ stability: "preview" }).type(),
|
|
932
|
+
sprintId: belongsTo({ stability: "preview" }).type()
|
|
933
|
+
},
|
|
934
|
+
relations: { sprint: relation("sprint", {
|
|
935
|
+
type: "belongsTo",
|
|
936
|
+
fk: "sprintId",
|
|
937
|
+
stability: "preview"
|
|
938
|
+
}) },
|
|
939
|
+
keys: ["sprintId", "date"]
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
//#endregion
|
|
943
|
+
//#region src/models/SprintProject.ts
|
|
944
|
+
/**
|
|
945
|
+
* Links a run config to a project whose cards can be planned into its runs. A run config with
|
|
946
|
+
* `isGlobal` is linked to every project.
|
|
947
|
+
*/
|
|
948
|
+
const sprintProjectDesc = makeModel({
|
|
949
|
+
name: "sprintProject",
|
|
950
|
+
fields: {
|
|
951
|
+
accountId: belongsTo({}).type(),
|
|
952
|
+
projectId: belongsTo({}).type(),
|
|
953
|
+
sprintConfigId: belongsTo({}).type()
|
|
954
|
+
},
|
|
955
|
+
relations: {
|
|
956
|
+
account: relation("account", {
|
|
957
|
+
type: "belongsTo",
|
|
958
|
+
fk: "accountId"
|
|
959
|
+
}),
|
|
960
|
+
project: relation("project", {
|
|
961
|
+
type: "belongsTo",
|
|
962
|
+
fk: "projectId"
|
|
963
|
+
}),
|
|
964
|
+
sprintConfig: relation("sprintConfig", {
|
|
965
|
+
type: "belongsTo",
|
|
966
|
+
fk: "sprintConfigId"
|
|
967
|
+
})
|
|
968
|
+
},
|
|
969
|
+
keys: ["sprintConfigId", "projectId"]
|
|
970
|
+
});
|
|
971
|
+
|
|
972
|
+
//#endregion
|
|
973
|
+
//#region src/models/User.ts
|
|
974
|
+
/**
|
|
975
|
+
* A person, or an integration or API token that acts in an organization. `kind` tells them apart.
|
|
976
|
+
*/
|
|
977
|
+
const userDesc = makeModel({
|
|
978
|
+
name: "user",
|
|
979
|
+
fields: {
|
|
980
|
+
fullName: string({ optional: true }),
|
|
981
|
+
id: id(),
|
|
982
|
+
isIntegration: bool({}),
|
|
983
|
+
kind: typed({}).type(),
|
|
984
|
+
name: string({}),
|
|
985
|
+
profileImageId: belongsTo({ optional: true }).type(),
|
|
986
|
+
timezone: string({
|
|
987
|
+
optional: true,
|
|
988
|
+
stability: "preview"
|
|
989
|
+
})
|
|
990
|
+
},
|
|
991
|
+
relations: { profileImage: relation("file", {
|
|
992
|
+
type: "belongsTo",
|
|
993
|
+
fk: "profileImageId",
|
|
994
|
+
optional: true
|
|
995
|
+
}) },
|
|
996
|
+
keys: ["id"]
|
|
997
|
+
});
|
|
998
|
+
|
|
999
|
+
//#endregion
|
|
1000
|
+
//#region src/models/WorkflowItem.ts
|
|
1001
|
+
/**
|
|
1002
|
+
* A Journey Step: a template for a sub card. Starting a deck's journey on a card creates a sub card
|
|
1003
|
+
* from each of its steps.
|
|
1004
|
+
* @experimental `preview` in the Codecks API: may change in any release.
|
|
1005
|
+
*/
|
|
1006
|
+
const workflowItemDesc = makeModel({
|
|
1007
|
+
name: "workflowItem",
|
|
1008
|
+
stability: "preview",
|
|
1009
|
+
fields: {
|
|
1010
|
+
accountId: belongsTo({ stability: "preview" }).type(),
|
|
1011
|
+
accountSeq: int({ stability: "preview" }),
|
|
1012
|
+
assigneeId: belongsTo({
|
|
1013
|
+
optional: true,
|
|
1014
|
+
stability: "preview"
|
|
1015
|
+
}).type(),
|
|
1016
|
+
checkboxInfo: typed({ stability: "preview" }).type(),
|
|
1017
|
+
checkboxStats: typed({ stability: "preview" }).type(),
|
|
1018
|
+
content: string({ stability: "preview" }),
|
|
1019
|
+
createdAt: date({ stability: "preview" }),
|
|
1020
|
+
creatorId: belongsTo({ stability: "preview" }).type(),
|
|
1021
|
+
deckId: belongsTo({ stability: "preview" }).type(),
|
|
1022
|
+
effort: int({
|
|
1023
|
+
optional: true,
|
|
1024
|
+
stability: "preview"
|
|
1025
|
+
}),
|
|
1026
|
+
itemId: id(),
|
|
1027
|
+
label: string({
|
|
1028
|
+
optional: true,
|
|
1029
|
+
stability: "preview"
|
|
1030
|
+
}),
|
|
1031
|
+
lastUpdatedAt: date({ stability: "preview" }),
|
|
1032
|
+
masterTags: typed({ stability: "preview" }).type(),
|
|
1033
|
+
mentionedUsers: typed({ stability: "preview" }).type(),
|
|
1034
|
+
priority: typed({
|
|
1035
|
+
optional: true,
|
|
1036
|
+
stability: "preview"
|
|
1037
|
+
}).type(),
|
|
1038
|
+
sortValue: string({ stability: "preview" }),
|
|
1039
|
+
tags: typed({ stability: "preview" }).type(),
|
|
1040
|
+
targetDeckId: belongsTo({
|
|
1041
|
+
optional: true,
|
|
1042
|
+
stability: "preview"
|
|
1043
|
+
}).type(),
|
|
1044
|
+
title: string({ stability: "preview" }),
|
|
1045
|
+
version: int({ stability: "preview" }),
|
|
1046
|
+
visibility: typed({ stability: "preview" }).type()
|
|
1047
|
+
},
|
|
1048
|
+
relations: {
|
|
1049
|
+
account: relation("account", {
|
|
1050
|
+
type: "belongsTo",
|
|
1051
|
+
fk: "accountId",
|
|
1052
|
+
stability: "preview"
|
|
1053
|
+
}),
|
|
1054
|
+
assignee: relation("user", {
|
|
1055
|
+
type: "belongsTo",
|
|
1056
|
+
fk: "assigneeId",
|
|
1057
|
+
optional: true,
|
|
1058
|
+
stability: "preview"
|
|
1059
|
+
}),
|
|
1060
|
+
creator: relation("user", {
|
|
1061
|
+
type: "belongsTo",
|
|
1062
|
+
fk: "creatorId",
|
|
1063
|
+
stability: "preview"
|
|
1064
|
+
}),
|
|
1065
|
+
deck: relation("deck", {
|
|
1066
|
+
type: "belongsTo",
|
|
1067
|
+
fk: "deckId",
|
|
1068
|
+
stability: "preview"
|
|
1069
|
+
}),
|
|
1070
|
+
inDeps: relation("workflowItem", {
|
|
1071
|
+
type: "hasMany",
|
|
1072
|
+
fkAsArray: true,
|
|
1073
|
+
stability: "preview"
|
|
1074
|
+
}),
|
|
1075
|
+
outDeps: relation("workflowItem", {
|
|
1076
|
+
type: "hasMany",
|
|
1077
|
+
fkAsArray: true,
|
|
1078
|
+
stability: "preview"
|
|
1079
|
+
}),
|
|
1080
|
+
targetDeck: relation("deck", {
|
|
1081
|
+
type: "belongsTo",
|
|
1082
|
+
fk: "targetDeckId",
|
|
1083
|
+
optional: true,
|
|
1084
|
+
stability: "preview"
|
|
1085
|
+
})
|
|
1086
|
+
},
|
|
1087
|
+
keys: ["itemId"]
|
|
1088
|
+
});
|
|
1089
|
+
|
|
1090
|
+
//#endregion
|
|
1091
|
+
//#region src/models/index.ts
|
|
1092
|
+
const modelMap = {
|
|
1093
|
+
_root: _rootDesc,
|
|
1094
|
+
account: accountDesc,
|
|
1095
|
+
attachment: attachmentDesc,
|
|
1096
|
+
card: cardDesc,
|
|
1097
|
+
cardHistory: cardHistoryDesc,
|
|
1098
|
+
deck: deckDesc,
|
|
1099
|
+
file: fileDesc,
|
|
1100
|
+
handCard: handCardDesc,
|
|
1101
|
+
milestone: milestoneDesc,
|
|
1102
|
+
milestoneProgress: milestoneProgressDesc,
|
|
1103
|
+
milestoneProject: milestoneProjectDesc,
|
|
1104
|
+
project: projectDesc,
|
|
1105
|
+
projectTag: projectTagDesc,
|
|
1106
|
+
queueEntry: queueEntryDesc,
|
|
1107
|
+
release: releaseDesc,
|
|
1108
|
+
resolvable: resolvableDesc,
|
|
1109
|
+
resolvableEntry: resolvableEntryDesc,
|
|
1110
|
+
resolvableEntryReaction: resolvableEntryReactionDesc,
|
|
1111
|
+
sprint: sprintDesc,
|
|
1112
|
+
sprintConfig: sprintConfigDesc,
|
|
1113
|
+
sprintConfigProgress: sprintConfigProgressDesc,
|
|
1114
|
+
sprintProgress: sprintProgressDesc,
|
|
1115
|
+
sprintProject: sprintProjectDesc,
|
|
1116
|
+
user: userDesc,
|
|
1117
|
+
workflowItem: workflowItemDesc
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
//#endregion
|
|
1121
|
+
//#region src/query-helpers.ts
|
|
1122
|
+
const normalizeQuery = (q) => {
|
|
1123
|
+
return JSON.stringify(q);
|
|
1124
|
+
};
|
|
1125
|
+
const queryToKey = normalizeQuery;
|
|
1126
|
+
const getRelKey = (r, k) => {
|
|
1127
|
+
const getSuffix = () => {
|
|
1128
|
+
if (r.type === "exists") return `exists:`;
|
|
1129
|
+
if (r.type === "count") return `count:`;
|
|
1130
|
+
return "";
|
|
1131
|
+
};
|
|
1132
|
+
const suffix = getSuffix();
|
|
1133
|
+
const isPlainKey = () => {
|
|
1134
|
+
if (r.type === "first") return false;
|
|
1135
|
+
if (r.filter && Object.keys(r.filter).length > 0) return false;
|
|
1136
|
+
if (r.type === "query" || r.type === void 0) {
|
|
1137
|
+
if (r.limit || r.orderBy || r.offset) return false;
|
|
1138
|
+
}
|
|
1139
|
+
return true;
|
|
1140
|
+
};
|
|
1141
|
+
if (isPlainKey()) return `${suffix}${k}`;
|
|
1142
|
+
const q = { ...r.filter };
|
|
1143
|
+
if (r.type === "first") {
|
|
1144
|
+
q.$first = true;
|
|
1145
|
+
q.$order = r.orderBy;
|
|
1146
|
+
}
|
|
1147
|
+
if (r.type === "query" || r.type === void 0) {
|
|
1148
|
+
if (r.limit) q.$limit = r.limit;
|
|
1149
|
+
if (r.offset) q.$offset = r.offset;
|
|
1150
|
+
if (r.orderBy) q.$order = r.orderBy;
|
|
1151
|
+
}
|
|
1152
|
+
return `${suffix}${k}(${normalizeQuery(q)})`;
|
|
1153
|
+
};
|
|
1154
|
+
const processRelations = (rels) => {
|
|
1155
|
+
const result = {};
|
|
1156
|
+
for (const [key, relq] of Object.entries(rels)) {
|
|
1157
|
+
const asArray = Array.isArray(relq) ? relq : [relq];
|
|
1158
|
+
for (const rel of asArray) {
|
|
1159
|
+
if (!rel) continue;
|
|
1160
|
+
result[getRelKey(rel, key)] = makeRelQuerySerializable(rel);
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
return result;
|
|
1164
|
+
};
|
|
1165
|
+
const makeModelQuerySerializable = (q) => {
|
|
1166
|
+
if (!q.relations) return q;
|
|
1167
|
+
return {
|
|
1168
|
+
...q,
|
|
1169
|
+
relations: processRelations(q.relations)
|
|
1170
|
+
};
|
|
1171
|
+
};
|
|
1172
|
+
const makeRelQuerySerializable = (r) => {
|
|
1173
|
+
if (r.type === "exists" || r.type === "count") return { asField: true };
|
|
1174
|
+
return {
|
|
1175
|
+
asField: false,
|
|
1176
|
+
fields: r.fields,
|
|
1177
|
+
relations: r.relations ? processRelations(r.relations) : void 0
|
|
1178
|
+
};
|
|
1179
|
+
};
|
|
1180
|
+
const serializeModel = (q) => {
|
|
1181
|
+
const list = q.fields ? [...q.fields] : [];
|
|
1182
|
+
if (!q.relations) return list;
|
|
1183
|
+
const relObj = {};
|
|
1184
|
+
Object.entries(q.relations).forEach(([k, r]) => {
|
|
1185
|
+
if (r.asField) list.push(k);
|
|
1186
|
+
else relObj[k] = serializeModel(r);
|
|
1187
|
+
});
|
|
1188
|
+
if (Object.keys(relObj).length) list.push(relObj);
|
|
1189
|
+
return list;
|
|
1190
|
+
};
|
|
1191
|
+
const serializeInstanceQuery = (q, instances) => {
|
|
1192
|
+
return Object.fromEntries(instances.map((instance) => {
|
|
1193
|
+
const name = instance["~model"];
|
|
1194
|
+
const getKey = () => {
|
|
1195
|
+
if (name === "_root") return "_root";
|
|
1196
|
+
return `${name}(${instance["~key"]})`;
|
|
1197
|
+
};
|
|
1198
|
+
return [getKey(), serializeModel(q)];
|
|
1199
|
+
}));
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1202
|
+
//#endregion
|
|
1203
|
+
export { _rootDesc as _rootDesc$1, getRelKey, makeModelQuerySerializable, makeRelQuerySerializable, modelMap, queryToKey, serializeInstanceQuery, serializeModel };
|