@suss/ir-core 0.1.1 → 0.3.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/{chunk-QQLJDL3C.js → chunk-L4XGOS3I.js} +58 -3
- package/dist/index.cjs +61 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -3
- package/dist/schemas.cjs +61 -4
- package/dist/schemas.d.cts +40 -1
- package/dist/schemas.d.ts +40 -1
- package/dist/schemas.js +7 -3
- package/package.json +1 -1
|
@@ -24,7 +24,16 @@ var ConfidenceInfoSchema = z.object({
|
|
|
24
24
|
var SourceLocationSchema = z.object({
|
|
25
25
|
file: z.string(),
|
|
26
26
|
range: z.object({ start: z.number(), end: z.number() }),
|
|
27
|
-
exportName: z.string().nullable()
|
|
27
|
+
exportName: z.string().nullable(),
|
|
28
|
+
/**
|
|
29
|
+
* What the extract was pointed at, as that project calls itself.
|
|
30
|
+
*
|
|
31
|
+
* A path is relative to wherever the extract ran, so two services in
|
|
32
|
+
* one repository both say `src/handlers.ts` and merging their
|
|
33
|
+
* summaries puts them on top of each other. This is what tells them
|
|
34
|
+
* apart, and what a reader groups by.
|
|
35
|
+
*/
|
|
36
|
+
workspace: z.string().optional()
|
|
28
37
|
});
|
|
29
38
|
var RestSemanticsSchema = z.object({
|
|
30
39
|
name: z.literal("rest"),
|
|
@@ -129,6 +138,9 @@ var BoundaryBindingSchema = z.object({
|
|
|
129
138
|
semantics: SemanticsSchema,
|
|
130
139
|
recognition: z.string()
|
|
131
140
|
});
|
|
141
|
+
function typeDefinitionKey(ref) {
|
|
142
|
+
return ref.def ?? null;
|
|
143
|
+
}
|
|
132
144
|
var TypeShapeSchema = z.lazy(
|
|
133
145
|
() => z.discriminatedUnion("type", [
|
|
134
146
|
z.object({
|
|
@@ -156,11 +168,52 @@ var TypeShapeSchema = z.lazy(
|
|
|
156
168
|
z.object({
|
|
157
169
|
type: z.literal("ref"),
|
|
158
170
|
name: z.string(),
|
|
159
|
-
from: z.string().optional()
|
|
171
|
+
from: z.string().optional(),
|
|
172
|
+
def: z.string().optional()
|
|
160
173
|
}),
|
|
161
174
|
z.object({ type: z.literal("unknown") })
|
|
162
175
|
])
|
|
163
176
|
);
|
|
177
|
+
var MAX_DEFINITION_DEPTH = 6;
|
|
178
|
+
function withDefinitionsInlined(shape, definitions, depth = 0, inProgress = /* @__PURE__ */ new Set()) {
|
|
179
|
+
if (definitions === void 0 || depth >= MAX_DEFINITION_DEPTH) {
|
|
180
|
+
return shape;
|
|
181
|
+
}
|
|
182
|
+
const deeper = (inner) => withDefinitionsInlined(inner, definitions, depth + 1, inProgress);
|
|
183
|
+
if (shape.type === "ref") {
|
|
184
|
+
const key = typeDefinitionKey(shape);
|
|
185
|
+
if (key === null) {
|
|
186
|
+
return shape;
|
|
187
|
+
}
|
|
188
|
+
const defined = definitions[key];
|
|
189
|
+
if (defined === void 0 || inProgress.has(key)) {
|
|
190
|
+
return shape;
|
|
191
|
+
}
|
|
192
|
+
return withDefinitionsInlined(
|
|
193
|
+
defined,
|
|
194
|
+
definitions,
|
|
195
|
+
depth,
|
|
196
|
+
/* @__PURE__ */ new Set([...inProgress, key])
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
if (shape.type === "record") {
|
|
200
|
+
const properties = {};
|
|
201
|
+
for (const [name, value] of Object.entries(shape.properties)) {
|
|
202
|
+
properties[name] = deeper(value);
|
|
203
|
+
}
|
|
204
|
+
return { ...shape, properties };
|
|
205
|
+
}
|
|
206
|
+
if (shape.type === "array") {
|
|
207
|
+
return { ...shape, items: deeper(shape.items) };
|
|
208
|
+
}
|
|
209
|
+
if (shape.type === "dictionary") {
|
|
210
|
+
return { ...shape, values: deeper(shape.values) };
|
|
211
|
+
}
|
|
212
|
+
if (shape.type === "union") {
|
|
213
|
+
return { ...shape, variants: shape.variants.map(deeper) };
|
|
214
|
+
}
|
|
215
|
+
return shape;
|
|
216
|
+
}
|
|
164
217
|
|
|
165
218
|
export {
|
|
166
219
|
ConfidenceSourceSchema,
|
|
@@ -178,5 +231,7 @@ export {
|
|
|
178
231
|
MessageBusSemanticsSchema,
|
|
179
232
|
SemanticsSchema,
|
|
180
233
|
BoundaryBindingSchema,
|
|
181
|
-
|
|
234
|
+
typeDefinitionKey,
|
|
235
|
+
TypeShapeSchema,
|
|
236
|
+
withDefinitionsInlined
|
|
182
237
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -59,7 +59,9 @@ __export(index_exports, {
|
|
|
59
59
|
ruleBoundaryMatchesKey: () => ruleBoundaryMatchesKey,
|
|
60
60
|
runtimeConfigBinding: () => runtimeConfigBinding,
|
|
61
61
|
storageRelationalBinding: () => storageRelationalBinding,
|
|
62
|
-
|
|
62
|
+
typeDefinitionKey: () => typeDefinitionKey,
|
|
63
|
+
validateRule: () => validateRule,
|
|
64
|
+
withDefinitionsInlined: () => withDefinitionsInlined
|
|
63
65
|
});
|
|
64
66
|
module.exports = __toCommonJS(index_exports);
|
|
65
67
|
|
|
@@ -89,7 +91,16 @@ var ConfidenceInfoSchema = import_zod.z.object({
|
|
|
89
91
|
var SourceLocationSchema = import_zod.z.object({
|
|
90
92
|
file: import_zod.z.string(),
|
|
91
93
|
range: import_zod.z.object({ start: import_zod.z.number(), end: import_zod.z.number() }),
|
|
92
|
-
exportName: import_zod.z.string().nullable()
|
|
94
|
+
exportName: import_zod.z.string().nullable(),
|
|
95
|
+
/**
|
|
96
|
+
* What the extract was pointed at, as that project calls itself.
|
|
97
|
+
*
|
|
98
|
+
* A path is relative to wherever the extract ran, so two services in
|
|
99
|
+
* one repository both say `src/handlers.ts` and merging their
|
|
100
|
+
* summaries puts them on top of each other. This is what tells them
|
|
101
|
+
* apart, and what a reader groups by.
|
|
102
|
+
*/
|
|
103
|
+
workspace: import_zod.z.string().optional()
|
|
93
104
|
});
|
|
94
105
|
var RestSemanticsSchema = import_zod.z.object({
|
|
95
106
|
name: import_zod.z.literal("rest"),
|
|
@@ -194,6 +205,9 @@ var BoundaryBindingSchema = import_zod.z.object({
|
|
|
194
205
|
semantics: SemanticsSchema,
|
|
195
206
|
recognition: import_zod.z.string()
|
|
196
207
|
});
|
|
208
|
+
function typeDefinitionKey(ref) {
|
|
209
|
+
return ref.def ?? null;
|
|
210
|
+
}
|
|
197
211
|
var TypeShapeSchema = import_zod.z.lazy(
|
|
198
212
|
() => import_zod.z.discriminatedUnion("type", [
|
|
199
213
|
import_zod.z.object({
|
|
@@ -221,11 +235,52 @@ var TypeShapeSchema = import_zod.z.lazy(
|
|
|
221
235
|
import_zod.z.object({
|
|
222
236
|
type: import_zod.z.literal("ref"),
|
|
223
237
|
name: import_zod.z.string(),
|
|
224
|
-
from: import_zod.z.string().optional()
|
|
238
|
+
from: import_zod.z.string().optional(),
|
|
239
|
+
def: import_zod.z.string().optional()
|
|
225
240
|
}),
|
|
226
241
|
import_zod.z.object({ type: import_zod.z.literal("unknown") })
|
|
227
242
|
])
|
|
228
243
|
);
|
|
244
|
+
var MAX_DEFINITION_DEPTH = 6;
|
|
245
|
+
function withDefinitionsInlined(shape, definitions, depth = 0, inProgress = /* @__PURE__ */ new Set()) {
|
|
246
|
+
if (definitions === void 0 || depth >= MAX_DEFINITION_DEPTH) {
|
|
247
|
+
return shape;
|
|
248
|
+
}
|
|
249
|
+
const deeper = (inner) => withDefinitionsInlined(inner, definitions, depth + 1, inProgress);
|
|
250
|
+
if (shape.type === "ref") {
|
|
251
|
+
const key = typeDefinitionKey(shape);
|
|
252
|
+
if (key === null) {
|
|
253
|
+
return shape;
|
|
254
|
+
}
|
|
255
|
+
const defined = definitions[key];
|
|
256
|
+
if (defined === void 0 || inProgress.has(key)) {
|
|
257
|
+
return shape;
|
|
258
|
+
}
|
|
259
|
+
return withDefinitionsInlined(
|
|
260
|
+
defined,
|
|
261
|
+
definitions,
|
|
262
|
+
depth,
|
|
263
|
+
/* @__PURE__ */ new Set([...inProgress, key])
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
if (shape.type === "record") {
|
|
267
|
+
const properties = {};
|
|
268
|
+
for (const [name, value] of Object.entries(shape.properties)) {
|
|
269
|
+
properties[name] = deeper(value);
|
|
270
|
+
}
|
|
271
|
+
return { ...shape, properties };
|
|
272
|
+
}
|
|
273
|
+
if (shape.type === "array") {
|
|
274
|
+
return { ...shape, items: deeper(shape.items) };
|
|
275
|
+
}
|
|
276
|
+
if (shape.type === "dictionary") {
|
|
277
|
+
return { ...shape, values: deeper(shape.values) };
|
|
278
|
+
}
|
|
279
|
+
if (shape.type === "union") {
|
|
280
|
+
return { ...shape, variants: shape.variants.map(deeper) };
|
|
281
|
+
}
|
|
282
|
+
return shape;
|
|
283
|
+
}
|
|
229
284
|
|
|
230
285
|
// src/channel.ts
|
|
231
286
|
function parseChannel(channel) {
|
|
@@ -709,5 +764,7 @@ function messageBusBinding(opts) {
|
|
|
709
764
|
ruleBoundaryMatchesKey,
|
|
710
765
|
runtimeConfigBinding,
|
|
711
766
|
storageRelationalBinding,
|
|
712
|
-
|
|
767
|
+
typeDefinitionKey,
|
|
768
|
+
validateRule,
|
|
769
|
+
withDefinitionsInlined
|
|
713
770
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { TypeShape, BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, DeployableUnitSchema, SemanticsSchema, SourceLocationSchema } from './schemas.cjs';
|
|
3
|
-
export { FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, StorageRelationalSemanticsSchema, TypeShapeSchema } from './schemas.cjs';
|
|
3
|
+
export { FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, StorageRelationalSemanticsSchema, TypeShapeSchema, typeDefinitionKey, withDefinitionsInlined } from './schemas.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Normalize a route path to a canonical form for matching.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { TypeShape, BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, DeployableUnitSchema, SemanticsSchema, SourceLocationSchema } from './schemas.js';
|
|
3
|
-
export { FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, StorageRelationalSemanticsSchema, TypeShapeSchema } from './schemas.js';
|
|
3
|
+
export { FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, StorageRelationalSemanticsSchema, TypeShapeSchema, typeDefinitionKey, withDefinitionsInlined } from './schemas.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Normalize a route path to a canonical form for matching.
|
package/dist/index.js
CHANGED
|
@@ -14,8 +14,10 @@ import {
|
|
|
14
14
|
SemanticsSchema,
|
|
15
15
|
SourceLocationSchema,
|
|
16
16
|
StorageRelationalSemanticsSchema,
|
|
17
|
-
TypeShapeSchema
|
|
18
|
-
|
|
17
|
+
TypeShapeSchema,
|
|
18
|
+
typeDefinitionKey,
|
|
19
|
+
withDefinitionsInlined
|
|
20
|
+
} from "./chunk-L4XGOS3I.js";
|
|
19
21
|
|
|
20
22
|
// src/channel.ts
|
|
21
23
|
function parseChannel(channel) {
|
|
@@ -498,5 +500,7 @@ export {
|
|
|
498
500
|
ruleBoundaryMatchesKey,
|
|
499
501
|
runtimeConfigBinding,
|
|
500
502
|
storageRelationalBinding,
|
|
501
|
-
|
|
503
|
+
typeDefinitionKey,
|
|
504
|
+
validateRule,
|
|
505
|
+
withDefinitionsInlined
|
|
502
506
|
};
|
package/dist/schemas.cjs
CHANGED
|
@@ -35,7 +35,9 @@ __export(schemas_exports, {
|
|
|
35
35
|
SemanticsSchema: () => SemanticsSchema,
|
|
36
36
|
SourceLocationSchema: () => SourceLocationSchema,
|
|
37
37
|
StorageRelationalSemanticsSchema: () => StorageRelationalSemanticsSchema,
|
|
38
|
-
TypeShapeSchema: () => TypeShapeSchema
|
|
38
|
+
TypeShapeSchema: () => TypeShapeSchema,
|
|
39
|
+
typeDefinitionKey: () => typeDefinitionKey,
|
|
40
|
+
withDefinitionsInlined: () => withDefinitionsInlined
|
|
39
41
|
});
|
|
40
42
|
module.exports = __toCommonJS(schemas_exports);
|
|
41
43
|
var import_zod = require("zod");
|
|
@@ -63,7 +65,16 @@ var ConfidenceInfoSchema = import_zod.z.object({
|
|
|
63
65
|
var SourceLocationSchema = import_zod.z.object({
|
|
64
66
|
file: import_zod.z.string(),
|
|
65
67
|
range: import_zod.z.object({ start: import_zod.z.number(), end: import_zod.z.number() }),
|
|
66
|
-
exportName: import_zod.z.string().nullable()
|
|
68
|
+
exportName: import_zod.z.string().nullable(),
|
|
69
|
+
/**
|
|
70
|
+
* What the extract was pointed at, as that project calls itself.
|
|
71
|
+
*
|
|
72
|
+
* A path is relative to wherever the extract ran, so two services in
|
|
73
|
+
* one repository both say `src/handlers.ts` and merging their
|
|
74
|
+
* summaries puts them on top of each other. This is what tells them
|
|
75
|
+
* apart, and what a reader groups by.
|
|
76
|
+
*/
|
|
77
|
+
workspace: import_zod.z.string().optional()
|
|
67
78
|
});
|
|
68
79
|
var RestSemanticsSchema = import_zod.z.object({
|
|
69
80
|
name: import_zod.z.literal("rest"),
|
|
@@ -168,6 +179,9 @@ var BoundaryBindingSchema = import_zod.z.object({
|
|
|
168
179
|
semantics: SemanticsSchema,
|
|
169
180
|
recognition: import_zod.z.string()
|
|
170
181
|
});
|
|
182
|
+
function typeDefinitionKey(ref) {
|
|
183
|
+
return ref.def ?? null;
|
|
184
|
+
}
|
|
171
185
|
var TypeShapeSchema = import_zod.z.lazy(
|
|
172
186
|
() => import_zod.z.discriminatedUnion("type", [
|
|
173
187
|
import_zod.z.object({
|
|
@@ -195,11 +209,52 @@ var TypeShapeSchema = import_zod.z.lazy(
|
|
|
195
209
|
import_zod.z.object({
|
|
196
210
|
type: import_zod.z.literal("ref"),
|
|
197
211
|
name: import_zod.z.string(),
|
|
198
|
-
from: import_zod.z.string().optional()
|
|
212
|
+
from: import_zod.z.string().optional(),
|
|
213
|
+
def: import_zod.z.string().optional()
|
|
199
214
|
}),
|
|
200
215
|
import_zod.z.object({ type: import_zod.z.literal("unknown") })
|
|
201
216
|
])
|
|
202
217
|
);
|
|
218
|
+
var MAX_DEFINITION_DEPTH = 6;
|
|
219
|
+
function withDefinitionsInlined(shape, definitions, depth = 0, inProgress = /* @__PURE__ */ new Set()) {
|
|
220
|
+
if (definitions === void 0 || depth >= MAX_DEFINITION_DEPTH) {
|
|
221
|
+
return shape;
|
|
222
|
+
}
|
|
223
|
+
const deeper = (inner) => withDefinitionsInlined(inner, definitions, depth + 1, inProgress);
|
|
224
|
+
if (shape.type === "ref") {
|
|
225
|
+
const key = typeDefinitionKey(shape);
|
|
226
|
+
if (key === null) {
|
|
227
|
+
return shape;
|
|
228
|
+
}
|
|
229
|
+
const defined = definitions[key];
|
|
230
|
+
if (defined === void 0 || inProgress.has(key)) {
|
|
231
|
+
return shape;
|
|
232
|
+
}
|
|
233
|
+
return withDefinitionsInlined(
|
|
234
|
+
defined,
|
|
235
|
+
definitions,
|
|
236
|
+
depth,
|
|
237
|
+
/* @__PURE__ */ new Set([...inProgress, key])
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
if (shape.type === "record") {
|
|
241
|
+
const properties = {};
|
|
242
|
+
for (const [name, value] of Object.entries(shape.properties)) {
|
|
243
|
+
properties[name] = deeper(value);
|
|
244
|
+
}
|
|
245
|
+
return { ...shape, properties };
|
|
246
|
+
}
|
|
247
|
+
if (shape.type === "array") {
|
|
248
|
+
return { ...shape, items: deeper(shape.items) };
|
|
249
|
+
}
|
|
250
|
+
if (shape.type === "dictionary") {
|
|
251
|
+
return { ...shape, values: deeper(shape.values) };
|
|
252
|
+
}
|
|
253
|
+
if (shape.type === "union") {
|
|
254
|
+
return { ...shape, variants: shape.variants.map(deeper) };
|
|
255
|
+
}
|
|
256
|
+
return shape;
|
|
257
|
+
}
|
|
203
258
|
// Annotate the CommonJS export names for ESM import in node:
|
|
204
259
|
0 && (module.exports = {
|
|
205
260
|
BoundaryBindingSchema,
|
|
@@ -217,5 +272,7 @@ var TypeShapeSchema = import_zod.z.lazy(
|
|
|
217
272
|
SemanticsSchema,
|
|
218
273
|
SourceLocationSchema,
|
|
219
274
|
StorageRelationalSemanticsSchema,
|
|
220
|
-
TypeShapeSchema
|
|
275
|
+
TypeShapeSchema,
|
|
276
|
+
typeDefinitionKey,
|
|
277
|
+
withDefinitionsInlined
|
|
221
278
|
});
|
package/dist/schemas.d.cts
CHANGED
|
@@ -64,6 +64,7 @@ declare const SourceLocationSchema: z.ZodObject<{
|
|
|
64
64
|
end: z.ZodNumber;
|
|
65
65
|
}, z.core.$strip>;
|
|
66
66
|
exportName: z.ZodNullable<z.ZodString>;
|
|
67
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
67
68
|
}, z.core.$strip>;
|
|
68
69
|
declare const RestSemanticsSchema: z.ZodObject<{
|
|
69
70
|
name: z.ZodLiteral<"rest">;
|
|
@@ -317,6 +318,17 @@ type TypeShape = {
|
|
|
317
318
|
} | {
|
|
318
319
|
type: "ref";
|
|
319
320
|
name: string;
|
|
321
|
+
/**
|
|
322
|
+
* Where this type is written down, when it is. The key into the
|
|
323
|
+
* summary's table of definitions.
|
|
324
|
+
*
|
|
325
|
+
* A name does not identify a type. Every instantiation of one
|
|
326
|
+
* generic reports the generic's own name and file, so `Omit<User,
|
|
327
|
+
* "secret">` and `Omit<Order, "total">` are both `Omit`, and a
|
|
328
|
+
* table keyed on that hands the second one the first one's
|
|
329
|
+
* fields. This is built from what the type actually is.
|
|
330
|
+
*/
|
|
331
|
+
def?: string | undefined;
|
|
320
332
|
/**
|
|
321
333
|
* The file that declares this type, when the project declares it.
|
|
322
334
|
* Absent for a name the language or a dependency owns, which means
|
|
@@ -330,6 +342,33 @@ type TypeShape = {
|
|
|
330
342
|
} | {
|
|
331
343
|
type: "unknown";
|
|
332
344
|
};
|
|
345
|
+
/**
|
|
346
|
+
* How a table of definitions names the type a ref points at.
|
|
347
|
+
*
|
|
348
|
+
* A ref carries the name and the file that declares it, and that pair
|
|
349
|
+
* already identifies the type, so a table keyed on it needs nothing new
|
|
350
|
+
* on the ref. A name the language or a dependency owns has no file and
|
|
351
|
+
* keys on the name alone.
|
|
352
|
+
*/
|
|
353
|
+
declare function typeDefinitionKey(ref: {
|
|
354
|
+
def?: string | undefined;
|
|
355
|
+
}): string | null;
|
|
333
356
|
declare const TypeShapeSchema: z.ZodType<TypeShape>;
|
|
357
|
+
/**
|
|
358
|
+
* A shape with the definitions it names put back into it.
|
|
359
|
+
*
|
|
360
|
+
* Comparing two shapes means comparing their structure, and a ref has
|
|
361
|
+
* none. Rather than teach every comparison to look in a table, the
|
|
362
|
+
* table goes back into the shape once, and everything downstream reads
|
|
363
|
+
* what it always read.
|
|
364
|
+
*
|
|
365
|
+
* Putting a definition back is a substitution rather than a level of
|
|
366
|
+
* nesting, so it does not spend depth. Counting it did: a type six
|
|
367
|
+
* deep came back three deep, and a consumer reading a field past that
|
|
368
|
+
* point was told the provider did not have it. What stops a type that
|
|
369
|
+
* names itself is the set of names already being put back on this
|
|
370
|
+
* path, which is how the shape walk guards its own cycles.
|
|
371
|
+
*/
|
|
372
|
+
declare function withDefinitionsInlined(shape: TypeShape, definitions: Record<string, TypeShape> | undefined, depth?: number, inProgress?: ReadonlySet<string>): TypeShape;
|
|
334
373
|
|
|
335
|
-
export { BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, DeployableUnitSchema, FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, SemanticsSchema, SourceLocationSchema, StorageRelationalSemanticsSchema, type TypeShape, TypeShapeSchema };
|
|
374
|
+
export { BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, DeployableUnitSchema, FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, SemanticsSchema, SourceLocationSchema, StorageRelationalSemanticsSchema, type TypeShape, TypeShapeSchema, typeDefinitionKey, withDefinitionsInlined };
|
package/dist/schemas.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ declare const SourceLocationSchema: z.ZodObject<{
|
|
|
64
64
|
end: z.ZodNumber;
|
|
65
65
|
}, z.core.$strip>;
|
|
66
66
|
exportName: z.ZodNullable<z.ZodString>;
|
|
67
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
67
68
|
}, z.core.$strip>;
|
|
68
69
|
declare const RestSemanticsSchema: z.ZodObject<{
|
|
69
70
|
name: z.ZodLiteral<"rest">;
|
|
@@ -317,6 +318,17 @@ type TypeShape = {
|
|
|
317
318
|
} | {
|
|
318
319
|
type: "ref";
|
|
319
320
|
name: string;
|
|
321
|
+
/**
|
|
322
|
+
* Where this type is written down, when it is. The key into the
|
|
323
|
+
* summary's table of definitions.
|
|
324
|
+
*
|
|
325
|
+
* A name does not identify a type. Every instantiation of one
|
|
326
|
+
* generic reports the generic's own name and file, so `Omit<User,
|
|
327
|
+
* "secret">` and `Omit<Order, "total">` are both `Omit`, and a
|
|
328
|
+
* table keyed on that hands the second one the first one's
|
|
329
|
+
* fields. This is built from what the type actually is.
|
|
330
|
+
*/
|
|
331
|
+
def?: string | undefined;
|
|
320
332
|
/**
|
|
321
333
|
* The file that declares this type, when the project declares it.
|
|
322
334
|
* Absent for a name the language or a dependency owns, which means
|
|
@@ -330,6 +342,33 @@ type TypeShape = {
|
|
|
330
342
|
} | {
|
|
331
343
|
type: "unknown";
|
|
332
344
|
};
|
|
345
|
+
/**
|
|
346
|
+
* How a table of definitions names the type a ref points at.
|
|
347
|
+
*
|
|
348
|
+
* A ref carries the name and the file that declares it, and that pair
|
|
349
|
+
* already identifies the type, so a table keyed on it needs nothing new
|
|
350
|
+
* on the ref. A name the language or a dependency owns has no file and
|
|
351
|
+
* keys on the name alone.
|
|
352
|
+
*/
|
|
353
|
+
declare function typeDefinitionKey(ref: {
|
|
354
|
+
def?: string | undefined;
|
|
355
|
+
}): string | null;
|
|
333
356
|
declare const TypeShapeSchema: z.ZodType<TypeShape>;
|
|
357
|
+
/**
|
|
358
|
+
* A shape with the definitions it names put back into it.
|
|
359
|
+
*
|
|
360
|
+
* Comparing two shapes means comparing their structure, and a ref has
|
|
361
|
+
* none. Rather than teach every comparison to look in a table, the
|
|
362
|
+
* table goes back into the shape once, and everything downstream reads
|
|
363
|
+
* what it always read.
|
|
364
|
+
*
|
|
365
|
+
* Putting a definition back is a substitution rather than a level of
|
|
366
|
+
* nesting, so it does not spend depth. Counting it did: a type six
|
|
367
|
+
* deep came back three deep, and a consumer reading a field past that
|
|
368
|
+
* point was told the provider did not have it. What stops a type that
|
|
369
|
+
* names itself is the set of names already being put back on this
|
|
370
|
+
* path, which is how the shape walk guards its own cycles.
|
|
371
|
+
*/
|
|
372
|
+
declare function withDefinitionsInlined(shape: TypeShape, definitions: Record<string, TypeShape> | undefined, depth?: number, inProgress?: ReadonlySet<string>): TypeShape;
|
|
334
373
|
|
|
335
|
-
export { BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, DeployableUnitSchema, FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, SemanticsSchema, SourceLocationSchema, StorageRelationalSemanticsSchema, type TypeShape, TypeShapeSchema };
|
|
374
|
+
export { BoundaryBindingSchema, ConfidenceInfoSchema, ConfidenceLevelSchema, ConfidenceSourceSchema, CorroborationSchema, DeployableUnitSchema, FunctionCallSemanticsSchema, GraphqlOperationSemanticsSchema, GraphqlResolverSemanticsSchema, MessageBusSemanticsSchema, RestSemanticsSchema, RuntimeConfigSemanticsSchema, SemanticsSchema, SourceLocationSchema, StorageRelationalSemanticsSchema, type TypeShape, TypeShapeSchema, typeDefinitionKey, withDefinitionsInlined };
|
package/dist/schemas.js
CHANGED
|
@@ -14,8 +14,10 @@ import {
|
|
|
14
14
|
SemanticsSchema,
|
|
15
15
|
SourceLocationSchema,
|
|
16
16
|
StorageRelationalSemanticsSchema,
|
|
17
|
-
TypeShapeSchema
|
|
18
|
-
|
|
17
|
+
TypeShapeSchema,
|
|
18
|
+
typeDefinitionKey,
|
|
19
|
+
withDefinitionsInlined
|
|
20
|
+
} from "./chunk-L4XGOS3I.js";
|
|
19
21
|
export {
|
|
20
22
|
BoundaryBindingSchema,
|
|
21
23
|
ConfidenceInfoSchema,
|
|
@@ -32,5 +34,7 @@ export {
|
|
|
32
34
|
SemanticsSchema,
|
|
33
35
|
SourceLocationSchema,
|
|
34
36
|
StorageRelationalSemanticsSchema,
|
|
35
|
-
TypeShapeSchema
|
|
37
|
+
TypeShapeSchema,
|
|
38
|
+
typeDefinitionKey,
|
|
39
|
+
withDefinitionsInlined
|
|
36
40
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@suss/ir-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Shared IR primitives for suss — type shapes, boundary bindings, source locations, and confidence. Imported by both @suss/behavioral-ir and @suss/intent-ir so neither depends on the other.",
|
|
6
6
|
"keywords": [
|