@suss/adapter-python 0.34.1 → 0.35.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
@@ -1075,6 +1075,16 @@ interface Registered {
1075
1075
  reference: WrapperReference;
1076
1076
  form: PyWrapperForm;
1077
1077
  }
1078
+ /**
1079
+ * The closure a project's decorator hands back, read with the route's
1080
+ * pattern. It runs the route's function where it calls the decorator's
1081
+ * parameter, `continuation`. No pack declares it, so it has no form.
1082
+ */
1083
+ interface DecoratorClosure {
1084
+ pack: PythonPack;
1085
+ pattern: PythonDiscoveryPattern;
1086
+ continuation: string;
1087
+ }
1078
1088
  /** A wrapper form with the pattern and pack that declare it. */
1079
1089
  interface FormOf {
1080
1090
  pack: PythonPack;
@@ -1095,8 +1105,11 @@ declare class PythonWrapperIndex {
1095
1105
  /** By wrapper reference: the parameters a dependency function declares, and its file. */
1096
1106
  private readonly dependencyParameterTable;
1097
1107
  private readonly unitsByFile;
1098
- /** Told about every registration, so a cache can repeat the ones a file's discovery made. */
1099
- onRegistered: ((target: ReachedFunction, declared: FormOf) => void) | null;
1108
+ /**
1109
+ * Told about every registration, a pack's form or a project decorator's
1110
+ * closure, so a cache can repeat the ones a file's discovery made.
1111
+ */
1112
+ onRegistered: ((target: ReachedFunction, how: FormOf | DecoratorClosure) => void) | null;
1100
1113
  constructor(options: WrapperIndexOptions, filesByPath: ReadonlyMap<string, BoundPythonFile>);
1101
1114
  /**
1102
1115
  * The same lookup `wrappersFor` noted under `id`, made again over this
@@ -1115,6 +1128,13 @@ declare class PythonWrapperIndex {
1115
1128
  }, target: ReachedFunction, declared: FormOf): void;
1116
1129
  /** The unit for a function, built once however many registrations point at it. */
1117
1130
  registered(target: ReachedFunction, declared: FormOf): Registered;
1131
+ /**
1132
+ * The unit for the closure a project's decorator hands back, built once
1133
+ * however many routes the decorator is written on. Its name is what
1134
+ * calling the decorator writes, since the decorator may have a summary
1135
+ * of its own under its name.
1136
+ */
1137
+ registeredClosure(target: ReachedFunction, closure: DecoratorClosure): WrapperReference;
1118
1138
  /**
1119
1139
  * The parameters the dependencies among these wrappers declare, and
1120
1140
  * whether one is declared through a parameter source such as `Query()`.
@@ -1126,6 +1146,26 @@ declare class PythonWrapperIndex {
1126
1146
  declaresSource: boolean;
1127
1147
  };
1128
1148
  wrappersFor(query: RouteWrapperQuery): WrapperReference[];
1149
+ /**
1150
+ * The decorators written on the route's function below the one that
1151
+ * registers it, outermost first. Each wraps the function the library
1152
+ * calls. None has a summary: a library's has no body in the run, and a
1153
+ * project's own is not composed into the route yet, so a project
1154
+ * decorator goes by what calling it writes, `require_admin(fn)`, which
1155
+ * no summary is named. The decorators the packs read, such as the
1156
+ * route's own and the namespace's `@ns.doc`, are left out.
1157
+ */
1158
+ private decoratorLayers;
1159
+ private decoratorLayer;
1160
+ /**
1161
+ * The layer a project's own decorator puts around the route. When it
1162
+ * hands back a closure written inside it that returns what calling the
1163
+ * function it was given returns, the closure is summarized and
1164
+ * composed into the route. Any other decorator, including one whose
1165
+ * closure keeps going after that call, goes by the same name with no
1166
+ * summary behind it.
1167
+ */
1168
+ private projectDecoratorLayer;
1129
1169
  /**
1130
1170
  * What the mounts above the route's router register on the way down:
1131
1171
  * the dependencies an `include_router` call lists, and those of each
@@ -1389,7 +1429,7 @@ interface ExtractPythonOptions {
1389
1429
  onExtractionReport?: (report: ExtractionReport) => void;
1390
1430
  /** Called once with what the cache decided, for `suss extract --timing`. */
1391
1431
  onCacheDiagnostic?: (diagnostic: CacheDiagnostic) => void;
1392
- /** Absolute. `<projectRoot>/.suss/cache` by default; `null` turns it off. */
1432
+ /** Absolute. `<projectRoot>/.suss/cache` by default, or under `SUSS_CACHE_DIR`; `null` turns it off. */
1393
1433
  cacheDir?: string | null;
1394
1434
  /** The modules the project lists in `suss.json`, with absolute paths. */
1395
1435
  modules?: readonly DeclaredModule[];
package/dist/index.d.ts CHANGED
@@ -1075,6 +1075,16 @@ interface Registered {
1075
1075
  reference: WrapperReference;
1076
1076
  form: PyWrapperForm;
1077
1077
  }
1078
+ /**
1079
+ * The closure a project's decorator hands back, read with the route's
1080
+ * pattern. It runs the route's function where it calls the decorator's
1081
+ * parameter, `continuation`. No pack declares it, so it has no form.
1082
+ */
1083
+ interface DecoratorClosure {
1084
+ pack: PythonPack;
1085
+ pattern: PythonDiscoveryPattern;
1086
+ continuation: string;
1087
+ }
1078
1088
  /** A wrapper form with the pattern and pack that declare it. */
1079
1089
  interface FormOf {
1080
1090
  pack: PythonPack;
@@ -1095,8 +1105,11 @@ declare class PythonWrapperIndex {
1095
1105
  /** By wrapper reference: the parameters a dependency function declares, and its file. */
1096
1106
  private readonly dependencyParameterTable;
1097
1107
  private readonly unitsByFile;
1098
- /** Told about every registration, so a cache can repeat the ones a file's discovery made. */
1099
- onRegistered: ((target: ReachedFunction, declared: FormOf) => void) | null;
1108
+ /**
1109
+ * Told about every registration, a pack's form or a project decorator's
1110
+ * closure, so a cache can repeat the ones a file's discovery made.
1111
+ */
1112
+ onRegistered: ((target: ReachedFunction, how: FormOf | DecoratorClosure) => void) | null;
1100
1113
  constructor(options: WrapperIndexOptions, filesByPath: ReadonlyMap<string, BoundPythonFile>);
1101
1114
  /**
1102
1115
  * The same lookup `wrappersFor` noted under `id`, made again over this
@@ -1115,6 +1128,13 @@ declare class PythonWrapperIndex {
1115
1128
  }, target: ReachedFunction, declared: FormOf): void;
1116
1129
  /** The unit for a function, built once however many registrations point at it. */
1117
1130
  registered(target: ReachedFunction, declared: FormOf): Registered;
1131
+ /**
1132
+ * The unit for the closure a project's decorator hands back, built once
1133
+ * however many routes the decorator is written on. Its name is what
1134
+ * calling the decorator writes, since the decorator may have a summary
1135
+ * of its own under its name.
1136
+ */
1137
+ registeredClosure(target: ReachedFunction, closure: DecoratorClosure): WrapperReference;
1118
1138
  /**
1119
1139
  * The parameters the dependencies among these wrappers declare, and
1120
1140
  * whether one is declared through a parameter source such as `Query()`.
@@ -1126,6 +1146,26 @@ declare class PythonWrapperIndex {
1126
1146
  declaresSource: boolean;
1127
1147
  };
1128
1148
  wrappersFor(query: RouteWrapperQuery): WrapperReference[];
1149
+ /**
1150
+ * The decorators written on the route's function below the one that
1151
+ * registers it, outermost first. Each wraps the function the library
1152
+ * calls. None has a summary: a library's has no body in the run, and a
1153
+ * project's own is not composed into the route yet, so a project
1154
+ * decorator goes by what calling it writes, `require_admin(fn)`, which
1155
+ * no summary is named. The decorators the packs read, such as the
1156
+ * route's own and the namespace's `@ns.doc`, are left out.
1157
+ */
1158
+ private decoratorLayers;
1159
+ private decoratorLayer;
1160
+ /**
1161
+ * The layer a project's own decorator puts around the route. When it
1162
+ * hands back a closure written inside it that returns what calling the
1163
+ * function it was given returns, the closure is summarized and
1164
+ * composed into the route. Any other decorator, including one whose
1165
+ * closure keeps going after that call, goes by the same name with no
1166
+ * summary behind it.
1167
+ */
1168
+ private projectDecoratorLayer;
1129
1169
  /**
1130
1170
  * What the mounts above the route's router register on the way down:
1131
1171
  * the dependencies an `include_router` call lists, and those of each
@@ -1389,7 +1429,7 @@ interface ExtractPythonOptions {
1389
1429
  onExtractionReport?: (report: ExtractionReport) => void;
1390
1430
  /** Called once with what the cache decided, for `suss extract --timing`. */
1391
1431
  onCacheDiagnostic?: (diagnostic: CacheDiagnostic) => void;
1392
- /** Absolute. `<projectRoot>/.suss/cache` by default; `null` turns it off. */
1432
+ /** Absolute. `<projectRoot>/.suss/cache` by default, or under `SUSS_CACHE_DIR`; `null` turns it off. */
1393
1433
  cacheDir?: string | null;
1394
1434
  /** The modules the project lists in `suss.json`, with absolute paths. */
1395
1435
  modules?: readonly DeclaredModule[];