@prisma-next/utils 0.8.0 → 0.9.0-dev.2

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.
@@ -0,0 +1,25 @@
1
+ //#region src/json.d.ts
2
+ /**
3
+ * Structural types for values that can be losslessly round-tripped through
4
+ * `JSON.stringify` / `JSON.parse`.
5
+ *
6
+ * These are *structural* (no nominal brand): a value satisfying `JsonObject`
7
+ * is guaranteed only to have JSON-stringifiable shape, not to carry any
8
+ * particular semantic identity. Use these as the type of opaque "JSON-shaped"
9
+ * data crossing API boundaries when the consumer needs the JSON-cleanness
10
+ * promise but does not need a domain-specific shape.
11
+ *
12
+ * Notable consumers of `JsonObject` include the framework's
13
+ * `ContractSerializer` SPI: `serializeContract` returns `JsonObject` so that
14
+ * call sites can stringify, hash, or feed the result into another SPI without
15
+ * re-asserting JSON-cleanness.
16
+ */
17
+ type JsonPrimitive = string | number | boolean | null;
18
+ type JsonArray = readonly JsonValue[];
19
+ type JsonObject = {
20
+ readonly [key: string]: JsonValue;
21
+ };
22
+ type JsonValue = JsonPrimitive | JsonArray | JsonObject;
23
+ //#endregion
24
+ export { type JsonArray, type JsonObject, type JsonPrimitive, type JsonValue };
25
+ //# sourceMappingURL=json.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.mts","names":[],"sources":["../src/json.ts"],"mappings":";;AAgBA;;;;;AAEA;;;;;AAEA;;;;KAJY,aAAA;AAAA,KAEA,SAAA,YAAqB,SAAA;AAAA,KAErB,UAAA;EAAA,UAAyB,GAAA,WAAc,SAAA;AAAA;AAAA,KAEvC,SAAA,GAAY,aAAA,GAAgB,SAAA,GAAY,UAAA"}
package/dist/json.mjs ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@prisma-next/utils",
3
- "version": "0.8.0",
3
+ "version": "0.9.0-dev.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "description": "Shared utility functions for Prisma Next",
8
8
  "devDependencies": {
9
- "@prisma-next/tsconfig": "0.8.0",
10
- "@prisma-next/tsdown": "0.8.0",
9
+ "@prisma-next/tsconfig": "0.9.0-dev.2",
10
+ "@prisma-next/tsdown": "0.9.0-dev.2",
11
11
  "tsdown": "0.22.0",
12
12
  "typescript": "5.9.3",
13
13
  "vitest": "4.1.5"
@@ -26,6 +26,7 @@
26
26
  "./canonical-stringify": "./dist/canonical-stringify.mjs",
27
27
  "./defined": "./dist/defined.mjs",
28
28
  "./hash-content": "./dist/hash-content.mjs",
29
+ "./json": "./dist/json.mjs",
29
30
  "./redact-db-url": "./dist/redact-db-url.mjs",
30
31
  "./result": "./dist/result.mjs",
31
32
  "./simplify-deep": "./dist/simplify-deep.mjs",
@@ -0,0 +1 @@
1
+ export type { JsonArray, JsonObject, JsonPrimitive, JsonValue } from '../json';
package/src/json.ts ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Structural types for values that can be losslessly round-tripped through
3
+ * `JSON.stringify` / `JSON.parse`.
4
+ *
5
+ * These are *structural* (no nominal brand): a value satisfying `JsonObject`
6
+ * is guaranteed only to have JSON-stringifiable shape, not to carry any
7
+ * particular semantic identity. Use these as the type of opaque "JSON-shaped"
8
+ * data crossing API boundaries when the consumer needs the JSON-cleanness
9
+ * promise but does not need a domain-specific shape.
10
+ *
11
+ * Notable consumers of `JsonObject` include the framework's
12
+ * `ContractSerializer` SPI: `serializeContract` returns `JsonObject` so that
13
+ * call sites can stringify, hash, or feed the result into another SPI without
14
+ * re-asserting JSON-cleanness.
15
+ */
16
+
17
+ export type JsonPrimitive = string | number | boolean | null;
18
+
19
+ export type JsonArray = readonly JsonValue[];
20
+
21
+ export type JsonObject = { readonly [key: string]: JsonValue };
22
+
23
+ export type JsonValue = JsonPrimitive | JsonArray | JsonObject;