@suss/adapter-ruby 0.3.2-0 → 0.5.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.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Tree, Node } from 'web-tree-sitter';
2
2
  export { Node as RbNode, Tree as RbTree } from 'web-tree-sitter';
3
- import { RawCodeStructure } from '@suss/extractor';
4
- import { TypeShape, BehavioralSummary } from '@suss/behavioral-ir';
5
3
  import { Database } from '@suss/datalog';
4
+ import { TypeShape, BehavioralSummary } from '@suss/behavioral-ir';
5
+ import { RawCodeStructure } from '@suss/extractor';
6
6
 
7
7
  /**
8
8
  * Finds the file behind a constant.
@@ -147,6 +147,21 @@ interface RubyPack {
147
147
  /** Wire protocol for the produced boundary bindings, e.g. "http-graphql". */
148
148
  protocol: string;
149
149
  discovery: RubyDiscoveryPattern[];
150
+ /** What the library's own database calls look like. The README says how one is matched. */
151
+ storage?: RbStoragePattern[];
152
+ }
153
+ /**
154
+ * Ruby writes no return type, so a call is matched by what its receiver
155
+ * inherits from. A model is a class that reaches one of these base classes,
156
+ * whether the project declares an intermediate one or not.
157
+ */
158
+ interface RbStoragePattern {
159
+ /** Base classes the library gives a model, `ActiveRecord::Base` for Rails. */
160
+ baseClasses: string[];
161
+ /** Methods that change what is stored. Anything else reads. */
162
+ writes: string[];
163
+ /** Which database is behind the connection, which the project settles. */
164
+ storageSystem: "postgres" | "mysql" | "sqlite";
150
165
  }
151
166
  type RubyDiscoveryPattern = GraphqlObjectFields;
152
167
  /** A class whose `< ...` superclass is one of `baseClassNames` declares GraphQL fields through DSL calls in its own body. */
@@ -183,6 +198,11 @@ interface GraphqlObjectFields {
183
198
  typeNameConvention: GraphqlTypeNameConvention;
184
199
  }
185
200
 
201
+ interface RbStorageOptions {
202
+ readonly facts: Database;
203
+ readonly patterns: readonly RbStoragePattern[];
204
+ }
205
+
186
206
  /** Parsed files by absolute path, so a class that several fields refer to is only parsed once. */
187
207
  interface FileCache {
188
208
  get(absPath: string): Promise<Node | null>;
@@ -193,6 +213,8 @@ interface DiscoveryOptions {
193
213
  /** Repo-relative or absolute path recorded on each summary's `location.file`. */
194
214
  filePath: string;
195
215
  cache: FileCache;
216
+ /** What a pack needs to say a call talks to the database. Absent when no pack does. */
217
+ storage?: RbStorageOptions | undefined;
196
218
  }
197
219
  declare function discoverUnits(root: Node, options: DiscoveryOptions): Promise<RawCodeStructure[]>;
198
220
 
@@ -253,4 +275,4 @@ interface TypeReadContext {
253
275
  */
254
276
  declare function typeShapeFromNode(node: Node, ctx: TypeReadContext): TypeShape | null;
255
277
 
256
- export { type AncestorEntry, type AncestorLookup, type Ancestry, type ClassInfo, type ConstantPathConvention, type DiscoveryOptions, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type ReachedBody, type RubyDiscoveryPattern, type RubyPack, type TypeReadContext, ancestryOf, createFileCache, discoverUnits, emitEntryFact, extractRubyProject, findRubyFiles, graphqlTypeNameFromQualified, inheritedStatements, methodInAncestry, parseRuby, qualifyConstantRef, reachDefinition, resolveConstantFile, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };
278
+ export { type AncestorEntry, type AncestorLookup, type Ancestry, type ClassInfo, type ConstantPathConvention, type DiscoveryOptions, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type RbStoragePattern, type ReachedBody, type RubyDiscoveryPattern, type RubyPack, type TypeReadContext, ancestryOf, createFileCache, discoverUnits, emitEntryFact, extractRubyProject, findRubyFiles, graphqlTypeNameFromQualified, inheritedStatements, methodInAncestry, parseRuby, qualifyConstantRef, reachDefinition, resolveConstantFile, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Tree, Node } from 'web-tree-sitter';
2
2
  export { Node as RbNode, Tree as RbTree } from 'web-tree-sitter';
3
- import { RawCodeStructure } from '@suss/extractor';
4
- import { TypeShape, BehavioralSummary } from '@suss/behavioral-ir';
5
3
  import { Database } from '@suss/datalog';
4
+ import { TypeShape, BehavioralSummary } from '@suss/behavioral-ir';
5
+ import { RawCodeStructure } from '@suss/extractor';
6
6
 
7
7
  /**
8
8
  * Finds the file behind a constant.
@@ -147,6 +147,21 @@ interface RubyPack {
147
147
  /** Wire protocol for the produced boundary bindings, e.g. "http-graphql". */
148
148
  protocol: string;
149
149
  discovery: RubyDiscoveryPattern[];
150
+ /** What the library's own database calls look like. The README says how one is matched. */
151
+ storage?: RbStoragePattern[];
152
+ }
153
+ /**
154
+ * Ruby writes no return type, so a call is matched by what its receiver
155
+ * inherits from. A model is a class that reaches one of these base classes,
156
+ * whether the project declares an intermediate one or not.
157
+ */
158
+ interface RbStoragePattern {
159
+ /** Base classes the library gives a model, `ActiveRecord::Base` for Rails. */
160
+ baseClasses: string[];
161
+ /** Methods that change what is stored. Anything else reads. */
162
+ writes: string[];
163
+ /** Which database is behind the connection, which the project settles. */
164
+ storageSystem: "postgres" | "mysql" | "sqlite";
150
165
  }
151
166
  type RubyDiscoveryPattern = GraphqlObjectFields;
152
167
  /** A class whose `< ...` superclass is one of `baseClassNames` declares GraphQL fields through DSL calls in its own body. */
@@ -183,6 +198,11 @@ interface GraphqlObjectFields {
183
198
  typeNameConvention: GraphqlTypeNameConvention;
184
199
  }
185
200
 
201
+ interface RbStorageOptions {
202
+ readonly facts: Database;
203
+ readonly patterns: readonly RbStoragePattern[];
204
+ }
205
+
186
206
  /** Parsed files by absolute path, so a class that several fields refer to is only parsed once. */
187
207
  interface FileCache {
188
208
  get(absPath: string): Promise<Node | null>;
@@ -193,6 +213,8 @@ interface DiscoveryOptions {
193
213
  /** Repo-relative or absolute path recorded on each summary's `location.file`. */
194
214
  filePath: string;
195
215
  cache: FileCache;
216
+ /** What a pack needs to say a call talks to the database. Absent when no pack does. */
217
+ storage?: RbStorageOptions | undefined;
196
218
  }
197
219
  declare function discoverUnits(root: Node, options: DiscoveryOptions): Promise<RawCodeStructure[]>;
198
220
 
@@ -253,4 +275,4 @@ interface TypeReadContext {
253
275
  */
254
276
  declare function typeShapeFromNode(node: Node, ctx: TypeReadContext): TypeShape | null;
255
277
 
256
- export { type AncestorEntry, type AncestorLookup, type Ancestry, type ClassInfo, type ConstantPathConvention, type DiscoveryOptions, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type ReachedBody, type RubyDiscoveryPattern, type RubyPack, type TypeReadContext, ancestryOf, createFileCache, discoverUnits, emitEntryFact, extractRubyProject, findRubyFiles, graphqlTypeNameFromQualified, inheritedStatements, methodInAncestry, parseRuby, qualifyConstantRef, reachDefinition, resolveConstantFile, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };
278
+ export { type AncestorEntry, type AncestorLookup, type Ancestry, type ClassInfo, type ConstantPathConvention, type DiscoveryOptions, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type GraphqlObjectFields, type GraphqlTypeNameConvention, type MethodLookup, type RbStoragePattern, type ReachedBody, type RubyDiscoveryPattern, type RubyPack, type TypeReadContext, ancestryOf, createFileCache, discoverUnits, emitEntryFact, extractRubyProject, findRubyFiles, graphqlTypeNameFromQualified, inheritedStatements, methodInAncestry, parseRuby, qualifyConstantRef, reachDefinition, resolveConstantFile, typeShapeFromNode, underscoreConstantPath, unitKey, walkClasses, walkDefinitions };