@ontrails/core 1.0.0-beta.4 → 1.0.0-beta.41

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 (247) hide show
  1. package/CHANGELOG.md +412 -12
  2. package/README.md +112 -28
  3. package/package.json +11 -1
  4. package/src/activation-provenance.ts +116 -0
  5. package/src/activation-source-compatibility.ts +430 -0
  6. package/src/activation-source-projection.ts +227 -0
  7. package/src/activation-source.ts +93 -0
  8. package/src/blob-ref.ts +51 -0
  9. package/src/branded.ts +1 -1
  10. package/src/compose-batch.ts +69 -0
  11. package/src/compose-schema.ts +36 -0
  12. package/src/context.ts +59 -11
  13. package/src/derive.ts +271 -19
  14. package/src/detours.ts +8 -0
  15. package/src/diagnostics.ts +21 -0
  16. package/src/draft.ts +350 -0
  17. package/src/entity.ts +346 -0
  18. package/src/error-projection.ts +51 -0
  19. package/src/errors.ts +335 -48
  20. package/src/execute.ts +1577 -0
  21. package/src/fire.ts +1172 -0
  22. package/src/glob.ts +81 -0
  23. package/src/index.ts +568 -32
  24. package/src/internal/fork-ctx.ts +69 -0
  25. package/src/layer-projection.ts +193 -0
  26. package/src/layer.ts +43 -6
  27. package/src/observe.ts +361 -0
  28. package/src/path-scope.ts +66 -0
  29. package/src/path-security.ts +11 -3
  30. package/src/permits.ts +12 -0
  31. package/src/queue.ts +163 -0
  32. package/src/redaction/patterns.ts +6 -3
  33. package/src/resilience.ts +11 -11
  34. package/src/resource-config.ts +804 -0
  35. package/src/resource.ts +194 -0
  36. package/src/result.ts +18 -0
  37. package/src/run.ts +76 -0
  38. package/src/runtime-builtins.ts +69 -0
  39. package/src/schedule-runtime.ts +689 -0
  40. package/src/schedule.ts +326 -0
  41. package/src/serialization.ts +92 -55
  42. package/src/sha256.ts +136 -0
  43. package/src/signal-diagnostics.ts +633 -0
  44. package/src/signal-ref.ts +111 -0
  45. package/src/signal.ts +104 -0
  46. package/src/store/accessor-protocol.ts +56 -0
  47. package/src/store/index.ts +4 -0
  48. package/src/structured-examples.ts +248 -0
  49. package/src/surface-derivation.ts +91 -0
  50. package/src/surface-filter.ts +101 -0
  51. package/src/surface-overlay.ts +694 -0
  52. package/src/surface-versioning.ts +42 -0
  53. package/src/topo.ts +762 -38
  54. package/src/tracing.ts +346 -0
  55. package/src/trail-id-glob.ts +15 -0
  56. package/src/trail.ts +1244 -34
  57. package/src/trails/derive-trail.ts +835 -0
  58. package/src/trails/index.ts +9 -0
  59. package/src/trails/ingest.ts +152 -0
  60. package/src/trails-db.ts +212 -0
  61. package/src/transport-error-map.ts +174 -0
  62. package/src/type-utils.ts +87 -0
  63. package/src/types.ts +254 -12
  64. package/src/validate-established-topo.ts +73 -0
  65. package/src/validate-topo.ts +569 -55
  66. package/src/validation.ts +152 -4
  67. package/src/version-marker.ts +716 -0
  68. package/src/version-resolution.ts +308 -0
  69. package/src/version-runtime.ts +120 -0
  70. package/src/webhook.ts +461 -0
  71. package/src/workspace.ts +183 -16
  72. package/src/zod-wrappers.ts +72 -0
  73. package/.turbo/turbo-build.log +0 -1
  74. package/.turbo/turbo-lint.log +0 -3
  75. package/.turbo/turbo-typecheck.log +0 -1
  76. package/dist/adapters.d.ts +0 -39
  77. package/dist/adapters.d.ts.map +0 -1
  78. package/dist/adapters.js +0 -2
  79. package/dist/adapters.js.map +0 -1
  80. package/dist/blob-ref.d.ts +0 -20
  81. package/dist/blob-ref.d.ts.map +0 -1
  82. package/dist/blob-ref.js +0 -22
  83. package/dist/blob-ref.js.map +0 -1
  84. package/dist/branded.d.ts +0 -36
  85. package/dist/branded.d.ts.map +0 -1
  86. package/dist/branded.js +0 -89
  87. package/dist/branded.js.map +0 -1
  88. package/dist/collections.d.ts +0 -31
  89. package/dist/collections.d.ts.map +0 -1
  90. package/dist/collections.js +0 -60
  91. package/dist/collections.js.map +0 -1
  92. package/dist/context.d.ts +0 -10
  93. package/dist/context.d.ts.map +0 -1
  94. package/dist/context.js +0 -15
  95. package/dist/context.js.map +0 -1
  96. package/dist/derive.d.ts +0 -33
  97. package/dist/derive.d.ts.map +0 -1
  98. package/dist/derive.js +0 -125
  99. package/dist/derive.js.map +0 -1
  100. package/dist/errors.d.ts +0 -83
  101. package/dist/errors.d.ts.map +0 -1
  102. package/dist/errors.js +0 -142
  103. package/dist/errors.js.map +0 -1
  104. package/dist/event.d.ts +0 -45
  105. package/dist/event.d.ts.map +0 -1
  106. package/dist/event.js +0 -17
  107. package/dist/event.js.map +0 -1
  108. package/dist/fetch.d.ts +0 -15
  109. package/dist/fetch.d.ts.map +0 -1
  110. package/dist/fetch.js +0 -102
  111. package/dist/fetch.js.map +0 -1
  112. package/dist/guards.d.ts +0 -17
  113. package/dist/guards.d.ts.map +0 -1
  114. package/dist/guards.js +0 -25
  115. package/dist/guards.js.map +0 -1
  116. package/dist/health.d.ts +0 -18
  117. package/dist/health.d.ts.map +0 -1
  118. package/dist/health.js +0 -5
  119. package/dist/health.js.map +0 -1
  120. package/dist/index.d.ts +0 -34
  121. package/dist/index.d.ts.map +0 -1
  122. package/dist/index.js +0 -38
  123. package/dist/index.js.map +0 -1
  124. package/dist/job.d.ts +0 -24
  125. package/dist/job.d.ts.map +0 -1
  126. package/dist/job.js +0 -17
  127. package/dist/job.js.map +0 -1
  128. package/dist/layer.d.ts +0 -17
  129. package/dist/layer.d.ts.map +0 -1
  130. package/dist/layer.js +0 -21
  131. package/dist/layer.js.map +0 -1
  132. package/dist/path-security.d.ts +0 -28
  133. package/dist/path-security.d.ts.map +0 -1
  134. package/dist/path-security.js +0 -63
  135. package/dist/path-security.js.map +0 -1
  136. package/dist/patterns/bulk.d.ts +0 -15
  137. package/dist/patterns/bulk.d.ts.map +0 -1
  138. package/dist/patterns/bulk.js +0 -14
  139. package/dist/patterns/bulk.js.map +0 -1
  140. package/dist/patterns/change.d.ts +0 -10
  141. package/dist/patterns/change.d.ts.map +0 -1
  142. package/dist/patterns/change.js +0 -10
  143. package/dist/patterns/change.js.map +0 -1
  144. package/dist/patterns/date-range.d.ts +0 -10
  145. package/dist/patterns/date-range.d.ts.map +0 -1
  146. package/dist/patterns/date-range.js +0 -10
  147. package/dist/patterns/date-range.js.map +0 -1
  148. package/dist/patterns/index.d.ts +0 -9
  149. package/dist/patterns/index.d.ts.map +0 -1
  150. package/dist/patterns/index.js +0 -9
  151. package/dist/patterns/index.js.map +0 -1
  152. package/dist/patterns/pagination.d.ts +0 -18
  153. package/dist/patterns/pagination.d.ts.map +0 -1
  154. package/dist/patterns/pagination.js +0 -18
  155. package/dist/patterns/pagination.js.map +0 -1
  156. package/dist/patterns/progress.d.ts +0 -11
  157. package/dist/patterns/progress.d.ts.map +0 -1
  158. package/dist/patterns/progress.js +0 -11
  159. package/dist/patterns/progress.js.map +0 -1
  160. package/dist/patterns/sorting.d.ts +0 -13
  161. package/dist/patterns/sorting.d.ts.map +0 -1
  162. package/dist/patterns/sorting.js +0 -10
  163. package/dist/patterns/sorting.js.map +0 -1
  164. package/dist/patterns/status.d.ts +0 -15
  165. package/dist/patterns/status.d.ts.map +0 -1
  166. package/dist/patterns/status.js +0 -9
  167. package/dist/patterns/status.js.map +0 -1
  168. package/dist/patterns/timestamps.d.ts +0 -10
  169. package/dist/patterns/timestamps.d.ts.map +0 -1
  170. package/dist/patterns/timestamps.js +0 -10
  171. package/dist/patterns/timestamps.js.map +0 -1
  172. package/dist/redaction/index.d.ts +0 -4
  173. package/dist/redaction/index.d.ts.map +0 -1
  174. package/dist/redaction/index.js +0 -3
  175. package/dist/redaction/index.js.map +0 -1
  176. package/dist/redaction/patterns.d.ts +0 -9
  177. package/dist/redaction/patterns.d.ts.map +0 -1
  178. package/dist/redaction/patterns.js +0 -39
  179. package/dist/redaction/patterns.js.map +0 -1
  180. package/dist/redaction/redactor.d.ts +0 -27
  181. package/dist/redaction/redactor.d.ts.map +0 -1
  182. package/dist/redaction/redactor.js +0 -89
  183. package/dist/redaction/redactor.js.map +0 -1
  184. package/dist/resilience.d.ts +0 -34
  185. package/dist/resilience.d.ts.map +0 -1
  186. package/dist/resilience.js +0 -164
  187. package/dist/resilience.js.map +0 -1
  188. package/dist/result.d.ts +0 -57
  189. package/dist/result.d.ts.map +0 -1
  190. package/dist/result.js +0 -156
  191. package/dist/result.js.map +0 -1
  192. package/dist/serialization.d.ts +0 -27
  193. package/dist/serialization.d.ts.map +0 -1
  194. package/dist/serialization.js +0 -153
  195. package/dist/serialization.js.map +0 -1
  196. package/dist/topo.d.ts +0 -16
  197. package/dist/topo.d.ts.map +0 -1
  198. package/dist/topo.js +0 -66
  199. package/dist/topo.js.map +0 -1
  200. package/dist/trail.d.ts +0 -89
  201. package/dist/trail.d.ts.map +0 -1
  202. package/dist/trail.js +0 -18
  203. package/dist/trail.js.map +0 -1
  204. package/dist/types.d.ts +0 -46
  205. package/dist/types.d.ts.map +0 -1
  206. package/dist/types.js +0 -2
  207. package/dist/types.js.map +0 -1
  208. package/dist/validate-topo.d.ts +0 -24
  209. package/dist/validate-topo.d.ts.map +0 -1
  210. package/dist/validate-topo.js +0 -158
  211. package/dist/validate-topo.js.map +0 -1
  212. package/dist/validation.d.ts +0 -27
  213. package/dist/validation.d.ts.map +0 -1
  214. package/dist/validation.js +0 -134
  215. package/dist/validation.js.map +0 -1
  216. package/dist/workspace.d.ts +0 -25
  217. package/dist/workspace.d.ts.map +0 -1
  218. package/dist/workspace.js +0 -57
  219. package/dist/workspace.js.map +0 -1
  220. package/src/__tests__/blob-ref.test.ts +0 -103
  221. package/src/__tests__/branded.test.ts +0 -148
  222. package/src/__tests__/collections.test.ts +0 -126
  223. package/src/__tests__/context.test.ts +0 -66
  224. package/src/__tests__/derive.test.ts +0 -203
  225. package/src/__tests__/errors.test.ts +0 -309
  226. package/src/__tests__/event.test.ts +0 -82
  227. package/src/__tests__/fetch.test.ts +0 -217
  228. package/src/__tests__/guards.test.ts +0 -102
  229. package/src/__tests__/job.test.ts +0 -98
  230. package/src/__tests__/layer.test.ts +0 -212
  231. package/src/__tests__/path-security.test.ts +0 -114
  232. package/src/__tests__/patterns.test.ts +0 -273
  233. package/src/__tests__/redaction.test.ts +0 -244
  234. package/src/__tests__/resilience.test.ts +0 -246
  235. package/src/__tests__/result.test.ts +0 -155
  236. package/src/__tests__/serialization.test.ts +0 -401
  237. package/src/__tests__/topo.test.ts +0 -181
  238. package/src/__tests__/trail.test.ts +0 -217
  239. package/src/__tests__/validate-topo.test.ts +0 -278
  240. package/src/__tests__/validation.test.ts +0 -283
  241. package/src/__tests__/workspace.test.ts +0 -183
  242. package/src/adapters.ts +0 -68
  243. package/src/event.ts +0 -77
  244. package/src/health.ts +0 -23
  245. package/src/job.ts +0 -20
  246. package/tsconfig.json +0 -9
  247. package/tsconfig.tsbuildinfo +0 -1
package/dist/job.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;iBAQ1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
package/dist/job.js DELETED
@@ -1,17 +0,0 @@
1
- import { z } from 'zod';
2
- import { progressFields } from './patterns/progress.js';
3
- import { statusFields } from './patterns/status.js';
4
- /**
5
- * Proof: job-style output schema composes from existing pattern helpers.
6
- * No dedicated `kind: "job"` needed — regular trails with status+progress output work.
7
- */
8
- export const jobOutputSchema = z.object({
9
- ...progressFields().shape,
10
- ...statusFields().shape,
11
- completedAt: z.string().optional(),
12
- error: z.string().optional(),
13
- jobId: z.string(),
14
- result: z.unknown().optional(),
15
- startedAt: z.string().optional(),
16
- });
17
- //# sourceMappingURL=job.js.map
package/dist/job.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"job.js","sourceRoot":"","sources":["../src/job.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,GAAG,cAAc,EAAE,CAAC,KAAK;IACzB,GAAG,YAAY,EAAE,CAAC,KAAK;IACvB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC"}
package/dist/layer.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import type { Trail } from './trail.js';
2
- import type { Implementation } from './types.js';
3
- /** A composable middleware that wraps trail implementations */
4
- export interface Layer {
5
- readonly name: string;
6
- readonly description?: string | undefined;
7
- /** Wrap a trail's implementation, returning a new implementation */
8
- wrap<I, O>(trail: Trail<I, O>, implementation: Implementation<I, O>): Implementation<I, O>;
9
- }
10
- /**
11
- * Apply layers outermost-first: layers[0] wraps layers[1] wraps ... wraps
12
- * the base implementation.
13
- *
14
- * An empty layers array returns the implementation unchanged.
15
- */
16
- export declare const composeLayers: <I, O>(layers: readonly Layer[], trail: Trail<I, O>, implementation: Implementation<I, O>) => Implementation<I, O>;
17
- //# sourceMappingURL=layer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../src/layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAMjD,+DAA+D;AAC/D,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE1C,oEAAoE;IACpE,IAAI,CAAC,CAAC,EAAE,CAAC,EACP,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAClB,cAAc,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,GACnC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;CACzB;AAMD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,CAAC,EAAE,CAAC,EAChC,QAAQ,SAAS,KAAK,EAAE,EACxB,OAAO,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAClB,gBAAgB,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,KACnC,cAAc,CAAC,CAAC,EAAE,CAAC,CAUrB,CAAC"}
package/dist/layer.js DELETED
@@ -1,21 +0,0 @@
1
- // ---------------------------------------------------------------------------
2
- // Composition
3
- // ---------------------------------------------------------------------------
4
- /**
5
- * Apply layers outermost-first: layers[0] wraps layers[1] wraps ... wraps
6
- * the base implementation.
7
- *
8
- * An empty layers array returns the implementation unchanged.
9
- */
10
- export const composeLayers = (layers, trail, implementation) => {
11
- // Fold right so layers[0] is the outermost wrapper
12
- let result = implementation;
13
- for (let i = layers.length - 1; i >= 0; i -= 1) {
14
- const layer = layers[i];
15
- if (layer) {
16
- result = layer.wrap(trail, result);
17
- }
18
- }
19
- return result;
20
- };
21
- //# sourceMappingURL=layer.js.map
package/dist/layer.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"layer.js","sourceRoot":"","sources":["../src/layer.ts"],"names":[],"mappings":"AAmBA,8EAA8E;AAC9E,cAAc;AACd,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,MAAwB,EACxB,KAAkB,EAClB,cAAoC,EACd,EAAE;IACxB,mDAAmD;IACnD,IAAI,MAAM,GAAG,cAAc,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"}
@@ -1,28 +0,0 @@
1
- /**
2
- * Path security utilities for preventing path traversal attacks.
3
- *
4
- * All functions are runtime-agnostic (Node / Bun compatible).
5
- */
6
- import { PermissionError } from './errors.js';
7
- import { Result } from './result.js';
8
- /**
9
- * Resolves `userPath` relative to `basePath` and ensures it stays within
10
- * the base directory. Returns the resolved absolute path on success, or a
11
- * `PermissionError` if the path escapes.
12
- *
13
- * Uses lexical path comparison (not `realpath`). Does not follow symlinks —
14
- * if an attacker can create symlinks inside `basePath`, those could point
15
- * outside the base. Use `realpath` before calling in symlink-sensitive environments.
16
- */
17
- export declare const securePath: (basePath: string, userPath: string) => Result<string, PermissionError>;
18
- /**
19
- * Returns `true` if `userPath` (resolved against `basePath`) stays within
20
- * `basePath`.
21
- */
22
- export declare const isPathSafe: (basePath: string, userPath: string) => boolean;
23
- /**
24
- * Joins multiple path segments, resolves them against `basePath`, and
25
- * validates the result stays within the base directory.
26
- */
27
- export declare const resolveSafePath: (basePath: string, ...segments: string[]) => Result<string, PermissionError>;
28
- //# sourceMappingURL=path-security.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"path-security.d.ts","sourceRoot":"","sources":["../src/path-security.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAmBrC;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GACrB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,MAAM,CAAC,MAAM,EAAE,eAAe,CAgBhC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,UAAU,MAAM,EAAE,UAAU,MAAM,KAAG,OAI/D,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,MAAM,EAChB,GAAG,UAAU,MAAM,EAAE,KACpB,MAAM,CAAC,MAAM,EAAE,eAAe,CAchC,CAAC"}
@@ -1,63 +0,0 @@
1
- /**
2
- * Path security utilities for preventing path traversal attacks.
3
- *
4
- * All functions are runtime-agnostic (Node / Bun compatible).
5
- */
6
- import { resolve, relative, normalize, isAbsolute } from 'node:path';
7
- import { PermissionError } from './errors.js';
8
- import { Result } from './result.js';
9
- // ---------------------------------------------------------------------------
10
- // Internal
11
- // ---------------------------------------------------------------------------
12
- /** Returns true when `target` is equal to or a descendant of `base`. */
13
- const isWithin = (base, target) => {
14
- const rel = relative(base, target);
15
- // Empty string means they are the same directory.
16
- // A relative path starting with ".." means it escapes.
17
- // An absolute path means a completely different tree.
18
- return rel === '' || (!rel.startsWith('..') && !isAbsolute(rel));
19
- };
20
- // ---------------------------------------------------------------------------
21
- // Public API
22
- // ---------------------------------------------------------------------------
23
- /**
24
- * Resolves `userPath` relative to `basePath` and ensures it stays within
25
- * the base directory. Returns the resolved absolute path on success, or a
26
- * `PermissionError` if the path escapes.
27
- *
28
- * Uses lexical path comparison (not `realpath`). Does not follow symlinks —
29
- * if an attacker can create symlinks inside `basePath`, those could point
30
- * outside the base. Use `realpath` before calling in symlink-sensitive environments.
31
- */
32
- export const securePath = (basePath, userPath) => {
33
- const base = resolve(basePath);
34
- const resolved = resolve(base, userPath);
35
- if (!isWithin(base, resolved)) {
36
- return Result.err(new PermissionError(`Path traversal detected: "${userPath}" escapes "${basePath}"`, {
37
- context: { basePath: base, resolved, userPath },
38
- }));
39
- }
40
- return Result.ok(resolved);
41
- };
42
- /**
43
- * Returns `true` if `userPath` (resolved against `basePath`) stays within
44
- * `basePath`.
45
- */
46
- export const isPathSafe = (basePath, userPath) => {
47
- const base = resolve(basePath);
48
- const resolved = resolve(base, userPath);
49
- return isWithin(base, resolved);
50
- };
51
- /**
52
- * Joins multiple path segments, resolves them against `basePath`, and
53
- * validates the result stays within the base directory.
54
- */
55
- export const resolveSafePath = (basePath, ...segments) => {
56
- const base = resolve(basePath);
57
- const joined = resolve(base, ...segments.map((s) => normalize(s)));
58
- if (!isWithin(base, joined)) {
59
- return Result.err(new PermissionError(`Path traversal detected: segments escape "${basePath}"`, { context: { basePath: base, resolved: joined, segments } }));
60
- }
61
- return Result.ok(joined);
62
- };
63
- //# sourceMappingURL=path-security.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"path-security.js","sourceRoot":"","sources":["../src/path-security.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E,wEAAwE;AACxE,MAAM,QAAQ,GAAG,CAAC,IAAY,EAAE,MAAc,EAAW,EAAE;IACzD,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnC,kDAAkD;IAClD,uDAAuD;IACvD,sDAAsD;IACtD,OAAO,GAAG,KAAK,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AACnE,CAAC,CAAC;AAEF,8EAA8E;AAC9E,aAAa;AACb,8EAA8E;AAE9E;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,QAAgB,EAChB,QAAgB,EACiB,EAAE;IACnC,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAEzC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC9B,OAAO,MAAM,CAAC,GAAG,CACf,IAAI,eAAe,CACjB,6BAA6B,QAAQ,cAAc,QAAQ,GAAG,EAC9D;YACE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE;SAChD,CACF,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,QAAgB,EAAE,QAAgB,EAAW,EAAE;IACxE,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACzC,OAAO,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAClC,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,QAAgB,EAChB,GAAG,QAAkB,EACY,EAAE;IACnC,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC,GAAG,CACf,IAAI,eAAe,CACjB,6CAA6C,QAAQ,GAAG,EACxD,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,CAC5D,CACF,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Bulk operation schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Bulk operation output wrapper for a given item schema. */
6
- export declare const bulkOutput: <T>(itemSchema: z.ZodType<T>) => z.ZodObject<{
7
- errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
8
- index: z.ZodNumber;
9
- message: z.ZodString;
10
- }, z.core.$strip>>>;
11
- failed: z.ZodNumber;
12
- items: z.ZodArray<z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>>>;
13
- succeeded: z.ZodNumber;
14
- }, z.core.$strip>;
15
- //# sourceMappingURL=bulk.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bulk.d.ts","sourceRoot":"","sources":["../../src/patterns/bulk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,6DAA6D;AAC7D,eAAO,MAAM,UAAU,GAAI,CAAC,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;;;;;;;;iBAQlD,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Bulk operation schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Bulk operation output wrapper for a given item schema. */
6
- export const bulkOutput = (itemSchema) => z.object({
7
- errors: z
8
- .array(z.object({ index: z.number(), message: z.string() }))
9
- .optional(),
10
- failed: z.number(),
11
- items: z.array(itemSchema),
12
- succeeded: z.number(),
13
- });
14
- //# sourceMappingURL=bulk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bulk.js","sourceRoot":"","sources":["../../src/patterns/bulk.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,6DAA6D;AAC7D,MAAM,CAAC,MAAM,UAAU,GAAG,CAAI,UAAwB,EAAE,EAAE,CACxD,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC;SACN,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;SAC3D,QAAQ,EAAE;IACb,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;IAC1B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Change-tracking schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Before/after change output for a given schema. */
6
- export declare const changeOutput: <T>(schema: z.ZodType<T>) => z.ZodObject<{
7
- after: z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>>;
8
- before: z.ZodOptional<z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>>>;
9
- }, z.core.$strip>;
10
- //# sourceMappingURL=change.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"change.d.ts","sourceRoot":"","sources":["../../src/patterns/change.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qDAAqD;AACrD,eAAO,MAAM,YAAY,GAAI,CAAC,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;;;iBAIhD,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Change-tracking schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Before/after change output for a given schema. */
6
- export const changeOutput = (schema) => z.object({
7
- after: schema,
8
- before: schema.optional(),
9
- });
10
- //# sourceMappingURL=change.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"change.js","sourceRoot":"","sources":["../../src/patterns/change.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qDAAqD;AACrD,MAAM,CAAC,MAAM,YAAY,GAAG,CAAI,MAAoB,EAAE,EAAE,CACtD,CAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM,CAAC,QAAQ,EAAE;CAC1B,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Date-range schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Optional since/until date-range fields. */
6
- export declare const dateRangeFields: () => z.ZodObject<{
7
- since: z.ZodOptional<z.ZodString>;
8
- until: z.ZodOptional<z.ZodString>;
9
- }, z.core.$strip>;
10
- //# sourceMappingURL=date-range.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range.d.ts","sourceRoot":"","sources":["../../src/patterns/date-range.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8CAA8C;AAC9C,eAAO,MAAM,eAAe;;;iBAIxB,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Date-range schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Optional since/until date-range fields. */
6
- export const dateRangeFields = () => z.object({
7
- since: z.string().optional(),
8
- until: z.string().optional(),
9
- });
10
- //# sourceMappingURL=date-range.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"date-range.js","sourceRoot":"","sources":["../../src/patterns/date-range.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8CAA8C;AAC9C,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAClC,CAAC,CAAC,MAAM,CAAC;IACP,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC7B,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- export { paginationFields, paginatedOutput } from './pagination.js';
2
- export { bulkOutput } from './bulk.js';
3
- export { timestampFields } from './timestamps.js';
4
- export { dateRangeFields } from './date-range.js';
5
- export { sortFields } from './sorting.js';
6
- export { statusFields } from './status.js';
7
- export { changeOutput } from './change.js';
8
- export { progressFields } from './progress.js';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/patterns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -1,9 +0,0 @@
1
- export { paginationFields, paginatedOutput } from './pagination.js';
2
- export { bulkOutput } from './bulk.js';
3
- export { timestampFields } from './timestamps.js';
4
- export { dateRangeFields } from './date-range.js';
5
- export { sortFields } from './sorting.js';
6
- export { statusFields } from './status.js';
7
- export { changeOutput } from './change.js';
8
- export { progressFields } from './progress.js';
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/patterns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Pagination schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Common pagination input fields. */
6
- export declare const paginationFields: () => z.ZodObject<{
7
- cursor: z.ZodOptional<z.ZodString>;
8
- limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
9
- offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
10
- }, z.core.$strip>;
11
- /** Paginated output wrapper for a given item schema. */
12
- export declare const paginatedOutput: <T>(itemSchema: z.ZodType<T>) => z.ZodObject<{
13
- hasMore: z.ZodBoolean;
14
- items: z.ZodArray<z.ZodType<T, unknown, z.core.$ZodTypeInternals<T, unknown>>>;
15
- nextCursor: z.ZodOptional<z.ZodString>;
16
- total: z.ZodNumber;
17
- }, z.core.$strip>;
18
- //# sourceMappingURL=pagination.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/patterns/pagination.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,sCAAsC;AACtC,eAAO,MAAM,gBAAgB;;;;iBAKzB,CAAC;AAEL,wDAAwD;AACxD,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;;;;;iBAMvD,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * Pagination schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Common pagination input fields. */
6
- export const paginationFields = () => z.object({
7
- cursor: z.string().optional(),
8
- limit: z.number().optional().default(20),
9
- offset: z.number().optional().default(0),
10
- });
11
- /** Paginated output wrapper for a given item schema. */
12
- export const paginatedOutput = (itemSchema) => z.object({
13
- hasMore: z.boolean(),
14
- items: z.array(itemSchema),
15
- nextCursor: z.string().optional(),
16
- total: z.number(),
17
- });
18
- //# sourceMappingURL=pagination.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/patterns/pagination.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,sCAAsC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,EAAE,CACnC,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IACxC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CACzC,CAAC,CAAC;AAEL,wDAAwD;AACxD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAI,UAAwB,EAAE,EAAE,CAC7D,CAAC,CAAC,MAAM,CAAC;IACP,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;IAC1B,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * Progress schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Progress tracking fields. */
6
- export declare const progressFields: () => z.ZodObject<{
7
- current: z.ZodNumber;
8
- percentage: z.ZodOptional<z.ZodNumber>;
9
- total: z.ZodNumber;
10
- }, z.core.$strip>;
11
- //# sourceMappingURL=progress.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"progress.d.ts","sourceRoot":"","sources":["../../src/patterns/progress.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gCAAgC;AAChC,eAAO,MAAM,cAAc;;;;iBAKvB,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * Progress schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Progress tracking fields. */
6
- export const progressFields = () => z.object({
7
- current: z.number(),
8
- percentage: z.number().optional(),
9
- total: z.number(),
10
- });
11
- //# sourceMappingURL=progress.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/patterns/progress.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gCAAgC;AAChC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CACjC,CAAC,CAAC,MAAM,CAAC;IACP,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Sorting schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Sort fields constrained to a set of allowed column names. */
6
- export declare const sortFields: <const T extends string>(allowedFields: [T, ...T[]]) => z.ZodObject<{
7
- sortBy: z.ZodOptional<z.ZodEnum<{ [k_1 in T]: k_1; } extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never>>;
8
- sortOrder: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
9
- asc: "asc";
10
- desc: "desc";
11
- }>>>;
12
- }, z.core.$strip>;
13
- //# sourceMappingURL=sorting.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sorting.d.ts","sourceRoot":"","sources":["../../src/patterns/sorting.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gEAAgE;AAChE,eAAO,MAAM,UAAU,GAAI,KAAK,CAAC,CAAC,SAAS,MAAM,EAC/C,eAAe,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;;;;;;iBAKxB,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Sorting schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Sort fields constrained to a set of allowed column names. */
6
- export const sortFields = (allowedFields) => z.object({
7
- sortBy: z.enum(allowedFields).optional(),
8
- sortOrder: z.enum(['asc', 'desc']).optional().default('asc'),
9
- });
10
- //# sourceMappingURL=sorting.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sorting.js","sourceRoot":"","sources":["../../src/patterns/sorting.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gEAAgE;AAChE,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,aAA0B,EAC1B,EAAE,CACF,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;IACxC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CAC7D,CAAC,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Status schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Standard workflow status field. */
6
- export declare const statusFields: () => z.ZodObject<{
7
- status: z.ZodEnum<{
8
- cancelled: "cancelled";
9
- pending: "pending";
10
- running: "running";
11
- completed: "completed";
12
- failed: "failed";
13
- }>;
14
- }, z.core.$strip>;
15
- //# sourceMappingURL=status.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/patterns/status.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,sCAAsC;AACtC,eAAO,MAAM,YAAY;;;;;;;;iBAGrB,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Status schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Standard workflow status field. */
6
- export const statusFields = () => z.object({
7
- status: z.enum(['pending', 'running', 'completed', 'failed', 'cancelled']),
8
- });
9
- //# sourceMappingURL=status.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/patterns/status.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,sCAAsC;AACtC,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,EAAE,CAC/B,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC;CAC3E,CAAC,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Timestamp schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Standard createdAt / updatedAt fields. */
6
- export declare const timestampFields: () => z.ZodObject<{
7
- createdAt: z.ZodString;
8
- updatedAt: z.ZodString;
9
- }, z.core.$strip>;
10
- //# sourceMappingURL=timestamps.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"timestamps.d.ts","sourceRoot":"","sources":["../../src/patterns/timestamps.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,6CAA6C;AAC7C,eAAO,MAAM,eAAe;;;iBAIxB,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Timestamp schema helpers for @ontrails/core/patterns
3
- */
4
- import { z } from 'zod';
5
- /** Standard createdAt / updatedAt fields. */
6
- export const timestampFields = () => z.object({
7
- createdAt: z.string(),
8
- updatedAt: z.string(),
9
- });
10
- //# sourceMappingURL=timestamps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"timestamps.js","sourceRoot":"","sources":["../../src/patterns/timestamps.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,6CAA6C;AAC7C,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE,CAClC,CAAC,CAAC,MAAM,CAAC;IACP,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- export { DEFAULT_PATTERNS, DEFAULT_SENSITIVE_KEYS } from './patterns.js';
2
- export { createRedactor } from './redactor.js';
3
- export type { Redactor, RedactorConfig } from './redactor.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/redaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -1,3 +0,0 @@
1
- export { DEFAULT_PATTERNS, DEFAULT_SENSITIVE_KEYS } from './patterns.js';
2
- export { createRedactor } from './redactor.js';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/redaction/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Default redaction patterns and sensitive key lists.
3
- *
4
- * These are used by {@link createRedactor} to strip secrets from strings
5
- * and object values before they reach logs, traces, or error payloads.
6
- */
7
- export declare const DEFAULT_PATTERNS: RegExp[];
8
- export declare const DEFAULT_SENSITIVE_KEYS: string[];
9
- //# sourceMappingURL=patterns.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../src/redaction/patterns.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,eAAO,MAAM,gBAAgB,EAAE,MAAM,EAkBpC,CAAC;AAMF,eAAO,MAAM,sBAAsB,EAAE,MAAM,EAW1C,CAAC"}
@@ -1,39 +0,0 @@
1
- /**
2
- * Default redaction patterns and sensitive key lists.
3
- *
4
- * These are used by {@link createRedactor} to strip secrets from strings
5
- * and object values before they reach logs, traces, or error payloads.
6
- */
7
- // ---------------------------------------------------------------------------
8
- // Regex patterns that match sensitive values inside arbitrary strings
9
- // ---------------------------------------------------------------------------
10
- export const DEFAULT_PATTERNS = [
11
- // Credit card numbers: 4 groups of 4 digits separated by spaces or dashes
12
- /\b\d{4}[- ]\d{4}[- ]\d{4}[- ]\d{4}\b/g,
13
- // SSN: XXX-XX-XXXX
14
- /\b\d{3}-\d{2}-\d{4}\b/g,
15
- // Bearer tokens
16
- /Bearer\s+[A-Za-z0-9\-._~+/]+=*/g,
17
- // Basic auth
18
- /Basic\s+[A-Za-z0-9+/]+=*/g,
19
- // API keys: sk-*, pk_*, sk_* prefixed tokens
20
- /\b(?:sk-|pk_|sk_)[A-Za-z0-9_-]{8,}\b/g,
21
- // JWT tokens: eyJ... (three base64url segments separated by dots)
22
- /\beyJ[A-Za-z0-9_-]+\.eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\b/g,
23
- ];
24
- // ---------------------------------------------------------------------------
25
- // Object keys whose values should always be redacted
26
- // ---------------------------------------------------------------------------
27
- export const DEFAULT_SENSITIVE_KEYS = [
28
- 'password',
29
- 'secret',
30
- 'token',
31
- 'apiKey',
32
- 'api_key',
33
- 'authorization',
34
- 'cookie',
35
- 'ssn',
36
- 'creditCard',
37
- 'credit_card',
38
- ];
39
- //# sourceMappingURL=patterns.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../src/redaction/patterns.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,8EAA8E;AAC9E,sEAAsE;AACtE,8EAA8E;AAE9E,MAAM,CAAC,MAAM,gBAAgB,GAAa;IACxC,0EAA0E;IAC1E,uCAAuC;IAEvC,mBAAmB;IACnB,wBAAwB;IAExB,gBAAgB;IAChB,iCAAiC;IAEjC,aAAa;IACb,2BAA2B;IAE3B,6CAA6C;IAC7C,uCAAuC;IAEvC,kEAAkE;IAClE,2DAA2D;CAC5D,CAAC;AAEF,8EAA8E;AAC9E,qDAAqD;AACrD,8EAA8E;AAE9E,MAAM,CAAC,MAAM,sBAAsB,GAAa;IAC9C,UAAU;IACV,QAAQ;IACR,OAAO;IACP,QAAQ;IACR,SAAS;IACT,eAAe;IACf,QAAQ;IACR,KAAK;IACL,YAAY;IACZ,aAAa;CACd,CAAC"}
@@ -1,27 +0,0 @@
1
- /**
2
- * Redactor — strips sensitive data from strings and objects.
3
- *
4
- * @example
5
- * ```ts
6
- * const r = createRedactor();
7
- * r.redact("token: Bearer abc123"); // "token: [REDACTED]"
8
- * r.redactObject({ password: "s3cret" }); // { password: "[REDACTED]" }
9
- * ```
10
- */
11
- export interface RedactorConfig {
12
- readonly patterns?: RegExp[];
13
- readonly sensitiveKeys?: string[];
14
- readonly replacement?: string;
15
- }
16
- export interface Redactor {
17
- /** Replace all pattern matches in a string with the replacement. */
18
- redact(value: string): string;
19
- /**
20
- * Deep-clone `obj` and redact:
21
- * 1. Values whose key matches a sensitive key (case-insensitive).
22
- * 2. All remaining string values that match a pattern.
23
- */
24
- redactObject<T extends Record<string, unknown>>(obj: T): T;
25
- }
26
- export declare const createRedactor: (config?: RedactorConfig) => Redactor;
27
- //# sourceMappingURL=redactor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redactor.d.ts","sourceRoot":"","sources":["../../src/redaction/redactor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,QAAQ;IACvB,oEAAoE;IACpE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAE9B;;;;OAIG;IACH,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC;CAC5D;AA8HD,eAAO,MAAM,cAAc,GAAI,SAAS,cAAc,KAAG,QAkBxD,CAAC"}