@suss/adapter-ruby 0.22.2 → 0.22.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/index.d.cts CHANGED
@@ -107,6 +107,13 @@ interface ClassInfo {
107
107
  qualifiedName: string;
108
108
  /** Null when it declares no superclass, or the expression is not a literal constant path. */
109
109
  superclassQualifiedName: string | null;
110
+ /**
111
+ * Every name the superclass expression can resolve to, in the order Ruby
112
+ * tries them: each level of the enclosing nesting innermost first, then the
113
+ * bare name at top level. A compound path is one entry. Empty when there is
114
+ * no readable superclass.
115
+ */
116
+ superclassCandidates: readonly string[];
110
117
  /** `body_statement` node, or null for `class Foo; end`. */
111
118
  bodyNode: Node | null;
112
119
  /** `Module.nesting` in effect inside this class's own body, innermost first. */
@@ -256,6 +263,18 @@ interface ControllerActions {
256
263
  ancestryRootClassNames: string[];
257
264
  /** Status code a wire response gets when the action does not say otherwise. */
258
265
  defaultStatusCode: number;
266
+ /** The receiverless calls the library gives an action for writing a wire status. Leave it out and every action reports the default. */
267
+ responseStatusCalls?: RbStatusCall[];
268
+ /** The number behind each name the library accepts where a status number could go, Rack's own symbol table for Rails. */
269
+ statusCodeNames?: Record<string, number>;
270
+ /**
271
+ * The methods every controller gets without defining them, which for
272
+ * Rails is `params`, `render` and the rest of what `ActionController`
273
+ * mixes in. An action's effect list is there to show what the action
274
+ * reaches in the project, and nothing in the project defines these,
275
+ * so a receiverless call to one of them is left off that list.
276
+ */
277
+ inheritedMethodNames?: string[];
259
278
  /** Absolute path of the file this pattern's own routing came from, for the one gap `routingGaps` may report. */
260
279
  routesFile: string;
261
280
  /** The method and path a project's own routing gives one controller's action, or null when that action has none. */
@@ -266,6 +285,25 @@ interface ControllerActions {
266
285
  /** One message per routing declaration kind this pattern's reading left uncovered. A pure read: calling it again gives the same list. */
267
286
  routingGaps?: () => readonly string[];
268
287
  }
288
+ /**
289
+ * One call an action writes to send a response, and where that call takes
290
+ * the status. A call may take it both ways, and then the keyword wins,
291
+ * which is what Rails does with `head :ok, status: :created`.
292
+ */
293
+ interface RbStatusCall {
294
+ /** The call's own name as an action writes it, `render` for Rails. */
295
+ name: string;
296
+ /** The keyword whose value gives the status, `status` for Rails. */
297
+ statusKeyword?: string;
298
+ /** The index of the positional argument giving the status, 0 for Rails' `head :no_content`. */
299
+ statusArgument?: number;
300
+ /**
301
+ * The status this call sends when the action writes none. Rails'
302
+ * `redirect_to` sends 302 where its `render` sends the controller's own
303
+ * default, so a default declared here wins over `defaultStatusCode`.
304
+ */
305
+ defaultStatusCode?: number;
306
+ }
269
307
  /** A class or module whose ancestry reaches one of `baseClassNames` declares GraphQL fields through DSL calls in its own body. */
270
308
  interface GraphqlObjectFields {
271
309
  type: "graphqlObjectFields";
@@ -322,20 +360,32 @@ interface RbStorageOptions {
322
360
  readonly patterns: readonly RbStoragePattern[];
323
361
  }
324
362
 
363
+ /** The methods a pack declared the library defines itself, so a receiverless call to one of them is not work the project does. */
364
+ type InheritedMethods = ReadonlySet<string>;
365
+
325
366
  /** Parsed files by absolute path, so a class that several fields refer to is only parsed once. */
326
367
  interface FileCache {
327
368
  get(absPath: string): Promise<Node | null>;
328
369
  }
329
370
  declare function createFileCache(parse: (source: string) => Promise<Node>, readFile: (absPath: string) => string | null): FileCache;
330
- interface DiscoveryOptions {
371
+ /**
372
+ * What the run's packs said that reading a method body needs. An
373
+ * options object that already declares both fields, `DiscoveryOptions`
374
+ * among them, is one of these and can be passed straight through.
375
+ */
376
+ interface BodyReadOptions {
377
+ /** What a pack needs to say a call talks to the database. Absent when no pack does. */
378
+ readonly storage?: RbStorageOptions | undefined;
379
+ /** The methods every pack in the run said its own library defines, which are left off an effect list. */
380
+ readonly inheritedMethods?: InheritedMethods | undefined;
381
+ }
382
+ interface DiscoveryOptions extends BodyReadOptions {
331
383
  packs: RubyPack[];
332
384
  /** Repo-relative or absolute path recorded on each summary's `location.file`. */
333
385
  filePath: string;
334
386
  /** Absolute path of the file being read, for a block's own `ReachedBody.file`. Falls back to `filePath` when nothing was written to disk. */
335
387
  absoluteFile?: string;
336
388
  cache: FileCache;
337
- /** What a pack needs to say a call talks to the database. Absent when no pack does. */
338
- storage?: RbStorageOptions | undefined;
339
389
  /** Called once per discovered unit whose own body is a method this run can follow calls out of, so the reach walk has a place to start. */
340
390
  onReachSeed?: (raw: RawCodeStructure, seed: ReachSeed) => void;
341
391
  }
@@ -605,4 +655,4 @@ declare function methodDefinitionsIn(file: string, root: Node): Map<string, Node
605
655
  */
606
656
  declare const ADAPTER_VERSION = "0.1.0";
607
657
 
608
- export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantPathConvention, type ControllerActions, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type ProjectNodes, type Range, type RbStoragePattern, type ReachedBody, type RubyDiscoveryPattern, type RubyExtendsSite, type RubyPack, type RubyRequireSite, type RubyStubEvidence, type RubyStubEvidenceOptions, type RubyValueHandle, RubyWhySession, type RubyWhySessionOptions, type TypeReadContext, ancestryOf, bindEvaluator, bodyStatements, booleanLiteralValue, collectFileConstants, createFileCache, discoverUnits, emitConstantBindings, emitEntryFact, emitValueFacts, evaluatedValue, extractRubyProject, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, methodDefinitionsIn, methodInAncestry, nodeId, parseRuby, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };
658
+ export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantPathConvention, type ControllerActions, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type ProjectNodes, type Range, type RbStatusCall, type RbStoragePattern, type ReachedBody, type RubyDiscoveryPattern, type RubyExtendsSite, type RubyPack, type RubyRequireSite, type RubyStubEvidence, type RubyStubEvidenceOptions, type RubyValueHandle, RubyWhySession, type RubyWhySessionOptions, type TypeReadContext, ancestryOf, bindEvaluator, bodyStatements, booleanLiteralValue, collectFileConstants, createFileCache, discoverUnits, emitConstantBindings, emitEntryFact, emitValueFacts, evaluatedValue, extractRubyProject, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, methodDefinitionsIn, methodInAncestry, nodeId, parseRuby, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };
package/dist/index.d.ts CHANGED
@@ -107,6 +107,13 @@ interface ClassInfo {
107
107
  qualifiedName: string;
108
108
  /** Null when it declares no superclass, or the expression is not a literal constant path. */
109
109
  superclassQualifiedName: string | null;
110
+ /**
111
+ * Every name the superclass expression can resolve to, in the order Ruby
112
+ * tries them: each level of the enclosing nesting innermost first, then the
113
+ * bare name at top level. A compound path is one entry. Empty when there is
114
+ * no readable superclass.
115
+ */
116
+ superclassCandidates: readonly string[];
110
117
  /** `body_statement` node, or null for `class Foo; end`. */
111
118
  bodyNode: Node | null;
112
119
  /** `Module.nesting` in effect inside this class's own body, innermost first. */
@@ -256,6 +263,18 @@ interface ControllerActions {
256
263
  ancestryRootClassNames: string[];
257
264
  /** Status code a wire response gets when the action does not say otherwise. */
258
265
  defaultStatusCode: number;
266
+ /** The receiverless calls the library gives an action for writing a wire status. Leave it out and every action reports the default. */
267
+ responseStatusCalls?: RbStatusCall[];
268
+ /** The number behind each name the library accepts where a status number could go, Rack's own symbol table for Rails. */
269
+ statusCodeNames?: Record<string, number>;
270
+ /**
271
+ * The methods every controller gets without defining them, which for
272
+ * Rails is `params`, `render` and the rest of what `ActionController`
273
+ * mixes in. An action's effect list is there to show what the action
274
+ * reaches in the project, and nothing in the project defines these,
275
+ * so a receiverless call to one of them is left off that list.
276
+ */
277
+ inheritedMethodNames?: string[];
259
278
  /** Absolute path of the file this pattern's own routing came from, for the one gap `routingGaps` may report. */
260
279
  routesFile: string;
261
280
  /** The method and path a project's own routing gives one controller's action, or null when that action has none. */
@@ -266,6 +285,25 @@ interface ControllerActions {
266
285
  /** One message per routing declaration kind this pattern's reading left uncovered. A pure read: calling it again gives the same list. */
267
286
  routingGaps?: () => readonly string[];
268
287
  }
288
+ /**
289
+ * One call an action writes to send a response, and where that call takes
290
+ * the status. A call may take it both ways, and then the keyword wins,
291
+ * which is what Rails does with `head :ok, status: :created`.
292
+ */
293
+ interface RbStatusCall {
294
+ /** The call's own name as an action writes it, `render` for Rails. */
295
+ name: string;
296
+ /** The keyword whose value gives the status, `status` for Rails. */
297
+ statusKeyword?: string;
298
+ /** The index of the positional argument giving the status, 0 for Rails' `head :no_content`. */
299
+ statusArgument?: number;
300
+ /**
301
+ * The status this call sends when the action writes none. Rails'
302
+ * `redirect_to` sends 302 where its `render` sends the controller's own
303
+ * default, so a default declared here wins over `defaultStatusCode`.
304
+ */
305
+ defaultStatusCode?: number;
306
+ }
269
307
  /** A class or module whose ancestry reaches one of `baseClassNames` declares GraphQL fields through DSL calls in its own body. */
270
308
  interface GraphqlObjectFields {
271
309
  type: "graphqlObjectFields";
@@ -322,20 +360,32 @@ interface RbStorageOptions {
322
360
  readonly patterns: readonly RbStoragePattern[];
323
361
  }
324
362
 
363
+ /** The methods a pack declared the library defines itself, so a receiverless call to one of them is not work the project does. */
364
+ type InheritedMethods = ReadonlySet<string>;
365
+
325
366
  /** Parsed files by absolute path, so a class that several fields refer to is only parsed once. */
326
367
  interface FileCache {
327
368
  get(absPath: string): Promise<Node | null>;
328
369
  }
329
370
  declare function createFileCache(parse: (source: string) => Promise<Node>, readFile: (absPath: string) => string | null): FileCache;
330
- interface DiscoveryOptions {
371
+ /**
372
+ * What the run's packs said that reading a method body needs. An
373
+ * options object that already declares both fields, `DiscoveryOptions`
374
+ * among them, is one of these and can be passed straight through.
375
+ */
376
+ interface BodyReadOptions {
377
+ /** What a pack needs to say a call talks to the database. Absent when no pack does. */
378
+ readonly storage?: RbStorageOptions | undefined;
379
+ /** The methods every pack in the run said its own library defines, which are left off an effect list. */
380
+ readonly inheritedMethods?: InheritedMethods | undefined;
381
+ }
382
+ interface DiscoveryOptions extends BodyReadOptions {
331
383
  packs: RubyPack[];
332
384
  /** Repo-relative or absolute path recorded on each summary's `location.file`. */
333
385
  filePath: string;
334
386
  /** Absolute path of the file being read, for a block's own `ReachedBody.file`. Falls back to `filePath` when nothing was written to disk. */
335
387
  absoluteFile?: string;
336
388
  cache: FileCache;
337
- /** What a pack needs to say a call talks to the database. Absent when no pack does. */
338
- storage?: RbStorageOptions | undefined;
339
389
  /** Called once per discovered unit whose own body is a method this run can follow calls out of, so the reach walk has a place to start. */
340
390
  onReachSeed?: (raw: RawCodeStructure, seed: ReachSeed) => void;
341
391
  }
@@ -605,4 +655,4 @@ declare function methodDefinitionsIn(file: string, root: Node): Map<string, Node
605
655
  */
606
656
  declare const ADAPTER_VERSION = "0.1.0";
607
657
 
608
- export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantPathConvention, type ControllerActions, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type ProjectNodes, type Range, type RbStoragePattern, type ReachedBody, type RubyDiscoveryPattern, type RubyExtendsSite, type RubyPack, type RubyRequireSite, type RubyStubEvidence, type RubyStubEvidenceOptions, type RubyValueHandle, RubyWhySession, type RubyWhySessionOptions, type TypeReadContext, ancestryOf, bindEvaluator, bodyStatements, booleanLiteralValue, collectFileConstants, createFileCache, discoverUnits, emitConstantBindings, emitEntryFact, emitValueFacts, evaluatedValue, extractRubyProject, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, methodDefinitionsIn, methodInAncestry, nodeId, parseRuby, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };
658
+ export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantPathConvention, type ControllerActions, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type ProjectNodes, type Range, type RbStatusCall, type RbStoragePattern, type ReachedBody, type RubyDiscoveryPattern, type RubyExtendsSite, type RubyPack, type RubyRequireSite, type RubyStubEvidence, type RubyStubEvidenceOptions, type RubyValueHandle, RubyWhySession, type RubyWhySessionOptions, type TypeReadContext, ancestryOf, bindEvaluator, bodyStatements, booleanLiteralValue, collectFileConstants, createFileCache, discoverUnits, emitConstantBindings, emitEntryFact, emitValueFacts, evaluatedValue, extractRubyProject, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, methodDefinitionsIn, methodInAncestry, nodeId, parseRuby, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };