-
Notifications
You must be signed in to change notification settings - Fork 4
/
RM_API.d.ts
398 lines (341 loc) · 14 KB
/
RM_API.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
/*
Licensed Materials - Property of IBM
(c) Copyright IBM Corporation 2013, 2014. All Rights Reserved.
Note to U.S.Government Users Restricted Rights:
Use, duplication or disclosure restricted by GSA ADP Schedule
Contract with IBM Corp.
*/
/**
* The IBM Rational RM 5.0 interface expressed as a TypeScript interface definition.
* This file targets version 1.0RC1 of the typescript language.
* API specification is available here: https://jazz.net/wiki/bin/view/Main/RMExtensionsMain
*/
declare module RM {
/** A reference to a single artifact.
*/
export interface ArtifactRef {
equals(ref: ArtifactRef): boolean;
}
/** Contains a set of attribute values in an AttributeValues object and
* associates them with a particular ArtifactRef
*/
class ArtifactAttributes {
ref: ArtifactRef;
values: AttributeValues;
constructor();
constructor(ref: ArtifactRef);
constructor(ref: ArtifactRef, values: AttributeValues);
}
/** A reference to a Type of artifact
*/
class ArtifactType {
name: string;
constructor(name: string);
}
/** Represents a set of attribute values. Each property is an attribute value */
class AttributeValues {
[x: string]: any;
// int -> number
// float -> number
// string -> string
// xhtml ->string
// Date -> Date
// datetime -> Date
// time -> RM.Time
// duration -> RM.Duration
// user -> UserRef
// enum -> string
// multivalued enum -> string[]
// boolean -> boolean
// artifact -> RM.ArtifactRef
// artifact type -> RM.ArtifactType
constructor(args?: any);
}
/** Represents a Duration attribute value
* Values will be normalised on save (2d1h -> 49h)
*/
class Duration {
weeks: number;
days: number;
hours: number;
constructor(weeks: number, days: number, hours: number);
}
/** Represents a set of links from a single artifact, with a single link type
* to multiple end points
* The 'any' in linktype should be either a string or a LinkTypeDefinition
*/
export interface LinkDefinition<T> {
art: ArtifactRef;
linktype: any;
targets: T[];
}
/** Object capturing the results of a getLinkedArtifacts call */
export interface LinkedDataSet {
internal: LinkDefinition<ArtifactRef>[];
external: LinkDefinition<string>[];
}
/** Represents a type of link, differentiating between linktypes that have different
* subject to object and object to subject identifiers
* The 'direction' string should be an RM.Data.LinkDirection constant
*/
class LinkTypeDefinition {
uri: string;
direction: string;
constructor(uri: string, direction: string);
}
/** Represents a location in relation to an artifact in a module. The ref identifies the artifact
* and the placement is an RMData_PlacementStrategy value that describes where the specified location
* is in relation to that artifact.
*/
class LocationSpecification {
ref: ArtifactRef;
placement: string;
constructor(ref: ArtifactRef, placement: string);
}
/** Represents the result of an attempted operation
* Code indicates success/failure
* Message may contain a message suitable for displaying to the user, or for debugging
* May have an arbitrary number of other properties on it depending on the operation attempted
* data property varies according to operation attempted (for instance LinkedDataSet or ArtifactAttributes[])
*/
export interface OperationResult<T> {
code: string;
message?: string;
data: T;
}
/** Represents the ability to statically access the possible OperationResult constants
* These are accessed via RM.OperationResult.OPERATION_... rather than on specific instances
* of an OperationResult.
*/
var OperationResult: {
// Result constants
OPERATION_OK: string;
OPERATION_CANCELLED: string;
OPERATION_INVALID: string;
OPERATION_FAILED: string;
}
// Part of a tree structure
export interface StructureNode extends ArtifactAttributes {
ref: ArtifactRef;
values: AttributeValues;
children: StructureNode[];
parent: StructureNode;
}
// Represents Time attribute values
// Times will be validated against 24hr clock notation hh:mm:ss
class Time {
hours: number;
minutes: number;
seconds: number;
constructor(hours: number, minutes: number, seconds: number);
}
// Contains details about a single user
export interface User {
username: string;
userId: string;
email: string;
ref: UserRef;
}
// Represents a single user. Completely opaque - nothing to print out?
export interface UserRef {
}
// Represents
export interface ValueRange {
attributeKey: string;
valueType: string;
possibleValues: string[];
multivalued: boolean;
min: number;
max: number;
}
interface RMData_Attributes {
PRIMARY_TEXT: string;
IDENTIFIER: string;
CREATED_BY: string;
CREATED_ON: string;
MODIFIED_BY: string;
MODIFIED_ON: string;
DESCRIPTION: string;
NAME: string;
DEPTH: string;
SECTION_NUMBER: string;
CONTAINING_MODULE: string;
IS_HEADING: string;
FORMAT: string;
ALTERNATE_SPELLING: string;
ARTIFACT_TYPE: string
}
interface RMData_LinkTypes {
LINK_TO: LinkTypeDefinition;
LINK_FROM: LinkTypeDefinition;
AFFECTED_BY: LinkTypeDefinition;
CHILD_OF: LinkTypeDefinition;
PARENT_OF: LinkTypeDefinition;
ELABORATED_BY: LinkTypeDefinition;
ELABORATES: LinkTypeDefinition;
EMBEDDED_IN: LinkTypeDefinition;
EMBEDS: LinkTypeDefinition;
EXTERNAL_LINK_TO: LinkTypeDefinition;
EXTERNAL_LINK_FROM: LinkTypeDefinition;
EXTRACTED: LinkTypeDefinition;
EXTRACTED_FROM: LinkTypeDefinition;
IMPLEMENTED_BY: LinkTypeDefinition;
REFERENCES: LinkTypeDefinition;
REFERENCED_BY: LinkTypeDefinition;
REFERENCES_TERM: LinkTypeDefinition;
TERM_REFERENCED_BY: LinkTypeDefinition;
SYNONYM: LinkTypeDefinition;
TRACKED_BY: LinkTypeDefinition;
VALIDATED_BY: LinkTypeDefinition;
DERIVES: LinkTypeDefinition;
SPECIFIES: LinkTypeDefinition;
SPECIFIED_BY: LinkTypeDefinition;
}
interface RMData_Formats {
TEXT: string;
MODULE: string;
COLLECTION: string;
WRAPPED: string;
SKETCH: string;
BUSINESS_PROCESS_DIAGRAM: string;
PART: string;
SCREEN_FLOW: string;
STORYBOARD: string;
SIMPLE_FLOW_DIAGRAM: string;
USE_CASE_DIAGRAM: string;
}
interface RMData_ValueTypes {
INTEGER: string;
FLOAT: string;
STRING: string;
XHTML: string;
DATE: string;
DATETIME: string;
TIME: string;
DURATION: string;
USER: string;
ENUMERATION: string;
BOOLEAN: string;
ARTIFACT: string;
}
interface RMData_LinkDirection {
OUT: string;
IN: string;
BIDIRECTIONAL: string;
}
interface RMData_PlacementStrategy {
BEFORE: string;
BELOW: string;
AFTER: string;
}
interface RMData_Module {
// Remove an artifact or tree of artifacts from a module, with the option to delete the core artifact as well if
// its last use was in this module.
removeArtifact:
{
(ref: ArtifactRef, deleteIfLastUse: boolean, callback: (result: OperationResult<void >) => void): void;
};
// Creates an artifact in a module with attributes taken from attributeValues and location determined by the strategy
createArtifact:
{
(attributeValues: AttributeValues, strategy: LocationSpecification, callback: (result: OperationResult<ArtifactRef>) => void): void;
};
// Move an artifact or tree of artifacts to another location in the same module, as determined by the by the strategy
moveArtifact:
{
(ref: ArtifactRef, strategy: LocationSpecification, callback: (result: OperationResult<void >) => void): void;
};
}
export interface RMData {
// Constants
Attributes: RMData_Attributes;
LinkTypes: RMData_LinkTypes;
Formats: RMData_Formats;
ValueTypes: RMData_ValueTypes;
LinkDirection: RMData_LinkDirection;
PlacementStrategy: RMData_PlacementStrategy;
Module: RMData_Module;
// Read attribute values for one or more artifacts
// Includes properties as well as attributes (depth et c)
getAttributes:
{
// Attributes on a single artifact
(refs: ArtifactRef, attributes: string, callback: (result: OperationResult<ArtifactAttributes[]>) => void ): void;
(refs: ArtifactRef, attributes: string[], callback: (result: OperationResult<ArtifactAttributes[]>) => void ): void;
(refs: ArtifactRef, callback: (result: OperationResult<ArtifactAttributes[]>) => void ): void;
// Attributes on a set of artifacts
(refs: ArtifactRef[], attributes: string, callback: (result: OperationResult<ArtifactAttributes[]>) => void ): void;
(refs: ArtifactRef[], attributes: string[], callback: (result: OperationResult<ArtifactAttributes[]>) => void ): void;
(refs: ArtifactRef[], callback: (result: OperationResult<ArtifactAttributes[]>) => void ): void;
};
// Read a set of attributes for the contents of the given artifact
// Assumes the given artifact is an aggregating artifact such as a module or collection
getContentsAttributes:
{
(ref: ArtifactRef, attributes: string, callback: (result: OperationResult<ArtifactAttributes[]>) => void ): void;
(ref: ArtifactRef, attributes: string[], callback: (result: OperationResult<ArtifactAttributes[]>) => void ): void;
}
// Get the structure of the artifacts within the given artifact
// Assumes the given artifact is a structured aggregating artifact such as a module
getContentsStructure:
{
(ref: ArtifactRef, attributes: string, callback: (result: OperationResult<StructureNode[]>) => void ): void;
(ref: ArtifactRef, attributes: string[], callback: (result: OperationResult<StructureNode[]>) => void ): void;
(ref: ArtifactRef, callback: (result: OperationResult<StructureNode[]>) => void ): void;
}
// Set attribute values on one or more artifacts in a single operation
setAttributes:
{
(changes: ArtifactAttributes, callback: (result: OperationResult<OperationResult<ArtifactRef>[]>) => void ): void;
(changes: ArtifactAttributes[], callback: (result: OperationResult<OperationResult<ArtifactRef>[]>) => void ): void;
}
// The 'any' type for the parameter "type" should be either a string or a LinkTypeDefinition
createLink(source: ArtifactRef, type: any, target: ArtifactRef, callback: (result: OperationResult<void >) => void ): void;
deleteLink(source: ArtifactRef, type: any, target: ArtifactRef, callback: (result: OperationResult<void >) => void ): void;
// Discover the artifacts linked to the given artifact
// The linkTypes array parameter should contain only strings and LinkTypeDefinitions
getLinkedArtifacts: {
(ref: ArtifactRef, callback: (result: OperationResult<LinkedDataSet>) => void ): void;
(ref: ArtifactRef, linkTypes: any[], callback: (result: OperationResult<LinkedDataSet>) => void ): void;
};
getValueRange(ref: ArtifactRef, attributes: string[], callback: (result: OperationResult<ValueRange[]>) => void ): void;
getUserDetails(user: UserRef, callback: (result: OperationResult<User>) => void ): void;
getCurrentUser(callback: (result: OperationResult<User>) => void): void;
}
export interface RMEvent {
// Callback signature likely to vary according to what event is involved
// Hard to capture that here (without use of any[] in the callback).
// Given API is ok for now, anything in the future should be more general (allow more, not restrict)
subscribe(event: string, callback: (refs: ArtifactRef[]) => void ): void;
unsubscribe(event: string, callback: (refs: ArtifactRef[]) => void ): void;
// Known events
ARTIFACT_SELECTED: string;
ARTIFACT_OPENED: string;
ARTIFACT_CLOSED: string;
ARTIFACT_SAVED: string;
}
export interface RMClient {
getCurrentArtifact(callback: (result: OperationResult<ArtifactAttributes>) => void ): void;
// Show the web client's Artifact Picker interface and get a callback with the result
showArtifactPicker:
{
// Pick from all visible projects
(callback: (result : OperationResult<ArtifactRef[]>) => void ): void;
// Pick from the project containing the given artifact
(ref: ArtifactRef, callback: (result : OperationResult<ArtifactRef[]>) => void ): void;
}
showUserPicker:
{
(callback: (result : OperationResult<UserRef[]>) => void ): void;
}
// Set the current selection in the client
// Can only select artifacts present in the current web page (e.g. contents of an open module or artifact explorer view)
// Will return false and leave selection unchanged if any of the artifacts cannot be selected
// Triggers a "selection" callback.
setSelection(refs: ArtifactRef[]): boolean;
}
var Data: RMData;
var Client: RMClient;
var Event: RMEvent;
var Version: string;
}