@selvajs/server 1.0.0-beta.9 → 1.0.1

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.
Files changed (91) hide show
  1. package/README.md +18 -20
  2. package/dist/access/project-access-input.d.ts +13 -16
  3. package/dist/access/project-access-input.d.ts.map +1 -1
  4. package/dist/access/project-access-input.js +2 -2
  5. package/dist/access/project-access-input.js.map +1 -1
  6. package/dist/compute/idempotency.d.ts +18 -22
  7. package/dist/compute/idempotency.d.ts.map +1 -1
  8. package/dist/compute/idempotency.js +10 -14
  9. package/dist/compute/idempotency.js.map +1 -1
  10. package/dist/compute/index.d.ts.map +1 -1
  11. package/dist/compute/index.js +3 -5
  12. package/dist/compute/index.js.map +1 -1
  13. package/dist/compute/limits.d.ts +70 -86
  14. package/dist/compute/limits.d.ts.map +1 -1
  15. package/dist/compute/limits.js +27 -56
  16. package/dist/compute/limits.js.map +1 -1
  17. package/dist/compute/rate-limit.d.ts +41 -53
  18. package/dist/compute/rate-limit.d.ts.map +1 -1
  19. package/dist/compute/rate-limit.js +27 -35
  20. package/dist/compute/rate-limit.js.map +1 -1
  21. package/dist/compute/remote-definition.d.ts +8 -22
  22. package/dist/compute/remote-definition.d.ts.map +1 -1
  23. package/dist/compute/remote-definition.js +9 -19
  24. package/dist/compute/remote-definition.js.map +1 -1
  25. package/dist/compute/safe-url.d.ts +7 -5
  26. package/dist/compute/safe-url.d.ts.map +1 -1
  27. package/dist/compute/safe-url.js +26 -28
  28. package/dist/compute/safe-url.js.map +1 -1
  29. package/dist/definitions/definition-service.d.ts +13 -38
  30. package/dist/definitions/definition-service.d.ts.map +1 -1
  31. package/dist/definitions/definition-service.js +25 -53
  32. package/dist/definitions/definition-service.js.map +1 -1
  33. package/dist/definitions/index.d.ts +2 -2
  34. package/dist/definitions/index.d.ts.map +1 -1
  35. package/dist/definitions/index.js +1 -5
  36. package/dist/definitions/index.js.map +1 -1
  37. package/dist/definitions/load-for-render.d.ts +23 -20
  38. package/dist/definitions/load-for-render.d.ts.map +1 -1
  39. package/dist/definitions/load-for-render.js +55 -41
  40. package/dist/definitions/load-for-render.js.map +1 -1
  41. package/dist/definitions/schema-extraction.d.ts +36 -16
  42. package/dist/definitions/schema-extraction.d.ts.map +1 -1
  43. package/dist/definitions/schema-extraction.js +65 -28
  44. package/dist/definitions/schema-extraction.js.map +1 -1
  45. package/dist/errors/SentryErrorReporter.d.ts +2 -3
  46. package/dist/errors/SentryErrorReporter.d.ts.map +1 -1
  47. package/dist/errors/SentryErrorReporter.js +10 -14
  48. package/dist/errors/SentryErrorReporter.js.map +1 -1
  49. package/dist/http/body-size.d.ts +8 -11
  50. package/dist/http/body-size.d.ts.map +1 -1
  51. package/dist/http/body-size.js +8 -11
  52. package/dist/http/body-size.js.map +1 -1
  53. package/dist/http/redirect.d.ts +3 -7
  54. package/dist/http/redirect.d.ts.map +1 -1
  55. package/dist/http/redirect.js +8 -8
  56. package/dist/http/redirect.js.map +1 -1
  57. package/dist/http/route-classifier.d.ts +20 -24
  58. package/dist/http/route-classifier.d.ts.map +1 -1
  59. package/dist/http/route-classifier.js +6 -7
  60. package/dist/http/route-classifier.js.map +1 -1
  61. package/dist/http/security-headers.d.ts +13 -15
  62. package/dist/http/security-headers.d.ts.map +1 -1
  63. package/dist/http/security-headers.js +10 -12
  64. package/dist/http/security-headers.js.map +1 -1
  65. package/dist/logging/PinoLogger.d.ts +8 -14
  66. package/dist/logging/PinoLogger.d.ts.map +1 -1
  67. package/dist/logging/PinoLogger.js +29 -35
  68. package/dist/logging/PinoLogger.js.map +1 -1
  69. package/dist/logging/requestId.d.ts +20 -28
  70. package/dist/logging/requestId.d.ts.map +1 -1
  71. package/dist/logging/requestId.js +29 -37
  72. package/dist/logging/requestId.js.map +1 -1
  73. package/dist/ops/index.d.ts.map +1 -1
  74. package/dist/ops/index.js +2 -1
  75. package/dist/ops/index.js.map +1 -1
  76. package/dist/ops/semver.d.ts +22 -24
  77. package/dist/ops/semver.d.ts.map +1 -1
  78. package/dist/ops/semver.js +22 -25
  79. package/dist/ops/semver.js.map +1 -1
  80. package/dist/providers/create-selva-providers.d.ts +19 -27
  81. package/dist/providers/create-selva-providers.d.ts.map +1 -1
  82. package/dist/providers/create-selva-providers.js +28 -34
  83. package/dist/providers/create-selva-providers.js.map +1 -1
  84. package/dist/providers/index.d.ts.map +1 -1
  85. package/dist/providers/index.js +2 -4
  86. package/dist/providers/index.js.map +1 -1
  87. package/dist/tokens/token-codec.d.ts +24 -27
  88. package/dist/tokens/token-codec.d.ts.map +1 -1
  89. package/dist/tokens/token-codec.js +18 -21
  90. package/dist/tokens/token-codec.js.map +1 -1
  91. package/package.json +5 -5
@@ -1,14 +1,12 @@
1
- // Loader for "given a definition record, produce everything the client needs to
2
- // render its form and solve it": version resolution, blob fetch, compute-server
3
- // resolution, schema fetch (with the ADR 0005 staleness check), default merging.
1
+ // Given a definition record, produces everything the client needs to render its
2
+ // form and solve it.
4
3
  //
5
- // Access gating is intentionally NOT done here — the calling route decides
6
- // whether `ctx` is allowed to load this definition, since gates differ across
7
- // routes (project membership, segment ownership, share-token, admin override).
4
+ // Access gating is deliberately NOT done here — the calling route decides
5
+ // whether `ctx` may load this definition, since gates differ across routes
6
+ // (project membership, segment ownership, share-token, admin override).
8
7
  //
9
- // Everything stateful is injected (`DefinitionLoaderDeps`): stores, server
10
- // resolution, the warm-client cache, and the schema fetcher — so any app built
11
- // on the engine can wire its own composition root.
8
+ // Everything stateful is injected, so any app on the engine can wire its own
9
+ // composition root.
12
10
  import { UI_SCHEMA_VERSION } from '@selvajs/schemas';
13
11
  import { NoopLogger } from '@selvajs/platform';
14
12
  import { fetchSchemaFromCompute } from './schema-extraction.js';
@@ -23,18 +21,13 @@ export class DefinitionLoadError extends Error {
23
21
  }
24
22
  }
25
23
  /**
26
- * Build a definition loader over the injected stores/compute wiring.
27
- *
28
- * The returned function loads a definition's version blob + schema (with
29
- * merged compute defaults). By default it resolves the `channel` pointer
30
- * (live/draft); pass `explicitVersionId` to render an arbitrary historical
31
- * version instead — the caller must gate that behind edit permission
32
- * (editor-only, like the draft channel). Throws `DefinitionLoadError` for
33
- * classified failures so the caller can translate to HTTP status codes.
24
+ * The returned loader resolves the `channel` pointer (live/draft) by default.
25
+ * `explicitVersionId` renders an arbitrary historical version instead — the
26
+ * caller MUST gate that behind edit permission, as with the draft channel.
34
27
  */
35
28
  export function createDefinitionLoader(deps) {
36
29
  const { storage, definitions, projects, resolveServer, getClient, fetchSchema = fetchSchemaFromCompute, computeDebug = false, onWarn, logger = new NoopLogger() } = deps;
37
- return async function loadDefinitionForRender(ctx, record, channel, explicitVersionId) {
30
+ return async function loadDefinitionForRender(ctx, record, channel, explicitVersionId, options) {
38
31
  const versionId = explicitVersionId ?? (channel === 'draft' ? record.draftVersionId : record.liveVersionId);
39
32
  if (!versionId)
40
33
  throw new DefinitionLoadError('data', `Definition '${record.guid}' has no ${channel} version`);
@@ -57,6 +50,15 @@ export function createDefinitionLoader(deps) {
57
50
  catch (err) {
58
51
  throw new DefinitionLoadError('missing-config', 'No compute server configured for this definition', err);
59
52
  }
53
+ // Returning before `getClient` is the point — the connect is the cost, not
54
+ // the `getIO` it carries. A missing or stale-format cache falls through to
55
+ // the full path below, so the result is always a valid schema.
56
+ if (options?.skipComputeDefaults) {
57
+ const cachedSchema = version.schema;
58
+ if (cachedSchema && isUsableCachedSchema(cachedSchema)) {
59
+ return { version, definitionSource, computeServer, schema: cachedSchema };
60
+ }
61
+ }
60
62
  // Only the client is used here (getIO); the entry's solve scheduler rides
61
63
  // along unused.
62
64
  let client;
@@ -68,24 +70,21 @@ export function createDefinitionLoader(deps) {
68
70
  throw new DefinitionLoadError('connect', `Failed to connect to Rhino Compute server: ${message}`, err);
69
71
  }
70
72
  try {
71
- // Prefer the schema cached on the version row (extracted + validated at
72
- // upload) — but ONLY when its format version matches the app's. The
73
- // stored schema is a disposable cache (ADR 0005): on a version mismatch
74
- // (or a pre-caching row with no schema at all) re-extract from compute,
75
- // whose C# SchemaMigrator emits the current format — the web side never
76
- // migrates schemas itself. `getIO` is always needed to merge compute
77
- // default values into the schema, cached or not.
73
+ // The stored schema is a disposable cache, used ONLY when its format
74
+ // version matches the app's. On a mismatch (or a pre-caching row with no
75
+ // schema) re-extract from compute, whose C# SchemaMigrator emits the
76
+ // current format — the web side never migrates schemas itself. `getIO`
77
+ // runs either way, to merge compute default values in.
78
78
  const cachedSchema = version.schema;
79
- const freshCache = cachedSchema && cachedSchema.schemaVersion === UI_SCHEMA_VERSION ? cachedSchema : null;
79
+ const freshCache = cachedSchema && isUsableCachedSchema(cachedSchema) ? cachedSchema : null;
80
80
  const [definition, fetchedSchema] = await Promise.all([
81
81
  client.getIO(definitionSource),
82
82
  freshCache ? Promise.resolve(freshCache) : fetchSchema(definitionSource, computeServer)
83
83
  ]);
84
- // Persist the refreshed schema back onto the version row (best-effort —
85
- // a viewer context may lack write access; the next editor render or the
86
- // solve-time backfill will land it). Only when the re-extracted schema
87
- // is at the app's current version: persisting an older format (compute
88
- // plugin behind the app) would just go stale again next render.
84
+ // Best-effort — a viewer context may lack write access, and the next
85
+ // editor render or the solve-time backfill will land it. Guarded on the
86
+ // current version because persisting an older format (compute plugin
87
+ // behind the app) would just go stale again next render.
89
88
  if (!freshCache && fetchedSchema.schemaVersion === UI_SCHEMA_VERSION) {
90
89
  definitions.setVersionSchema(ctx, version.id, fetchedSchema).catch((err) => {
91
90
  if (onWarn) {
@@ -103,13 +102,12 @@ export function createDefinitionLoader(deps) {
103
102
  if (!definition) {
104
103
  throw new Error(`Failed to get definition IO — server returned undefined`);
105
104
  }
106
- // Surface IO health when something looks off: zero inputs, or the compute
107
- // layer reported parse/load problems (e.g. an empty ValueList because its
108
- // backing GH component didn't resolve → "Missing Definition Objects", or a
109
- // PascalCase /io response the parser silently dropped to []). On a problem
110
- // we also fetch the raw IO so the un-parsed wire shape is in the logs.
111
- // Always-on warn (cheap, only fires on the unhappy path); the verbose raw
112
- // dump is gated on `computeDebug`.
105
+ // Zero inputs or reported parse/load problems mean a definition that will
106
+ // render wrong without saying why: an empty ValueList whose backing GH
107
+ // component didn't resolve ("Missing Definition Objects"), or a PascalCase
108
+ // /io response the parser silently dropped to []. Warning is always on —
109
+ // it only fires on the unhappy path — while the raw wire dump costs an
110
+ // extra round-trip and stays behind `computeDebug`.
113
111
  const ioParseErrors = definition.parseErrors ?? [];
114
112
  const ioLoadErrors = definition.loadErrors ?? [];
115
113
  const ioLooksBroken = definition.inputs.length === 0 || ioParseErrors.length > 0 || ioLoadErrors.length > 0;
@@ -161,10 +159,26 @@ export function createDefinitionLoader(deps) {
161
159
  }
162
160
  };
163
161
  }
164
- // Merge default values from Compute definition into schema inputs.
165
- // Colors come back as "r,g,b" or "a,r,g,b" strings — convert to hex so the
166
- // color picker can consume them directly.
162
+ /**
163
+ * A cached schema is usable only if it is BOTH the current format version and
164
+ * structurally sound. The version check alone is not enough: a compute server
165
+ * that serialized the schema with the wrong Newtonsoft emits PascalCase keys, so
166
+ * `schemaVersion` reads as undefined while `SchemaVersion` holds the value —
167
+ * and a row cached during that window would otherwise be served forever, long
168
+ * after the server was fixed. See `assertCamelCaseSchema`.
169
+ */
170
+ function isUsableCachedSchema(schema) {
171
+ return schema.schemaVersion === UI_SCHEMA_VERSION && Array.isArray(schema.inputs);
172
+ }
173
+ // Colors come back from Compute as "r,g,b" or "a,r,g,b" strings — converted to
174
+ // hex here so the color picker can consume them directly.
167
175
  function mergeComputeDefaults(schema, computeInputs) {
176
+ if (!Array.isArray(schema.inputs)) {
177
+ throw new DefinitionLoadError('schema', `Schema has no 'inputs' array (keys: ${Object.keys(schema)
178
+ .slice(0, 12)
179
+ .join(', ')}). A PascalCase shape here means compute serialized it with the wrong ` +
180
+ `Newtonsoft — see assertCamelCaseSchema.`);
181
+ }
168
182
  const byParamId = new Map(computeInputs.map((input) => [input.id, input]));
169
183
  return {
170
184
  ...schema,
@@ -1 +1 @@
1
- {"version":3,"file":"load-for-render.js","sourceRoot":"","sources":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,CAAC,CAAC,EAAE,CAAC;gBAClF,CAAC;YACF,CAAC;YAED,IAAI,YAAY,IAAI,YAAY,CAAC,OAAO,KAAK,SAAS,EAAE,CAAC;gBACxD,OAAO,EAAE,GAAG,WAAW,EAAE,OAAO,EAAE,YAAY,CAAC,OAAO,EAAE,CAAC;YAC1D,CAAC;YACD,OAAO,WAAW,CAAC;QACpB,CAAC,CAAC;KACF,CAAC;AACH,CAAC"}
@@ -3,33 +3,53 @@ import { type UISchema } from '@selvajs/schemas';
3
3
  import type { ComputeServerConfig } from '@selvajs/platform';
4
4
  /** One entry of the compute schema endpoint's response, typed to our `UISchema`. */
5
5
  export type SchemaExtractionResult = SchemaEndpointResult<UISchema>;
6
- /** Read compute's schema-endpoint body, typed to `UISchema`. See {@link readSchemaResults}. */
6
+ /** Thin re-export of @selvajs/compute's unwrap, typed to `UISchema`. */
7
7
  export declare function readSchemaResults(raw: unknown): SchemaExtractionResult[];
8
8
  /** Thrown when compute is reachable but the definition yields no usable schema. */
9
9
  export declare class SchemaExtractionError extends Error {
10
- readonly kind: 'unreachable' | 'invalid' | 'unsupported';
11
- constructor(kind: 'unreachable' | 'invalid' | 'unsupported', message: string);
10
+ readonly kind: 'unreachable' | 'invalid' | 'unsupported' | 'malformed';
11
+ constructor(kind: 'unreachable' | 'invalid' | 'unsupported' | 'malformed', message: string);
12
12
  }
13
13
  /**
14
- * Plugin↔app compat gate: reject a schema emitted by a NEWER plugin than this
15
- * app was built against — its shape may contain constructs the renderer does
16
- * not know. Older (or missing) versions pass: the compute-side C# migrator
17
- * always emits its own current version, and an older shape only lacks
18
- * optional additions.
14
+ * Rejects a schema whose keys are not camelCase by the time it reaches a consumer.
15
+ *
16
+ * Compute serializes the plugin's `UISchema` POCO, whose camelCase names live in
17
+ * `[JsonProperty]` attributes. `Selva.gha` ILRepack-merges Newtonsoft, so those
18
+ * attributes have type `Selva!Newtonsoft.Json.JsonPropertyAttribute`; a compute
19
+ * server serializing with its OWN Newtonsoft does not recognize them, reads no
20
+ * attributes, and falls back to raw CLR member names — `Inputs`, `Layout`.
21
+ * Nothing throws on the wire: every consumer just reads `schema.inputs` as
22
+ * undefined and renders a definition with no inputs.
23
+ *
24
+ * `postSchemaFormData` repairs that casing via `normalizeUISchemaCasing`, so a
25
+ * schema fresh off the wire never trips this. It stays because schemas are also
26
+ * PERSISTED: a row cached before the normalizer existed still holds PascalCase,
27
+ * and it reaches consumers without passing through `postSchemaFormData` again.
28
+ * A schema with no `inputs` in any casing lands here too. It is a backstop, not
29
+ * the primary defense — which is why it names the missing key rather than telling
30
+ * the operator to go update their compute server.
31
+ *
32
+ * Checked structurally rather than by plugin version, because the casing depends
33
+ * on which assembly serialized the schema, not on any version number.
34
+ */
35
+ export declare function assertCamelCaseSchema(schema: UISchema): void;
36
+ /**
37
+ * Rejects a schema from a NEWER plugin than this app was built against — its
38
+ * shape may contain constructs the renderer doesn't know. Older (or missing)
39
+ * versions pass: the compute-side C# migrator always emits its own current
40
+ * version, and an older shape only lacks optional additions.
19
41
  */
20
42
  export declare function assertSupportedSchemaVersion(schema: UISchema): void;
21
43
  /**
22
- * POST a multipart form to Rhino Compute's `/grasshopper/schema` endpoint (no
23
- * solve required) and return the per-file results. Throws `SchemaExtractionError`
24
- * ('unreachable') on a network failure or non-2xx — the per-file `error` field
25
- * Compute reports on its 200-with-no-schemas case is left for the caller to
26
- * diagnose, since single-file and multi-file callers want different messages.
44
+ * POSTs a multipart form to Rhino Compute's `/grasshopper/schema` endpoint (no
45
+ * solve required). Throws 'unreachable' on a network failure or non-2xx. The
46
+ * per-file `error` Compute reports on its 200-with-no-schemas case is left to
47
+ * the caller — single-file and multi-file callers want different messages.
27
48
  */
28
49
  export declare function postSchemaFormData(formData: FormData, server: ComputeServerConfig): Promise<SchemaExtractionResult[]>;
29
50
  /**
30
- * Fetch the UI schema from Rhino Compute's `/grasshopper/schema` endpoint (no
31
- * solve required). Throws `SchemaExtractionError` so callers can map to the
32
- * right HTTP status (503 unreachable / 422 invalid or unsupported).
51
+ * Throws `SchemaExtractionError` so callers can map to the right HTTP status:
52
+ * 503 unreachable / 422 invalid or unsupported.
33
53
  */
34
54
  export declare function fetchSchemaFromCompute(definitionBytes: Uint8Array, server: ComputeServerConfig): Promise<UISchema>;
35
55
  //# sourceMappingURL=schema-extraction.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-extraction.d.ts","sourceRoot":"","sources":["../../src/definitions/schema-extraction.ts"],"names":[],"mappings":"AASA,OAAO,EAEN,KAAK,oBAAoB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,oFAAoF;AACpF,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AAEpE,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,sBAAsB,EAAE,CAExE;AAED,mFAAmF;AACnF,qBAAa,qBAAsB,SAAQ,KAAK;aAE9B,IAAI,EAAE,aAAa,GAAG,SAAS,GAAG,aAAa;gBAA/C,IAAI,EAAE,aAAa,GAAG,SAAS,GAAG,aAAa,EAC/D,OAAO,EAAE,MAAM;CAKhB;AAOD;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAmBnE;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACvC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,mBAAmB,GACzB,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA0BnC;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAC3C,eAAe,EAAE,UAAU,EAC3B,MAAM,EAAE,mBAAmB,GACzB,OAAO,CAAC,QAAQ,CAAC,CA4BnB"}
1
+ {"version":3,"file":"schema-extraction.d.ts","sourceRoot":"","sources":["../../src/definitions/schema-extraction.ts"],"names":[],"mappings":"AAIA,OAAO,EAGN,KAAK,oBAAoB,EACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAqB,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,oFAAoF;AACpF,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;AAEpE,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,sBAAsB,EAAE,CAExE;AAED,mFAAmF;AACnF,qBAAa,qBAAsB,SAAQ,KAAK;aAE9B,IAAI,EAAE,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW;gBAA7D,IAAI,EAAE,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,EAC7E,OAAO,EAAE,MAAM;CAKhB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAsB5D;AAOD;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAmBnE;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACvC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,mBAAmB,GACzB,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAiCnC;AAED;;;GAGG;AACH,wBAAsB,sBAAsB,CAC3C,eAAe,EAAE,UAAU,EAC3B,MAAM,EAAE,mBAAmB,GACzB,OAAO,CAAC,QAAQ,CAAC,CA4BnB"}
@@ -1,14 +1,9 @@
1
- // Shared compute-schema extraction. One implementation used by:
2
- // - upload routes (validate-and-cache gate — no upload without a valid schema)
3
- // - the render path (falls back to live extraction for un-cached or stale
4
- // versions; see load-for-render.ts and ADR 0005)
5
- // - the temporary solve-time backfill bridge (see the app's specs/SchemaCaching.md)
6
- //
7
1
  // Extraction IS validation: a `.gh` with no valid "Schema" output, or an
8
- // unreachable compute server, throws here and the caller rejects the upload.
9
- import { readSchemaResults as readWrapper } from '@selvajs/compute/grasshopper';
2
+ // unreachable compute server, throws here — which is what makes this the upload
3
+ // gate as well as the render path's fallback for un-cached or stale versions.
4
+ import { normalizeUISchemaCasing, readSchemaResults as readWrapper } from '@selvajs/compute/grasshopper';
10
5
  import { UI_SCHEMA_VERSION } from '@selvajs/schemas';
11
- /** Read compute's schema-endpoint body, typed to `UISchema`. See {@link readSchemaResults}. */
6
+ /** Thin re-export of @selvajs/compute's unwrap, typed to `UISchema`. */
12
7
  export function readSchemaResults(raw) {
13
8
  return readWrapper(raw);
14
9
  }
@@ -21,16 +16,53 @@ export class SchemaExtractionError extends Error {
21
16
  this.name = 'SchemaExtractionError';
22
17
  }
23
18
  }
19
+ /**
20
+ * Rejects a schema whose keys are not camelCase by the time it reaches a consumer.
21
+ *
22
+ * Compute serializes the plugin's `UISchema` POCO, whose camelCase names live in
23
+ * `[JsonProperty]` attributes. `Selva.gha` ILRepack-merges Newtonsoft, so those
24
+ * attributes have type `Selva!Newtonsoft.Json.JsonPropertyAttribute`; a compute
25
+ * server serializing with its OWN Newtonsoft does not recognize them, reads no
26
+ * attributes, and falls back to raw CLR member names — `Inputs`, `Layout`.
27
+ * Nothing throws on the wire: every consumer just reads `schema.inputs` as
28
+ * undefined and renders a definition with no inputs.
29
+ *
30
+ * `postSchemaFormData` repairs that casing via `normalizeUISchemaCasing`, so a
31
+ * schema fresh off the wire never trips this. It stays because schemas are also
32
+ * PERSISTED: a row cached before the normalizer existed still holds PascalCase,
33
+ * and it reaches consumers without passing through `postSchemaFormData` again.
34
+ * A schema with no `inputs` in any casing lands here too. It is a backstop, not
35
+ * the primary defense — which is why it names the missing key rather than telling
36
+ * the operator to go update their compute server.
37
+ *
38
+ * Checked structurally rather than by plugin version, because the casing depends
39
+ * on which assembly serialized the schema, not on any version number.
40
+ */
41
+ export function assertCamelCaseSchema(schema) {
42
+ const raw = schema;
43
+ if (Array.isArray(raw.inputs))
44
+ return;
45
+ const pascalKeys = ['Inputs', 'Outputs', 'Layout', 'SchemaVersion'].filter((k) => k in raw);
46
+ if (pascalKeys.length > 0) {
47
+ throw new SchemaExtractionError('malformed', `Schema keys are PascalCase (found ${pascalKeys.join(', ')}), so every property name ` +
48
+ `is wrong and the definition would render with no inputs. Compute serialized it with ` +
49
+ `its own Newtonsoft instead of the one merged into Selva.gha. Fresh responses are ` +
50
+ `normalized, so this is most likely a schema cached before that fix — re-save the ` +
51
+ `definition version to re-extract it.`);
52
+ }
53
+ throw new SchemaExtractionError('malformed', `Compute returned a schema with no 'inputs' array (got keys: ${Object.keys(raw)
54
+ .slice(0, 12)
55
+ .join(', ')}).`);
56
+ }
24
57
  function parseSemver(version) {
25
58
  const m = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
26
59
  return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
27
60
  }
28
61
  /**
29
- * Plugin↔app compat gate: reject a schema emitted by a NEWER plugin than this
30
- * app was built against — its shape may contain constructs the renderer does
31
- * not know. Older (or missing) versions pass: the compute-side C# migrator
32
- * always emits its own current version, and an older shape only lacks
33
- * optional additions.
62
+ * Rejects a schema from a NEWER plugin than this app was built against — its
63
+ * shape may contain constructs the renderer doesn't know. Older (or missing)
64
+ * versions pass: the compute-side C# migrator always emits its own current
65
+ * version, and an older shape only lacks optional additions.
34
66
  */
35
67
  export function assertSupportedSchemaVersion(schema) {
36
68
  const version = schema.schemaVersion;
@@ -51,11 +83,10 @@ export function assertSupportedSchemaVersion(schema) {
51
83
  }
52
84
  }
53
85
  /**
54
- * POST a multipart form to Rhino Compute's `/grasshopper/schema` endpoint (no
55
- * solve required) and return the per-file results. Throws `SchemaExtractionError`
56
- * ('unreachable') on a network failure or non-2xx — the per-file `error` field
57
- * Compute reports on its 200-with-no-schemas case is left for the caller to
58
- * diagnose, since single-file and multi-file callers want different messages.
86
+ * POSTs a multipart form to Rhino Compute's `/grasshopper/schema` endpoint (no
87
+ * solve required). Throws 'unreachable' on a network failure or non-2xx. The
88
+ * per-file `error` Compute reports on its 200-with-no-schemas case is left to
89
+ * the caller — single-file and multi-file callers want different messages.
59
90
  */
60
91
  export async function postSchemaFormData(formData, server) {
61
92
  const schemaUrl = new URL('/grasshopper/schema', server.serverUrl).toString();
@@ -73,12 +104,18 @@ export async function postSchemaFormData(formData, server) {
73
104
  if (!response.ok) {
74
105
  throw new SchemaExtractionError('unreachable', `Schema endpoint returned ${response.status}: ${response.statusText}`);
75
106
  }
76
- return readSchemaResults(await response.json());
107
+ // Normalize here rather than in each caller: the upload/validation route reads
108
+ // `postSchemaFormData` directly, so a fix applied only inside
109
+ // `fetchSchemaFromCompute` would leave that path serving PascalCase schemas.
110
+ const results = readSchemaResults(await response.json());
111
+ return results.map((result) => ({
112
+ ...result,
113
+ schemas: result.schemas?.map((schema) => normalizeUISchemaCasing(schema))
114
+ }));
77
115
  }
78
116
  /**
79
- * Fetch the UI schema from Rhino Compute's `/grasshopper/schema` endpoint (no
80
- * solve required). Throws `SchemaExtractionError` so callers can map to the
81
- * right HTTP status (503 unreachable / 422 invalid or unsupported).
117
+ * Throws `SchemaExtractionError` so callers can map to the right HTTP status:
118
+ * 503 unreachable / 422 invalid or unsupported.
82
119
  */
83
120
  export async function fetchSchemaFromCompute(definitionBytes, server) {
84
121
  const formData = new FormData();
@@ -87,11 +124,10 @@ export async function fetchSchemaFromCompute(definitionBytes, server) {
87
124
  const results = await postSchemaFormData(formData, server);
88
125
  const schemas = results.flatMap((r) => r.schemas ?? []);
89
126
  if (schemas.length === 0) {
90
- // Compute reports a per-file diagnosis in an `error` field and still answers 200, so
91
- // the !response.ok guard in postSchemaFormData never fires for it. Surface that message
92
- // verbatim — it names the actual cause (bad Schema source, no embedded schema, ...),
93
- // which the generic fallback below cannot, and its absence sends people debugging the
94
- // wrong thing.
127
+ // Compute answers 200 while reporting a per-file `error`, so the
128
+ // !response.ok guard never fires for it. Surface that message verbatim: it
129
+ // names the actual cause (bad Schema source, no embedded schema, ...),
130
+ // which the generic fallback below cannot.
95
131
  const diagnosis = results.map((r) => r.error).filter(Boolean);
96
132
  if (diagnosis.length > 0) {
97
133
  throw new SchemaExtractionError('invalid', diagnosis.join('\n'));
@@ -100,6 +136,7 @@ export async function fetchSchemaFromCompute(definitionBytes, server) {
100
136
  'In Grasshopper, verify a Context Bake component with the output name "Schema" is present and wired to the solver.');
101
137
  }
102
138
  assertSupportedSchemaVersion(schemas[0]);
139
+ assertCamelCaseSchema(schemas[0]);
103
140
  return schemas[0];
104
141
  }
105
142
  //# sourceMappingURL=schema-extraction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-extraction.js","sourceRoot":"","sources":["../../src/definitions/schema-extraction.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,iFAAiF;AACjF,4EAA4E;AAC5E,qDAAqD;AACrD,sFAAsF;AACtF,EAAE;AACF,yEAAyE;AACzE,6EAA6E;AAE7E,OAAO,EACN,iBAAiB,IAAI,WAAW,EAEhC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAiB,MAAM,kBAAkB,CAAC;AAMpE,+FAA+F;AAC/F,MAAM,UAAU,iBAAiB,CAAC,GAAY;IAC7C,OAAO,WAAW,CAAW,GAAG,CAAC,CAAC;AACnC,CAAC;AAED,mFAAmF;AACnF,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAE9B;IADjB,YACiB,IAA+C,EAC/D,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAA2C;QAI/D,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACrC,CAAC;CACD;AAED,SAAS,WAAW,CAAC,OAAe;IACnC,MAAM,CAAC,GAAG,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,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AQ,EAAE,MAAM,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAExD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,iEAAiE;QACjE,2EAA2E;QAC3E,uEAAuE;QACvE,2CAA2C;QAC3C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC9D,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC1B,MAAM,IAAI,qBAAqB,CAAC,SAAS,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAClE,CAAC;QAED,MAAM,IAAI,qBAAqB,CAC9B,SAAS,EACT,qCAAqC;YACpC,mHAAmH,CACpH,CAAC;IACH,CAAC;IAED,4BAA4B,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,qBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAClC,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC"}
@@ -3,9 +3,8 @@ export declare class SentryErrorReporter implements IErrorReporter {
3
3
  private readonly sentry;
4
4
  private constructor();
5
5
  /**
6
- * Initialize Sentry and return a reporter, or `null` if `@sentry/node` is
7
- * not installed (optional dependency absent). Never throws — a broken
8
- * error-tracker must not take down boot.
6
+ * Initialize Sentry and return a reporter, or `null` when `@sentry/node`
7
+ * won't load. Never throws — a broken error-tracker must not take down boot.
9
8
  */
10
9
  static create(opts: {
11
10
  dsn: string;
@@ -1 +1 @@
1
- {"version":3,"file":"SentryErrorReporter.d.ts","sourceRoot":"","sources":["../../src/errors/SentryErrorReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA4BtE,qBAAa,mBAAoB,YAAW,cAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAA3C,OAAO;IAEP;;;;OAIG;WACU,MAAM,CAAC,IAAI,EAAE;QACzB,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IA+BvC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;CAgBrD"}
1
+ {"version":3,"file":"SentryErrorReporter.d.ts","sourceRoot":"","sources":["../../src/errors/SentryErrorReporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AA0BtE,qBAAa,mBAAoB,YAAW,cAAc;IACrC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAA3C,OAAO;IAEP;;;OAGG;WACU,MAAM,CAAC,IAAI,EAAE;QACzB,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC;IA4BvC,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI;CAgBrD"}
@@ -4,19 +4,15 @@ export class SentryErrorReporter {
4
4
  this.sentry = sentry;
5
5
  }
6
6
  /**
7
- * Initialize Sentry and return a reporter, or `null` if `@sentry/node` is
8
- * not installed (optional dependency absent). Never throws — a broken
9
- * error-tracker must not take down boot.
7
+ * Initialize Sentry and return a reporter, or `null` when `@sentry/node`
8
+ * won't load. Never throws — a broken error-tracker must not take down boot.
10
9
  */
11
10
  static async create(opts) {
12
11
  try {
13
- // Dynamic so the package stays optional. `@vite-ignore` keeps the
14
- // bundler from trying to resolve it at build time when it's absent.
15
- // `@ts-ignore` (not `@ts-expect-error`) because whether the module
16
- // resolves at type-check time depends on the environment — it's a real
17
- // dep in some installs, absent in others — so we can't assert the error
18
- // is always present. The `as unknown as` cast narrows whatever loads to
19
- // the two calls we use.
12
+ // `@vite-ignore` stops the bundler resolving an absent package at build
13
+ // time. `@ts-ignore` rather than `@ts-expect-error` because the module
14
+ // is a real dep in some installs and missing in others, so we can't
15
+ // assert the error is always there for `expect-error` to consume.
20
16
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
21
17
  // @ts-ignore -- optional dependency, may be absent at type-check time
22
18
  const sentry = (await import(/* @vite-ignore */ '@sentry/node'));
@@ -24,8 +20,8 @@ export class SentryErrorReporter {
24
20
  dsn: opts.dsn,
25
21
  environment: opts.environment,
26
22
  release: opts.release,
27
- // Error tracking only — no performance tracing by default. Flip
28
- // this up later if you want transactions/spans.
23
+ // 0 = error tracking only, no performance tracing. Raise it to
24
+ // sample transactions/spans.
29
25
  tracesSampleRate: 0
30
26
  });
31
27
  return new SentryErrorReporter(sentry);
@@ -51,8 +47,8 @@ export class SentryErrorReporter {
51
47
  });
52
48
  }
53
49
  catch (err) {
54
- // Reporting is best-effort and sits on the error path — a second
55
- // failure here would mask the first. Swallow after logging.
50
+ // Best-effort, and this sits on the error path — letting a second
51
+ // failure escape would mask the first.
56
52
  console.error('[ErrorReporter] Failed to capture error:', err);
57
53
  }
58
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SentryErrorReporter.js","sourceRoot":"","sources":["../../src/errors/SentryErrorReporter.ts"],"names":[],"mappings":"AA4BA,MAAM,OAAO,mBAAmB;IACM;IAArC,YAAqC,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAE3D;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAInB;QACA,IAAI,CAAC;YACJ,kEAA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,MAAM,CAAC;YAClD,IAAI,OAAO,EAAE,KAAK;gBAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAC/C,IAAI,OAAO,EAAE,KAAK;gBAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE;gBACnC,IAAI;gBACJ,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS;aAC1D,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACd,kEAAkE;YAClE,uCAAuC;YACvC,OAAO,CAAC,KAAK,CAAC,0CAA0C,EAAE,GAAG,CAAC,CAAC;QAChE,CAAC;IACF,CAAC;CACD"}
@@ -3,19 +3,16 @@ export interface HeadersLike {
3
3
  get(name: string): string | null;
4
4
  }
5
5
  /**
6
- * True when the request's declared `Content-Length` exceeds `maxBytes`.
7
- * Check BEFORE the body is read so a malicious client can't burn memory by
8
- * sending a huge payload to a small-body endpoint; the route maps a `true`
9
- * result to its transport's 413.
6
+ * True when the request's declared `Content-Length` exceeds `maxBytes`. Call it
7
+ * BEFORE reading the body, so a huge payload aimed at a small-body endpoint
8
+ * can't burn memory; the route maps `true` to its transport's 413.
10
9
  *
11
- * Background: a global body-size limit (e.g. adapter-node's `BODY_SIZE_LIMIT`)
12
- * has to be set high enough for the largest legitimate upload, which means
13
- * smaller JSON endpoints inherit that ceiling by default. This check is the
14
- * per-route lower bound.
10
+ * This is the per-route lower bound. A global limit (e.g. adapter-node's
11
+ * `BODY_SIZE_LIMIT`) has to clear the largest legitimate upload, so every small
12
+ * JSON endpoint would otherwise inherit that ceiling.
15
13
  *
16
- * Caveat: requests without `Content-Length` (chunked transfer encoding) bypass
17
- * this check. Most browsers and HTTP clients send Content-Length on POST/PUT.
18
- * The global limit is the backstop for those.
14
+ * Requests without `Content-Length` (chunked encoding) slip past this check —
15
+ * the global limit is the backstop there.
19
16
  */
20
17
  export declare function declaredBodySizeExceeds(headers: HeadersLike, maxBytes: number): boolean;
21
18
  //# sourceMappingURL=body-size.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"body-size.d.ts","sourceRoot":"","sources":["../../src/http/body-size.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC3B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGvF"}
1
+ {"version":3,"file":"body-size.d.ts","sourceRoot":"","sources":["../../src/http/body-size.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,MAAM,WAAW,WAAW;IAC3B,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACjC;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGvF"}
@@ -1,17 +1,14 @@
1
1
  /**
2
- * True when the request's declared `Content-Length` exceeds `maxBytes`.
3
- * Check BEFORE the body is read so a malicious client can't burn memory by
4
- * sending a huge payload to a small-body endpoint; the route maps a `true`
5
- * result to its transport's 413.
2
+ * True when the request's declared `Content-Length` exceeds `maxBytes`. Call it
3
+ * BEFORE reading the body, so a huge payload aimed at a small-body endpoint
4
+ * can't burn memory; the route maps `true` to its transport's 413.
6
5
  *
7
- * Background: a global body-size limit (e.g. adapter-node's `BODY_SIZE_LIMIT`)
8
- * has to be set high enough for the largest legitimate upload, which means
9
- * smaller JSON endpoints inherit that ceiling by default. This check is the
10
- * per-route lower bound.
6
+ * This is the per-route lower bound. A global limit (e.g. adapter-node's
7
+ * `BODY_SIZE_LIMIT`) has to clear the largest legitimate upload, so every small
8
+ * JSON endpoint would otherwise inherit that ceiling.
11
9
  *
12
- * Caveat: requests without `Content-Length` (chunked transfer encoding) bypass
13
- * this check. Most browsers and HTTP clients send Content-Length on POST/PUT.
14
- * The global limit is the backstop for those.
10
+ * Requests without `Content-Length` (chunked encoding) slip past this check —
11
+ * the global limit is the backstop there.
15
12
  */
16
13
  export function declaredBodySizeExceeds(headers, maxBytes) {
17
14
  const declared = Number(headers.get('content-length'));
@@ -1 +1 @@
1
- {"version":3,"file":"body-size.js","sourceRoot":"","sources":["../../src/http/body-size.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAoB,EAAE,QAAgB;IAC7E,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACvD,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,QAAQ,CAAC;AACzD,CAAC"}
1
+ {"version":3,"file":"body-size.js","sourceRoot":"","sources":["../../src/http/body-size.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAoB,EAAE,QAAgB;IAC7E,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC;IACvD,OAAO,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,GAAG,QAAQ,CAAC;AACzD,CAAC"}
@@ -1,11 +1,7 @@
1
1
  /**
2
- * Validate a user-supplied post-login redirect target. Accepts only same-origin
3
- * relative paths starting with `/` followed by a non-`/` character, so
4
- * `//evil.com/path` (protocol-relative URL — browser treats as cross-origin)
5
- * and `/\evil.com` (back-slash variants some browsers normalize) are rejected.
6
- *
7
- * Always returns a safe path: the validated target on success, the fallback
8
- * otherwise. Routes call this with `redirectTo` from form data or query string.
2
+ * Validate a user-supplied post-login redirect target (`redirectTo` from form
3
+ * data or a query string) against open redirects. Returns the target when it is
4
+ * a same-origin relative path, the fallback otherwise — never a raw target.
9
5
  */
10
6
  export declare function safeRedirectTarget(raw: string | null | undefined, fallback: string): string;
11
7
  //# sourceMappingURL=redirect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../src/http/redirect.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM3F"}
1
+ {"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../src/http/redirect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAU3F"}