@istar-ts/core 0.15.0-beta.8 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -139,6 +139,12 @@ function shortKindName(kind) {
139
139
  }
140
140
  //#endregion
141
141
  //#region src/metamodels.ts
142
+ /** piStar-ext's line kinds, as SVG dash arrays (`KindLine.dash`); `continuous` has none. */
143
+ const LINE_DASHES = {
144
+ continuous: void 0,
145
+ dashed: "10,5",
146
+ dotted: "1,3"
147
+ };
142
148
  var MetamodelError = class extends Error {
143
149
  name = "MetamodelError";
144
150
  };
@@ -233,7 +239,8 @@ function addElementKind(table, declaration) {
233
239
  pistarType: type,
234
240
  ...table.extension !== void 0 ? { extension: table.extension } : {},
235
241
  ...declaration.shape ? { shape: declaration.shape } : {},
236
- ...declaration.textBox ? { textBox: declaration.textBox } : {}
242
+ ...declaration.textBox ? { textBox: declaration.textBox } : {},
243
+ ...declaration.description !== void 0 ? { description: declaration.description } : {}
237
244
  };
238
245
  table.elements.set(kind, definition);
239
246
  table.elementsByType.set(type, kind);
@@ -274,7 +281,8 @@ function addLinkKind(table, declaration) {
274
281
  ...declaration.check ? { check: declaration.check } : {},
275
282
  pistarType: type,
276
283
  ...table.extension !== void 0 ? { extension: table.extension } : {},
277
- ...declaration.line ? { line: declaration.line } : {}
284
+ ...declaration.line ? { line: declaration.line } : {},
285
+ ...declaration.description !== void 0 ? { description: declaration.description } : {}
278
286
  };
279
287
  if (declaration.arity !== "n") {
280
288
  table.links.set(kind, definition);
@@ -325,7 +333,8 @@ function addHubKinds(table, base, parts, hubSize) {
325
333
  ...owner,
326
334
  shape: HUB_SHAPE,
327
335
  role: "hub",
328
- of: base.kind
336
+ of: base.kind,
337
+ 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.`
329
338
  });
330
339
  table.elementsByType.set(`${base.pistarType}Hub`, parts.hub);
331
340
  const common = {
@@ -347,7 +356,8 @@ function addHubKinds(table, base, parts, hubSize) {
347
356
  unique: "kind"
348
357
  },
349
358
  pistarType: `${base.pistarType}Start`,
350
- role: "leg"
359
+ role: "leg",
360
+ description: `One source's leg of a ${base.label} link, drawn from the source to the shared hub.`
351
361
  });
352
362
  table.linksByType.set(`${base.pistarType}Start`, parts.leg);
353
363
  claim(parts.end, `${base.pistarType}End`, "link");
@@ -365,7 +375,8 @@ function addHubKinds(table, base, parts, hubSize) {
365
375
  },
366
376
  pistarType: `${base.pistarType}End`,
367
377
  ...base.line ? { line: base.line } : {},
368
- role: "end"
378
+ role: "end",
379
+ description: `The ${base.label} link's hub-to-target leg, carrying the link's own meaning.`
369
380
  });
370
381
  table.linksByType.set(`${base.pistarType}End`, parts.end);
371
382
  }
@@ -413,12 +424,40 @@ const ISTAR_LINK_LABELS = {
413
424
  "istar.QualificationLink": "Qualification",
414
425
  "istar.ContributionLink": "Contribution"
415
426
  };
427
+ /**
428
+ * Base descriptions of iStar 2.0's kinds, written in our own words from the **iStar 2.0 Language
429
+ * Guide** (Dalpiaz, Franch & Horkoff, arXiv:1605.07767, 2016, CC BY 4.0): actors and intentional
430
+ * elements (§§2 and 4), actor links (§3), dependencies (§5) and intentional-element links (§6).
431
+ */
432
+ const ISTAR_ELEMENT_DESCRIPTIONS = {
433
+ "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.",
434
+ "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.",
435
+ "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.",
436
+ "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.",
437
+ "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.",
438
+ "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.",
439
+ "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."
440
+ };
441
+ /**
442
+ * Base descriptions of iStar 2.0's link kinds (see `ISTAR_ELEMENT_DESCRIPTIONS` for the source).
443
+ */
444
+ const ISTAR_LINK_DESCRIPTIONS = {
445
+ "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.",
446
+ "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.",
447
+ "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).",
448
+ "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.",
449
+ "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.",
450
+ "istar.NeededByLink": "Links a Task to the Resource it requires in order to be performed (iStar 2.0 Language Guide §6.2).",
451
+ "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).",
452
+ "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."
453
+ };
416
454
  function istarLinks(kinds, category) {
417
455
  return kinds.map((kind) => ({
418
456
  kind,
419
457
  category,
420
458
  label: ISTAR_LINK_LABELS[kind],
421
- info: LINK_KIND_INFO[kind]
459
+ info: LINK_KIND_INFO[kind],
460
+ description: ISTAR_LINK_DESCRIPTIONS[kind]
422
461
  }));
423
462
  }
424
463
  /** iStar 2.0's declaration, built from the constants in `metamodel.ts`. */
@@ -428,12 +467,14 @@ const ISTAR_2_0_DECLARATION = {
428
467
  elements: [...ACTOR_KINDS.map((kind) => ({
429
468
  kind,
430
469
  category: "actor",
431
- size: DEFAULT_ELEMENT_SIZE[kind]
470
+ size: DEFAULT_ELEMENT_SIZE[kind],
471
+ description: ISTAR_ELEMENT_DESCRIPTIONS[kind]
432
472
  })), ...NODE_KINDS.map((kind) => ({
433
473
  kind,
434
474
  category: "node",
435
475
  size: DEFAULT_ELEMENT_SIZE[kind],
436
- info: NODE_KIND_INFO[kind]
476
+ info: NODE_KIND_INFO[kind],
477
+ description: ISTAR_ELEMENT_DESCRIPTIONS[kind]
437
478
  }))],
438
479
  links: [
439
480
  ...istarLinks(ACTOR_LINK_KINDS, "actor"),
@@ -1399,6 +1440,7 @@ function validateFileMetamodel(value, path = FILE_METAMODEL_KEY) {
1399
1440
  optionalString(entry, "label", at);
1400
1441
  optionalString(entry, "behavesLike", at);
1401
1442
  optionalString(entry, "pistarType", at);
1443
+ optionalString(entry, "description", at);
1402
1444
  if (kind === "element") {
1403
1445
  if (entry.category !== void 0 && entry.category !== "node" && entry.category !== "actor") fail(`${at}.category`, "must be \"node\" or \"actor\"");
1404
1446
  checkSize(entry.size, `${at}.size`);
@@ -3313,6 +3355,7 @@ exports.ISTAR_2_0 = ISTAR_2_0;
3313
3355
  exports.ISTAR_2_0_DECLARATION = ISTAR_2_0_DECLARATION;
3314
3356
  exports.ISTAR_PREFIX = ISTAR_PREFIX;
3315
3357
  exports.ISTAR_VERSION = ISTAR_VERSION;
3358
+ exports.LINE_DASHES = LINE_DASHES;
3316
3359
  exports.LINK_KINDS = LINK_KINDS;
3317
3360
  exports.LINK_KIND_INFO = LINK_KIND_INFO;
3318
3361
  exports.LINK_SELECTOR = LINK_SELECTOR;