@zuplo/cli 6.71.22 → 6.71.25

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 (203) hide show
  1. package/node_modules/@fastify/fast-json-stringify-compiler/.github/dependabot.yml +42 -2
  2. package/node_modules/@fastify/fast-json-stringify-compiler/.github/workflows/ci.yml +6 -1
  3. package/node_modules/@fastify/fast-json-stringify-compiler/.github/workflows/lock-threads.yml +19 -0
  4. package/node_modules/@fastify/fast-json-stringify-compiler/LICENSE +1 -1
  5. package/node_modules/@fastify/fast-json-stringify-compiler/README.md +1 -1
  6. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.gitattributes +2 -0
  7. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/dependabot.yml +13 -0
  8. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/workflows/ci.yml +33 -0
  9. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/.github/workflows/lock-threads.yml +19 -0
  10. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/LICENSE +22 -0
  11. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/README.md +742 -0
  12. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench-cmp-branch.js +116 -0
  13. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench-cmp-lib.js +339 -0
  14. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench-thread.js +33 -0
  15. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/benchmark/bench.js +391 -0
  16. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/build/build-schema-validator.js +26 -0
  17. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/eslint.config.js +9 -0
  18. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/examples/example.js +81 -0
  19. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/examples/server.js +42 -0
  20. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/index.js +1308 -0
  21. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/location.js +24 -0
  22. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/merge-schemas.js +9 -0
  23. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/schema-validator.js +1134 -0
  24. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/serializer.js +141 -0
  25. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/standalone.js +34 -0
  26. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/lib/validator.js +96 -0
  27. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/package.json +89 -0
  28. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/additionalProperties.test.js +332 -0
  29. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/allof.test.js +751 -0
  30. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/any.test.js +231 -0
  31. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/anyof.test.js +812 -0
  32. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/array.test.js +688 -0
  33. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/asNumber.test.js +13 -0
  34. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/basic.test.js +400 -0
  35. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/bigint.test.js +76 -0
  36. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/clean-cache.test.js +47 -0
  37. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/const.test.js +314 -0
  38. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/date.test.js +639 -0
  39. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/debug-mode.test.js +130 -0
  40. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/defaults.test.js +376 -0
  41. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/enum.test.js +37 -0
  42. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/fix-604.test.js +25 -0
  43. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/fixtures/.keep +0 -0
  44. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/if-then-else.test.js +540 -0
  45. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/inferType.test.js +92 -0
  46. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/infinity.test.js +55 -0
  47. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/integer.test.js +194 -0
  48. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/invalidSchema.test.js +38 -0
  49. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-479.test.js +57 -0
  50. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-793.test.js +107 -0
  51. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-794.test.js +177 -0
  52. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/issue-836.test.js +183 -0
  53. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-add-comma.test.js +57 -0
  54. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/README.md +10 -0
  55. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4/required.json +54 -0
  56. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft4.test.js +12 -0
  57. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6/required.json +70 -0
  58. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft6.test.js +12 -0
  59. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7/required.json +70 -0
  60. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/draft7.test.js +12 -0
  61. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/json-schema-test-suite/util.js +31 -0
  62. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/missing-values.test.js +88 -0
  63. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/multi-type-serializer.test.js +19 -0
  64. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/nestedObjects.test.js +63 -0
  65. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/nullable.test.js +543 -0
  66. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/oneof.test.js +510 -0
  67. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/patternProperties.test.js +168 -0
  68. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/recursion.test.js +245 -0
  69. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/ref.json +12 -0
  70. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/ref.test.js +2077 -0
  71. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/regex.test.js +32 -0
  72. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/required.test.js +204 -0
  73. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/requiresAjv.test.js +50 -0
  74. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize.test.js +141 -0
  75. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize2.test.js +18 -0
  76. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize3.test.js +17 -0
  77. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize4.test.js +16 -0
  78. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize5.test.js +16 -0
  79. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize6.test.js +22 -0
  80. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/sanitize7.test.js +68 -0
  81. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/side-effect.test.js +196 -0
  82. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/standalone-mode.test.js +219 -0
  83. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/string.test.js +84 -0
  84. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/surrogate.test.js +67 -0
  85. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/toJSON.test.js +203 -0
  86. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/typebox.test.js +36 -0
  87. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/typesArray.test.js +550 -0
  88. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/unknownFormats.test.js +27 -0
  89. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/test/webpack.test.js +50 -0
  90. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/types/index.d.ts +219 -0
  91. package/node_modules/@fastify/fast-json-stringify-compiler/node_modules/fast-json-stringify/types/index.tst.ts +259 -0
  92. package/node_modules/@fastify/fast-json-stringify-compiler/package.json +6 -11
  93. package/node_modules/@fastify/fast-json-stringify-compiler/types/{index.test-d.ts → index.tst.ts} +34 -32
  94. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts +5 -0
  95. package/node_modules/@posthog/core/dist/posthog-core-stateless.d.ts.map +1 -1
  96. package/node_modules/@posthog/core/dist/posthog-core-stateless.js +50 -10
  97. package/node_modules/@posthog/core/dist/posthog-core-stateless.mjs +47 -10
  98. package/node_modules/@posthog/core/dist/posthog-core.d.ts +2 -2
  99. package/node_modules/@posthog/core/dist/posthog-core.d.ts.map +1 -1
  100. package/node_modules/@posthog/core/dist/posthog-core.js +10 -6
  101. package/node_modules/@posthog/core/dist/posthog-core.mjs +11 -7
  102. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.d.ts +1 -0
  103. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.d.ts.map +1 -1
  104. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.js +3 -0
  105. package/node_modules/@posthog/core/dist/testing/PostHogCoreTestClient.mjs +3 -0
  106. package/node_modules/@posthog/core/dist/utils/promise-queue.d.ts +3 -0
  107. package/node_modules/@posthog/core/dist/utils/promise-queue.d.ts.map +1 -1
  108. package/node_modules/@posthog/core/dist/utils/promise-queue.js +15 -3
  109. package/node_modules/@posthog/core/dist/utils/promise-queue.mjs +15 -3
  110. package/node_modules/@posthog/core/package.json +1 -1
  111. package/node_modules/@posthog/core/src/posthog-core-stateless.ts +80 -14
  112. package/node_modules/@posthog/core/src/posthog-core.ts +18 -7
  113. package/node_modules/@posthog/core/src/testing/PostHogCoreTestClient.ts +4 -0
  114. package/node_modules/@posthog/core/src/utils/promise-queue.ts +17 -4
  115. package/node_modules/@posthog/types/dist/posthog.d.ts +12 -0
  116. package/node_modules/@posthog/types/dist/posthog.d.ts.map +1 -1
  117. package/node_modules/@posthog/types/package.json +1 -1
  118. package/node_modules/@posthog/types/src/posthog.ts +13 -0
  119. package/node_modules/@protobufjs/utf8/CHANGELOG.md +8 -0
  120. package/node_modules/@protobufjs/utf8/index.js +29 -18
  121. package/node_modules/@protobufjs/utf8/package.json +2 -2
  122. package/node_modules/@protobufjs/utf8/tests/index.js +5 -0
  123. package/node_modules/@types/node/README.md +1 -1
  124. package/node_modules/@types/node/buffer.d.ts +64 -25
  125. package/node_modules/@types/node/crypto.d.ts +18 -5
  126. package/node_modules/@types/node/diagnostics_channel.d.ts +237 -3
  127. package/node_modules/@types/node/dns.d.ts +1 -1
  128. package/node_modules/@types/node/ffi.d.ts +486 -0
  129. package/node_modules/@types/node/fs/promises.d.ts +3 -0
  130. package/node_modules/@types/node/fs.d.ts +21 -6
  131. package/node_modules/@types/node/http.d.ts +25 -0
  132. package/node_modules/@types/node/index.d.ts +1 -0
  133. package/node_modules/@types/node/package.json +2 -2
  134. package/node_modules/@types/node/process.d.ts +14 -1
  135. package/node_modules/@types/node/quic.d.ts +92 -11
  136. package/node_modules/@types/node/sqlite.d.ts +55 -0
  137. package/node_modules/@types/node/stream/iter.d.ts +150 -0
  138. package/node_modules/@types/node/stream.d.ts +32 -0
  139. package/node_modules/@types/node/test.d.ts +112 -2
  140. package/node_modules/@types/node/ts5.6/index.d.ts +1 -0
  141. package/node_modules/@types/node/ts5.7/index.d.ts +1 -0
  142. package/node_modules/@types/node/util.d.ts +19 -2
  143. package/node_modules/@types/node/v8.d.ts +84 -2
  144. package/node_modules/@types/node/worker_threads.d.ts +8 -7
  145. package/node_modules/@zuplo/core/package.json +1 -1
  146. package/node_modules/@zuplo/graphql/out/esm/index.js +11 -11
  147. package/node_modules/@zuplo/graphql/out/esm/index.js.map +1 -1
  148. package/node_modules/@zuplo/graphql/package.json +1 -1
  149. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  150. package/node_modules/@zuplo/otel/package.json +1 -1
  151. package/node_modules/@zuplo/runtime/out/esm/{chunk-54PA7VDV.js → chunk-4QJJMELB.js} +1 -1
  152. package/node_modules/@zuplo/runtime/out/esm/{chunk-54PA7VDV.js.map → chunk-4QJJMELB.js.map} +1 -1
  153. package/node_modules/@zuplo/runtime/out/esm/chunk-MJWTZPC2.js +402 -0
  154. package/node_modules/@zuplo/runtime/out/esm/chunk-MJWTZPC2.js.map +1 -0
  155. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  156. package/node_modules/@zuplo/runtime/out/esm/index.js.map +1 -1
  157. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +7 -7
  158. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js.map +1 -1
  159. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  160. package/node_modules/@zuplo/runtime/out/types/index.d.ts +263 -19
  161. package/node_modules/@zuplo/runtime/out/types/mcp-gateway/index.d.ts +33 -7
  162. package/node_modules/@zuplo/runtime/package.json +1 -1
  163. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +1 -1
  164. package/node_modules/hono/dist/adapter/bun/websocket.js +3 -1
  165. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +1 -1
  166. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +3 -1
  167. package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +1 -1
  168. package/node_modules/hono/dist/cjs/utils/body.js +12 -4
  169. package/node_modules/hono/dist/cjs/utils/buffer.js +2 -1
  170. package/node_modules/hono/dist/cjs/validator/validator.js +3 -3
  171. package/node_modules/hono/dist/middleware/serve-static/index.js +1 -1
  172. package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +2 -2
  173. package/node_modules/hono/dist/types/utils/body.d.ts +1 -1
  174. package/node_modules/hono/dist/utils/body.js +12 -4
  175. package/node_modules/hono/dist/utils/buffer.js +2 -1
  176. package/node_modules/hono/dist/validator/validator.js +3 -3
  177. package/node_modules/hono/package.json +8 -7
  178. package/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
  179. package/node_modules/iconv-lite/encodings/utf32.js +10 -3
  180. package/node_modules/iconv-lite/package.json +2 -2
  181. package/node_modules/iconv-lite/types/encodings.d.ts +2 -0
  182. package/node_modules/protobufjs/dist/light/protobuf.js +2 -2
  183. package/node_modules/protobufjs/dist/light/protobuf.min.js +2 -2
  184. package/node_modules/protobufjs/dist/minimal/protobuf.js +2 -2
  185. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +2 -2
  186. package/node_modules/protobufjs/dist/protobuf.js +5 -2
  187. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  188. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  189. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  190. package/node_modules/protobufjs/package.json +1 -1
  191. package/node_modules/protobufjs/src/parse.js +3 -0
  192. package/node_modules/toad-cache/README.md +10 -9
  193. package/node_modules/toad-cache/dist/toad-cache.cjs +139 -139
  194. package/node_modules/toad-cache/dist/toad-cache.mjs +136 -140
  195. package/node_modules/toad-cache/package.json +8 -8
  196. package/node_modules/toad-cache/toad-cache.d.cts +20 -14
  197. package/node_modules/toad-cache/toad-cache.d.ts +18 -14
  198. package/package.json +6 -6
  199. package/node_modules/@fastify/fast-json-stringify-compiler/.eslintrc +0 -1
  200. package/node_modules/@zuplo/runtime/out/esm/chunk-36XLJ4X6.js +0 -389
  201. package/node_modules/@zuplo/runtime/out/esm/chunk-36XLJ4X6.js.map +0 -1
  202. package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
  203. /package/node_modules/@zuplo/runtime/out/esm/{chunk-36XLJ4X6.js.LEGAL.txt → chunk-MJWTZPC2.js.LEGAL.txt} +0 -0
@@ -0,0 +1,219 @@
1
+ import Ajv, { Options as AjvOptions } from 'ajv'
2
+
3
+ type Build = typeof build
4
+
5
+ declare namespace build {
6
+ interface BaseSchema {
7
+ /**
8
+ * Schema id
9
+ */
10
+ $id?: string
11
+ /**
12
+ * Schema title
13
+ */
14
+ title?: string;
15
+ /**
16
+ * Schema description
17
+ */
18
+ description?: string;
19
+ /**
20
+ * A comment to be added to the schema
21
+ */
22
+ $comment?: string;
23
+ /**
24
+ * Default value to be assigned when no value is given in the document
25
+ */
26
+ default?: any;
27
+ /**
28
+ * A list of example values that match this schema
29
+ */
30
+ examples?: any[];
31
+ /**
32
+ * Additional schema definition to reference from within the schema
33
+ */
34
+ definitions?: Record<string, Schema>
35
+ /**
36
+ * A set of schemas of which at least one must match
37
+ */
38
+ anyOf?: Partial<Schema>[];
39
+ /**
40
+ * A set of schemas which must all match
41
+ */
42
+ allOf?: Partial<Schema>[];
43
+ /**
44
+ * A conditional schema to check, controls schemas defined in `then` and `else`
45
+ */
46
+ if?: Partial<Schema>;
47
+ /**
48
+ * A schema to apply if the conditional schema from `if` passes
49
+ */
50
+ then?: Partial<Schema>;
51
+ /**
52
+ * A schema to apply if the conditional schema from `if` fails
53
+ */
54
+ else?: Partial<Schema>;
55
+ /**
56
+ * Open API 3.0 spec states that any value that can be null must be declared `nullable`
57
+ * @default false
58
+ */
59
+ nullable?: boolean;
60
+ }
61
+
62
+ export interface RefSchema {
63
+ /**
64
+ * A json-pointer to a schema to use as a reference
65
+ */
66
+ $ref: string;
67
+ }
68
+
69
+ export interface AnySchema extends BaseSchema {
70
+ }
71
+
72
+ export interface StringSchema extends BaseSchema {
73
+ type: 'string';
74
+ format?: string;
75
+ }
76
+
77
+ export interface IntegerSchema extends BaseSchema {
78
+ type: 'integer';
79
+ }
80
+
81
+ export interface NumberSchema extends BaseSchema {
82
+ type: 'number';
83
+ }
84
+
85
+ export interface NullSchema extends BaseSchema {
86
+ type: 'null';
87
+ }
88
+
89
+ export interface BooleanSchema extends BaseSchema {
90
+ type: 'boolean';
91
+ }
92
+
93
+ export interface ArraySchema extends BaseSchema {
94
+ type: 'array';
95
+ /**
96
+ * The schema for the items in the array
97
+ */
98
+ items: Schema | {}
99
+ }
100
+
101
+ export interface TupleSchema extends BaseSchema {
102
+ type: 'array';
103
+ /**
104
+ * The schemas for the items in the tuple
105
+ */
106
+ items: Schema[];
107
+ }
108
+
109
+ type ObjectProperties = Record<string, Partial<Schema>> & {
110
+ anyOf?: ObjectProperties[];
111
+ allOf?: ObjectProperties[];
112
+ if?: ObjectProperties;
113
+ then?: ObjectProperties;
114
+ else?: ObjectProperties;
115
+ }
116
+
117
+ export interface ObjectSchema extends BaseSchema {
118
+ type: 'object';
119
+ /**
120
+ * Describe the properties of the object
121
+ */
122
+ properties?: ObjectProperties;
123
+ /**
124
+ * The required properties of the object
125
+ */
126
+ required?: string[];
127
+ /**
128
+ * Describe properties that have keys following a given pattern
129
+ */
130
+ patternProperties?: ObjectProperties;
131
+ /**
132
+ * Specifies whether additional properties on the object are allowed, and optionally what schema they should
133
+ * adhere to
134
+ * @default false
135
+ */
136
+ additionalProperties?: Schema | boolean;
137
+ }
138
+
139
+ export type Schema =
140
+ | RefSchema
141
+ | StringSchema
142
+ | IntegerSchema
143
+ | NumberSchema
144
+ | NullSchema
145
+ | BooleanSchema
146
+ | ArraySchema
147
+ | TupleSchema
148
+ | ObjectSchema
149
+
150
+ export interface Options {
151
+ /**
152
+ * Optionally add an external definition to reference from your schema
153
+ */
154
+ schema?: Record<string, Schema>
155
+ /**
156
+ * Configure Ajv, which is used to evaluate conditional schemas and combined (anyOf) schemas
157
+ */
158
+ ajv?: AjvOptions
159
+ /**
160
+ * Optionally configure how the integer will be rounded
161
+ *
162
+ * @default 'trunc'
163
+ */
164
+ rounding?: 'ceil' | 'floor' | 'round' | 'trunc'
165
+ /**
166
+ * Running mode of fast-json-stringify
167
+ */
168
+ mode?: 'debug' | 'standalone'
169
+ /**
170
+ * Large arrays are defined as arrays containing, by default, `20000`
171
+ * elements or more. That value can be adjusted via the option parameter
172
+ * `largeArraySize`.
173
+ *
174
+ * @default 20000
175
+ */
176
+ largeArraySize?: number | string | BigInt
177
+ /**
178
+ * Specify the function on how large Arrays should be stringified.
179
+ *
180
+ * @default 'default'
181
+ */
182
+ largeArrayMechanism?: 'default' | 'json-stringify'
183
+ }
184
+
185
+ export const validLargeArrayMechanisms: string[]
186
+ export function restore (value: <TDoc extends object = object>(doc: TDoc) => string): ReturnType<Build>
187
+
188
+ export const build: Build
189
+ export { build as default }
190
+ }
191
+
192
+ interface DebugOption extends build.Options {
193
+ mode: 'debug'
194
+ }
195
+
196
+ interface StandaloneOption extends build.Options {
197
+ mode: 'standalone'
198
+ }
199
+
200
+ type StringCoercible = string | Date | RegExp
201
+ type IntegerCoercible = number | BigInt
202
+
203
+ /**
204
+ * Build a stringify function using a schema of the documents that should be stringified
205
+ * @param schema The schema used to stringify values
206
+ * @param options The options to use (optional)
207
+ */
208
+ declare function build (schema: build.AnySchema, options: DebugOption): { code: string, ajv: Ajv }
209
+ declare function build (schema: build.AnySchema, options: StandaloneOption): string
210
+ declare function build (schema: build.AnySchema, options?: build.Options): <TDoc = any>(doc: TDoc) => any
211
+ declare function build (schema: build.StringSchema, options?: build.Options): <TDoc extends StringCoercible = StringCoercible>(doc: TDoc) => string
212
+ declare function build (schema: build.IntegerSchema | build.NumberSchema, options?: build.Options): <TDoc extends IntegerCoercible = IntegerCoercible>(doc: TDoc) => string
213
+ declare function build (schema: build.NullSchema, options?: build.Options): <TDoc extends null = null>(doc: TDoc) => 'null'
214
+ declare function build (schema: build.BooleanSchema, options?: build.Options): <TDoc extends boolean = boolean>(doc: TDoc) => string
215
+ declare function build (schema: build.ArraySchema | build.TupleSchema, options?: build.Options): <TDoc extends any[]= any[]>(doc: TDoc) => string
216
+ declare function build (schema: build.ObjectSchema, options?: build.Options): <TDoc extends object = object>(doc: TDoc) => string
217
+ declare function build (schema: build.Schema, options?: build.Options): <TDoc = object | any[] | string | number | boolean | null> (doc: TDoc) => string
218
+
219
+ export = build
@@ -0,0 +1,259 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- Test using this disabled, see https://github.com/fastify/fast-json-stringify/pull/683
2
+ import Ajv from 'ajv'
3
+ import build, { restore, Schema, validLargeArrayMechanisms } from '..'
4
+ import { expect } from 'tstyche'
5
+
6
+ // Number schemas
7
+ build({
8
+ type: 'number'
9
+ })(25)
10
+ build({
11
+ type: 'integer'
12
+ })(-5)
13
+ build({
14
+ type: 'integer'
15
+ })(5n)
16
+
17
+ build({
18
+ type: 'number'
19
+ }, { rounding: 'ceil' })
20
+ build({
21
+ type: 'number'
22
+ }, { rounding: 'floor' })
23
+ build({
24
+ type: 'number'
25
+ }, { rounding: 'round' })
26
+ build({
27
+ type: 'number'
28
+ }, { rounding: 'trunc' })
29
+
30
+ expect(build).type.not.toBeCallableWith({
31
+ type: 'number'
32
+ }, { rounding: 'invalid' })
33
+
34
+ // String schema
35
+ build({
36
+ type: 'string'
37
+ })('foobar')
38
+
39
+ // Boolean schema
40
+ build({
41
+ type: 'boolean'
42
+ })(true)
43
+
44
+ // Null schema
45
+ build({
46
+ type: 'null'
47
+ })(null)
48
+
49
+ // Array schemas
50
+ build({
51
+ type: 'array',
52
+ items: { type: 'number' }
53
+ })([25])
54
+ build({
55
+ type: 'array',
56
+ items: [{ type: 'string' }, { type: 'integer' }]
57
+ })(['hello', 42])
58
+
59
+ // Object schemas
60
+ build({
61
+ type: 'object'
62
+ })({})
63
+ build({
64
+ type: 'object',
65
+ properties: {
66
+ foo: { type: 'string' },
67
+ bar: { type: 'integer' }
68
+ },
69
+ required: ['foo'],
70
+ patternProperties: {
71
+ 'baz*': { type: 'null' }
72
+ },
73
+ additionalProperties: {
74
+ type: 'boolean'
75
+ }
76
+ })({ foo: 'bar' })
77
+ build({
78
+ type: 'object',
79
+ properties: {
80
+ foo: { type: 'string' },
81
+ bar: { type: 'integer' }
82
+ },
83
+ required: ['foo'],
84
+ patternProperties: {
85
+ 'baz*': { type: 'null' }
86
+ },
87
+ additionalProperties: {
88
+ type: 'boolean'
89
+ }
90
+ }, { rounding: 'floor' })({ foo: 'bar' })
91
+
92
+ // Reference schemas
93
+ build({
94
+ title: 'Example Schema',
95
+ definitions: {
96
+ num: {
97
+ type: 'object',
98
+ properties: {
99
+ int: {
100
+ type: 'integer'
101
+ }
102
+ }
103
+ },
104
+ str: {
105
+ type: 'string'
106
+ },
107
+ def: {
108
+ type: 'null'
109
+ }
110
+ },
111
+ type: 'object',
112
+ properties: {
113
+ nickname: {
114
+ $ref: '#/definitions/str'
115
+ }
116
+ },
117
+ patternProperties: {
118
+ num: {
119
+ $ref: '#/definitions/num'
120
+ }
121
+ },
122
+ additionalProperties: {
123
+ $ref: '#/definitions/def'
124
+ }
125
+ })({ nickname: '', num: { int: 5 }, other: null })
126
+
127
+ // Conditional/Combined schemas
128
+ build({
129
+ title: 'Conditional/Combined Schema',
130
+ type: 'object',
131
+ properties: {
132
+ something: {
133
+ anyOf: [
134
+ { type: 'string' },
135
+ { type: 'boolean' }
136
+ ]
137
+ }
138
+ },
139
+ if: {
140
+ properties: {
141
+ something: { type: 'string' }
142
+ }
143
+ },
144
+ then: {
145
+ properties: {
146
+ somethingElse: { type: 'number' }
147
+ }
148
+ },
149
+ else: {
150
+ properties: {
151
+ somethingElse: { type: 'null' }
152
+ }
153
+ }
154
+ })({ something: 'a string', somethingElse: 42 })
155
+
156
+ // String schema with format
157
+ build({
158
+ type: 'string',
159
+ format: 'date-time'
160
+ })(new Date())
161
+
162
+ /*
163
+ This overload doesn't work yet -
164
+ TypeScript chooses the generic for the schema
165
+ before it chooses the overload for the options
166
+ parameter.
167
+ let str: string, ajv: Ajv
168
+ str = build({
169
+ type: 'number'
170
+ }, { debugMode: true }).code
171
+ ajv = build({
172
+ type: 'number'
173
+ }, { debugMode: true }).ajv
174
+ str = build({
175
+ type: 'number'
176
+ }, { mode: 'debug' }).code
177
+ ajv = build({
178
+ type: 'number'
179
+ }, { mode: 'debug' }).ajv
180
+ str = build({
181
+ type: 'number'
182
+ }, { mode: 'standalone' })
183
+ */
184
+ const debugCompiled = build({
185
+ title: 'default string',
186
+ type: 'object',
187
+ properties: {
188
+ firstName: {
189
+ type: 'string'
190
+ }
191
+ }
192
+ }, { mode: 'debug' })
193
+
194
+ expect(build.restore(debugCompiled)).type.toBe(build({} as Schema))
195
+ expect(restore(debugCompiled)).type.toBe(build({} as Schema))
196
+
197
+ expect(build.validLargeArrayMechanisms).type.toBe<string[]>()
198
+ expect(validLargeArrayMechanisms).type.toBe<string[]>()
199
+
200
+ /**
201
+ * Schema inference
202
+ */
203
+
204
+ // With inference
205
+ interface InferenceSchema {
206
+ id: string;
207
+ a?: number;
208
+ }
209
+
210
+ const stringify3 = build({
211
+ type: 'object',
212
+ properties: { a: { type: 'string' } },
213
+ })
214
+
215
+ stringify3<InferenceSchema>({ id: '123' })
216
+ stringify3<InferenceSchema>({ a: 123, id: '123' })
217
+ expect(stringify3<InferenceSchema>).type.not.toBeCallableWith({ anotherOne: 'bar' })
218
+ expect(stringify3<Schema>).type.not.toBeCallableWith({ a: 'bar' })
219
+
220
+ // Without inference
221
+ const stringify4 = build({
222
+ type: 'object',
223
+ properties: { a: { type: 'string' } },
224
+ })
225
+ stringify4({ id: '123' })
226
+ stringify4({ a: 123, id: '123' })
227
+ stringify4({ anotherOne: 'bar' })
228
+ stringify4({ a: 'bar' })
229
+
230
+ // Without inference - string type
231
+ const stringify5 = build({
232
+ type: 'string',
233
+ })
234
+ stringify5('foo')
235
+ expect(stringify5).type.not.toBeCallableWith({ id: '123' })
236
+
237
+ // Without inference - null type
238
+ const stringify6 = build({
239
+ type: 'null',
240
+ })
241
+ stringify6(null)
242
+ expect(stringify6).type.not.toBeCallableWith('a string')
243
+
244
+ // Without inference - boolean type
245
+ const stringify7 = build({
246
+ type: 'boolean',
247
+ })
248
+ stringify7(true)
249
+ expect(stringify7).type.not.toBeCallableWith('a string')
250
+
251
+ // largeArrayMechanism
252
+ build({}, { largeArrayMechanism: 'json-stringify' })
253
+ build({}, { largeArrayMechanism: 'default' })
254
+ expect(build).type.not.toBeCallableWith({} as Schema, { largeArrayMechanism: 'invalid' })
255
+
256
+ build({}, { largeArraySize: 2000 })
257
+ build({}, { largeArraySize: '2e4' })
258
+ build({}, { largeArraySize: 2n })
259
+ expect(build).type.not.toBeCallableWith({} as Schema, { largeArraySize: ['asdf'] })
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fastify/fast-json-stringify-compiler",
3
3
  "description": "Build and manage the fast-json-stringify instances for the fastify framework",
4
- "version": "5.0.3",
4
+ "version": "5.1.0",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
7
7
  "types": "types/index.d.ts",
@@ -10,7 +10,7 @@
10
10
  "lint:fix": "eslint --fix",
11
11
  "unit": "c8 --100 node --test",
12
12
  "test": "npm run unit && npm run test:typescript",
13
- "test:typescript": "tsd"
13
+ "test:typescript": "tstyche"
14
14
  },
15
15
  "repository": {
16
16
  "type": "git",
@@ -53,19 +53,14 @@
53
53
  }
54
54
  ],
55
55
  "devDependencies": {
56
- "@fastify/pre-commit": "^2.1.0",
57
- "c8": "^10.1.3",
56
+ "c8": "^11.0.0",
58
57
  "eslint": "^9.17.0",
59
58
  "fastify": "^5.0.0",
60
- "neostandard": "^0.12.0",
59
+ "neostandard": "^0.13.0",
61
60
  "sanitize-filename": "^1.6.3",
62
- "tsd": "^0.31.0"
61
+ "tstyche": "^7.1.0"
63
62
  },
64
- "pre-commit": [
65
- "lint",
66
- "test"
67
- ],
68
63
  "dependencies": {
69
- "fast-json-stringify": "^6.0.0"
64
+ "fast-json-stringify": "^7.0.0"
70
65
  }
71
66
  }
@@ -1,4 +1,4 @@
1
- import { expectAssignable, expectError, expectType } from 'tsd'
1
+ import { expect } from 'tstyche'
2
2
  import SerializerSelector, {
3
3
  RouteDefinition,
4
4
  Serializer,
@@ -14,12 +14,12 @@ import SerializerSelector, {
14
14
 
15
15
  {
16
16
  const compiler = SerializerSelector()
17
- expectType<SerializerFactory>(compiler)
17
+ expect(compiler).type.toBe<SerializerFactory>()
18
18
  }
19
19
 
20
20
  {
21
21
  const compiler = SerializerSelectorNamed()
22
- expectType<SerializerFactory>(compiler)
22
+ expect(compiler).type.toBe<SerializerFactory>()
23
23
  }
24
24
 
25
25
  {
@@ -34,13 +34,13 @@ import SerializerSelector, {
34
34
  const externalSchemas1 = {}
35
35
 
36
36
  const factory = SerializerSelector()
37
- expectType<SerializerFactory>(factory)
37
+ expect(factory).type.toBe<SerializerFactory>()
38
38
  const compiler = factory(externalSchemas1, {})
39
- expectType<SerializerCompiler>(compiler)
39
+ expect(compiler).type.toBe<SerializerCompiler>()
40
40
  const serializeFunc = compiler({ schema: sampleSchema, method: '', url: '', httpStatus: '' })
41
- expectType<Serializer>(serializeFunc)
41
+ expect(serializeFunc).type.toBe<Serializer>()
42
42
 
43
- expectType<string>(serializeFunc({ name: 'hello' }))
43
+ expect(serializeFunc({ name: 'hello' })).type.toBe<string>()
44
44
  }
45
45
 
46
46
  /**
@@ -49,21 +49,21 @@ import SerializerSelector, {
49
49
 
50
50
  const reader = StandaloneSerializer({
51
51
  readMode: true,
52
- restoreFunction: (route: RouteDefinition) => {
53
- expectAssignable<RouteDefinition>(route)
52
+ restoreFunction: (route) => {
53
+ expect(route).type.toBe<RouteDefinition>()
54
54
  return {} as Serializer
55
55
  },
56
56
  })
57
- expectType<SerializerFactory>(reader)
57
+ expect(reader).type.toBe<SerializerFactory>()
58
58
 
59
59
  const writer = StandaloneSerializer({
60
60
  readMode: false,
61
- storeFunction: (route: RouteDefinition, code: string) => {
62
- expectAssignable<RouteDefinition>(route)
63
- expectAssignable<string>(code)
61
+ storeFunction: (route, code) => {
62
+ expect(route).type.toBe<RouteDefinition>()
63
+ expect(code).type.toBe<string>()
64
64
  },
65
65
  })
66
- expectType<SerializerFactory>(writer)
66
+ expect(writer).type.toBe<SerializerFactory>()
67
67
 
68
68
  {
69
69
  const base = {
@@ -100,43 +100,45 @@ expectType<SerializerFactory>(writer)
100
100
  [refSchema.$id]: refSchema
101
101
  }
102
102
 
103
- expectError(StandaloneSerializer({
103
+ expect(StandaloneSerializer).type.not.toBeCallableWith({
104
104
  readMode: true,
105
105
  storeFunction () { }
106
- }))
107
- expectError(StandaloneSerializer({
106
+ })
107
+
108
+ expect(StandaloneSerializer).type.not.toBeCallableWith({
108
109
  readMode: false,
109
110
  restoreFunction () {}
110
- }))
111
- expectError(StandaloneSerializer({
111
+ })
112
+
113
+ expect(StandaloneSerializer).type.not.toBeCallableWith({
112
114
  restoreFunction () {}
113
- }))
115
+ })
114
116
 
115
- expectType<SerializerFactory>(StandaloneSerializer({
117
+ expect(StandaloneSerializer({
116
118
  storeFunction (routeOpts, schemaSerializerCode) {
117
- expectType<RouteDefinition>(routeOpts)
118
- expectType<string>(schemaSerializerCode)
119
+ expect(routeOpts).type.toBe<RouteDefinition>()
120
+ expect(schemaSerializerCode).type.toBe<string>()
119
121
  }
120
- }))
122
+ })).type.toBe<SerializerFactory>()
121
123
 
122
- expectType<SerializerFactory>(StandaloneSerializer({
124
+ expect(StandaloneSerializer({
123
125
  readMode: true,
124
126
  restoreFunction (routeOpts) {
125
- expectType<RouteDefinition>(routeOpts)
127
+ expect(routeOpts).type.toBe<RouteDefinition>()
126
128
  return {} as Serializer
127
129
  }
128
- }))
130
+ })).type.toBe<SerializerFactory>()
129
131
 
130
132
  const factory = StandaloneSerializer({
131
133
  readMode: false,
132
134
  storeFunction (routeOpts, schemaSerializerCode) {
133
- expectType<RouteDefinition>(routeOpts)
134
- expectType<string>(schemaSerializerCode)
135
+ expect(routeOpts).type.toBe<RouteDefinition>()
136
+ expect(schemaSerializerCode).type.toBe<string>()
135
137
  }
136
138
  })
137
- expectType<SerializerFactory>(factory)
139
+ expect(factory).type.toBe<SerializerFactory>()
138
140
 
139
141
  const compiler = factory(schemaMap)
140
- expectType<SerializerCompiler>(compiler)
141
- expectType<Serializer>(compiler(endpointSchema))
142
+ expect(compiler).type.toBe<SerializerCompiler>()
143
+ expect(compiler(endpointSchema)).type.toBe<Serializer>()
142
144
  }
@@ -9,6 +9,7 @@ declare class PostHogFetchNetworkError extends Error {
9
9
  constructor(error: unknown);
10
10
  }
11
11
  export declare const maybeAdd: (key: string, value: JsonType | undefined) => Record<string, JsonType>;
12
+ export declare const applyCallerFeatureFlagOverrides: (target: PostHogEventProperties, callerProperties: PostHogEventProperties) => void;
12
13
  export declare function logFlushError(err: any): Promise<void>;
13
14
  /**
14
15
  * True for the network error PostHog throws when a request fails to reach the server
@@ -55,6 +56,7 @@ export declare abstract class PostHogCoreStateless {
55
56
  private maxQueueSize;
56
57
  private flushInterval;
57
58
  private flushPromise;
59
+ private flushPromises;
58
60
  private shutdownPromise;
59
61
  private requestTimeout;
60
62
  private featureFlagsRequestTimeoutMs;
@@ -222,6 +224,7 @@ export declare abstract class PostHogCoreStateless {
222
224
  * Avoids unnecessary promise errors
223
225
  */
224
226
  private flushBackground;
227
+ private waitForPendingPromises;
225
228
  /**
226
229
  * Flushes the queue of pending events.
227
230
  *
@@ -250,7 +253,9 @@ export declare abstract class PostHogCoreStateless {
250
253
  * @throws PostHogFetchNetworkError
251
254
  * @throws Error
252
255
  */
256
+ protected flushWithPendingPromises(): Promise<void>;
253
257
  flush(): Promise<void>;
258
+ private flushInternal;
254
259
  protected getCustomHeaders(): {
255
260
  [key: string]: string;
256
261
  };