@suss/adapter-python 0.22.1 → 0.22.3

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
@@ -125,7 +125,11 @@ interface Range {
125
125
  end: number;
126
126
  }
127
127
 
128
- type DecoratorArg = {
128
+ /** An argument as written, plus its node so a reader can evaluate what it comes down to. */
129
+ type DecoratorArg = DecoratorArgShape & {
130
+ readonly node: Node;
131
+ };
132
+ type DecoratorArgShape = {
129
133
  kind: "string";
130
134
  value: string;
131
135
  } | {
@@ -243,6 +247,20 @@ interface StoragePattern {
243
247
  queryTypes: string[];
244
248
  /** Chain-ending methods that change what is stored. Anything else reads. */
245
249
  writes: string[];
250
+ /**
251
+ * Methods on a query type that touch no rows of their own: one that runs
252
+ * a statement built elsewhere, `session.execute(stmt)`, whose own chain
253
+ * already records the work, and one that manages the session, `close`.
254
+ * A call to one of these records nothing.
255
+ */
256
+ recordsNothing?: string[];
257
+ /**
258
+ * Methods whose keywords supply column values rather than pick rows,
259
+ * `values` in `update(User).where(id=1).values(name="x")`. Their
260
+ * keywords are reported as fields; every other call's keywords are the
261
+ * selector.
262
+ */
263
+ valueMethods?: string[];
246
264
  /**
247
265
  * Functions the library exports that start a query on their own, for the
248
266
  * case where a call site imports one rather than reaching it through a
@@ -297,9 +315,32 @@ interface RouteConventions {
297
315
  * that sets its own status would be reported at the default.
298
316
  */
299
317
  statusFromReturnedTuple?: boolean;
318
+ /**
319
+ * The library's own callables that end the request with a status, such
320
+ * as FastAPI's `HTTPException` and Flask's `abort`. Declaring them is
321
+ * also what makes a `raise` in a route body an outcome of its own: a
322
+ * raise the list does not cover comes out as a throw with no status,
323
+ * and one it does cover comes out as the response the library sends.
324
+ */
325
+ responseStatusCalls?: PyStatusCall[];
300
326
  /** Unset means the library has no router mounting, and a route's decorator path stands as written. */
301
327
  routerComposition?: RouterComposition;
302
328
  }
329
+ /**
330
+ * One callable that ends the request, and where it takes the status.
331
+ * A call may take it either way, so a pattern may state both, and the
332
+ * keyword wins where an argument is written both ways.
333
+ */
334
+ interface PyStatusCall {
335
+ /** The callee as the file imports it, module and name together, `fastapi.HTTPException`. */
336
+ callee: string;
337
+ /** The keyword whose value gives the status, FastAPI's `status_code`. */
338
+ statusKeyword?: string;
339
+ /** The index of the positional argument giving the status, 0 for `abort(404)`. */
340
+ statusArgument?: number;
341
+ /** What the library sends when the call states no status of its own. */
342
+ defaultStatusCode?: number;
343
+ }
303
344
  /**
304
345
  * A class has a decorator whose first string-literal argument is the route path,
305
346
  * and each method in its body named after an HTTP verb becomes its own unit,
@@ -745,4 +786,4 @@ declare function pythonImportEvidence(options: PythonImportEvidenceOptions): Pro
745
786
  */
746
787
  declare const ADAPTER_VERSION = "0.1.0";
747
788
 
748
- export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type PathRepeatedSlashes, type PrefixTrailingSlash, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type StoragePattern, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitEntryFact, emitModuleImportFacts, emitValueFacts, extractPythonProject, findPythonFiles, nodeId, objectReturnedBy, parsePython, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, readKey, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, unitKey };
789
+ export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type PathRepeatedSlashes, type PrefixTrailingSlash, type PyStatusCall, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type StoragePattern, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitEntryFact, emitModuleImportFacts, emitValueFacts, extractPythonProject, findPythonFiles, nodeId, objectReturnedBy, parsePython, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, readKey, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, unitKey };
package/dist/index.d.ts CHANGED
@@ -125,7 +125,11 @@ interface Range {
125
125
  end: number;
126
126
  }
127
127
 
128
- type DecoratorArg = {
128
+ /** An argument as written, plus its node so a reader can evaluate what it comes down to. */
129
+ type DecoratorArg = DecoratorArgShape & {
130
+ readonly node: Node;
131
+ };
132
+ type DecoratorArgShape = {
129
133
  kind: "string";
130
134
  value: string;
131
135
  } | {
@@ -243,6 +247,20 @@ interface StoragePattern {
243
247
  queryTypes: string[];
244
248
  /** Chain-ending methods that change what is stored. Anything else reads. */
245
249
  writes: string[];
250
+ /**
251
+ * Methods on a query type that touch no rows of their own: one that runs
252
+ * a statement built elsewhere, `session.execute(stmt)`, whose own chain
253
+ * already records the work, and one that manages the session, `close`.
254
+ * A call to one of these records nothing.
255
+ */
256
+ recordsNothing?: string[];
257
+ /**
258
+ * Methods whose keywords supply column values rather than pick rows,
259
+ * `values` in `update(User).where(id=1).values(name="x")`. Their
260
+ * keywords are reported as fields; every other call's keywords are the
261
+ * selector.
262
+ */
263
+ valueMethods?: string[];
246
264
  /**
247
265
  * Functions the library exports that start a query on their own, for the
248
266
  * case where a call site imports one rather than reaching it through a
@@ -297,9 +315,32 @@ interface RouteConventions {
297
315
  * that sets its own status would be reported at the default.
298
316
  */
299
317
  statusFromReturnedTuple?: boolean;
318
+ /**
319
+ * The library's own callables that end the request with a status, such
320
+ * as FastAPI's `HTTPException` and Flask's `abort`. Declaring them is
321
+ * also what makes a `raise` in a route body an outcome of its own: a
322
+ * raise the list does not cover comes out as a throw with no status,
323
+ * and one it does cover comes out as the response the library sends.
324
+ */
325
+ responseStatusCalls?: PyStatusCall[];
300
326
  /** Unset means the library has no router mounting, and a route's decorator path stands as written. */
301
327
  routerComposition?: RouterComposition;
302
328
  }
329
+ /**
330
+ * One callable that ends the request, and where it takes the status.
331
+ * A call may take it either way, so a pattern may state both, and the
332
+ * keyword wins where an argument is written both ways.
333
+ */
334
+ interface PyStatusCall {
335
+ /** The callee as the file imports it, module and name together, `fastapi.HTTPException`. */
336
+ callee: string;
337
+ /** The keyword whose value gives the status, FastAPI's `status_code`. */
338
+ statusKeyword?: string;
339
+ /** The index of the positional argument giving the status, 0 for `abort(404)`. */
340
+ statusArgument?: number;
341
+ /** What the library sends when the call states no status of its own. */
342
+ defaultStatusCode?: number;
343
+ }
303
344
  /**
304
345
  * A class has a decorator whose first string-literal argument is the route path,
305
346
  * and each method in its body named after an HTTP verb becomes its own unit,
@@ -745,4 +786,4 @@ declare function pythonImportEvidence(options: PythonImportEvidenceOptions): Pro
745
786
  */
746
787
  declare const ADAPTER_VERSION = "0.1.0";
747
788
 
748
- export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type PathRepeatedSlashes, type PrefixTrailingSlash, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type StoragePattern, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitEntryFact, emitModuleImportFacts, emitValueFacts, extractPythonProject, findPythonFiles, nodeId, objectReturnedBy, parsePython, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, readKey, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, unitKey };
789
+ export { ADAPTER_VERSION, type AnnotationContext, type Binding, type BoundPythonFile, type DecoratedClassRoute, type DecoratedFunctionRoute, type DecoratorArg, type DecoratorClassification, type DiscoveryOptions, type ExtractPythonOptions, type ExtractPythonResult, type ModuleBinding, type ModuleResolution, type ModuleResolverOptions, type MountObjectCarrier, type MountObjectPrefix, type MountPrefixEffect, type NoValuePrefix, type PathRepeatedSlashes, type PrefixTrailingSlash, type PyStatusCall, type PythonDiscoveryPattern, type PythonImportEvidence, type PythonImportEvidenceOptions, type PythonImportSite, type PythonPack, type PythonValueHandle, PythonWhySession, type PythonWhySessionOptions, type RawSqlPattern, type RelativeModuleSpec, type RouteConventions, type RoutePrefixResolution, type RouterComposition, type RouterIndex, type Scope, type ScopeKind, type StoragePattern, annotationToShape, bindModule, buildRouterIndex, classifyDecorator, containedValues, discoverUnits, emitEntryFact, emitModuleImportFacts, emitValueFacts, extractPythonProject, findPythonFiles, nodeId, objectReturnedBy, parsePython, parsePythonSync, preloadPythonGrammar, pythonImportEvidence, readKey, resolveAbsoluteModule, resolveCalls, resolveModule, resolveName, resolveRelativeModule, shapeFromName, unitKey };