@voxgig/apidef 8.25.2 → 8.25.4
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/desc.d.ts +3 -0
- package/dist/guide/heuristic01.js +141 -37
- package/dist/guide/heuristic01.js.map +1 -1
- package/dist/transform/args.js +4 -8
- package/dist/transform/args.js.map +1 -1
- package/dist/transform/body.d.ts +1 -2
- package/dist/transform/body.js +19 -14
- package/dist/transform/body.js.map +1 -1
- package/dist/transform/field.js +13 -1
- package/dist/transform/field.js.map +1 -1
- package/dist/transform/flowstep.js +5 -5
- package/dist/transform/flowstep.js.map +1 -1
- package/dist/transform/graphql.d.ts +2 -1
- package/dist/transform/graphql.js +13 -9
- package/dist/transform/graphql.js.map +1 -1
- package/dist/transform/top.js +34 -1
- package/dist/transform/top.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utility.d.ts +3 -1
- package/dist/utility.js +31 -5
- package/dist/utility.js.map +1 -1
- package/package.json +1 -1
- package/src/desc.ts +4 -0
- package/src/guide/heuristic01.ts +163 -38
- package/src/transform/args.ts +5 -8
- package/src/transform/body.ts +24 -17
- package/src/transform/field.ts +18 -3
- package/src/transform/flowstep.ts +5 -5
- package/src/transform/graphql.ts +19 -9
- package/src/transform/top.ts +41 -1
- package/src/utility.ts +37 -5
package/dist/desc.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ type MethodDesc = {
|
|
|
15
15
|
path: string;
|
|
16
16
|
method: string;
|
|
17
17
|
summary: string;
|
|
18
|
+
deprecated?: boolean;
|
|
18
19
|
tags: string[];
|
|
19
20
|
parameters: any[];
|
|
20
21
|
responses: Record<string, any>;
|
|
@@ -65,6 +66,8 @@ type EntityPathDesc = {
|
|
|
65
66
|
why_action: Record<string, string[]>;
|
|
66
67
|
why_ent: string[];
|
|
67
68
|
why_path: string[];
|
|
69
|
+
ops?: number;
|
|
70
|
+
deprecated_ops?: number;
|
|
68
71
|
};
|
|
69
72
|
type PathSegment = {
|
|
70
73
|
lit?: string;
|
|
@@ -64,7 +64,7 @@ async function heuristic01(ctx) {
|
|
|
64
64
|
{
|
|
65
65
|
select: 'def.paths', apply: [
|
|
66
66
|
MeasurePath,
|
|
67
|
-
{ select:
|
|
67
|
+
{ select: selectPathItemMembers, apply: MeasureMethod },
|
|
68
68
|
PreparePath
|
|
69
69
|
]
|
|
70
70
|
},
|
|
@@ -86,7 +86,7 @@ async function heuristic01(ctx) {
|
|
|
86
86
|
// ShowNode,
|
|
87
87
|
]
|
|
88
88
|
},
|
|
89
|
-
{ select: 'work.entmap', apply: BuildEntity }
|
|
89
|
+
{ select: 'work.entmap', apply: [VersionActions, BuildEntity] }
|
|
90
90
|
]);
|
|
91
91
|
const result = analysis.execSync(ctx, {});
|
|
92
92
|
if (result.err) {
|
|
@@ -123,9 +123,11 @@ function ShowNode(spec) {
|
|
|
123
123
|
KONSOLE_LOG('NODE', spec.node.key, spec.node.val);
|
|
124
124
|
}
|
|
125
125
|
function Prepare(spec) {
|
|
126
|
+
// Keyed by names from the definition, so no key may find an Object.prototype member.
|
|
127
|
+
const named = () => Object.create(null);
|
|
126
128
|
const guide = {
|
|
127
129
|
control: {},
|
|
128
|
-
entity:
|
|
130
|
+
entity: named(),
|
|
129
131
|
metrics: {
|
|
130
132
|
count: {
|
|
131
133
|
path: 0,
|
|
@@ -134,11 +136,11 @@ function Prepare(spec) {
|
|
|
134
136
|
tag: 0,
|
|
135
137
|
cmp: 0,
|
|
136
138
|
entity: 0,
|
|
137
|
-
origcmprefs:
|
|
139
|
+
origcmprefs: named(),
|
|
138
140
|
},
|
|
139
141
|
found: {
|
|
140
|
-
tag:
|
|
141
|
-
cmp:
|
|
142
|
+
tag: named(),
|
|
143
|
+
cmp: named(),
|
|
142
144
|
}
|
|
143
145
|
},
|
|
144
146
|
};
|
|
@@ -146,19 +148,19 @@ function Prepare(spec) {
|
|
|
146
148
|
def: spec.ctx.def,
|
|
147
149
|
guide,
|
|
148
150
|
work: {
|
|
149
|
-
pathmap:
|
|
150
|
-
entmap:
|
|
151
|
-
envelope:
|
|
152
|
-
listEnvelope:
|
|
153
|
-
envelopePaths:
|
|
154
|
-
sharing: { routes: [], records:
|
|
155
|
-
recordResources:
|
|
156
|
-
tagItems:
|
|
157
|
-
claims:
|
|
158
|
-
claimowner:
|
|
159
|
-
claimrecord:
|
|
160
|
-
pathowner:
|
|
161
|
-
recordowner:
|
|
151
|
+
pathmap: named(),
|
|
152
|
+
entmap: named(),
|
|
153
|
+
envelope: named(),
|
|
154
|
+
listEnvelope: named(),
|
|
155
|
+
envelopePaths: named(),
|
|
156
|
+
sharing: { routes: [], records: named(), yields: named() },
|
|
157
|
+
recordResources: named(),
|
|
158
|
+
tagItems: named(),
|
|
159
|
+
claims: named(),
|
|
160
|
+
claimowner: named(),
|
|
161
|
+
claimrecord: named(),
|
|
162
|
+
pathowner: named(),
|
|
163
|
+
recordowner: named(),
|
|
162
164
|
entity: {
|
|
163
165
|
count: {
|
|
164
166
|
seen: 0,
|
|
@@ -173,6 +175,9 @@ function MeasurePath(spec) {
|
|
|
173
175
|
const guide = spec.data.guide;
|
|
174
176
|
const metrics = guide.metrics;
|
|
175
177
|
const pathdef = spec.node.val;
|
|
178
|
+
if (!isPathItem(spec.node.key, pathdef)) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
176
181
|
metrics.count.path++;
|
|
177
182
|
metrics.count.method += ((pathdef.get ? 1 : 0) +
|
|
178
183
|
(pathdef.post ? 1 : 0) +
|
|
@@ -207,6 +212,9 @@ function PreparePath(spec) {
|
|
|
207
212
|
const work = spec.data.work;
|
|
208
213
|
const pathstr = spec.node.key;
|
|
209
214
|
const pathdef = spec.node.val;
|
|
215
|
+
if (!isPathItem(pathstr, pathdef)) {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
210
218
|
const pathdesc = {
|
|
211
219
|
path: pathstr,
|
|
212
220
|
def: pathdef,
|
|
@@ -215,6 +223,15 @@ function PreparePath(spec) {
|
|
|
215
223
|
};
|
|
216
224
|
work.pathmap[pathstr] = pathdesc;
|
|
217
225
|
}
|
|
226
|
+
// A vendor extension beside the paths is no path, as apidef reads no `x-` key.
|
|
227
|
+
function isPathItem(key, pathdef) {
|
|
228
|
+
return !String(key).startsWith('x-') &&
|
|
229
|
+
null != pathdef && 'object' === typeof pathdef && !Array.isArray(pathdef);
|
|
230
|
+
}
|
|
231
|
+
function selectPathItemMembers(pathdef, spec) {
|
|
232
|
+
return isPathItem(spec.node.key, pathdef) ?
|
|
233
|
+
(0, utility_2.sortedKeys)(pathdef).map((key) => pathdef[key]) : [];
|
|
234
|
+
}
|
|
218
235
|
function selectCmpXrefs(_source, spec) {
|
|
219
236
|
const counts = (0, refcount_1.countRefs)(spec.ctx.def);
|
|
220
237
|
return Object.keys(counts)
|
|
@@ -269,7 +286,7 @@ function MeasureEnvelope(spec) {
|
|
|
269
286
|
function MeasureEnvelopeItems(spec) {
|
|
270
287
|
const work = spec.data.work;
|
|
271
288
|
const envelope = work.envelope;
|
|
272
|
-
const carriers =
|
|
289
|
+
const carriers = Object.create(null);
|
|
273
290
|
for (const xref of Object.keys(envelope)) {
|
|
274
291
|
if ('' !== envelope[xref]) {
|
|
275
292
|
(carriers[envelope[xref]] = carriers[envelope[xref]] ?? []).push(xref);
|
|
@@ -335,6 +352,9 @@ function selectAllMethods(_source, spec) {
|
|
|
335
352
|
}
|
|
336
353
|
let caught = { methods: [] };
|
|
337
354
|
for (const [path, pdef] of (0, utility_2.sortedEntries)(ctx.def.paths)) {
|
|
355
|
+
if (!isPathItem(path, pdef)) {
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
338
358
|
for (const [m, mdef] of (0, utility_2.sortedEntries)(pdef)) {
|
|
339
359
|
const method = m.toUpperCase();
|
|
340
360
|
// A path item also holds parameters, servers, summary and the like.
|
|
@@ -354,6 +374,7 @@ function selectAllMethods(_source, spec) {
|
|
|
354
374
|
// Carried so authExchangeOp can see a per-operation `security: []`.
|
|
355
375
|
// Everything downstream ignores it.
|
|
356
376
|
security: mdef.security,
|
|
377
|
+
deprecated: true === mdef.deprecated,
|
|
357
378
|
});
|
|
358
379
|
}
|
|
359
380
|
}
|
|
@@ -560,7 +581,8 @@ function ResolveEntityName(spec) {
|
|
|
560
581
|
}
|
|
561
582
|
why_path.push(...(ment.why_cmp ?? []));
|
|
562
583
|
const pm = matchEntityPath(parts);
|
|
563
|
-
let entname =
|
|
584
|
+
let entname = samePathOwner(mdesc, work, why_path)
|
|
585
|
+
?? pathEntityName(data, mdesc, parts, pm, work.pathowner, why_path);
|
|
564
586
|
if (null == entname) {
|
|
565
587
|
work.entity.count.unresolved++;
|
|
566
588
|
entname = 'entity' + work.entity.count.unresolved;
|
|
@@ -611,6 +633,27 @@ function ResolveEntityName(spec) {
|
|
|
611
633
|
(0, utility_2.debugpath)(pathStr, methodName, 'RESOLVE-ENTITY-NAME', (0, utility_2.formatJSONIC)({ entdesc, ment }, { hsepd: 0, $: true, color: true }));
|
|
612
634
|
}
|
|
613
635
|
}
|
|
636
|
+
// A method named only from its tag, as a DELETE answering 204 is, joins the
|
|
637
|
+
// entity a read of the same path resolved to when that read carries the same
|
|
638
|
+
// tag: the tag then groups the path's routes and names no other resource. A
|
|
639
|
+
// tag the read does not carry, Admin on the delete of a team, keeps its name.
|
|
640
|
+
function samePathOwner(mdesc, work, why) {
|
|
641
|
+
const ment = mdesc.MethodEntity;
|
|
642
|
+
const owner = work.pathowner[mdesc.path];
|
|
643
|
+
if (null == owner || 'tag' !== ment?.ref) {
|
|
644
|
+
return null;
|
|
645
|
+
}
|
|
646
|
+
const tags = mdesc.tags ?? [];
|
|
647
|
+
for (const method of ['GET', 'QUERY', 'PUT', 'PATCH']) {
|
|
648
|
+
const entname = owner[method];
|
|
649
|
+
const read = work.methods.find((m) => m.path === mdesc.path && m.method === method);
|
|
650
|
+
if (null != entname && (read?.tags ?? []).some((tag) => tags.includes(tag))) {
|
|
651
|
+
why.push('same-path-tag=' + entname + '/' + method);
|
|
652
|
+
return entname;
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
return null;
|
|
656
|
+
}
|
|
614
657
|
// The name a method's path shape and component give it, or null where neither
|
|
615
658
|
// does. A verb on a parent takes the name pathowner holds for the parent.
|
|
616
659
|
function pathEntityName(data, mdesc, parts, pm, pathowner, why) {
|
|
@@ -897,7 +940,10 @@ function ResolveOperation(spec) {
|
|
|
897
940
|
if (null != (0, utility_1.authExchangeOp)(mdesc, (0, utility_1.specSecuredByDefault)(spec.data.def))) {
|
|
898
941
|
entdesc.authexchange_ops = (entdesc.authexchange_ops ?? 0) + 1;
|
|
899
942
|
}
|
|
900
|
-
const
|
|
943
|
+
const pathdesc = entdesc.path[pathStr];
|
|
944
|
+
pathdesc.ops = (pathdesc.ops ?? 0) + 1;
|
|
945
|
+
pathdesc.deprecated_ops = (pathdesc.deprecated_ops ?? 0) + (true === mdesc.deprecated ? 1 : 0);
|
|
946
|
+
const op = pathdesc.op;
|
|
901
947
|
const opdef = {
|
|
902
948
|
method: methodName,
|
|
903
949
|
why_op: why_op.join(';')
|
|
@@ -981,13 +1027,60 @@ function ResolveTransform(spec) {
|
|
|
981
1027
|
transform.res = (0, utility_1.itemEnvelopeTransform)(key);
|
|
982
1028
|
}
|
|
983
1029
|
}
|
|
984
|
-
const reqschema = getRequestBodySchema(mdesc
|
|
1030
|
+
const reqschema = getRequestBodySchema(spec.data.def, mdesc);
|
|
985
1031
|
(0, utility_2.debugpath)(pathStr, methodName, 'TRANSFORM-REQ', (0, struct_1.keysof)(reqschema?.properties));
|
|
986
1032
|
transform.req = (0, utility_1.bodyRequestTransform)(reqschema, [entdesc.origname, entdesc.name]);
|
|
987
1033
|
if (!(0, struct_1.isempty)(transform) && null != op[opname]) {
|
|
988
1034
|
op[opname].transform = transform;
|
|
989
1035
|
}
|
|
990
1036
|
}
|
|
1037
|
+
// An API that keeps older versions of a route beside the current one gives
|
|
1038
|
+
// every version the same selector, so only the first would ever be reached.
|
|
1039
|
+
// The highest version with an operation the spec does not deprecate is the
|
|
1040
|
+
// route; each other version becomes an action named for it (v1, v2), or
|
|
1041
|
+
// suffixes the action its path already has, so it stays reachable.
|
|
1042
|
+
function VersionActions(spec) {
|
|
1043
|
+
const entdesc = spec.node.val;
|
|
1044
|
+
const groups = {};
|
|
1045
|
+
for (const pathStr of (0, utility_2.sortedKeys)(entdesc.path)) {
|
|
1046
|
+
const vm = pathStr.match(/\/v(\d+)(?=\/|$)/);
|
|
1047
|
+
if (null == vm) {
|
|
1048
|
+
continue;
|
|
1049
|
+
}
|
|
1050
|
+
const key = pathStr.replace(/\/v\d+(?=\/|$)/, '/v');
|
|
1051
|
+
groups[key] = groups[key] ?? [];
|
|
1052
|
+
groups[key].push({ path: pathStr, version: Number(vm[1]) });
|
|
1053
|
+
}
|
|
1054
|
+
for (const members of Object.values(groups)) {
|
|
1055
|
+
if (members.length < 2) {
|
|
1056
|
+
continue;
|
|
1057
|
+
}
|
|
1058
|
+
const live = members.filter((m) => {
|
|
1059
|
+
const pathdesc = entdesc.path[m.path];
|
|
1060
|
+
return (pathdesc.deprecated_ops ?? 0) < (pathdesc.ops ?? 0);
|
|
1061
|
+
});
|
|
1062
|
+
const route = (0 < live.length ? live : members)
|
|
1063
|
+
.reduce((a, b) => b.version > a.version ? b : a);
|
|
1064
|
+
for (const m of members) {
|
|
1065
|
+
if (m === route) {
|
|
1066
|
+
continue;
|
|
1067
|
+
}
|
|
1068
|
+
const pathdesc = entdesc.path[m.path];
|
|
1069
|
+
const vname = 'v' + m.version;
|
|
1070
|
+
const why = ['ent', entdesc.name, 'version', vname, 'behind', route.path];
|
|
1071
|
+
const actions = pathdesc.action ?? {};
|
|
1072
|
+
pathdesc.action = {};
|
|
1073
|
+
for (const actname of (0, utility_2.sortedKeys)(actions)) {
|
|
1074
|
+
pathdesc.action[actname + '_' + vname] = {
|
|
1075
|
+
why_action: [...actions[actname].why_action, ...why],
|
|
1076
|
+
};
|
|
1077
|
+
}
|
|
1078
|
+
if (0 === (0, utility_2.sortedKeys)(actions).length) {
|
|
1079
|
+
pathdesc.action[vname] = { why_action: why };
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
991
1084
|
function BuildEntity(spec) {
|
|
992
1085
|
const entdesc = spec.node.val;
|
|
993
1086
|
const guide = spec.data.guide;
|
|
@@ -1229,7 +1322,7 @@ function outsideCollection(path, collection) {
|
|
|
1229
1322
|
// Two of a tag's collections whose item routes take the same parameters, or
|
|
1230
1323
|
// that are both read, would share a selector on the tag's entity.
|
|
1231
1324
|
function tagCollides(def, items) {
|
|
1232
|
-
const seen =
|
|
1325
|
+
const seen = Object.create(null);
|
|
1233
1326
|
let reads = 0;
|
|
1234
1327
|
for (const [collection, params] of Object.entries(items)) {
|
|
1235
1328
|
for (const key of Object.keys(params)) {
|
|
@@ -1316,8 +1409,9 @@ function entityPathMatch_tpp(data, pm, mdesc, why) {
|
|
|
1316
1409
|
}
|
|
1317
1410
|
return entname;
|
|
1318
1411
|
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1412
|
+
// The JSON body a method sends, a Swagger 2 body parameter included.
|
|
1413
|
+
function getRequestBodySchema(def, mdesc) {
|
|
1414
|
+
return (0, body_1.requestSchema)(def, mdesc.method, mdesc.path) ?? mdesc.requestBody?.schema;
|
|
1321
1415
|
}
|
|
1322
1416
|
// The response an operation's result is read from, down to an Accepted
|
|
1323
1417
|
// response when nothing else answers, whose body may be the job it queued.
|
|
@@ -1346,7 +1440,7 @@ function namingSchemas(method, responses, answered, envelope) {
|
|
|
1346
1440
|
return schemas;
|
|
1347
1441
|
}
|
|
1348
1442
|
function answeredRefs(def, envelope) {
|
|
1349
|
-
const answered =
|
|
1443
|
+
const answered = Object.create(null);
|
|
1350
1444
|
for (const pathdef of Object.values(def?.paths ?? {})) {
|
|
1351
1445
|
for (const [method, mdef] of Object.entries(pathdef ?? {})) {
|
|
1352
1446
|
if (null == METHOD_CONSIDER_ORDER[method.toUpperCase()] ||
|
|
@@ -1449,8 +1543,7 @@ function inferEntityName(mdesc, parts, why) {
|
|
|
1449
1543
|
return null;
|
|
1450
1544
|
}
|
|
1451
1545
|
function probableEntityMethod(data, mdesc, pm, why) {
|
|
1452
|
-
const
|
|
1453
|
-
const reqSchema = getRequestBodySchema(request);
|
|
1546
|
+
const reqSchema = getRequestBodySchema(data.def, mdesc);
|
|
1454
1547
|
const response = mdesc.responses?.['201'] || mdesc.responses?.['200'];
|
|
1455
1548
|
const resSchema = getResponseSchema(response);
|
|
1456
1549
|
const noResponse = null == resSchema && null != mdesc.responses?.['204'];
|
|
@@ -1502,13 +1595,24 @@ function entityCmpMatch(data, entname, mdesc, why) {
|
|
|
1502
1595
|
const cmpInfrequent = (ment.method_rate < IS_ENTCMP_METHOD_RATE
|
|
1503
1596
|
|| ment.path_rate < IS_ENTCMP_PATH_RATE);
|
|
1504
1597
|
const cmpShared = true === data.work.sharing.yields[ment.origcmpref + ' ' + mdesc.method + ' ' + mdesc.path];
|
|
1598
|
+
// CallRouteOptionV2 answering /call_routes/{id}/options/{id}: the record
|
|
1599
|
+
// names the path's resource, qualified by its parent and versioned.
|
|
1600
|
+
const unversioned = (ment.cmp ?? '').replace(/_v\d+$/, '');
|
|
1601
|
+
const qualifies = unversioned !== ment.cmp && unversioned.endsWith('_' + entname);
|
|
1505
1602
|
if (null != ment.cmp
|
|
1506
1603
|
&& entname != ment.cmp
|
|
1507
1604
|
&& !ment.cmp.startsWith(entname)) {
|
|
1508
1605
|
if (cmpInfrequent && cmpShared) {
|
|
1509
1606
|
why.push('cmp-shared');
|
|
1510
1607
|
}
|
|
1511
|
-
if (
|
|
1608
|
+
if (qualifies) {
|
|
1609
|
+
why.push('cmp-qualifies-path');
|
|
1610
|
+
out.name = unversioned;
|
|
1611
|
+
out.orig = ment.origcmp;
|
|
1612
|
+
out.cmpish = true;
|
|
1613
|
+
out.pathish = false;
|
|
1614
|
+
}
|
|
1615
|
+
else if (cmpInfrequent && !cmpShared) {
|
|
1512
1616
|
why.push('cmp-primary');
|
|
1513
1617
|
out.name = ment.cmp;
|
|
1514
1618
|
out.orig = ment.origcmp;
|
|
@@ -1550,7 +1654,7 @@ function entityCmpMatch(data, entname, mdesc, why) {
|
|
|
1550
1654
|
}
|
|
1551
1655
|
function cmpOccursInPath(data, cmpname) {
|
|
1552
1656
|
if (null == data.work.potentialCmpsFromPaths) {
|
|
1553
|
-
data.work.potentialCmpsFromPaths =
|
|
1657
|
+
data.work.potentialCmpsFromPaths = Object.create(null);
|
|
1554
1658
|
(0, jostraca_1.each)(data.def.paths, (_pathdef, pathstr) => {
|
|
1555
1659
|
const parts = data.work.pathmap[pathstr].parts;
|
|
1556
1660
|
parts
|
|
@@ -1590,7 +1694,7 @@ function pathResource(parts, method) {
|
|
|
1590
1694
|
// with, each keyed `cmp METHOD path`: those of a component that several
|
|
1591
1695
|
// resources share, where a record (one that declares an `id`) is never shared.
|
|
1592
1696
|
function sharedRoutes(routes, records) {
|
|
1593
|
-
const bycmp =
|
|
1697
|
+
const bycmp = Object.create(null);
|
|
1594
1698
|
for (const route of routes) {
|
|
1595
1699
|
const parts = route.path.split('/').filter((p) => '' !== p);
|
|
1596
1700
|
const resource = pathResource(parts, route.method);
|
|
@@ -1606,14 +1710,14 @@ function sharedRoutes(routes, records) {
|
|
|
1606
1710
|
if (new Set(counted.map((entry) => group[entry.resource])).size < 2) {
|
|
1607
1711
|
continue;
|
|
1608
1712
|
}
|
|
1609
|
-
const members =
|
|
1713
|
+
const members = Object.create(null);
|
|
1610
1714
|
for (const name of new Set(counted.map((entry) => entry.resource))) {
|
|
1611
1715
|
members[group[name]] = (members[group[name]] ?? 0) + 1;
|
|
1612
1716
|
}
|
|
1613
1717
|
taking.push(...counted.filter((entry) => 1 === members[group[entry.resource]]));
|
|
1614
1718
|
}
|
|
1615
|
-
const cmps =
|
|
1616
|
-
const routesOf =
|
|
1719
|
+
const cmps = Object.create(null);
|
|
1720
|
+
const routesOf = Object.create(null);
|
|
1617
1721
|
for (const entry of taking) {
|
|
1618
1722
|
(cmps[entry.resource] = cmps[entry.resource] ?? new Set()).add(entry.cmp);
|
|
1619
1723
|
const key = entry.resource + ' ' + entry.op + ' ' + paramNames(entry.parts);
|
|
@@ -1644,12 +1748,12 @@ function isSharingView(entry, names) {
|
|
|
1644
1748
|
// Item routes under the same parent keyed by the same parameters address the
|
|
1645
1749
|
// same records, so the resources they name are one: each maps to its group.
|
|
1646
1750
|
function aliasGroups(entries) {
|
|
1647
|
-
const group =
|
|
1751
|
+
const group = Object.create(null);
|
|
1648
1752
|
const find = (name) => group[name] === name ? name : find(group[name]);
|
|
1649
1753
|
for (const entry of entries) {
|
|
1650
1754
|
group[entry.resource] = entry.resource;
|
|
1651
1755
|
}
|
|
1652
|
-
const first =
|
|
1756
|
+
const first = Object.create(null);
|
|
1653
1757
|
for (const entry of entries) {
|
|
1654
1758
|
if (!isParam(entry.parts[entry.parts.length - 1])) {
|
|
1655
1759
|
continue;
|