@suss/adapter-ruby 0.36.0 → 0.37.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.cjs +4600 -3474
- package/dist/index.d.cts +141 -5
- package/dist/index.d.ts +141 -5
- package/dist/index.js +4660 -3532
- package/package.json +8 -8
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Database } from '@suss/datalog';
|
|
2
2
|
import { Tree, Node } from 'web-tree-sitter';
|
|
3
3
|
export { Node as RbNode, Tree as RbTree } from 'web-tree-sitter';
|
|
4
|
-
import { TypeShape, RequestSpellingMetadata, Effect, BehavioralSummary } from '@suss/behavioral-ir';
|
|
4
|
+
import { MessageBusTechnology, TypeShape, RequestSpellingMetadata, Effect, BehavioralSummary } from '@suss/behavioral-ir';
|
|
5
5
|
import { DeclaredEntryPoint, RawCodeStructure, TimingReport, ExtractionReport, CacheDiagnostic, ExtractorOptions, DeclaredModule, KeptParses } from '@suss/extractor';
|
|
6
6
|
import { UnwrapsByName, WhyExplained } from '@suss/resolution';
|
|
7
7
|
import { Value } from '@suss/values';
|
|
@@ -397,12 +397,69 @@ interface RubyPack {
|
|
|
397
397
|
inflections?: RbInflections;
|
|
398
398
|
/** Methods the library offers that hand back the argument at `argument`, keyed on the module the callee comes from. */
|
|
399
399
|
transparentWrappers?: UnwrapsByName[];
|
|
400
|
+
/**
|
|
401
|
+
* Methods the library adds to every object, nil included, that hand
|
|
402
|
+
* back the receiver or nil when it is blank, such as ActiveSupport's
|
|
403
|
+
* `presence`. A read followed by one of these and `||` has a fallback.
|
|
404
|
+
*/
|
|
405
|
+
blankToNil?: string[];
|
|
400
406
|
/** How the library builds test records from named factories. */
|
|
401
407
|
factories?: RbFactories[];
|
|
402
408
|
/** How a class-based test runner declares tests, as Minitest does. */
|
|
403
409
|
testClasses?: RbTestClasses[];
|
|
404
410
|
/** How the library writes a test, so each one becomes a `test` unit a PRD scenario can list under `coveredBy`. */
|
|
405
411
|
tests?: RbTestCases[];
|
|
412
|
+
/** How the library runs a method later in a worker, and the calls that enqueue it. */
|
|
413
|
+
jobs?: RbJobPattern[];
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* A background job library. A job's method becomes a `consumer` unit on
|
|
417
|
+
* a message-bus channel, and a call that enqueues it becomes a message
|
|
418
|
+
* send to that channel. DESIGN.md says how the adapter reads each kind.
|
|
419
|
+
*/
|
|
420
|
+
type RbJobPattern = RbJobClasses | RbMailers;
|
|
421
|
+
/**
|
|
422
|
+
* Job classes with one method the worker runs, as ActiveJob and Sidekiq
|
|
423
|
+
* write them: `ReportJob.perform_later(id)` runs `ReportJob#perform(id)`.
|
|
424
|
+
* The channel is the class, with the queue the class declares in front.
|
|
425
|
+
*/
|
|
426
|
+
interface RbJobClasses {
|
|
427
|
+
type: "jobClasses";
|
|
428
|
+
messageBus: MessageBusTechnology;
|
|
429
|
+
/** Library bases a job class extends, as a project writes them: `ActiveJob::Base`. */
|
|
430
|
+
baseClasses: string[];
|
|
431
|
+
/** Library modules a job class includes: `Sidekiq::Job`. */
|
|
432
|
+
modules: string[];
|
|
433
|
+
/** The instance method the worker runs: `perform`. */
|
|
434
|
+
performMethod: string;
|
|
435
|
+
/** The class methods that enqueue a job, each with the position its first job argument is at: `perform_in` takes the delay first. */
|
|
436
|
+
enqueueMethods: Record<string, number>;
|
|
437
|
+
/** Class methods that return the job with options set, so an enqueue can be called on their result: `set`. */
|
|
438
|
+
optionMethods: string[];
|
|
439
|
+
/** The class-body calls that declare the job's queue. */
|
|
440
|
+
queueDeclarations: RbQueueDeclaration[];
|
|
441
|
+
}
|
|
442
|
+
/** A class-body call that declares a job's queue, and where it takes the queue. */
|
|
443
|
+
interface RbQueueDeclaration {
|
|
444
|
+
/** `queue_as`, or `sidekiq_options`. */
|
|
445
|
+
call: string;
|
|
446
|
+
/** Where the call takes the queue: positionally for `queue_as :exports`, or under a keyword for `sidekiq_options queue: "push"`. */
|
|
447
|
+
queue: RbArgumentPlace;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Mailers, as ActionMailer writes them: every public instance method is
|
|
451
|
+
* a message, and `UserMailer.welcome(user).deliver_later` enqueues
|
|
452
|
+
* `UserMailer#welcome(user)`. The channel is `UserMailer.welcome`.
|
|
453
|
+
*/
|
|
454
|
+
interface RbMailers {
|
|
455
|
+
type: "mailers";
|
|
456
|
+
messageBus: MessageBusTechnology;
|
|
457
|
+
/** Library bases a mailer extends: `ActionMailer::Base`. */
|
|
458
|
+
baseClasses: string[];
|
|
459
|
+
/** The calls on a built message that enqueue it: `deliver_later`. */
|
|
460
|
+
enqueueMethods: string[];
|
|
461
|
+
/** Class methods that return the mailer with parameters set, so the message can be built on their result: `with`. */
|
|
462
|
+
optionMethods: string[];
|
|
406
463
|
}
|
|
407
464
|
/**
|
|
408
465
|
* Tests written as nested blocks, the way RSpec writes them:
|
|
@@ -989,6 +1046,45 @@ interface RbResolverHooks {
|
|
|
989
1046
|
* payload in its place.
|
|
990
1047
|
*/
|
|
991
1048
|
answerIsListHead?: boolean;
|
|
1049
|
+
/**
|
|
1050
|
+
* The class the library raises when a hook listed here returns false
|
|
1051
|
+
* with no payload. A hook not listed makes the field resolve to null
|
|
1052
|
+
* instead. graphql-ruby raises for `authorized?` and returns null for
|
|
1053
|
+
* `ready?`.
|
|
1054
|
+
*/
|
|
1055
|
+
refusalRaises?: Record<string, string>;
|
|
1056
|
+
}
|
|
1057
|
+
/** How a library reads whether a field's value, or the items of a list it returns, can be null. */
|
|
1058
|
+
interface RbGraphqlNullability {
|
|
1059
|
+
/** The keyword on a field or type call, and inside a list type, that says whether the value can be null. */
|
|
1060
|
+
keyword: string;
|
|
1061
|
+
/** The class-level call a wired class makes to say whether the field it resolves can be null. */
|
|
1062
|
+
callName?: string;
|
|
1063
|
+
/** Whether a field can be null when nothing says. */
|
|
1064
|
+
nullableByDefault: boolean;
|
|
1065
|
+
/** Whether a list's items can be null when the list type does not say. */
|
|
1066
|
+
listItemsNullableByDefault: boolean;
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* A type the library generates from another one when a method is called
|
|
1070
|
+
* on it, such as `CampaignType.connection_type`. In every name below,
|
|
1071
|
+
* `{type}` is replaced with the wrapped type's GraphQL name, and a ref
|
|
1072
|
+
* named `{type}` alone is the wrapped type.
|
|
1073
|
+
*/
|
|
1074
|
+
interface RbGraphqlTypeWrapper {
|
|
1075
|
+
/** The name of the type the field returns. */
|
|
1076
|
+
name: string;
|
|
1077
|
+
/** Each type the wrapper generates, by name, with its fields. */
|
|
1078
|
+
types: Record<string, Record<string, TypeShape>>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Other types the method takes as keyword arguments, keyed by the ref
|
|
1081
|
+
* name in `types` that each one replaces, with the library type used
|
|
1082
|
+
* when the call passes none.
|
|
1083
|
+
*/
|
|
1084
|
+
typeArguments?: Record<string, {
|
|
1085
|
+
keyword: string;
|
|
1086
|
+
fallback: string;
|
|
1087
|
+
}>;
|
|
992
1088
|
}
|
|
993
1089
|
/** A class or module whose ancestry reaches one of `baseClassNames` declares GraphQL fields through DSL calls in its own body. */
|
|
994
1090
|
interface GraphqlObjectFields {
|
|
@@ -1006,6 +1102,18 @@ interface GraphqlObjectFields {
|
|
|
1006
1102
|
fieldCallName: string;
|
|
1007
1103
|
/** The DSL call declaring a referenced class's own return type. */
|
|
1008
1104
|
typeCallName: string;
|
|
1105
|
+
/** The keyword a field call can give its type under, in place of its second positional argument. */
|
|
1106
|
+
typeKeyword?: string;
|
|
1107
|
+
/** The class-level call that sets a type's GraphQL name, in place of the one `typeNameConvention` derives. */
|
|
1108
|
+
typeNameCallName?: string;
|
|
1109
|
+
/** How a field says its value can be null. Without it, a resolver's output says nothing about null. */
|
|
1110
|
+
nullability?: RbGraphqlNullability;
|
|
1111
|
+
/** Methods that, called on a type class, give a type the library generates from it, keyed by method name. */
|
|
1112
|
+
typeWrappers?: Record<string, RbGraphqlTypeWrapper>;
|
|
1113
|
+
/** Object types the library defines itself, which a generated type refers to, by name with their fields. */
|
|
1114
|
+
libraryTypes?: Record<string, Record<string, TypeShape>>;
|
|
1115
|
+
/** Classes whose instance, when a resolver returns one, the library reports as an error in place of the field's value. */
|
|
1116
|
+
returnedErrorClassNames?: string[];
|
|
1009
1117
|
argumentCallName: string;
|
|
1010
1118
|
/** Keywords whose value is a class to read the declared contract from, one hop away. They are tried in the order listed. */
|
|
1011
1119
|
wiringKeywords: string[];
|
|
@@ -1063,6 +1171,30 @@ interface EffectAt {
|
|
|
1063
1171
|
at: Node;
|
|
1064
1172
|
}
|
|
1065
1173
|
|
|
1174
|
+
/**
|
|
1175
|
+
* Background jobs: the method a worker runs later, and the calls that
|
|
1176
|
+
* enqueue it.
|
|
1177
|
+
*
|
|
1178
|
+
* A class whose ancestry reaches one of a job pattern's base classes, or
|
|
1179
|
+
* mixes in one of its modules, is a job. The method the worker runs
|
|
1180
|
+
* becomes a `consumer` unit bound to a message-bus channel, and a call
|
|
1181
|
+
* that enqueues the job becomes a `message-send` to that channel with the
|
|
1182
|
+
* job's arguments. Both sides decide whether a class is a job through the
|
|
1183
|
+
* same ancestry rules, so they agree on the channel. An enqueue whose job
|
|
1184
|
+
* the rules do not settle is recorded with no channel, and the summary
|
|
1185
|
+
* gets a gap for it. DESIGN.md has the spellings each kind reads.
|
|
1186
|
+
*/
|
|
1187
|
+
|
|
1188
|
+
/** One job pattern, with the pack that declared it, which its effects and units are recognized as. */
|
|
1189
|
+
interface RbJobDeclaration {
|
|
1190
|
+
readonly pattern: RbJobPattern;
|
|
1191
|
+
readonly recognition: string;
|
|
1192
|
+
}
|
|
1193
|
+
interface RbJobOptions {
|
|
1194
|
+
readonly facts: Database;
|
|
1195
|
+
readonly declarations: readonly RbJobDeclaration[];
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1066
1198
|
/**
|
|
1067
1199
|
* Finds the calls in a Ruby body that read or write the database.
|
|
1068
1200
|
*
|
|
@@ -1193,6 +1325,8 @@ interface BodyReadOptions {
|
|
|
1193
1325
|
readonly facts?: Database | undefined;
|
|
1194
1326
|
/** The storage patterns that decide whether a call reads or writes the database. Absent when no pack declares any. */
|
|
1195
1327
|
readonly storage?: RbStorageOptions | undefined;
|
|
1328
|
+
/** The job patterns that decide whether a call enqueues a background job. Absent when no pack declares any. */
|
|
1329
|
+
readonly jobs?: RbJobOptions | undefined;
|
|
1196
1330
|
/** The methods the run's packs declare their libraries define. Calls to them are left off an effect list. */
|
|
1197
1331
|
readonly inheritedMethods?: InheritedMethods | undefined;
|
|
1198
1332
|
/** The calls whose block the run's packs declare runs as part of the surrounding body. */
|
|
@@ -1518,9 +1652,9 @@ declare function rubyStubEvidence(options: RubyStubEvidenceOptions): Promise<Rub
|
|
|
1518
1652
|
/**
|
|
1519
1653
|
* Turns a Ruby DSL call's type argument into an IR type shape.
|
|
1520
1654
|
*
|
|
1521
|
-
*
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1655
|
+
* It reads a constant, a one-element array of one, or a wrapper method the
|
|
1656
|
+
* pack declares called on one. A lambda or any other call abstains rather
|
|
1657
|
+
* than guessing at what it evaluates to.
|
|
1524
1658
|
*/
|
|
1525
1659
|
|
|
1526
1660
|
interface TypeReadContext {
|
|
@@ -1531,6 +1665,8 @@ interface TypeReadContext {
|
|
|
1531
1665
|
scalars: Readonly<Record<string, TypeShape>>;
|
|
1532
1666
|
scalarNamePrefixes: readonly string[];
|
|
1533
1667
|
typeNameConvention: GraphqlTypeNameConvention;
|
|
1668
|
+
/** The methods that turn a type into one the library generates, with that type's name, as `{type}Connection`. */
|
|
1669
|
+
typeWrapperNames?: Readonly<Record<string, string>>;
|
|
1534
1670
|
}
|
|
1535
1671
|
/**
|
|
1536
1672
|
* Returns null when the type cannot be read, and the field then abstains.
|
|
@@ -1552,4 +1688,4 @@ declare function typeShapeFromNode(node: Node, ctx: TypeReadContext): TypeShape
|
|
|
1552
1688
|
*/
|
|
1553
1689
|
declare const ADAPTER_VERSION = "0.1.0";
|
|
1554
1690
|
|
|
1555
|
-
export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantFileCache, type ConstantPathConvention, type ControllerActions, type ControllerRoute, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type FileFactsOptions, type GraphqlObjectFields, type GraphqlTypeNameConvention, type KeptRubyParses, type LibraryException, type MethodLookup, type ParameterBindings, type ProjectNodes, type Range, type RbAddressingCall, type RbArgumentPlace, type RbBodyBlock, type RbExpectations, type RbFactories, type RbFactoryBuilder, type RbFormatSwitch, type RbInflections, type RbPredicateMatcher, type RbRawSqlPattern, type RbResolverHooks, type RbRowCall, type RbSharedInclude, type RbStatusCall, type RbStorageOptions, type RbStoragePattern, type RbTestCases, type RbTestClasses, type RbTestMocks, 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, children, collectFileConstants, createConstantFileCache, createFileCache, discoverUnits, emitConstantBindings, emitValueFacts, evaluatedValue, extractRubyProject, factsForFile, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, keptRubyParses, methodDefinitionsIn, methodInAncestry, nestedStatements, nodeId, parseRuby, parseRubyAhead, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, storageClaims, storageEffects, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, walkClasses, walkDefinitions };
|
|
1691
|
+
export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantFileCache, type ConstantPathConvention, type ControllerActions, type ControllerRoute, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type FileFactsOptions, type GraphqlObjectFields, type GraphqlTypeNameConvention, type KeptRubyParses, type LibraryException, type MethodLookup, type ParameterBindings, type ProjectNodes, type Range, type RbAddressingCall, type RbArgumentPlace, type RbBodyBlock, type RbExpectations, type RbFactories, type RbFactoryBuilder, type RbFormatSwitch, type RbGraphqlNullability, type RbGraphqlTypeWrapper, type RbInflections, type RbJobClasses, type RbJobPattern, type RbMailers, type RbPredicateMatcher, type RbQueueDeclaration, type RbRawSqlPattern, type RbResolverHooks, type RbRowCall, type RbSharedInclude, type RbStatusCall, type RbStorageOptions, type RbStoragePattern, type RbTestCases, type RbTestClasses, type RbTestMocks, 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, children, collectFileConstants, createConstantFileCache, createFileCache, discoverUnits, emitConstantBindings, emitValueFacts, evaluatedValue, extractRubyProject, factsForFile, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, keptRubyParses, methodDefinitionsIn, methodInAncestry, nestedStatements, nodeId, parseRuby, parseRubyAhead, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, storageClaims, storageEffects, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, walkClasses, walkDefinitions };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Database } from '@suss/datalog';
|
|
2
2
|
import { Tree, Node } from 'web-tree-sitter';
|
|
3
3
|
export { Node as RbNode, Tree as RbTree } from 'web-tree-sitter';
|
|
4
|
-
import { TypeShape, RequestSpellingMetadata, Effect, BehavioralSummary } from '@suss/behavioral-ir';
|
|
4
|
+
import { MessageBusTechnology, TypeShape, RequestSpellingMetadata, Effect, BehavioralSummary } from '@suss/behavioral-ir';
|
|
5
5
|
import { DeclaredEntryPoint, RawCodeStructure, TimingReport, ExtractionReport, CacheDiagnostic, ExtractorOptions, DeclaredModule, KeptParses } from '@suss/extractor';
|
|
6
6
|
import { UnwrapsByName, WhyExplained } from '@suss/resolution';
|
|
7
7
|
import { Value } from '@suss/values';
|
|
@@ -397,12 +397,69 @@ interface RubyPack {
|
|
|
397
397
|
inflections?: RbInflections;
|
|
398
398
|
/** Methods the library offers that hand back the argument at `argument`, keyed on the module the callee comes from. */
|
|
399
399
|
transparentWrappers?: UnwrapsByName[];
|
|
400
|
+
/**
|
|
401
|
+
* Methods the library adds to every object, nil included, that hand
|
|
402
|
+
* back the receiver or nil when it is blank, such as ActiveSupport's
|
|
403
|
+
* `presence`. A read followed by one of these and `||` has a fallback.
|
|
404
|
+
*/
|
|
405
|
+
blankToNil?: string[];
|
|
400
406
|
/** How the library builds test records from named factories. */
|
|
401
407
|
factories?: RbFactories[];
|
|
402
408
|
/** How a class-based test runner declares tests, as Minitest does. */
|
|
403
409
|
testClasses?: RbTestClasses[];
|
|
404
410
|
/** How the library writes a test, so each one becomes a `test` unit a PRD scenario can list under `coveredBy`. */
|
|
405
411
|
tests?: RbTestCases[];
|
|
412
|
+
/** How the library runs a method later in a worker, and the calls that enqueue it. */
|
|
413
|
+
jobs?: RbJobPattern[];
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* A background job library. A job's method becomes a `consumer` unit on
|
|
417
|
+
* a message-bus channel, and a call that enqueues it becomes a message
|
|
418
|
+
* send to that channel. DESIGN.md says how the adapter reads each kind.
|
|
419
|
+
*/
|
|
420
|
+
type RbJobPattern = RbJobClasses | RbMailers;
|
|
421
|
+
/**
|
|
422
|
+
* Job classes with one method the worker runs, as ActiveJob and Sidekiq
|
|
423
|
+
* write them: `ReportJob.perform_later(id)` runs `ReportJob#perform(id)`.
|
|
424
|
+
* The channel is the class, with the queue the class declares in front.
|
|
425
|
+
*/
|
|
426
|
+
interface RbJobClasses {
|
|
427
|
+
type: "jobClasses";
|
|
428
|
+
messageBus: MessageBusTechnology;
|
|
429
|
+
/** Library bases a job class extends, as a project writes them: `ActiveJob::Base`. */
|
|
430
|
+
baseClasses: string[];
|
|
431
|
+
/** Library modules a job class includes: `Sidekiq::Job`. */
|
|
432
|
+
modules: string[];
|
|
433
|
+
/** The instance method the worker runs: `perform`. */
|
|
434
|
+
performMethod: string;
|
|
435
|
+
/** The class methods that enqueue a job, each with the position its first job argument is at: `perform_in` takes the delay first. */
|
|
436
|
+
enqueueMethods: Record<string, number>;
|
|
437
|
+
/** Class methods that return the job with options set, so an enqueue can be called on their result: `set`. */
|
|
438
|
+
optionMethods: string[];
|
|
439
|
+
/** The class-body calls that declare the job's queue. */
|
|
440
|
+
queueDeclarations: RbQueueDeclaration[];
|
|
441
|
+
}
|
|
442
|
+
/** A class-body call that declares a job's queue, and where it takes the queue. */
|
|
443
|
+
interface RbQueueDeclaration {
|
|
444
|
+
/** `queue_as`, or `sidekiq_options`. */
|
|
445
|
+
call: string;
|
|
446
|
+
/** Where the call takes the queue: positionally for `queue_as :exports`, or under a keyword for `sidekiq_options queue: "push"`. */
|
|
447
|
+
queue: RbArgumentPlace;
|
|
448
|
+
}
|
|
449
|
+
/**
|
|
450
|
+
* Mailers, as ActionMailer writes them: every public instance method is
|
|
451
|
+
* a message, and `UserMailer.welcome(user).deliver_later` enqueues
|
|
452
|
+
* `UserMailer#welcome(user)`. The channel is `UserMailer.welcome`.
|
|
453
|
+
*/
|
|
454
|
+
interface RbMailers {
|
|
455
|
+
type: "mailers";
|
|
456
|
+
messageBus: MessageBusTechnology;
|
|
457
|
+
/** Library bases a mailer extends: `ActionMailer::Base`. */
|
|
458
|
+
baseClasses: string[];
|
|
459
|
+
/** The calls on a built message that enqueue it: `deliver_later`. */
|
|
460
|
+
enqueueMethods: string[];
|
|
461
|
+
/** Class methods that return the mailer with parameters set, so the message can be built on their result: `with`. */
|
|
462
|
+
optionMethods: string[];
|
|
406
463
|
}
|
|
407
464
|
/**
|
|
408
465
|
* Tests written as nested blocks, the way RSpec writes them:
|
|
@@ -989,6 +1046,45 @@ interface RbResolverHooks {
|
|
|
989
1046
|
* payload in its place.
|
|
990
1047
|
*/
|
|
991
1048
|
answerIsListHead?: boolean;
|
|
1049
|
+
/**
|
|
1050
|
+
* The class the library raises when a hook listed here returns false
|
|
1051
|
+
* with no payload. A hook not listed makes the field resolve to null
|
|
1052
|
+
* instead. graphql-ruby raises for `authorized?` and returns null for
|
|
1053
|
+
* `ready?`.
|
|
1054
|
+
*/
|
|
1055
|
+
refusalRaises?: Record<string, string>;
|
|
1056
|
+
}
|
|
1057
|
+
/** How a library reads whether a field's value, or the items of a list it returns, can be null. */
|
|
1058
|
+
interface RbGraphqlNullability {
|
|
1059
|
+
/** The keyword on a field or type call, and inside a list type, that says whether the value can be null. */
|
|
1060
|
+
keyword: string;
|
|
1061
|
+
/** The class-level call a wired class makes to say whether the field it resolves can be null. */
|
|
1062
|
+
callName?: string;
|
|
1063
|
+
/** Whether a field can be null when nothing says. */
|
|
1064
|
+
nullableByDefault: boolean;
|
|
1065
|
+
/** Whether a list's items can be null when the list type does not say. */
|
|
1066
|
+
listItemsNullableByDefault: boolean;
|
|
1067
|
+
}
|
|
1068
|
+
/**
|
|
1069
|
+
* A type the library generates from another one when a method is called
|
|
1070
|
+
* on it, such as `CampaignType.connection_type`. In every name below,
|
|
1071
|
+
* `{type}` is replaced with the wrapped type's GraphQL name, and a ref
|
|
1072
|
+
* named `{type}` alone is the wrapped type.
|
|
1073
|
+
*/
|
|
1074
|
+
interface RbGraphqlTypeWrapper {
|
|
1075
|
+
/** The name of the type the field returns. */
|
|
1076
|
+
name: string;
|
|
1077
|
+
/** Each type the wrapper generates, by name, with its fields. */
|
|
1078
|
+
types: Record<string, Record<string, TypeShape>>;
|
|
1079
|
+
/**
|
|
1080
|
+
* Other types the method takes as keyword arguments, keyed by the ref
|
|
1081
|
+
* name in `types` that each one replaces, with the library type used
|
|
1082
|
+
* when the call passes none.
|
|
1083
|
+
*/
|
|
1084
|
+
typeArguments?: Record<string, {
|
|
1085
|
+
keyword: string;
|
|
1086
|
+
fallback: string;
|
|
1087
|
+
}>;
|
|
992
1088
|
}
|
|
993
1089
|
/** A class or module whose ancestry reaches one of `baseClassNames` declares GraphQL fields through DSL calls in its own body. */
|
|
994
1090
|
interface GraphqlObjectFields {
|
|
@@ -1006,6 +1102,18 @@ interface GraphqlObjectFields {
|
|
|
1006
1102
|
fieldCallName: string;
|
|
1007
1103
|
/** The DSL call declaring a referenced class's own return type. */
|
|
1008
1104
|
typeCallName: string;
|
|
1105
|
+
/** The keyword a field call can give its type under, in place of its second positional argument. */
|
|
1106
|
+
typeKeyword?: string;
|
|
1107
|
+
/** The class-level call that sets a type's GraphQL name, in place of the one `typeNameConvention` derives. */
|
|
1108
|
+
typeNameCallName?: string;
|
|
1109
|
+
/** How a field says its value can be null. Without it, a resolver's output says nothing about null. */
|
|
1110
|
+
nullability?: RbGraphqlNullability;
|
|
1111
|
+
/** Methods that, called on a type class, give a type the library generates from it, keyed by method name. */
|
|
1112
|
+
typeWrappers?: Record<string, RbGraphqlTypeWrapper>;
|
|
1113
|
+
/** Object types the library defines itself, which a generated type refers to, by name with their fields. */
|
|
1114
|
+
libraryTypes?: Record<string, Record<string, TypeShape>>;
|
|
1115
|
+
/** Classes whose instance, when a resolver returns one, the library reports as an error in place of the field's value. */
|
|
1116
|
+
returnedErrorClassNames?: string[];
|
|
1009
1117
|
argumentCallName: string;
|
|
1010
1118
|
/** Keywords whose value is a class to read the declared contract from, one hop away. They are tried in the order listed. */
|
|
1011
1119
|
wiringKeywords: string[];
|
|
@@ -1063,6 +1171,30 @@ interface EffectAt {
|
|
|
1063
1171
|
at: Node;
|
|
1064
1172
|
}
|
|
1065
1173
|
|
|
1174
|
+
/**
|
|
1175
|
+
* Background jobs: the method a worker runs later, and the calls that
|
|
1176
|
+
* enqueue it.
|
|
1177
|
+
*
|
|
1178
|
+
* A class whose ancestry reaches one of a job pattern's base classes, or
|
|
1179
|
+
* mixes in one of its modules, is a job. The method the worker runs
|
|
1180
|
+
* becomes a `consumer` unit bound to a message-bus channel, and a call
|
|
1181
|
+
* that enqueues the job becomes a `message-send` to that channel with the
|
|
1182
|
+
* job's arguments. Both sides decide whether a class is a job through the
|
|
1183
|
+
* same ancestry rules, so they agree on the channel. An enqueue whose job
|
|
1184
|
+
* the rules do not settle is recorded with no channel, and the summary
|
|
1185
|
+
* gets a gap for it. DESIGN.md has the spellings each kind reads.
|
|
1186
|
+
*/
|
|
1187
|
+
|
|
1188
|
+
/** One job pattern, with the pack that declared it, which its effects and units are recognized as. */
|
|
1189
|
+
interface RbJobDeclaration {
|
|
1190
|
+
readonly pattern: RbJobPattern;
|
|
1191
|
+
readonly recognition: string;
|
|
1192
|
+
}
|
|
1193
|
+
interface RbJobOptions {
|
|
1194
|
+
readonly facts: Database;
|
|
1195
|
+
readonly declarations: readonly RbJobDeclaration[];
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1066
1198
|
/**
|
|
1067
1199
|
* Finds the calls in a Ruby body that read or write the database.
|
|
1068
1200
|
*
|
|
@@ -1193,6 +1325,8 @@ interface BodyReadOptions {
|
|
|
1193
1325
|
readonly facts?: Database | undefined;
|
|
1194
1326
|
/** The storage patterns that decide whether a call reads or writes the database. Absent when no pack declares any. */
|
|
1195
1327
|
readonly storage?: RbStorageOptions | undefined;
|
|
1328
|
+
/** The job patterns that decide whether a call enqueues a background job. Absent when no pack declares any. */
|
|
1329
|
+
readonly jobs?: RbJobOptions | undefined;
|
|
1196
1330
|
/** The methods the run's packs declare their libraries define. Calls to them are left off an effect list. */
|
|
1197
1331
|
readonly inheritedMethods?: InheritedMethods | undefined;
|
|
1198
1332
|
/** The calls whose block the run's packs declare runs as part of the surrounding body. */
|
|
@@ -1518,9 +1652,9 @@ declare function rubyStubEvidence(options: RubyStubEvidenceOptions): Promise<Rub
|
|
|
1518
1652
|
/**
|
|
1519
1653
|
* Turns a Ruby DSL call's type argument into an IR type shape.
|
|
1520
1654
|
*
|
|
1521
|
-
*
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1655
|
+
* It reads a constant, a one-element array of one, or a wrapper method the
|
|
1656
|
+
* pack declares called on one. A lambda or any other call abstains rather
|
|
1657
|
+
* than guessing at what it evaluates to.
|
|
1524
1658
|
*/
|
|
1525
1659
|
|
|
1526
1660
|
interface TypeReadContext {
|
|
@@ -1531,6 +1665,8 @@ interface TypeReadContext {
|
|
|
1531
1665
|
scalars: Readonly<Record<string, TypeShape>>;
|
|
1532
1666
|
scalarNamePrefixes: readonly string[];
|
|
1533
1667
|
typeNameConvention: GraphqlTypeNameConvention;
|
|
1668
|
+
/** The methods that turn a type into one the library generates, with that type's name, as `{type}Connection`. */
|
|
1669
|
+
typeWrapperNames?: Readonly<Record<string, string>>;
|
|
1534
1670
|
}
|
|
1535
1671
|
/**
|
|
1536
1672
|
* Returns null when the type cannot be read, and the field then abstains.
|
|
@@ -1552,4 +1688,4 @@ declare function typeShapeFromNode(node: Node, ctx: TypeReadContext): TypeShape
|
|
|
1552
1688
|
*/
|
|
1553
1689
|
declare const ADAPTER_VERSION = "0.1.0";
|
|
1554
1690
|
|
|
1555
|
-
export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantFileCache, type ConstantPathConvention, type ControllerActions, type ControllerRoute, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type FileFactsOptions, type GraphqlObjectFields, type GraphqlTypeNameConvention, type KeptRubyParses, type LibraryException, type MethodLookup, type ParameterBindings, type ProjectNodes, type Range, type RbAddressingCall, type RbArgumentPlace, type RbBodyBlock, type RbExpectations, type RbFactories, type RbFactoryBuilder, type RbFormatSwitch, type RbInflections, type RbPredicateMatcher, type RbRawSqlPattern, type RbResolverHooks, type RbRowCall, type RbSharedInclude, type RbStatusCall, type RbStorageOptions, type RbStoragePattern, type RbTestCases, type RbTestClasses, type RbTestMocks, 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, children, collectFileConstants, createConstantFileCache, createFileCache, discoverUnits, emitConstantBindings, emitValueFacts, evaluatedValue, extractRubyProject, factsForFile, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, keptRubyParses, methodDefinitionsIn, methodInAncestry, nestedStatements, nodeId, parseRuby, parseRubyAhead, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, storageClaims, storageEffects, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, walkClasses, walkDefinitions };
|
|
1691
|
+
export { ADAPTER_VERSION, type AncestorEntry, type AncestorLookup, type Ancestry, type CallArgs, type ClassInfo, type ConstantFileCache, type ConstantPathConvention, type ControllerActions, type ControllerRoute, type DiscoveryOptions, type EvaluatedFile, type ExtractRubyOptions, type ExtractRubyResult, type FileCache, type FileConstants, type FileFactsOptions, type GraphqlObjectFields, type GraphqlTypeNameConvention, type KeptRubyParses, type LibraryException, type MethodLookup, type ParameterBindings, type ProjectNodes, type Range, type RbAddressingCall, type RbArgumentPlace, type RbBodyBlock, type RbExpectations, type RbFactories, type RbFactoryBuilder, type RbFormatSwitch, type RbGraphqlNullability, type RbGraphqlTypeWrapper, type RbInflections, type RbJobClasses, type RbJobPattern, type RbMailers, type RbPredicateMatcher, type RbQueueDeclaration, type RbRawSqlPattern, type RbResolverHooks, type RbRowCall, type RbSharedInclude, type RbStatusCall, type RbStorageOptions, type RbStoragePattern, type RbTestCases, type RbTestClasses, type RbTestMocks, 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, children, collectFileConstants, createConstantFileCache, createFileCache, discoverUnits, emitConstantBindings, emitValueFacts, evaluatedValue, extractRubyProject, factsForFile, field, findRubyFiles, graphqlTypeNameFromQualified, hashKeySymbolName, inheritedStatements, keptRubyParses, methodDefinitionsIn, methodInAncestry, nestedStatements, nodeId, parseRuby, parseRubyAhead, parseRubySync, preloadRubyGrammar, qualifyConstantRef, reachDefinition, readCallArgs, readKey, resolveConstantFile, rubyStubEvidence, runStatements, storageClaims, storageEffects, stringLiteralValue, stringValueOf, symbolValue, typeShapeFromNode, underscoreConstantPath, walkClasses, walkDefinitions };
|