@istar-ts/core 0.15.0-beta.7 → 0.15.0-beta.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +44 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +44 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -202,6 +202,13 @@ export interface ElementKindDefinition<K extends string = string> {
|
|
|
202
202
|
readonly role?: "hub";
|
|
203
203
|
/** For a hub kind: the n-ary link kind it was generated for. */
|
|
204
204
|
readonly of?: string;
|
|
205
|
+
/**
|
|
206
|
+
* What the kind means and when to use it, in 1-3 sentences: its definition, a hint for
|
|
207
|
+
* choosing it over a neighbouring kind, and (for built-in kinds) a cited source. Rendered by
|
|
208
|
+
* `@istar-ts/actions`' `metamodelContext` when present; optional so existing declarations and
|
|
209
|
+
* extensions keep compiling.
|
|
210
|
+
*/
|
|
211
|
+
readonly description?: string;
|
|
205
212
|
}
|
|
206
213
|
/** The kinds generated for an n-ary link kind: its hub element kind, leg and end link kinds. */
|
|
207
214
|
export interface HubLinkParts {
|
|
@@ -267,6 +274,8 @@ export interface LinkKindDefinition<K extends string = string> {
|
|
|
267
274
|
readonly role?: "leg" | "end";
|
|
268
275
|
/** For a generated kind: the n-ary link kind it was generated for. */
|
|
269
276
|
readonly of?: string;
|
|
277
|
+
/** See `ElementKindDefinition.description`. */
|
|
278
|
+
readonly description?: string;
|
|
270
279
|
}
|
|
271
280
|
/**
|
|
272
281
|
* How a root metamodel's files look, for models that don't come from a file (`createEmptyModel`)
|
|
@@ -332,6 +341,8 @@ export interface ElementKindDeclaration<K extends string = string> {
|
|
|
332
341
|
/** Presentation hints, kept as data for renderers (`@istar-ts/react` draws them). */
|
|
333
342
|
readonly shape?: KindShape;
|
|
334
343
|
readonly textBox?: KindTextBox;
|
|
344
|
+
/** See `ElementKindDefinition.description`. */
|
|
345
|
+
readonly description?: string;
|
|
335
346
|
}
|
|
336
347
|
export interface LinkKindDeclaration<K extends string = string> {
|
|
337
348
|
readonly kind: K;
|
|
@@ -364,6 +375,8 @@ export interface LinkKindDeclaration<K extends string = string> {
|
|
|
364
375
|
readonly parts?: Partial<HubLinkParts>;
|
|
365
376
|
/** The hub's size. Default 20×20, as in DSM3-goals. */
|
|
366
377
|
readonly hubSize?: Size;
|
|
378
|
+
/** See `ElementKindDefinition.description`. */
|
|
379
|
+
readonly description?: string;
|
|
367
380
|
}
|
|
368
381
|
/** A whole modelling language, turned into a `Metamodel` by `defineMetamodel`. */
|
|
369
382
|
export interface RootMetamodelDeclaration<EK extends string = string, LK extends string = string> {
|
package/dist/index.d.ts
CHANGED
|
@@ -202,6 +202,13 @@ export interface ElementKindDefinition<K extends string = string> {
|
|
|
202
202
|
readonly role?: "hub";
|
|
203
203
|
/** For a hub kind: the n-ary link kind it was generated for. */
|
|
204
204
|
readonly of?: string;
|
|
205
|
+
/**
|
|
206
|
+
* What the kind means and when to use it, in 1-3 sentences: its definition, a hint for
|
|
207
|
+
* choosing it over a neighbouring kind, and (for built-in kinds) a cited source. Rendered by
|
|
208
|
+
* `@istar-ts/actions`' `metamodelContext` when present; optional so existing declarations and
|
|
209
|
+
* extensions keep compiling.
|
|
210
|
+
*/
|
|
211
|
+
readonly description?: string;
|
|
205
212
|
}
|
|
206
213
|
/** The kinds generated for an n-ary link kind: its hub element kind, leg and end link kinds. */
|
|
207
214
|
export interface HubLinkParts {
|
|
@@ -267,6 +274,8 @@ export interface LinkKindDefinition<K extends string = string> {
|
|
|
267
274
|
readonly role?: "leg" | "end";
|
|
268
275
|
/** For a generated kind: the n-ary link kind it was generated for. */
|
|
269
276
|
readonly of?: string;
|
|
277
|
+
/** See `ElementKindDefinition.description`. */
|
|
278
|
+
readonly description?: string;
|
|
270
279
|
}
|
|
271
280
|
/**
|
|
272
281
|
* How a root metamodel's files look, for models that don't come from a file (`createEmptyModel`)
|
|
@@ -332,6 +341,8 @@ export interface ElementKindDeclaration<K extends string = string> {
|
|
|
332
341
|
/** Presentation hints, kept as data for renderers (`@istar-ts/react` draws them). */
|
|
333
342
|
readonly shape?: KindShape;
|
|
334
343
|
readonly textBox?: KindTextBox;
|
|
344
|
+
/** See `ElementKindDefinition.description`. */
|
|
345
|
+
readonly description?: string;
|
|
335
346
|
}
|
|
336
347
|
export interface LinkKindDeclaration<K extends string = string> {
|
|
337
348
|
readonly kind: K;
|
|
@@ -364,6 +375,8 @@ export interface LinkKindDeclaration<K extends string = string> {
|
|
|
364
375
|
readonly parts?: Partial<HubLinkParts>;
|
|
365
376
|
/** The hub's size. Default 20×20, as in DSM3-goals. */
|
|
366
377
|
readonly hubSize?: Size;
|
|
378
|
+
/** See `ElementKindDefinition.description`. */
|
|
379
|
+
readonly description?: string;
|
|
367
380
|
}
|
|
368
381
|
/** A whole modelling language, turned into a `Metamodel` by `defineMetamodel`. */
|
|
369
382
|
export interface RootMetamodelDeclaration<EK extends string = string, LK extends string = string> {
|
package/dist/index.js
CHANGED
|
@@ -232,7 +232,8 @@ function addElementKind(table, declaration) {
|
|
|
232
232
|
pistarType: type,
|
|
233
233
|
...table.extension !== void 0 ? { extension: table.extension } : {},
|
|
234
234
|
...declaration.shape ? { shape: declaration.shape } : {},
|
|
235
|
-
...declaration.textBox ? { textBox: declaration.textBox } : {}
|
|
235
|
+
...declaration.textBox ? { textBox: declaration.textBox } : {},
|
|
236
|
+
...declaration.description !== void 0 ? { description: declaration.description } : {}
|
|
236
237
|
};
|
|
237
238
|
table.elements.set(kind, definition);
|
|
238
239
|
table.elementsByType.set(type, kind);
|
|
@@ -273,7 +274,8 @@ function addLinkKind(table, declaration) {
|
|
|
273
274
|
...declaration.check ? { check: declaration.check } : {},
|
|
274
275
|
pistarType: type,
|
|
275
276
|
...table.extension !== void 0 ? { extension: table.extension } : {},
|
|
276
|
-
...declaration.line ? { line: declaration.line } : {}
|
|
277
|
+
...declaration.line ? { line: declaration.line } : {},
|
|
278
|
+
...declaration.description !== void 0 ? { description: declaration.description } : {}
|
|
277
279
|
};
|
|
278
280
|
if (declaration.arity !== "n") {
|
|
279
281
|
table.links.set(kind, definition);
|
|
@@ -324,7 +326,8 @@ function addHubKinds(table, base, parts, hubSize) {
|
|
|
324
326
|
...owner,
|
|
325
327
|
shape: HUB_SHAPE,
|
|
326
328
|
role: "hub",
|
|
327
|
-
of: base.kind
|
|
329
|
+
of: base.kind,
|
|
330
|
+
description: `The point where ${base.label}'s sources join on their way to its target, drawn as a small circle; not an intentional element in its own right.`
|
|
328
331
|
});
|
|
329
332
|
table.elementsByType.set(`${base.pistarType}Hub`, parts.hub);
|
|
330
333
|
const common = {
|
|
@@ -346,7 +349,8 @@ function addHubKinds(table, base, parts, hubSize) {
|
|
|
346
349
|
unique: "kind"
|
|
347
350
|
},
|
|
348
351
|
pistarType: `${base.pistarType}Start`,
|
|
349
|
-
role: "leg"
|
|
352
|
+
role: "leg",
|
|
353
|
+
description: `One source's leg of a ${base.label} link, drawn from the source to the shared hub.`
|
|
350
354
|
});
|
|
351
355
|
table.linksByType.set(`${base.pistarType}Start`, parts.leg);
|
|
352
356
|
claim(parts.end, `${base.pistarType}End`, "link");
|
|
@@ -364,7 +368,8 @@ function addHubKinds(table, base, parts, hubSize) {
|
|
|
364
368
|
},
|
|
365
369
|
pistarType: `${base.pistarType}End`,
|
|
366
370
|
...base.line ? { line: base.line } : {},
|
|
367
|
-
role: "end"
|
|
371
|
+
role: "end",
|
|
372
|
+
description: `The ${base.label} link's hub-to-target leg, carrying the link's own meaning.`
|
|
368
373
|
});
|
|
369
374
|
table.linksByType.set(`${base.pistarType}End`, parts.end);
|
|
370
375
|
}
|
|
@@ -412,12 +417,40 @@ const ISTAR_LINK_LABELS = {
|
|
|
412
417
|
"istar.QualificationLink": "Qualification",
|
|
413
418
|
"istar.ContributionLink": "Contribution"
|
|
414
419
|
};
|
|
420
|
+
/**
|
|
421
|
+
* Base descriptions of iStar 2.0's kinds, written in our own words from the **iStar 2.0 Language
|
|
422
|
+
* Guide** (Dalpiaz, Franch & Horkoff, arXiv:1605.07767, 2016, CC BY 4.0): actors and intentional
|
|
423
|
+
* elements (§§2 and 4), actor links (§3), dependencies (§5) and intentional-element links (§6).
|
|
424
|
+
*/
|
|
425
|
+
const ISTAR_ELEMENT_DESCRIPTIONS = {
|
|
426
|
+
"istar.Actor": "An intentional, autonomous entity that has strategic goals and exercises know-how to pursue them, alone or with other actors (iStar 2.0 Language Guide §2). Use plain Actor when neither Agent nor Role fits better.",
|
|
427
|
+
"istar.Agent": "An actor with a concrete, physical manifestation — a specific person, organisation or software system (iStar 2.0 Language Guide §2). Use it instead of Role for a named, identifiable participant rather than an abstract part anyone could play.",
|
|
428
|
+
"istar.Role": "An abstract characterisation of an actor's behaviour within some context, independent of who plays it (iStar 2.0 Language Guide §2). Use it instead of Agent when several concrete actors could fill the same part.",
|
|
429
|
+
"istar.Goal": "A state of affairs an actor wants achieved, with a clear-cut criterion for whether it is met (iStar 2.0 Language Guide §4). Unlike a Quality, a Goal is either achieved or not; unlike a Task, it says what to achieve, not how.",
|
|
430
|
+
"istar.Quality": "An attribute an actor wants some degree of, with no binary success criterion — it is satisficed rather than achieved outright (iStar 2.0 Language Guide §4). Use it instead of Goal for non-functional concerns (e.g. performance, usability) that admit degrees.",
|
|
431
|
+
"istar.Task": "A course of action an actor wants carried out, usually to achieve a Goal, satisfice a Quality, or produce or consume a Resource (iStar 2.0 Language Guide §4). Unlike a Goal, it specifies how, not just what.",
|
|
432
|
+
"istar.Resource": "A physical or informational entity an actor needs available to perform a Task (iStar 2.0 Language Guide §4). Its mere availability, not its satisfaction, is what matters — it has no intentional content of its own."
|
|
433
|
+
};
|
|
434
|
+
/**
|
|
435
|
+
* Base descriptions of iStar 2.0's link kinds (see `ISTAR_ELEMENT_DESCRIPTIONS` for the source).
|
|
436
|
+
*/
|
|
437
|
+
const ISTAR_LINK_DESCRIPTIONS = {
|
|
438
|
+
"istar.IsALink": "Generalisation/specialisation between two actors of the same category — two Roles, or two general Actors (iStar 2.0 Language Guide §3): the specific actor inherits the general one's properties.",
|
|
439
|
+
"istar.ParticipatesInLink": "Any association between two actors other than generalisation/specialisation, e.g. an Agent playing a Role (iStar 2.0 Language Guide §3). Unlike Is-A, it places no restriction on the actors' categories.",
|
|
440
|
+
"istar.DependencyLink": "A social relationship in which a depender actor relies on a dependee actor for a dependum (a Goal, Quality, Task or Resource) it cannot, or prefers not to, provide for itself (iStar 2.0 Language Guide §5).",
|
|
441
|
+
"istar.AndRefinementLink": "Decomposes an intentional element into sub-elements that must *all* be satisfied for the parent to be satisfied (iStar 2.0 Language Guide §6.1). Contrast with Or-Refinement, where any one alternative suffices.",
|
|
442
|
+
"istar.OrRefinementLink": "Decomposes an intentional element into alternative sub-elements, any *one* of which satisfies the parent (iStar 2.0 Language Guide §6.1). Contrast with And-Refinement, which needs every child.",
|
|
443
|
+
"istar.NeededByLink": "Links a Task to the Resource it requires in order to be performed (iStar 2.0 Language Guide §6.2).",
|
|
444
|
+
"istar.QualificationLink": "Links a Quality to the Goal, Task or Resource it qualifies, expressing a desired attribute of that element's achievement, execution or provision (iStar 2.0 Language Guide §6.4).",
|
|
445
|
+
"istar.ContributionLink": "Expresses how satisfying one intentional element affects another, with a strength from 'make' (sufficient positive evidence) through 'help' (partial positive) and 'hurt' (partial negative) to 'break' (sufficient negative evidence) (iStar 2.0 Language Guide §6.3). Unlike a Refinement, it is a weaker, quantifiable influence rather than a decomposition."
|
|
446
|
+
};
|
|
415
447
|
function istarLinks(kinds, category) {
|
|
416
448
|
return kinds.map((kind) => ({
|
|
417
449
|
kind,
|
|
418
450
|
category,
|
|
419
451
|
label: ISTAR_LINK_LABELS[kind],
|
|
420
|
-
info: LINK_KIND_INFO[kind]
|
|
452
|
+
info: LINK_KIND_INFO[kind],
|
|
453
|
+
description: ISTAR_LINK_DESCRIPTIONS[kind]
|
|
421
454
|
}));
|
|
422
455
|
}
|
|
423
456
|
/** iStar 2.0's declaration, built from the constants in `metamodel.ts`. */
|
|
@@ -427,12 +460,14 @@ const ISTAR_2_0_DECLARATION = {
|
|
|
427
460
|
elements: [...ACTOR_KINDS.map((kind) => ({
|
|
428
461
|
kind,
|
|
429
462
|
category: "actor",
|
|
430
|
-
size: DEFAULT_ELEMENT_SIZE[kind]
|
|
463
|
+
size: DEFAULT_ELEMENT_SIZE[kind],
|
|
464
|
+
description: ISTAR_ELEMENT_DESCRIPTIONS[kind]
|
|
431
465
|
})), ...NODE_KINDS.map((kind) => ({
|
|
432
466
|
kind,
|
|
433
467
|
category: "node",
|
|
434
468
|
size: DEFAULT_ELEMENT_SIZE[kind],
|
|
435
|
-
info: NODE_KIND_INFO[kind]
|
|
469
|
+
info: NODE_KIND_INFO[kind],
|
|
470
|
+
description: ISTAR_ELEMENT_DESCRIPTIONS[kind]
|
|
436
471
|
}))],
|
|
437
472
|
links: [
|
|
438
473
|
...istarLinks(ACTOR_LINK_KINDS, "actor"),
|
|
@@ -1398,6 +1433,7 @@ function validateFileMetamodel(value, path = FILE_METAMODEL_KEY) {
|
|
|
1398
1433
|
optionalString(entry, "label", at);
|
|
1399
1434
|
optionalString(entry, "behavesLike", at);
|
|
1400
1435
|
optionalString(entry, "pistarType", at);
|
|
1436
|
+
optionalString(entry, "description", at);
|
|
1401
1437
|
if (kind === "element") {
|
|
1402
1438
|
if (entry.category !== void 0 && entry.category !== "node" && entry.category !== "actor") fail(`${at}.category`, "must be \"node\" or \"actor\"");
|
|
1403
1439
|
checkSize(entry.size, `${at}.size`);
|