@intutic/shared-types 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +9 -9
  2. package/dist/apiKeyScopes.d.ts +99 -0
  3. package/dist/apiKeyScopes.d.ts.map +1 -0
  4. package/dist/apiKeyScopes.js +140 -0
  5. package/dist/apiKeyScopes.js.map +1 -0
  6. package/dist/attenuation.d.ts +6 -2
  7. package/dist/attenuation.d.ts.map +1 -1
  8. package/dist/attenuation.js +13 -1
  9. package/dist/attenuation.js.map +1 -1
  10. package/dist/auth.d.ts +29 -4
  11. package/dist/auth.d.ts.map +1 -1
  12. package/dist/auth.js +26 -6
  13. package/dist/auth.js.map +1 -1
  14. package/dist/enums.d.ts +9 -26
  15. package/dist/enums.d.ts.map +1 -1
  16. package/dist/enums.js +11 -28
  17. package/dist/enums.js.map +1 -1
  18. package/dist/errors.d.ts +6 -1
  19. package/dist/errors.d.ts.map +1 -1
  20. package/dist/errors.js +6 -1
  21. package/dist/errors.js.map +1 -1
  22. package/dist/finops.d.ts +4 -2
  23. package/dist/finops.d.ts.map +1 -1
  24. package/dist/guardrailRender.d.ts +51 -0
  25. package/dist/guardrailRender.d.ts.map +1 -1
  26. package/dist/guardrailRender.js +69 -1
  27. package/dist/guardrailRender.js.map +1 -1
  28. package/dist/identity.d.ts +0 -18
  29. package/dist/identity.d.ts.map +1 -1
  30. package/dist/identity.js +1 -5
  31. package/dist/identity.js.map +1 -1
  32. package/dist/index.d.ts +12 -8
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +42 -10
  35. package/dist/index.js.map +1 -1
  36. package/dist/mcpDaemonPolicyCache.d.ts +32 -0
  37. package/dist/mcpDaemonPolicyCache.d.ts.map +1 -0
  38. package/dist/mcpDaemonPolicyCache.js +43 -0
  39. package/dist/mcpDaemonPolicyCache.js.map +1 -0
  40. package/dist/notifications.d.ts +1 -1
  41. package/dist/notifications.d.ts.map +1 -1
  42. package/dist/notifications.js +12 -0
  43. package/dist/notifications.js.map +1 -1
  44. package/dist/piiDetectors.d.ts +3 -0
  45. package/dist/piiDetectors.d.ts.map +1 -1
  46. package/dist/piiDetectors.js.map +1 -1
  47. package/dist/piiDetectors.json +11 -6
  48. package/dist/posturePresets.d.ts.map +1 -1
  49. package/dist/posturePresets.js +12 -3
  50. package/dist/posturePresets.js.map +1 -1
  51. package/dist/responses/common.d.ts +63 -0
  52. package/dist/responses/common.d.ts.map +1 -0
  53. package/dist/responses/common.js +43 -0
  54. package/dist/responses/common.js.map +1 -0
  55. package/dist/responses/gateways.d.ts +5297 -0
  56. package/dist/responses/gateways.d.ts.map +1 -0
  57. package/dist/responses/gateways.js +473 -0
  58. package/dist/responses/gateways.js.map +1 -0
  59. package/dist/responses/guardrails.d.ts +5200 -0
  60. package/dist/responses/guardrails.d.ts.map +1 -0
  61. package/dist/responses/guardrails.js +374 -0
  62. package/dist/responses/guardrails.js.map +1 -0
  63. package/dist/responses/identity.d.ts +1659 -0
  64. package/dist/responses/identity.d.ts.map +1 -0
  65. package/dist/responses/identity.js +291 -0
  66. package/dist/responses/identity.js.map +1 -0
  67. package/dist/responses/index.d.ts +15 -0
  68. package/dist/responses/index.d.ts.map +1 -0
  69. package/dist/responses/index.js +31 -0
  70. package/dist/responses/index.js.map +1 -0
  71. package/dist/responses/integrations.d.ts +4248 -0
  72. package/dist/responses/integrations.d.ts.map +1 -0
  73. package/dist/responses/integrations.js +436 -0
  74. package/dist/responses/integrations.js.map +1 -0
  75. package/dist/responses/observability.d.ts +3222 -0
  76. package/dist/responses/observability.d.ts.map +1 -0
  77. package/dist/responses/observability.js +598 -0
  78. package/dist/responses/observability.js.map +1 -0
  79. package/dist/responses/orgSops.d.ts +112 -0
  80. package/dist/responses/orgSops.d.ts.map +1 -0
  81. package/dist/responses/orgSops.js +29 -0
  82. package/dist/responses/orgSops.js.map +1 -0
  83. package/dist/responses/rules.d.ts +1904 -0
  84. package/dist/responses/rules.d.ts.map +1 -0
  85. package/dist/responses/rules.js +331 -0
  86. package/dist/responses/rules.js.map +1 -0
  87. package/dist/skillScan.d.ts +31 -0
  88. package/dist/skillScan.d.ts.map +1 -1
  89. package/dist/skillScan.js +25 -1
  90. package/dist/skillScan.js.map +1 -1
  91. package/dist/sop.d.ts +8 -1
  92. package/dist/sop.d.ts.map +1 -1
  93. package/dist/sop.js.map +1 -1
  94. package/dist/workspaceSettings.d.ts +25 -10
  95. package/dist/workspaceSettings.d.ts.map +1 -1
  96. package/dist/workspaceSettings.js +2 -1
  97. package/dist/workspaceSettings.js.map +1 -1
  98. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  {
2
- "$comment": "PII detectors for both DLP scanners. The Rust proxy embeds this file (packages/proxy/src/dlp/pii_detectors.json); the MCP proxy reads a byte-identical copy (packages/shared-types/src/piiDetectors.json). Edit one, copy it over the other: a test on each side fails while they differ. Regexes are the subset Rust regex and JavaScript RegExp agree on — ASCII classes, no \\b, no \\d, no lookaround — and each match is then checked by the named validator and boundary rule, implemented identically in packages/proxy/src/dlp/pii.rs and packages/mcp-proxy/src/dlpPii.ts. Conformance vectors: packages/shared-types/fixtures/pii-detector-vectors.json.",
2
+ "$comment": "PII detectors for both DLP scanners. The Rust proxy embeds this file (packages/proxy/src/dlp/pii_detectors.json); the MCP proxy reads a byte-identical copy (packages/shared-types/src/piiDetectors.json). Edit one, copy it over the other: a test on each side fails while they differ. Regexes are the subset Rust regex and JavaScript RegExp agree on — ASCII classes, no \\b, no \\d, no lookaround — and each match is then checked by the named validator and boundary rule, implemented identically in packages/proxy/src/dlp/pii.rs and packages/mcp-proxy/src/dlpPii.ts. Conformance vectors: packages/shared-types/fixtures/pii-detector-vectors.json. `default_action` is what a detector does to live traffic (the request sent to the model, the response returned to the client) when neither the workspace nor the machine sets an action; `stored_action` is what it does to the copies Intutic keeps, whatever the live action: matches are redacted in sampled replay contexts and change-manifest targets, and a prompt or response with a match is not written to the response cache. Email and phone stay off on live traffic because coding agents edit real addresses and numbers (package.json authors, git config, fixtures) and a redacted one gets written back as the placeholder; nothing an agent needs is lost by keeping them out of what Intutic stores.",
3
3
  "version": 1,
4
4
  "detectors": [
5
5
  {
@@ -9,7 +9,8 @@
9
9
  "regex": "[0-9]{4}[ -][0-9]{4}[ -][0-9]{4}[ -][0-9]{4}|[0-9]{4}[ -][0-9]{6}[ -][0-9]{4,5}|[0-9]{13,19}",
10
10
  "boundary": "numeric",
11
11
  "validator": "card_luhn",
12
- "default_action": "redact"
12
+ "default_action": "redact",
13
+ "stored_action": "redact"
13
14
  },
14
15
  {
15
16
  "id": "pii.iban",
@@ -18,7 +19,8 @@
18
19
  "regex": "[A-Z]{2}[0-9]{2}(?: ?[A-Z0-9]){11,30}",
19
20
  "boundary": "word",
20
21
  "validator": "iban_mod97",
21
- "default_action": "redact"
22
+ "default_action": "redact",
23
+ "stored_action": "redact"
22
24
  },
23
25
  {
24
26
  "id": "pii.ssn",
@@ -27,7 +29,8 @@
27
29
  "regex": "[0-9]{3}-[0-9]{2}-[0-9]{4}",
28
30
  "boundary": "numeric",
29
31
  "validator": "ssn_ranges",
30
- "default_action": "redact"
32
+ "default_action": "redact",
33
+ "stored_action": "redact"
31
34
  },
32
35
  {
33
36
  "id": "pii.email",
@@ -36,7 +39,8 @@
36
39
  "regex": "[A-Za-z0-9._%+-]{1,64}@[A-Za-z0-9-]{1,63}(?:\\.[A-Za-z0-9-]{1,63}){1,8}",
37
40
  "boundary": "word",
38
41
  "validator": "email_shape",
39
- "default_action": "off"
42
+ "default_action": "off",
43
+ "stored_action": "redact"
40
44
  },
41
45
  {
42
46
  "id": "pii.phone",
@@ -45,7 +49,8 @@
45
49
  "regex": "\\+[1-9][0-9]{0,2}(?:[ .-]?\\([0-9]{1,4}\\)|[ .-]?[0-9]{1,4}){2,7}|(?:1[ .-])?(?:\\([2-9][0-9]{2}\\) ?|[2-9][0-9]{2}[ .-])[2-9][0-9]{2}[ .-][0-9]{4}",
46
50
  "boundary": "numeric",
47
51
  "validator": "phone_digits",
48
- "default_action": "off"
52
+ "default_action": "off",
53
+ "stored_action": "redact"
49
54
  }
50
55
  ],
51
56
  "card_brands": [
@@ -1 +1 @@
1
- {"version":3,"file":"posturePresets.d.ts","sourceRoot":"","sources":["../src/posturePresets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAA;IAC1C,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACtC;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,aAAa,EAkD5C,CAAA;AAEV;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,aAAa,EA6CxC,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,MAAM,CAAA;AAE7C,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAGtF;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,uFAAuF;IACvF,MAAM,EAAE,MAAM,CAAA;IACd,oFAAoF;IACpF,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;CACpB"}
1
+ {"version":3,"file":"posturePresets.d.ts","sourceRoot":"","sources":["../src/posturePresets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAA;IAC1C,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACtC;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,aAAa,EAkD5C,CAAA;AAUV;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,SAAS,aAAa,EAgDxC,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,MAAM,CAAA;AAE7C,yEAAyE;AACzE,wBAAgB,WAAW,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAGtF;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,uFAAuF;IACvF,MAAM,EAAE,MAAM,CAAA;IACd,oFAAoF;IACpF,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;CACpB"}
@@ -80,6 +80,12 @@ exports.SECURITY_POSTURES = [
80
80
  featureFlags: { ff_shadow_enforcement: true },
81
81
  },
82
82
  ];
83
+ /**
84
+ * What every cost posture's response cache keeps, said where the posture is
85
+ * chosen: all three turn exact caching on, and a cache is stored data.
86
+ */
87
+ const CACHE_STORAGE_NOTE = 'Cached answers are kept with their prompt text for 24 hours, scoped to this workspace; ' +
88
+ 'an exchange in which DLP finds a secret or personal data is never cached.';
83
89
  /**
84
90
  * Cost postures: how aggressively the workspace pursues savings.
85
91
  *
@@ -94,7 +100,8 @@ exports.COST_POSTURES = [
94
100
  title: 'Max savings',
95
101
  description: 'Bandit routing enforces its selections, and both response caches serve ' +
96
102
  'repeats without an upstream call. Routing learns from measured integrity ' +
97
- 'and cost; it detects malformed and truncated responses, not subtly worse ones.',
103
+ 'and cost; it detects malformed and truncated responses, not subtly worse ones. ' +
104
+ CACHE_STORAGE_NOTE,
98
105
  settings: {},
99
106
  featureFlags: {
100
107
  ff_bandit_routing: true,
@@ -108,7 +115,8 @@ exports.COST_POSTURES = [
108
115
  title: 'Balanced',
109
116
  description: 'Routing runs in shadow — it reports what it would have picked and what that ' +
110
117
  'would have saved, while every request is served by the model you asked for. ' +
111
- 'Exact-match caching on; semantic caching off.',
118
+ 'Exact-match caching on; semantic caching off. ' +
119
+ CACHE_STORAGE_NOTE,
112
120
  settings: {},
113
121
  featureFlags: {
114
122
  ff_bandit_routing: false,
@@ -121,7 +129,8 @@ exports.COST_POSTURES = [
121
129
  name: 'quality-first',
122
130
  title: 'Quality first',
123
131
  description: 'No routing, no semantic cache: every request is served by the requested ' +
124
- 'model, fresh, with only exact repeats of a whole request served from cache.',
132
+ 'model, fresh, with only exact repeats of a whole request served from cache. ' +
133
+ CACHE_STORAGE_NOTE,
125
134
  settings: {},
126
135
  featureFlags: {
127
136
  ff_bandit_routing: false,
@@ -1 +1 @@
1
- {"version":3,"file":"posturePresets.js","sourceRoot":"","sources":["../src/posturePresets.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AA6HH,kCAGC;AApHD;;GAEG;AACU,QAAA,iBAAiB,GAA6B;IACzD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;QACf,WAAW,EACT,iFAAiF;YACjF,2EAA2E;YAC3E,oEAAoE;QACtE,QAAQ,EAAE;YACR,qBAAqB,EAAE,WAAW;YAClC,oBAAoB,EAA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,EACT,0EAA0E;YAC1E,8EAA8E;YAC9E,kBAAkB;QACpB,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE;YACZ,iBAAiB,EAAE,KAAK;YACxB,iBAAiB,EAAE,KAAK;YACxB,uBAAuB,EAAE,IAAI;YAC7B,0BAA0B,EAAE,KAAK;SAClC;KACF;CACO,CAAA;AAIV,yEAAyE;AACzE,SAAgB,WAAW,CAAC,IAAiB,EAAE,IAAY;IACzD,MAAM,GAAG,GAAG,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,yBAAiB,CAAC,CAAC,CAAC,qBAAa,CAAA;IACnE,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;AACzC,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Building blocks of the control plane's response schemas.
3
+ *
4
+ * Each schema in `src/responses/` describes a response body as the client
5
+ * receives it: JSON, so a timestamp is a string and a field the handler left
6
+ * `undefined` is absent (`.optional()`), not `null` (`.nullable()`). A route
7
+ * declares its schema by answering through `respond(c, Schema, body)`
8
+ * (`services/control-plane/src/lib/respond.ts`); the OpenAPI document
9
+ * publishes it, `tsc` holds the handler's body to it, and the control plane's
10
+ * tests reject a body that does not match it or carries a field it does not
11
+ * declare. Write one from the handler and the service code it returns, never
12
+ * from what a client expects: where the two disagree, the handler is right.
13
+ *
14
+ * Conventions:
15
+ * - Top-level schemas are named `<Thing>Response` and exported with their
16
+ * inferred type under the same name.
17
+ * - No transforms, defaults or coercions: a schema describes, it does not
18
+ * convert.
19
+ * - In a union, put the branch with more fields first: zod keeps the first
20
+ * branch that matches and drops the fields it does not declare, which the
21
+ * tests then report as undeclared.
22
+ *
23
+ * @module
24
+ */
25
+ import { z } from 'zod';
26
+ /** A timestamp: a `Date` the handler returned, serialized by `JSON.stringify`. */
27
+ export declare const IsoTimestamp: z.ZodString;
28
+ /** How a list response's row keys are cased (`lib/listEnvelope.ts` in the control plane). */
29
+ export declare const RowCase: z.ZodEnum<["snake", "camel", "mixed"]>;
30
+ /**
31
+ * The two keys `applyListEnvelope` adds to a list response: the key that
32
+ * holds the rows, and how their keys are cased.
33
+ */
34
+ export declare function listEnvelope<K extends string, C extends z.infer<typeof RowCase>>(listProperty: K, rowCase: C): z.ZodObject<{
35
+ listProperty: z.ZodLiteral<K>;
36
+ rowCase: z.ZodLiteral<C>;
37
+ }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
38
+ listProperty: z.ZodLiteral<K>;
39
+ rowCase: z.ZodLiteral<C>;
40
+ }>, any> extends infer T ? { [k in keyof T]: T[k]; } : never, z.baseObjectInputType<{
41
+ listProperty: z.ZodLiteral<K>;
42
+ rowCase: z.ZodLiteral<C>;
43
+ }> extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1]; } : never>;
44
+ /**
45
+ * A response as a client reads it defensively: every field the schema
46
+ * declares (of any branch of a union), each `unknown` until the client checks
47
+ * it. A client that casts a body to `WireFields<SomeResponse>` instead of
48
+ * `Record<string, unknown>` can read only fields the route sends, so a field
49
+ * renamed on either side fails `tsc` rather than reading as absent forever.
50
+ */
51
+ export type WireFields<T> = {
52
+ [K in T extends unknown ? keyof T : never]?: unknown;
53
+ };
54
+ /** `{ deleted: true }`, the answer of a delete that has nothing else to say. */
55
+ export declare const DeletedResponse: z.ZodObject<{
56
+ deleted: z.ZodLiteral<true>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ deleted: true;
59
+ }, {
60
+ deleted: true;
61
+ }>;
62
+ export type DeletedResponse = z.infer<typeof DeletedResponse>;
63
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/responses/common.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,kFAAkF;AAClF,eAAO,MAAM,YAAY,aAAwC,CAAA;AAEjE,6FAA6F;AAC7F,eAAO,MAAM,OAAO,wCAAsC,CAAA;AAE1D;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,CAAC,CAAC,KAAK,CAAC,OAAO,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;;;;;;;;;kEAE5G;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,CAAC,SAAS,OAAO,GAAG,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,OAAO;CAAE,CAAA;AAEpF,gFAAgF;AAChF,eAAO,MAAM,eAAe;;;;;;EAAyC,CAAA;AACrE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA"}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeletedResponse = exports.RowCase = exports.IsoTimestamp = void 0;
4
+ exports.listEnvelope = listEnvelope;
5
+ /**
6
+ * Building blocks of the control plane's response schemas.
7
+ *
8
+ * Each schema in `src/responses/` describes a response body as the client
9
+ * receives it: JSON, so a timestamp is a string and a field the handler left
10
+ * `undefined` is absent (`.optional()`), not `null` (`.nullable()`). A route
11
+ * declares its schema by answering through `respond(c, Schema, body)`
12
+ * (`services/control-plane/src/lib/respond.ts`); the OpenAPI document
13
+ * publishes it, `tsc` holds the handler's body to it, and the control plane's
14
+ * tests reject a body that does not match it or carries a field it does not
15
+ * declare. Write one from the handler and the service code it returns, never
16
+ * from what a client expects: where the two disagree, the handler is right.
17
+ *
18
+ * Conventions:
19
+ * - Top-level schemas are named `<Thing>Response` and exported with their
20
+ * inferred type under the same name.
21
+ * - No transforms, defaults or coercions: a schema describes, it does not
22
+ * convert.
23
+ * - In a union, put the branch with more fields first: zod keeps the first
24
+ * branch that matches and drops the fields it does not declare, which the
25
+ * tests then report as undeclared.
26
+ *
27
+ * @module
28
+ */
29
+ const zod_1 = require("zod");
30
+ /** A timestamp: a `Date` the handler returned, serialized by `JSON.stringify`. */
31
+ exports.IsoTimestamp = zod_1.z.string().datetime({ offset: true });
32
+ /** How a list response's row keys are cased (`lib/listEnvelope.ts` in the control plane). */
33
+ exports.RowCase = zod_1.z.enum(['snake', 'camel', 'mixed']);
34
+ /**
35
+ * The two keys `applyListEnvelope` adds to a list response: the key that
36
+ * holds the rows, and how their keys are cased.
37
+ */
38
+ function listEnvelope(listProperty, rowCase) {
39
+ return zod_1.z.object({ listProperty: zod_1.z.literal(listProperty), rowCase: zod_1.z.literal(rowCase) });
40
+ }
41
+ /** `{ deleted: true }`, the answer of a delete that has nothing else to say. */
42
+ exports.DeletedResponse = zod_1.z.object({ deleted: zod_1.z.literal(true) });
43
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/responses/common.ts"],"names":[],"mappings":";;;AAoCA,oCAEC;AAtCD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,6BAAuB;AAEvB,kFAAkF;AACrE,QAAA,YAAY,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;AAEjE,6FAA6F;AAChF,QAAA,OAAO,GAAG,OAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAA;AAE1D;;;GAGG;AACH,SAAgB,YAAY,CAAsD,YAAe,EAAE,OAAU;IAC3G,OAAO,OAAC,CAAC,MAAM,CAAC,EAAE,YAAY,EAAE,OAAC,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,OAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;AACzF,CAAC;AAWD,gFAAgF;AACnE,QAAA,eAAe,GAAG,OAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA"}