@voxgig/apidef 8.22.1 → 8.23.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/apidef.d.ts CHANGED
@@ -18,6 +18,6 @@ declare namespace ApiDef {
18
18
  export type { ApiDefOptions, };
19
19
  export type { PathDef, MethodDef, ServerDef, ServerVariableDef, ParameterDef, SchemaDef, } from './def';
20
20
  export type { CmpDesc, BasicMethodDesc, MethodDesc, MethodEntityDesc, EntityDesc, EntityPathDesc, PathDesc, OpDesc, } from './desc';
21
- export type { OpName, ArgKind, NamesCluster, ModelEntityRelations, ModelOpMap, ModelFieldOp, ModelField, ModelArg, ModelPoint, ModelOp, ModelEntity, Model, ModelEntityFlow, ModelEntityFlowStep, ModelEntityFlowStepInput, ModelEntityFlowStepValidator, ModelEntityFlowStepSpec, } from './model';
21
+ export type { OpName, ArgKind, NamesCluster, ModelEntityRelations, ModelOpMap, ModelFieldOp, ModelField, ModelArg, ModelPoint, BodyKind, ModelBodyField, ModelBody, ModelOp, ModelEntity, Model, ModelEntityFlow, ModelEntityFlowStep, ModelEntityFlowStepInput, ModelEntityFlowStepValidator, ModelEntityFlowStepSpec, } from './model';
22
22
  export { KIT, ApiDef, gcEntityFiles, warningsFileText, parse, formatJSONIC, depluralize, sanitizeSlug, slugToPascalCase, getModelPath, nom, VALID_CANON, CANON_ONE, operationFacts, operationIndex, resolvedSpec, };
23
23
  export type { OperationSelector, OperationFacts, ResolvedSpec, };
package/dist/apidef.js CHANGED
@@ -65,6 +65,7 @@ const contract_1 = require("./transform/contract");
65
65
  const operation_1 = require("./transform/operation");
66
66
  const graphql_1 = require("./transform/graphql");
67
67
  const args_1 = require("./transform/args");
68
+ const body_1 = require("./transform/body");
68
69
  const select_1 = require("./transform/select");
69
70
  const field_1 = require("./transform/field");
70
71
  const casecollide_1 = require("./transform/casecollide");
@@ -233,6 +234,7 @@ function ApiDef(opts) {
233
234
  await (0, graphql_1.graphqlTransform)(ctx);
234
235
  await (0, contract_1.contractTransform)(ctx);
235
236
  await (0, args_1.argsTransform)(ctx);
237
+ await (0, body_1.bodyTransform)(ctx);
236
238
  await (0, select_1.selectTransform)(ctx);
237
239
  await (0, field_1.fieldTransform)(ctx);
238
240
  // Before flowTransform, so no flow is built for an entity it drops.
@@ -1 +1 @@
1
- {"version":3,"file":"apidef.js","sourceRoot":"","sources":["../src/apidef.ts"],"names":[],"mappings":";AAAA,iDAAiD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAoiB/C,MAAM;QAEN,gBAAgB;AAniBlB,MAAY,EAAE,oCAAe;AAC7B,0DAA4B;AAG5B,uCAEiB;AAEjB,uCAAyC;AAczC,mCAOgB;oFANd,WAAG;AASL,yCAEsB;AAGtB,mCAEgB;sFADd,aAAK;AAIP,2CAEoB;AAGpB,uCAiBkB;oFAhBhB,aAAG;6FAIH,sBAAY;4FACZ,qBAAW;6FAGX,sBAAY;iGACZ,0BAAgB;6FAIhB,sBAAY;4FACZ,qBAAW;0FACX,mBAAS;AAIX,yCAA8C;AAC9C,+CAAoD;AACpD,mDAAwD;AACxD,qDAA0D;AAC1D,iDAAsD;AACtD,2CAAgD;AAChD,+CAAoD;AACpD,6CAAkD;AAClD,yDAA8D;AAC9D,2CAAgD;AAChD,mDAAwD;AACxD,6CAAkD;AAElD,yCAEmB;+FADA,yBAAc;+FAAE,yBAAc;6FAAE,uBAAY;AAK/D,6CAAoD;AACpD,oDAAuD;8FAA9C,sBAAa;AACtB,yCAA+D;AAE/D,2BAA2B;AAC3B,MAAM,IAAI,GAAG,IAAA,iBAAO,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;AAG1C,iEAAiE;AACjE,SAAS,aAAa,CAAC,QAAa,EAAE,SAA6B;IACjE,MAAM,MAAM,GAAG,IAAI,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;IACjD,MAAM,KAAK,GAAG,MAAM,CAAC,MAA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,CAAC,MAAM;gBACnB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,SAAS,EAAE,IAAI,CAAC,SAAS;gBACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,IAAI;gBACJ,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,IAAI,EAAE,KAAK,CAAC,GAAG;gBACf,GAAG,EAAE,IAAI,CAAC,GAAG;aACd,CAAC,CAAA;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,IAAI,EAAE,CAAA;QAErD,yEAAyE;QACzE,iEAAiE;QACjE,OAAO,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAA;IAC9E,CAAC,CAAA;IAED,KAAK,CAAC,IAAI,GAAG,KAAK,CAAA;IAElB,OAAO,KAAK,CAAA;AACd,CAAC,CAAA"}
@@ -1,5 +1,8 @@
1
1
  import { ApiDefContext, Guide } from '../types';
2
2
  declare function heuristic01(ctx: ApiDefContext): Promise<Guide>;
3
+ declare function namingSchemas(method: string, responses: any, answered: Record<string, boolean>, envelope: Record<string, string>): any[];
4
+ declare function answeredRefs(def: any, envelope: Record<string, string>): Record<string, boolean>;
5
+ declare function namingRef(schema: any, envelope: Record<string, string>): string | undefined;
3
6
  declare function pathResource(parts: string[], method: string): string | null;
4
7
  type SharingRoute = {
5
8
  cmp: string;
@@ -8,4 +11,10 @@ type SharingRoute = {
8
11
  op: string;
9
12
  };
10
13
  declare function sharedRoutes(routes: SharingRoute[], records: string[]): string[];
11
- export { heuristic01, pathResource, sharedRoutes, };
14
+ declare function distinctRecord(share: any, item: any): boolean;
15
+ declare function distinctShare(def: any, sharePath: string, shareMethods: string[], itemPath: string, itemMethods: string[]): boolean;
16
+ declare function isVerb(partStr: string): boolean;
17
+ declare function verbParts(parts: string[]): string[];
18
+ declare function isNameParam(param: string): boolean;
19
+ declare function entityParamNames(paths: Record<string, Record<string, string>>): Record<string, Record<string, string>>;
20
+ export { answeredRefs, distinctRecord, distinctShare, heuristic01, namingRef, namingSchemas, pathResource, sharedRoutes, entityParamNames, isNameParam, isVerb, verbParts, };
@@ -1,8 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.answeredRefs = answeredRefs;
4
+ exports.distinctRecord = distinctRecord;
5
+ exports.distinctShare = distinctShare;
3
6
  exports.heuristic01 = heuristic01;
7
+ exports.namingRef = namingRef;
8
+ exports.namingSchemas = namingSchemas;
4
9
  exports.pathResource = pathResource;
5
10
  exports.sharedRoutes = sharedRoutes;
11
+ exports.entityParamNames = entityParamNames;
12
+ exports.isNameParam = isNameParam;
13
+ exports.isVerb = isVerb;
14
+ exports.verbParts = verbParts;
6
15
  const ordu_1 = require("ordu");
7
16
  const jostraca_1 = require("jostraca");
8
17
  const struct_1 = require("@voxgig/struct");
@@ -61,6 +70,7 @@ async function heuristic01(ctx) {
61
70
  { select: selectCmpXrefs, apply: MeasureRef },
62
71
  { select: selectAllMethods, apply: MeasureEnvelope },
63
72
  MeasureEnvelopeItems,
73
+ MeasureAnswered,
64
74
  { select: selectAllMethods, apply: MeasureSharing },
65
75
  MeasureShared,
66
76
  {
@@ -81,7 +91,11 @@ async function heuristic01(ctx) {
81
91
  throw result.err;
82
92
  }
83
93
  const guide = result.data.guide;
84
- guide.metrics.count.entity -= (0, entity_1.mergeCollectionPaths)(guide, ctx.log, (pathStr, methods, collection) => pathRecordRef(ctx.def, pathStr, methods, collection)).length;
94
+ guide.metrics.count.entity -= (0, entity_1.mergeCollectionPaths)(guide, ctx.log, (pathStr, methods, collection) => pathRecordRef(ctx.def, pathStr, methods, collection), (sharePath, shareMethods, itemPath, itemMethods) => distinctShare(ctx.def, sharePath, shareMethods, itemPath, itemMethods)).length;
95
+ // After the merge, which can move a path onto another entity.
96
+ for (const entity of Object.values(guide.entity)) {
97
+ nameEntityParams(entity);
98
+ }
85
99
  const metrics = guide.metrics;
86
100
  const entities = Object.values(guide.entity);
87
101
  const entityCount = entities.length;
@@ -136,6 +150,7 @@ function Prepare(spec) {
136
150
  listEnvelope: {},
137
151
  envelopePaths: {},
138
152
  sharing: { routes: [], records: {}, yields: {} },
153
+ recordResources: {},
139
154
  entity: {
140
155
  count: {
141
156
  seen: 0,
@@ -258,6 +273,11 @@ function MeasureEnvelopeItems(spec) {
258
273
  }
259
274
  }
260
275
  }
276
+ // The records some operation answers with in a 200 or 201, read through the
277
+ // envelopes MeasureEnvelopeItems settles.
278
+ function MeasureAnswered(spec) {
279
+ spec.data.work.answered = answeredRefs(spec.data.def, spec.data.work.envelope);
280
+ }
261
281
  function isPageAndItsItem(work, xrefs) {
262
282
  const pages = xrefs.filter((xref) => work.listEnvelope[xref]);
263
283
  const items = xrefs.filter((xref) => !work.listEnvelope[xref]);
@@ -276,13 +296,18 @@ function MeasureSharing(spec) {
276
296
  const parts = work.pathmap[mdesc.path].parts;
277
297
  const op = methodOpname(mdesc, matchEntityPath(parts), []) ?? '';
278
298
  const sharing = work.sharing;
279
- const xrefs = findPotentialSchemaRefs(mdesc.path, mdesc.method, mdesc.responses, work.envelope, []);
299
+ const resource = pathResource(parts, mdesc.method);
300
+ const xrefs = findPotentialSchemaRefs(mdesc.path, mdesc.method, mdesc.responses, work.envelope, work.answered, []);
280
301
  for (const xref of xrefs) {
281
302
  const m = xref.match(/\/(components\/schemas|definitions)\/(.+)$/);
282
303
  if (null != m) {
283
304
  const cmp = (0, utility_2.canonizeCmpName)(m[2]);
305
+ const record = declaresId(refSchema(spec.data.def, xref));
284
306
  sharing.routes.push({ cmp, method: mdesc.method, path: mdesc.path, op });
285
- sharing.records[cmp] = true === sharing.records[cmp] || declaresId(refSchema(spec.data.def, xref));
307
+ sharing.records[cmp] = true === sharing.records[cmp] || record;
308
+ if (record && null != resource) {
309
+ work.recordResources[resource] = true;
310
+ }
286
311
  }
287
312
  }
288
313
  }
@@ -348,7 +373,7 @@ function ResolveEntityComponent(spec) {
348
373
  const parts = work.pathmap[pathStr].parts;
349
374
  let why_cmp = [];
350
375
  let responses = methodDef.responses;
351
- let origxrefs = findPotentialSchemaRefs(pathStr, methodName, responses, work.envelope, why_cmp).map(val => ({
376
+ let origxrefs = findPotentialSchemaRefs(pathStr, methodName, responses, work.envelope, work.answered, why_cmp).map(val => ({
352
377
  val
353
378
  }));
354
379
  let cmpxrefs = origxrefs
@@ -504,6 +529,11 @@ function ResolveEntityName(spec) {
504
529
  }
505
530
  }
506
531
  entname = (0, utility_2.resplitFromCmp)(entname, ment.cmp, why_path);
532
+ const collectionEntity = itemOfCollection(data, mdesc, parts);
533
+ if (null != collectionEntity) {
534
+ why_path.push('collection-record=' + collectionEntity);
535
+ entname = collectionEntity;
536
+ }
507
537
  // Keep the pre-truncation name so a truncated-name collision can tell a
508
538
  // re-encounter of the SAME origin (merge) from a genuinely different one
509
539
  // (numeric suffix) — see ensureMinEntityName.
@@ -535,6 +565,14 @@ function ResolveEntityName(spec) {
535
565
  work.pathowner = work.pathowner ?? {};
536
566
  work.pathowner[pathStr] = work.pathowner[pathStr] ?? {};
537
567
  work.pathowner[pathStr][methodName] = entname;
568
+ // The entity a path's own record names, where the record carries the name
569
+ // the path's last segment gives.
570
+ const last = parts.filter((part) => !isParam(part)).pop();
571
+ work.recordowner = work.recordowner ?? {};
572
+ if (null == work.recordowner[pathStr] && isSchemaRef(ment.ref) &&
573
+ entname === ment.cmp && null != last && entname === (0, utility_2.canonize)(last)) {
574
+ work.recordowner[pathStr] = entname;
575
+ }
538
576
  // Same guard, same reason: the formatting is the cost, not the call.
539
577
  if ((0, utility_2.debugpathOn)()) {
540
578
  (0, utility_2.debugpath)(pathStr, methodName, 'RESOLVE-ENTITY-NAME', (0, utility_2.formatJSONIC)({ entdesc, ment }, { hsepd: 0, $: true, color: true }));
@@ -560,7 +598,7 @@ function RenameParams(spec) {
560
598
  rename: pathDesc.rename.param = (pathDesc.rename.param ?? {}),
561
599
  why: pathDesc.why_rename.why_param = (pathDesc.why_rename.why_param ?? {}),
562
600
  };
563
- const parts = pathdesc.parts;
601
+ const parts = verbParts(pathdesc.parts);
564
602
  const applySnakeCaseRename = () => {
565
603
  for (const part of parts) {
566
604
  const m = part.match(/^\{(.+)\}$/);
@@ -630,7 +668,7 @@ function RenameParams(spec) {
630
668
  updateParamRename(ctx, data, pathStr, methodName, paramRenameCapture, oldParam, 'id', 'id-parent-ent');
631
669
  why.push('id-parent-ent');
632
670
  }
633
- else {
671
+ else if (!isNameParam(oldParam)) {
634
672
  updateParamRename(ctx, data, pathStr, methodName, paramRenameCapture, oldParam, parentName + '_id', 'parent:' + parentName);
635
673
  why.push('parent');
636
674
  }
@@ -671,7 +709,7 @@ function RenameParams(spec) {
671
709
  else {
672
710
  why.push('default');
673
711
  let newParamName = parentName + '_id';
674
- if (newParamName != oldParam) {
712
+ if (newParamName != oldParam && !isNameParam(oldParam)) {
675
713
  updateParamRename(ctx, data, pathStr, methodName, paramRenameCapture, oldParam, newParamName, 'not-primary');
676
714
  why.push('not-primary');
677
715
  }
@@ -717,7 +755,7 @@ function FindActions(spec) {
717
755
  const methodName = mdesc.method;
718
756
  pathdesc.action = (pathdesc.action ?? {});
719
757
  pathdesc.why_action = (pathdesc.why_action ?? {});
720
- const parts = spec.data.work.pathmap[pathStr].parts;
758
+ const parts = verbParts(spec.data.work.pathmap[pathStr].parts);
721
759
  const fourthLastPart = parts[parts.length - 4];
722
760
  const fourthLastPartCanon = (0, utility_2.canonize)(fourthLastPart);
723
761
  const thirdLastPart = parts[parts.length - 3];
@@ -728,15 +766,17 @@ function FindActions(spec) {
728
766
  const lastPartCanon = (0, utility_2.canonize)(lastPart);
729
767
  const cmp = ment.cmp;
730
768
  if (null != ment.verb_on_parent) {
731
- pathdesc.action[lastPartCanon] = pathdesc.action[lastPartCanon] ?? {
732
- why_action: ['ent', entdesc.name, 'verb-on-parent', lastPart, methodName],
733
- };
769
+ if (isVerb(lastPart)) {
770
+ pathdesc.action[lastPartCanon] = pathdesc.action[lastPartCanon] ?? {
771
+ why_action: ['ent', entdesc.name, 'verb-on-parent', lastPart, methodName],
772
+ };
773
+ }
734
774
  }
735
775
  // /api/foo/bar where foo is the entity and bar is the action, no id param
736
776
  else if (secondLastPartCanon === cmp
737
777
  || secondLastPartCanon === ment.origcmp
738
778
  || secondLastPartCanon === entname) {
739
- if (!isParam(lastPart)) {
779
+ if (isVerb(lastPart)) {
740
780
  updateAction(methodName, lastPart, lastPartCanon, entdesc, pathdesc, 'no-param');
741
781
  }
742
782
  }
@@ -744,7 +784,7 @@ function FindActions(spec) {
744
784
  else if (thirdLastPartCanon === cmp
745
785
  || thirdLastPartCanon === ment.origcmp
746
786
  || thirdLastPartCanon === entname) {
747
- if (isParam(secondLastPart) && !isParam(lastPart)) {
787
+ if (isParam(secondLastPart) && isVerb(lastPart)) {
748
788
  updateAction(methodName, lastPart, lastPartCanon, entdesc, pathdesc, 'ent-param-2nd-last');
749
789
  }
750
790
  }
@@ -752,7 +792,7 @@ function FindActions(spec) {
752
792
  else if (fourthLastPartCanon === cmp
753
793
  || fourthLastPartCanon === ment.origcmp
754
794
  || fourthLastPartCanon === entname) {
755
- if (isParam(thirdLastPart) && !isParam(secondLastPart) && !isParam(lastPart)) {
795
+ if (isParam(thirdLastPart) && isVerb(secondLastPart) && isVerb(lastPart)) {
756
796
  const oldActionName = secondLastPart + '/' + lastPart;
757
797
  const actionName = secondLastPartCanon + '_' + lastPartCanon;
758
798
  updateAction(methodName, oldActionName, actionName, entdesc, pathdesc, 'ent-param-3rd-last');
@@ -1034,6 +1074,34 @@ function verbOnParent(data, pm, mdesc) {
1034
1074
  }
1035
1075
  return (0, utility_2.canonize)((0, struct_1.getelem)(pm, -3));
1036
1076
  }
1077
+ // The entity of an item route's collection, for a method on the item route
1078
+ // named by its tag alone, when the route answers nothing and the tag names
1079
+ // another resource with a record of its own, which the item's operations
1080
+ // would join: the collection's record then names the item too, as GitHub's
1081
+ // repository invitations do beside its repositories.
1082
+ function itemOfCollection(data, mdesc, parts) {
1083
+ const ment = mdesc.MethodEntity;
1084
+ if ('tag' !== ment.ref || null != ment.rescmp ||
1085
+ true !== data.work.recordResources[ment.cmp]) {
1086
+ return null;
1087
+ }
1088
+ const lits = parts.slice(0, parts.findIndex(isParam));
1089
+ if (0 === lits.length || !parts.slice(lits.length).every(isParam)) {
1090
+ return null;
1091
+ }
1092
+ const answers = Object.entries(data.def?.paths?.[mdesc.path] ?? {})
1093
+ .some(([method, mdef]) => null != METHOD_CONSIDER_ORDER[method.toUpperCase()] &&
1094
+ null != getResponseSchema(successResponse(mdef?.responses)));
1095
+ if (answers) {
1096
+ return null;
1097
+ }
1098
+ const collection = '/' + lits.join('/');
1099
+ return data.work.recordowner?.[collection] ??
1100
+ data.work.recordowner?.[collection + '/'] ?? null;
1101
+ }
1102
+ function isSchemaRef(ref) {
1103
+ return null != ref && '' !== ref && 'tag' !== ref;
1104
+ }
1037
1105
  function isOrigCmp(data, name) {
1038
1106
  return null != data.guide.metrics.count.origcmprefs[name];
1039
1107
  }
@@ -1117,17 +1185,58 @@ function successSchemas(responses) {
1117
1185
  .map((rescode) => getResponseSchema(responses?.[rescode]))
1118
1186
  .filter((schema) => null != schema);
1119
1187
  }
1188
+ // A read answered only by an Accepted response is named from it when another
1189
+ // operation answers with the same record in a 200 or 201, which shows the
1190
+ // record is a resource rather than the work queued.
1191
+ function namingSchemas(method, responses, answered, envelope) {
1192
+ const schemas = successSchemas(responses);
1193
+ if (0 === schemas.length && READ_METHODS.includes(method)) {
1194
+ const accepted = getResponseSchema(responses?.[202]);
1195
+ if (true === answered[namingRef(accepted, envelope) ?? '']) {
1196
+ schemas.push(accepted);
1197
+ }
1198
+ }
1199
+ return schemas;
1200
+ }
1201
+ function answeredRefs(def, envelope) {
1202
+ const answered = {};
1203
+ for (const pathdef of Object.values(def?.paths ?? {})) {
1204
+ for (const [method, mdef] of Object.entries(pathdef ?? {})) {
1205
+ if (null == METHOD_CONSIDER_ORDER[method.toUpperCase()] ||
1206
+ null == mdef || 'object' !== typeof mdef) {
1207
+ continue;
1208
+ }
1209
+ for (const schema of successSchemas(mdef.responses)) {
1210
+ const ref = namingRef(schema, envelope);
1211
+ if (null != ref) {
1212
+ answered[ref] = true;
1213
+ }
1214
+ }
1215
+ }
1216
+ }
1217
+ return answered;
1218
+ }
1219
+ // The component a response schema names through: the record an envelope
1220
+ // carries, else the schema's own component, else its array items'.
1221
+ function namingRef(schema, envelope) {
1222
+ const xref = schema?.['x-ref'];
1223
+ if (null != xref) {
1224
+ const itemref = envelope[xref];
1225
+ return null == itemref || '' === itemref ? xref : itemref;
1226
+ }
1227
+ return 'array' === schema?.type ? schema.items?.['x-ref'] : undefined;
1228
+ }
1120
1229
  function getResponseSchema(response) {
1121
1230
  return response?.content?.['application/json']?.schema ??
1122
1231
  response?.schema;
1123
1232
  }
1124
1233
  // The record a path answers with, read from its methods in the order they are
1125
1234
  // considered, so a read decides before a write.
1126
- function pathRecordRef(def, pathStr, methods, collection) {
1235
+ function pathRecordRef(def, pathStr, methods, collection, accepted = true) {
1127
1236
  const rank = (method) => METHOD_CONSIDER_ORDER[method] ?? Number.MAX_SAFE_INTEGER;
1128
1237
  const ordered = [...methods].sort((a, b) => rank(a) - rank(b) || (0, refcount_1.byCodePoint)(a, b));
1129
1238
  for (const method of ordered) {
1130
- const ref = routeRecordRef(def, pathStr, method, collection);
1239
+ const ref = routeRecordRef(def, pathStr, method, collection, accepted);
1131
1240
  if (null != ref) {
1132
1241
  return ref;
1133
1242
  }
@@ -1138,9 +1247,11 @@ function pathRecordRef(def, pathStr, methods, collection) {
1138
1247
  // items', or the one its envelope carries, such as the job summary in Mux's
1139
1248
  // `{ data }`. Only a collection reads a page, so beneath the collection a
1140
1249
  // team that holds nothing but its members is a team. Null when the answer
1141
- // names no component.
1142
- function routeRecordRef(def, pathStr, method, collection) {
1143
- const schema = getResponseSchema(successResponse(def?.paths?.[pathStr]?.[method.toLowerCase()]?.responses));
1250
+ // names no component, or is Accepted and `accepted` excludes it.
1251
+ function routeRecordRef(def, pathStr, method, collection, accepted = true) {
1252
+ const responses = def?.paths?.[pathStr]?.[method.toLowerCase()]?.responses;
1253
+ const schema = getResponseSchema(accepted ? successResponse(responses) :
1254
+ responses?.[200] ?? responses?.[201]);
1144
1255
  if (null == schema || 'object' !== typeof schema) {
1145
1256
  return null;
1146
1257
  }
@@ -1425,14 +1536,29 @@ function refSchema(def, xref) {
1425
1536
  }
1426
1537
  return node;
1427
1538
  }
1428
- // Read in place: resolveSchemaProperties merges, and merging rewrites the
1429
- // nodes the def's schemas share.
1430
- function declaresId(schema) {
1431
- if (null == schema || 'object' !== typeof schema) {
1539
+ // Whether a share's record is apart from an item's: both declare an `id`, and
1540
+ // the share has no more than half of its properties in common with the item,
1541
+ // since a collection's list is routinely a summary of its item's record.
1542
+ function distinctRecord(share, item) {
1543
+ if (!declaresId(share) || !declaresId(item)) {
1432
1544
  return false;
1433
1545
  }
1434
- const parts = [schema, ...(Array.isArray(schema.allOf) ? schema.allOf : [])];
1435
- return parts.some((part) => null != part?.properties?.id);
1546
+ const own = Object.keys((0, utility_2.mergedProperties)(share) ?? {});
1547
+ const theirs = (0, utility_2.mergedProperties)(item) ?? {};
1548
+ const common = own.filter((name) => Object.prototype.hasOwnProperty.call(theirs, name));
1549
+ return common.length * 2 <= own.length;
1550
+ }
1551
+ // Whether a collection share answers with a record apart from the one its item
1552
+ // route answers with, both read from a 200 or 201: an Accepted body may
1553
+ // describe the queued work rather than a resource.
1554
+ function distinctShare(def, sharePath, shareMethods, itemPath, itemMethods) {
1555
+ const share = pathRecordRef(def, sharePath, shareMethods, true, false);
1556
+ const item = pathRecordRef(def, itemPath, itemMethods, false, false);
1557
+ return null != share && null != item && share !== item &&
1558
+ distinctRecord(refSchema(def, share), refSchema(def, item));
1559
+ }
1560
+ function declaresId(schema) {
1561
+ return null != (0, utility_2.mergedProperties)(schema)?.id;
1436
1562
  }
1437
1563
  // The operation ResolveOperation will assign, needed before the entity is
1438
1564
  // named: whether a response unwraps as an envelope depends on it.
@@ -1560,6 +1686,96 @@ function updateParamRename(ctx, data, path, method, paramRenameCapture, oldParam
1560
1686
  function isParam(partStr) {
1561
1687
  return '{' === partStr[0] && '}' === partStr[partStr.length - 1];
1562
1688
  }
1689
+ // A segment holding a placeholder, whole or beside other text, names no verb.
1690
+ function isVerb(partStr) {
1691
+ return !String(partStr ?? '').includes('{');
1692
+ }
1693
+ // A custom method (`/schedules:count`, `/users/{id}:activate`) reads as a
1694
+ // trailing verb segment after what it acts on.
1695
+ function verbParts(parts) {
1696
+ const m = (parts[parts.length - 1] ?? '').match(/^(.+):([A-Za-z][\w-]*)$/);
1697
+ return null == m ? parts : [...parts.slice(0, -1), m[1], m[2]];
1698
+ }
1699
+ // A parameter whose own name says it holds a name, such as `project_name`,
1700
+ // which a derived `<parent>_id` would misdescribe.
1701
+ function isNameParam(param) {
1702
+ return /(^|_)name$/.test((0, jostraca_2.snakify)((0, utility_2.normalizeFieldName)(param)));
1703
+ }
1704
+ function nameEntityParams(entity) {
1705
+ const given = {};
1706
+ for (const [pathStr, guidePath] of Object.entries(entity.path ?? {})) {
1707
+ given[pathStr] = {};
1708
+ for (const [param, rename] of Object.entries(guidePath.rename?.param ?? {})) {
1709
+ given[pathStr][param] = rename.target;
1710
+ }
1711
+ }
1712
+ const named = entityParamNames(given);
1713
+ for (const [pathStr, guidePath] of Object.entries(entity.path ?? {})) {
1714
+ guidePath.rename = guidePath.rename ?? { param: {} };
1715
+ const renames = guidePath.rename.param = guidePath.rename.param ?? {};
1716
+ for (const param of Object.keys(renames)) {
1717
+ if (null == named[pathStr][param]) {
1718
+ delete renames[param];
1719
+ }
1720
+ }
1721
+ for (const [param, target] of Object.entries(named[pathStr])) {
1722
+ if (target !== renames[param]?.target) {
1723
+ renames[param] = { target, why_rename: ['entity-param'] };
1724
+ }
1725
+ }
1726
+ }
1727
+ }
1728
+ // An entity's paths with the renames of their parameters, given back with one
1729
+ // name for each parameter at the same place in several paths: its own name,
1730
+ // snake-cased as the paths would, unless some path makes it the entity's `id`.
1731
+ function entityParamNames(paths) {
1732
+ const out = {};
1733
+ const places = {};
1734
+ for (const pathStr of Object.keys(paths).sort(refcount_1.byCodePoint)) {
1735
+ out[pathStr] = { ...paths[pathStr] };
1736
+ const parts = verbParts(pathStr.split('/').filter((p) => '' !== p));
1737
+ parts.forEach((part, partI) => {
1738
+ if (isParam(part)) {
1739
+ const place = parts.slice(0, partI + 1).join('/');
1740
+ (places[place] = places[place] ?? []).push({ pathStr, param: part.slice(1, -1) });
1741
+ }
1742
+ });
1743
+ }
1744
+ for (const place of Object.keys(places).sort(refcount_1.byCodePoint)) {
1745
+ const uses = places[place];
1746
+ const names = uses.map((use) => out[use.pathStr][use.param] ?? use.param);
1747
+ const param = uses[0].param;
1748
+ const snake = (0, utility_2.depluralize)((0, jostraca_2.snakify)((0, utility_2.normalizeFieldName)(param)));
1749
+ const name = names.includes('id') ? null :
1750
+ names.includes(snake) ? snake :
1751
+ names.includes(param) ? param : null;
1752
+ if (null == name || names.every((n) => n === name)) {
1753
+ continue;
1754
+ }
1755
+ for (const use of uses) {
1756
+ const renames = out[use.pathStr];
1757
+ if (paramNameTaken(use.pathStr, renames, use.param, name)) {
1758
+ continue;
1759
+ }
1760
+ if (name === use.param) {
1761
+ delete renames[use.param];
1762
+ }
1763
+ else {
1764
+ renames[use.param] = name;
1765
+ }
1766
+ }
1767
+ }
1768
+ return out;
1769
+ }
1770
+ // As updateParamRename judges a clash: by what the path's other parameters
1771
+ // end up called.
1772
+ function paramNameTaken(pathStr, renames, param, name) {
1773
+ return Object.keys(renames).some((other) => other !== param && renames[other] === name) ||
1774
+ (pathStr.match(/\{([^}]+)\}/g) || [])
1775
+ .map((seg) => seg.slice(1, -1))
1776
+ .some((other) => other !== param && null == renames[other] &&
1777
+ (0, utility_2.canonize)(other) === name);
1778
+ }
1563
1779
  function findcmps(data, pathStr, underprops, opts) {
1564
1780
  const cmplist = [];
1565
1781
  const cmpset = new Set();
@@ -1598,23 +1814,17 @@ function makeMethodEntityDesc(desc) {
1598
1814
  };
1599
1815
  return ment;
1600
1816
  }
1601
- function findPotentialSchemaRefs(pathStr, methodName, responses, envelope, why) {
1817
+ function findPotentialSchemaRefs(pathStr, methodName, responses, envelope, answered, why) {
1602
1818
  const xrefs = [];
1603
- for (const schema of successSchemas(responses)) {
1604
- if (null != schema['x-ref']) {
1605
- // An envelope component names its wrapping, not the entity: the
1606
- // component it carries takes its place.
1607
- const itemref = envelope[schema['x-ref']];
1608
- if ('' !== itemref) {
1819
+ for (const schema of namingSchemas(methodName, responses, answered, envelope)) {
1820
+ // An envelope component names its wrapping, not the entity: the
1821
+ // component it carries takes its place.
1822
+ const ref = namingRef(schema, envelope);
1823
+ if (null != ref) {
1824
+ if (null != schema['x-ref'] && ref !== schema['x-ref']) {
1609
1825
  why.push('envelope=' + cmpRefName(schema['x-ref']));
1610
- xrefs.push(itemref);
1611
1826
  }
1612
- else {
1613
- xrefs.push(schema['x-ref']);
1614
- }
1615
- }
1616
- else if ('array' === schema.type && null != schema.items?.['x-ref']) {
1617
- xrefs.push(schema.items?.['x-ref']);
1827
+ xrefs.push(ref);
1618
1828
  }
1619
1829
  }
1620
1830
  (0, utility_2.debugpath)(pathStr, methodName, 'POTENTIAL-SCHEMA-REFS', xrefs);