@transcend-io/type-utils 3.1.0 → 3.2.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.
- package/dist/index.d.mts +17 -3
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +295 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -360,10 +360,20 @@ interface JSONSchema7 {
|
|
|
360
360
|
}
|
|
361
361
|
//#endregion
|
|
362
362
|
//#region src/codecTools/toJsonSchema.d.ts
|
|
363
|
+
/**
|
|
364
|
+
* Options for converting an `io-ts` codec to JSON Schema.
|
|
365
|
+
*/
|
|
366
|
+
interface ToJsonSchemaOptions {
|
|
367
|
+
/**
|
|
368
|
+
* Replace reused codecs with local draft-07 `definitions` references when
|
|
369
|
+
* doing so makes the serialized schema smaller.
|
|
370
|
+
*/
|
|
371
|
+
useReferences?: boolean;
|
|
372
|
+
}
|
|
363
373
|
/**
|
|
364
374
|
* Convert an `io-ts` codec to a JSON Schema (v7).
|
|
365
375
|
*/
|
|
366
|
-
declare const toJsonSchema: (rawType: any, strict?: boolean, alwaysIncludeRequired?: boolean) => JSONSchema7;
|
|
376
|
+
declare const toJsonSchema: (rawType: any, strict?: boolean, alwaysIncludeRequired?: boolean, options?: ToJsonSchemaOptions) => JSONSchema7;
|
|
367
377
|
//#endregion
|
|
368
378
|
//#region src/codecTools/createDefaultCodec.d.ts
|
|
369
379
|
/**
|
|
@@ -488,8 +498,12 @@ declare function invertSafe<TKey extends string, TValue extends string>(obj: { [
|
|
|
488
498
|
//#region src/valuesOf.d.ts
|
|
489
499
|
/**
|
|
490
500
|
* Build an `io-ts` codec over the values of an enum-like object.
|
|
501
|
+
*
|
|
502
|
+
* @param enm - Enum-like object
|
|
503
|
+
* @param name - Optional stable codec name
|
|
504
|
+
* @returns Codec accepting the enum values
|
|
491
505
|
*/
|
|
492
|
-
declare function valuesOf<TEnum extends string>(enm: { [key in string]: TEnum }): t.KeyofC<{ [key in TEnum]: unknown }>;
|
|
506
|
+
declare function valuesOf<TEnum extends string>(enm: { [key in string]: TEnum }, name?: string): t.KeyofC<{ [key in TEnum]: unknown }>;
|
|
493
507
|
//#endregion
|
|
494
508
|
//#region src/findAllWithRegex.d.ts
|
|
495
509
|
/**
|
|
@@ -594,5 +608,5 @@ declare class NoExcessType<C extends t.Any, A = C['_A'], O = A, I = unknown> ext
|
|
|
594
608
|
constructor(name: string, is: NoExcessType<C, A, O, I>['is'], validate: NoExcessType<C, A, O, I>['validate'], encode: NoExcessType<C, A, O, I>['encode'], type: C);
|
|
595
609
|
}
|
|
596
610
|
//#endregion
|
|
597
|
-
export { AnyArray, AnyFunction, ArrOrIdentityType, ArrType, CODEC_ERROR_MESSAGE, DeepPartial, DictionaryC, EnumInput, Enumerate, FindAllRegExp, FixedLengthArray, FixedLengthArrayBrand, FixedLengthString, FixedLengthStringBrand, Gql, HttpMethod, INTERFACE_REGEX, Identity, KeysStrictlyEqual, Merge, NoExcessType, NonEmptyString, Nullable, ObjByString, Optionalize, OrArray, Override, PartialRecordC, PromiseType, RecursiveIdentity, RecursiveObjectReplace, RecursiveTypeReplace, RegExpMatch, Requirize, Spread, StringKeys, StringKeysSafe, StringValues, Stringify, SubNotType, SubType, SubTypeRequired, TypescriptEnum, UnionToIntersection, aggregateObjects, apply, applyEnum, asyncApply, createDefaultCodec, createEnum, decodeCodec, dictionary, filterEnum, findAllWithRegex, flattenObject, fromEntries, getEntries, getKeys, getStringKeys, getValues, gql, groupBy, invert, invertSafe, isCodecError, listToEnum, makeEnum, noExcess, partialRecord, toJsonSchema, transposeObjectArray, valuesOf };
|
|
611
|
+
export { AnyArray, AnyFunction, ArrOrIdentityType, ArrType, CODEC_ERROR_MESSAGE, DeepPartial, DictionaryC, EnumInput, Enumerate, FindAllRegExp, FixedLengthArray, FixedLengthArrayBrand, FixedLengthString, FixedLengthStringBrand, Gql, HttpMethod, INTERFACE_REGEX, Identity, KeysStrictlyEqual, Merge, NoExcessType, NonEmptyString, Nullable, ObjByString, Optionalize, OrArray, Override, PartialRecordC, PromiseType, RecursiveIdentity, RecursiveObjectReplace, RecursiveTypeReplace, RegExpMatch, Requirize, Spread, StringKeys, StringKeysSafe, StringValues, Stringify, SubNotType, SubType, SubTypeRequired, ToJsonSchemaOptions, TypescriptEnum, UnionToIntersection, aggregateObjects, apply, applyEnum, asyncApply, createDefaultCodec, createEnum, decodeCodec, dictionary, filterEnum, findAllWithRegex, flattenObject, fromEntries, getEntries, getKeys, getStringKeys, getValues, gql, groupBy, invert, invertSafe, isCodecError, listToEnum, makeEnum, noExcess, partialRecord, toJsonSchema, transposeObjectArray, valuesOf };
|
|
598
612
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":["JSONSchema4TypeName","JSONSchema4Type","JSONSchema4Object","JSONSchema4Array","key","Array","JSONSchema4Version","JSONSchema4","id","$ref","$schema","title","description","default","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","items","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","definitions","k","properties","patternProperties","dependencies","enum","type","allOf","anyOf","oneOf","not","extends","format","JSONSchema6TypeName","JSONSchema6Type","JSONSchema6Object","JSONSchema6Array","JSONSchema6Version","JSONSchema6Definition","JSONSchema6","$id","contains","propertyNames","const","examples","JSONSchema7TypeName","JSONSchema7Type","JSONSchema7Object","JSONSchema7Array","JSONSchema7Version","JSONSchema7Definition","JSONSchema7","$comment","$defs","if","then","else","contentMediaType","contentEncoding","readOnly","writeOnly","ValidationResult","ValidationError","valid","errors","property","message","validate","instance","schema","checkPropertyChange","value","mustBeValid","result"],"sources":["../src/types.ts","../src/apply.ts","../src/codecTools/decodeCodec.ts","../src/codecTools/dictionary.ts","../src/codecTools/FixedLengthString.ts","../src/codecTools/FixedLengthArray.ts","../src/codecTools/partialRecord.ts","../src/codecTools/isCodecError.ts","../src/codecTools/NonEmptyString.ts","../../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts","../src/codecTools/toJsonSchema.ts","../src/codecTools/createDefaultCodec.ts","../src/enum.ts","../src/enums.ts","../src/getEntries.ts","../src/getKeys.ts","../src/getValues.ts","../src/groupBy.ts","../src/gql.ts","../src/invert.ts","../src/valuesOf.ts","../src/findAllWithRegex.ts","../src/flattenObject.ts","../src/aggregateObjects.ts","../src/transposeObjectArray.ts","../src/fromEntries.ts","../src/noExcess.ts"],"x_google_ignoreList":[9],"mappings":";;;;;;KAGY,WAAA;;;AAKZ;KAAY,WAAA,OAAkB,IAAA;;;;KAKlB,QAAA;;;;KAKA,OAAA,eAAsB,QAAA,IAAY,KAAA,2BAAgC,KAAA;AAA9E;;;AAAA,KAKY,WAAA,UAAqB,KAAA,SAAc,OAAA,iBAAwB,MAAA,GAAS,KAAA;;;;KAKpE,iBAAA,UAA2B,KAAA,2BAAgC,KAAA,GAAQ,KAAA;;;;KAKnE,OAAA,MAAa,CAAA,GAAI,CAAA;;;;KAKjB,QAAA,oBACE,CAAA,GAAI,CAAA,CAAE,CAAA;;;;KAMR,iBAAA,MAAuB,CAAA,SAAU,QAAA,GACzC,OAAA,CAAQ,CAAA,mBACN,QAAA,CAAS,OAAA,CAAQ,CAAA,OACjB,CAAA,GACF,CAAA,kBACE,CAAA,GACA,CAAA,gCAEgB,CAAA,GAAI,CAAA,CAAE,CAAA,mBAAoB,QAAA,CAAS,CAAA,CAAE,CAAA,KAAM,CAAA,CAAE,CAAA,MAE3D,CAAA;;;;KAKI,WAAA,oBAA+B,CAAA,IAAK,QAAA,CAAS,IAAA,CAAK,CAAA,EAAG,CAAA,IAAK,OAAA,CAAQ,CAAA;;;;KAKlE,SAAA,oBAA6B,CAAA,IAAK,QAAA,CAAS,IAAA,CAAK,CAAA,EAAG,CAAA,IAAK,QAAA,SAAiB,CAAA,GAAI,CA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D,qCwBOlB,OAAA,EAAS,CAAA,IxBPS;EwBSlB,UAAA,EAAY,CAAA,IxBJF;EwBMV,OAAA;IxBNiB,wEwBQf,sBAAA;EAAA;AAAA,MAEA,qBAAA,CAAsB,CAAA,EAAG,CAAA;;;;;;iBCzBb,WAAA,wBAAmC,aAAA,WAAwB,WAAA,YAAA,CACzE,OAAA,EAAS,QAAA,WACA,QAAA,YAAoB,CAAA,MAAO,CAAA;;;;;AzBFtC;c0BiFa,QAAA,aAAsB,CAAA,CAAE,QAAA,EACnC,KAAA,EAAO,CAAA,EACP,IAAA,cACC,YAAA,CAAa,CAAA;;;;cAoCH,YAAA,WAAuB,CAAA,CAAE,GAAA,MAAS,CAAA,YAAa,CAAA,uBAAwB,CAAA,CAAE,IAAA,CACpF,CAAA,EACA,CAAA,EACA,CAAA;EAAA,SASkB,IAAA,EAAM,CAAA;EAAA,SAPR,IAAA;cAGd,IAAA,UACA,EAAA,EAAI,YAAA,CAAa,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,SAC1B,QAAA,EAAU,YAAA,CAAa,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,eAChC,MAAA,EAAQ,YAAA,CAAa,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAA,aACd,IAAA,EAAM,CAAA;AAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":["JSONSchema4TypeName","JSONSchema4Type","JSONSchema4Object","JSONSchema4Array","key","Array","JSONSchema4Version","JSONSchema4","id","$ref","$schema","title","description","default","multipleOf","maximum","exclusiveMaximum","minimum","exclusiveMinimum","maxLength","minLength","pattern","additionalItems","items","maxItems","minItems","uniqueItems","maxProperties","minProperties","required","additionalProperties","definitions","k","properties","patternProperties","dependencies","enum","type","allOf","anyOf","oneOf","not","extends","format","JSONSchema6TypeName","JSONSchema6Type","JSONSchema6Object","JSONSchema6Array","JSONSchema6Version","JSONSchema6Definition","JSONSchema6","$id","contains","propertyNames","const","examples","JSONSchema7TypeName","JSONSchema7Type","JSONSchema7Object","JSONSchema7Array","JSONSchema7Version","JSONSchema7Definition","JSONSchema7","$comment","$defs","if","then","else","contentMediaType","contentEncoding","readOnly","writeOnly","ValidationResult","ValidationError","valid","errors","property","message","validate","instance","schema","checkPropertyChange","value","mustBeValid","result"],"sources":["../src/types.ts","../src/apply.ts","../src/codecTools/decodeCodec.ts","../src/codecTools/dictionary.ts","../src/codecTools/FixedLengthString.ts","../src/codecTools/FixedLengthArray.ts","../src/codecTools/partialRecord.ts","../src/codecTools/isCodecError.ts","../src/codecTools/NonEmptyString.ts","../../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts","../src/codecTools/toJsonSchema.ts","../src/codecTools/createDefaultCodec.ts","../src/enum.ts","../src/enums.ts","../src/getEntries.ts","../src/getKeys.ts","../src/getValues.ts","../src/groupBy.ts","../src/gql.ts","../src/invert.ts","../src/valuesOf.ts","../src/findAllWithRegex.ts","../src/flattenObject.ts","../src/aggregateObjects.ts","../src/transposeObjectArray.ts","../src/fromEntries.ts","../src/noExcess.ts"],"x_google_ignoreList":[9],"mappings":";;;;;;KAGY,WAAA;;;AAKZ;KAAY,WAAA,OAAkB,IAAA;;;;KAKlB,QAAA;;;;KAKA,OAAA,eAAsB,QAAA,IAAY,KAAA,2BAAgC,KAAA;AAA9E;;;AAAA,KAKY,WAAA,UAAqB,KAAA,SAAc,OAAA,iBAAwB,MAAA,GAAS,KAAA;;;;KAKpE,iBAAA,UAA2B,KAAA,2BAAgC,KAAA,GAAQ,KAAA;;;;KAKnE,OAAA,MAAa,CAAA,GAAI,CAAA;;;;KAKjB,QAAA,oBACE,CAAA,GAAI,CAAA,CAAE,CAAA;;;;KAMR,iBAAA,MAAuB,CAAA,SAAU,QAAA,GACzC,OAAA,CAAQ,CAAA,mBACN,QAAA,CAAS,OAAA,CAAQ,CAAA,OACjB,CAAA,GACF,CAAA,kBACE,CAAA,GACA,CAAA,gCAEgB,CAAA,GAAI,CAA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mjs
CHANGED
|
@@ -145,23 +145,35 @@ const NonEmptyString = t.brand(t.string, (value) => value.trim().length !== 0, "
|
|
|
145
145
|
/**
|
|
146
146
|
* Convert an `io-ts` codec to a JSON Schema (v7).
|
|
147
147
|
*/
|
|
148
|
-
const toJsonSchema = (rawType, strict = false, alwaysIncludeRequired = false) => {
|
|
148
|
+
const toJsonSchema = (rawType, strict = false, alwaysIncludeRequired = false, options = {}) => {
|
|
149
|
+
const context = { schemaCodecs: /* @__PURE__ */ new WeakMap() };
|
|
150
|
+
const schema = convertToJsonSchema(rawType, strict, alwaysIncludeRequired, context);
|
|
151
|
+
return options.useReferences ? addCodecReferences(schema, context) : schema;
|
|
152
|
+
};
|
|
153
|
+
/**
|
|
154
|
+
* Recursively convert an `io-ts` codec to an inline JSON Schema.
|
|
155
|
+
*
|
|
156
|
+
* Keeping this pass reference-free is important because parent codecs inspect
|
|
157
|
+
* and transform their generated child schemas.
|
|
158
|
+
*/
|
|
159
|
+
const convertToJsonSchema = (rawType, strict, alwaysIncludeRequired, context) => {
|
|
149
160
|
const type = rawType;
|
|
150
|
-
|
|
151
|
-
if (type._tag === "
|
|
152
|
-
if (type._tag === "
|
|
153
|
-
if (type._tag === "
|
|
154
|
-
if (type._tag === "
|
|
155
|
-
if (type._tag === "
|
|
161
|
+
const tracked = (schema) => trackSchema(type, schema, context);
|
|
162
|
+
if (type._tag === "StringType") return tracked({ type: "string" });
|
|
163
|
+
if (type._tag === "NumberType") return tracked({ type: "number" });
|
|
164
|
+
if (type._tag === "NullType") return tracked({ type: "null" });
|
|
165
|
+
if (type._tag === "BooleanType") return tracked({ type: "boolean" });
|
|
166
|
+
if (type._tag === "LiteralType") return tracked({ const: type.value });
|
|
167
|
+
if (type._tag === "KeyofType") return tracked({
|
|
156
168
|
type: "string",
|
|
157
169
|
enum: Object.keys(type.keys)
|
|
158
|
-
};
|
|
159
|
-
if (type._tag === "UnionType") return { anyOf: type.types.map((subtype) =>
|
|
160
|
-
if (type._tag === "IntersectionType" && !alwaysIncludeRequired) return { allOf: type.types.map((subtype) =>
|
|
170
|
+
});
|
|
171
|
+
if (type._tag === "UnionType") return tracked({ anyOf: type.types.map((subtype) => convertToJsonSchema(subtype, strict, alwaysIncludeRequired, context)) });
|
|
172
|
+
if (type._tag === "IntersectionType" && !alwaysIncludeRequired) return tracked({ allOf: type.types.map((subtype) => convertToJsonSchema(subtype, strict, alwaysIncludeRequired, context)) });
|
|
161
173
|
if (type._tag === "IntersectionType" && alwaysIncludeRequired) {
|
|
162
|
-
const results = type.types.map((subtype) =>
|
|
174
|
+
const results = type.types.map((subtype) => convertToJsonSchema(subtype, strict, alwaysIncludeRequired, context));
|
|
163
175
|
if (!results.every((result) => result.type === "object")) throw new Error("InterfaceType must have all children as type=object");
|
|
164
|
-
return {
|
|
176
|
+
return tracked({
|
|
165
177
|
type: "object",
|
|
166
178
|
required: results.map((result) => result.required).flat(),
|
|
167
179
|
properties: results.reduce((accumulator, result) => ({
|
|
@@ -169,47 +181,289 @@ const toJsonSchema = (rawType, strict = false, alwaysIncludeRequired = false) =>
|
|
|
169
181
|
...result.properties
|
|
170
182
|
}), {}),
|
|
171
183
|
...strict ? { additionalProperties: false } : {}
|
|
172
|
-
};
|
|
184
|
+
});
|
|
173
185
|
}
|
|
174
|
-
if (type._tag === "InterfaceType") return {
|
|
186
|
+
if (type._tag === "InterfaceType") return tracked({
|
|
175
187
|
type: "object",
|
|
176
188
|
required: Object.keys(type.props),
|
|
177
|
-
properties: Object.fromEntries(Object.entries(type.props).map(([key, subtype]) => [key,
|
|
189
|
+
properties: Object.fromEntries(Object.entries(type.props).map(([key, subtype]) => [key, convertToJsonSchema(subtype, strict, alwaysIncludeRequired, context)])),
|
|
178
190
|
...strict ? { additionalProperties: false } : {}
|
|
179
|
-
};
|
|
180
|
-
if (type._tag === "DictionaryType") return {
|
|
191
|
+
});
|
|
192
|
+
if (type._tag === "DictionaryType") return tracked({
|
|
181
193
|
type: "object",
|
|
182
|
-
additionalProperties:
|
|
183
|
-
};
|
|
184
|
-
if (type._tag === "PartialType") return {
|
|
194
|
+
additionalProperties: convertToJsonSchema(type.codomain, strict, alwaysIncludeRequired, context)
|
|
195
|
+
});
|
|
196
|
+
if (type._tag === "PartialType") return tracked({
|
|
185
197
|
type: "object",
|
|
186
198
|
...alwaysIncludeRequired ? { required: Object.keys(type.props) } : {},
|
|
187
199
|
properties: Object.fromEntries(Object.entries(type.props).map(([key, subtype]) => {
|
|
188
|
-
const result =
|
|
189
|
-
return [key, alwaysIncludeRequired && result.type ? {
|
|
200
|
+
const result = convertToJsonSchema(subtype, strict, alwaysIncludeRequired, context);
|
|
201
|
+
return [key, alwaysIncludeRequired && result.type ? trackSchema(subtype, {
|
|
190
202
|
...result,
|
|
191
203
|
type: [result.type, "null"]
|
|
192
|
-
} : result];
|
|
204
|
+
}, context) : result];
|
|
193
205
|
})),
|
|
194
206
|
...strict ? { additionalProperties: false } : {}
|
|
195
|
-
};
|
|
196
|
-
if (type._tag === "ArrayType") return {
|
|
207
|
+
});
|
|
208
|
+
if (type._tag === "ArrayType") return tracked({
|
|
197
209
|
type: "array",
|
|
198
|
-
items:
|
|
199
|
-
};
|
|
200
|
-
if (type._tag === "TupleType") return {
|
|
210
|
+
items: convertToJsonSchema(type.type, strict, alwaysIncludeRequired, context)
|
|
211
|
+
});
|
|
212
|
+
if (type._tag === "TupleType") return tracked({
|
|
201
213
|
type: "array",
|
|
202
|
-
items: type.types.map((subtype) =>
|
|
203
|
-
};
|
|
214
|
+
items: type.types.map((subtype) => convertToJsonSchema(subtype, strict, alwaysIncludeRequired, context))
|
|
215
|
+
});
|
|
204
216
|
if (type._tag === "RefinementType") {
|
|
205
|
-
if (type.name === "Int") return { type: "integer" };
|
|
206
|
-
return {
|
|
207
|
-
...
|
|
217
|
+
if (type.name === "Int") return tracked({ type: "integer" });
|
|
218
|
+
return tracked({
|
|
219
|
+
...convertToJsonSchema(type.type, strict, alwaysIncludeRequired, context),
|
|
208
220
|
description: `Predicate: ${type.predicate.name || type.name}`
|
|
209
|
-
};
|
|
221
|
+
});
|
|
210
222
|
}
|
|
211
|
-
return unhandledType(type);
|
|
223
|
+
return tracked(unhandledType(type));
|
|
212
224
|
};
|
|
225
|
+
/**
|
|
226
|
+
* Associate a generated schema object with the codec that produced it.
|
|
227
|
+
*
|
|
228
|
+
* @param codec - Source codec
|
|
229
|
+
* @param schema - Generated schema
|
|
230
|
+
* @param context - Shared conversion state
|
|
231
|
+
* @returns The generated schema
|
|
232
|
+
*/
|
|
233
|
+
function trackSchema(codec, schema, context) {
|
|
234
|
+
context.schemaCodecs.set(schema, codec);
|
|
235
|
+
return schema;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Move schemas produced by reused codec objects into local draft-07
|
|
239
|
+
* definitions.
|
|
240
|
+
*
|
|
241
|
+
* @param schema - Fully generated inline schema
|
|
242
|
+
* @param context - Shared conversion state
|
|
243
|
+
* @returns A smaller equivalent schema when references are beneficial
|
|
244
|
+
*/
|
|
245
|
+
function addCodecReferences(schema, context) {
|
|
246
|
+
const candidates = /* @__PURE__ */ new Map();
|
|
247
|
+
collectCodecCandidates(schema, context, candidates);
|
|
248
|
+
const definitionNames = /* @__PURE__ */ new WeakMap();
|
|
249
|
+
const selectedCandidates = /* @__PURE__ */ new Map();
|
|
250
|
+
const usedDefinitionNames = /* @__PURE__ */ new Set();
|
|
251
|
+
for (const variants of candidates.values()) for (const candidate of variants.values()) {
|
|
252
|
+
if (candidate.occurrences < 2) continue;
|
|
253
|
+
const definitionName = buildDefinitionName(candidate, usedDefinitionNames);
|
|
254
|
+
const reference = { $ref: `#/definitions/${definitionName}` };
|
|
255
|
+
const inlineSize = candidate.serializedSchema.length * candidate.occurrences;
|
|
256
|
+
if (candidate.serializedSchema.length + JSON.stringify(definitionName).length + 1 + JSON.stringify(reference).length * candidate.occurrences < inlineSize) {
|
|
257
|
+
usedDefinitionNames.add(definitionName);
|
|
258
|
+
selectedCandidates.set(definitionName, candidate);
|
|
259
|
+
candidate.schemas.forEach((candidateSchema) => definitionNames.set(candidateSchema, definitionName));
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
if (selectedCandidates.size === 0) return schema;
|
|
263
|
+
const definitions = {};
|
|
264
|
+
const result = inlineUnprofitableDefinitions(replaceCodecCandidates(schema, definitionNames, selectedCandidates, definitions), definitions);
|
|
265
|
+
return JSON.stringify(result).length < JSON.stringify(schema).length ? result : schema;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Collect schema variants by the identity of the codec that produced them.
|
|
269
|
+
*
|
|
270
|
+
* A codec can produce different schemas in different parent contexts, so its
|
|
271
|
+
* serialized schema is a secondary key.
|
|
272
|
+
*
|
|
273
|
+
* @param value - Current generated schema value
|
|
274
|
+
* @param context - Shared conversion state
|
|
275
|
+
* @param candidates - Candidates grouped by codec identity and schema variant
|
|
276
|
+
*/
|
|
277
|
+
function collectCodecCandidates(value, context, candidates) {
|
|
278
|
+
if (Array.isArray(value)) {
|
|
279
|
+
value.forEach((item) => collectCodecCandidates(item, context, candidates));
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (!isRecord(value)) return;
|
|
283
|
+
const schema = value;
|
|
284
|
+
const codec = context.schemaCodecs.get(schema);
|
|
285
|
+
if (codec) {
|
|
286
|
+
const serializedSchema = JSON.stringify(schema);
|
|
287
|
+
const variants = candidates.get(codec) ?? /* @__PURE__ */ new Map();
|
|
288
|
+
const candidate = variants.get(serializedSchema);
|
|
289
|
+
if (candidate) {
|
|
290
|
+
candidate.occurrences += 1;
|
|
291
|
+
candidate.schemas.push(schema);
|
|
292
|
+
} else {
|
|
293
|
+
variants.set(serializedSchema, {
|
|
294
|
+
codec,
|
|
295
|
+
occurrences: 1,
|
|
296
|
+
schemas: [schema],
|
|
297
|
+
serializedSchema,
|
|
298
|
+
schema
|
|
299
|
+
});
|
|
300
|
+
candidates.set(codec, variants);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
Object.values(value).forEach((child) => collectCodecCandidates(child, context, candidates));
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Replace selected codec schemas with references, creating definitions lazily
|
|
307
|
+
* so unused nested candidates are omitted.
|
|
308
|
+
*
|
|
309
|
+
* @param value - Current generated schema value
|
|
310
|
+
* @param definitionNames - Definition name for each selected schema object
|
|
311
|
+
* @param selectedCandidates - Selected candidates indexed by definition name
|
|
312
|
+
* @param definitions - Definitions created while replacing candidates
|
|
313
|
+
* @returns A copy with selected codec schemas replaced
|
|
314
|
+
*/
|
|
315
|
+
function replaceCodecCandidates(value, definitionNames, selectedCandidates, definitions) {
|
|
316
|
+
if (Array.isArray(value)) return value.map((item) => replaceCodecCandidates(item, definitionNames, selectedCandidates, definitions));
|
|
317
|
+
if (!isRecord(value)) return value;
|
|
318
|
+
const definitionName = definitionNames.get(value);
|
|
319
|
+
if (definitionName) {
|
|
320
|
+
ensureDefinition(definitionName, definitionNames, selectedCandidates, definitions);
|
|
321
|
+
return { $ref: `#/definitions/${definitionName}` };
|
|
322
|
+
}
|
|
323
|
+
return replaceSchemaChildren(value, definitionNames, selectedCandidates, definitions);
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* Create a selected definition and replace any nested selected codecs.
|
|
327
|
+
*
|
|
328
|
+
* @param definitionName - Definition to create
|
|
329
|
+
* @param definitionNames - Definition name for each selected schema object
|
|
330
|
+
* @param selectedCandidates - Selected candidates indexed by definition name
|
|
331
|
+
* @param definitions - Definitions created while replacing candidates
|
|
332
|
+
*/
|
|
333
|
+
function ensureDefinition(definitionName, definitionNames, selectedCandidates, definitions) {
|
|
334
|
+
if (Object.hasOwn(definitions, definitionName)) return;
|
|
335
|
+
definitions[definitionName] = {};
|
|
336
|
+
definitions[definitionName] = replaceSchemaChildren(selectedCandidates.get(definitionName).schema, definitionNames, selectedCandidates, definitions);
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Replace selected codecs below a schema object without replacing the object
|
|
340
|
+
* itself.
|
|
341
|
+
*
|
|
342
|
+
* @param schema - Schema whose children should be replaced
|
|
343
|
+
* @param definitionNames - Definition name for each selected schema object
|
|
344
|
+
* @param selectedCandidates - Selected candidates indexed by definition name
|
|
345
|
+
* @param definitions - Definitions created while replacing candidates
|
|
346
|
+
* @returns Schema object with replaced children
|
|
347
|
+
*/
|
|
348
|
+
function replaceSchemaChildren(schema, definitionNames, selectedCandidates, definitions) {
|
|
349
|
+
return Object.fromEntries(Object.entries(schema).map(([key, child]) => [key, replaceCodecCandidates(child, definitionNames, selectedCandidates, definitions)]));
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Inline definitions whose remaining references cost at least as much as the
|
|
353
|
+
* repeated schema bodies. This removes nested candidates that became
|
|
354
|
+
* single-use after a parent codec was moved into a definition.
|
|
355
|
+
*
|
|
356
|
+
* @param schema - Root schema without its definitions
|
|
357
|
+
* @param definitions - Generated definitions
|
|
358
|
+
* @returns Schema with only profitable definitions
|
|
359
|
+
*/
|
|
360
|
+
function inlineUnprofitableDefinitions(schema, definitions) {
|
|
361
|
+
let result = schema;
|
|
362
|
+
const remainingDefinitions = { ...definitions };
|
|
363
|
+
while (true) {
|
|
364
|
+
const referenceCounts = /* @__PURE__ */ new Map();
|
|
365
|
+
countDefinitionReferences(result, referenceCounts);
|
|
366
|
+
Object.values(remainingDefinitions).forEach((definition) => countDefinitionReferences(definition, referenceCounts));
|
|
367
|
+
const definitionNames = Object.keys(remainingDefinitions);
|
|
368
|
+
const definitionName = definitionNames.find((name) => (referenceCounts.get(name) ?? 0) < 2) ?? definitionNames.find((name) => {
|
|
369
|
+
const definition = remainingDefinitions[name];
|
|
370
|
+
const occurrences = referenceCounts.get(name) ?? 0;
|
|
371
|
+
const referenceSize = JSON.stringify({ $ref: `#/definitions/${name}` }).length;
|
|
372
|
+
const definitionSize = JSON.stringify(definition).length + JSON.stringify(name).length + 1;
|
|
373
|
+
return JSON.stringify(definition).length * occurrences <= definitionSize + referenceSize * occurrences;
|
|
374
|
+
});
|
|
375
|
+
if (!definitionName) break;
|
|
376
|
+
const definition = remainingDefinitions[definitionName];
|
|
377
|
+
delete remainingDefinitions[definitionName];
|
|
378
|
+
result = replaceDefinitionReference(result, definitionName, definition);
|
|
379
|
+
for (const [name, remainingDefinition] of Object.entries(remainingDefinitions)) remainingDefinitions[name] = replaceDefinitionReference(remainingDefinition, definitionName, definition);
|
|
380
|
+
}
|
|
381
|
+
return Object.keys(remainingDefinitions).length > 0 ? {
|
|
382
|
+
...result,
|
|
383
|
+
definitions: remainingDefinitions
|
|
384
|
+
} : result;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Count local references to generated definitions.
|
|
388
|
+
*
|
|
389
|
+
* @param value - Current schema value
|
|
390
|
+
* @param referenceCounts - Counts indexed by definition name
|
|
391
|
+
*/
|
|
392
|
+
function countDefinitionReferences(value, referenceCounts) {
|
|
393
|
+
if (Array.isArray(value)) {
|
|
394
|
+
value.forEach((item) => countDefinitionReferences(item, referenceCounts));
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
if (!isRecord(value)) return;
|
|
398
|
+
if (typeof value.$ref === "string" && value.$ref.startsWith("#/definitions/")) {
|
|
399
|
+
const definitionName = value.$ref.slice(14);
|
|
400
|
+
referenceCounts.set(definitionName, (referenceCounts.get(definitionName) ?? 0) + 1);
|
|
401
|
+
}
|
|
402
|
+
Object.values(value).forEach((child) => countDefinitionReferences(child, referenceCounts));
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Inline every bare reference to one generated definition.
|
|
406
|
+
*
|
|
407
|
+
* @param value - Current schema value
|
|
408
|
+
* @param definitionName - Definition to inline
|
|
409
|
+
* @param definition - Definition body
|
|
410
|
+
* @returns Schema value with matching references replaced
|
|
411
|
+
*/
|
|
412
|
+
function replaceDefinitionReference(value, definitionName, definition) {
|
|
413
|
+
if (Array.isArray(value)) return value.map((item) => replaceDefinitionReference(item, definitionName, definition));
|
|
414
|
+
if (!isRecord(value)) return value;
|
|
415
|
+
if (Object.keys(value).length === 1 && value.$ref === `#/definitions/${definitionName}`) return definition;
|
|
416
|
+
return Object.fromEntries(Object.entries(value).map(([key, child]) => [key, replaceDefinitionReference(child, definitionName, definition)]));
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Build a stable, JSON Pointer-safe definition name.
|
|
420
|
+
*
|
|
421
|
+
* Explicit simple codec names are preferred. Generated io-ts expression names
|
|
422
|
+
* fall back to a codec tag and content hash.
|
|
423
|
+
*
|
|
424
|
+
* @param candidate - Codec schema being named
|
|
425
|
+
* @param usedDefinitionNames - Definition names already allocated
|
|
426
|
+
* @returns Definition name
|
|
427
|
+
*/
|
|
428
|
+
function buildDefinitionName(candidate, usedDefinitionNames) {
|
|
429
|
+
const metadata = candidate.codec;
|
|
430
|
+
const explicitName = typeof metadata.name === "string" && /^[A-Za-z_][A-Za-z0-9_-]*$/u.test(metadata.name) ? metadata.name : void 0;
|
|
431
|
+
const codecTag = typeof metadata._tag === "string" ? metadata._tag.replace(/Type$/u, "").toLowerCase() : "schema";
|
|
432
|
+
const baseName = explicitName ?? `${codecTag || "schema"}-${hashString(candidate.serializedSchema)}`;
|
|
433
|
+
let definitionName = baseName;
|
|
434
|
+
let suffix = 2;
|
|
435
|
+
while (usedDefinitionNames.has(definitionName)) {
|
|
436
|
+
definitionName = `${baseName}-${suffix}`;
|
|
437
|
+
suffix += 1;
|
|
438
|
+
}
|
|
439
|
+
return definitionName;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Produce a compact deterministic hash for a definition name.
|
|
443
|
+
*
|
|
444
|
+
* Hash collisions cannot affect correctness because definition names are
|
|
445
|
+
* checked against their serialized schemas before use.
|
|
446
|
+
*
|
|
447
|
+
* @param value - Value to hash
|
|
448
|
+
* @returns Unsigned base-36 FNV-1a hash
|
|
449
|
+
*/
|
|
450
|
+
function hashString(value) {
|
|
451
|
+
let hash = 2166136261;
|
|
452
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
453
|
+
hash ^= value.charCodeAt(index);
|
|
454
|
+
hash = Math.imul(hash, 16777619);
|
|
455
|
+
}
|
|
456
|
+
return (hash >>> 0).toString(36);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Check whether a value is a non-null object record.
|
|
460
|
+
*
|
|
461
|
+
* @param value - Value to check
|
|
462
|
+
* @returns Whether the value is a record
|
|
463
|
+
*/
|
|
464
|
+
function isRecord(value) {
|
|
465
|
+
return typeof value === "object" && value !== null;
|
|
466
|
+
}
|
|
213
467
|
const unhandledType = (_shouldBeNever) => ({});
|
|
214
468
|
//#endregion
|
|
215
469
|
//#region src/codecTools/createDefaultCodec.ts
|
|
@@ -367,9 +621,13 @@ function invertSafe(obj) {
|
|
|
367
621
|
//#region src/valuesOf.ts
|
|
368
622
|
/**
|
|
369
623
|
* Build an `io-ts` codec over the values of an enum-like object.
|
|
624
|
+
*
|
|
625
|
+
* @param enm - Enum-like object
|
|
626
|
+
* @param name - Optional stable codec name
|
|
627
|
+
* @returns Codec accepting the enum values
|
|
370
628
|
*/
|
|
371
|
-
function valuesOf(enm) {
|
|
372
|
-
return t.keyof(invert(enm));
|
|
629
|
+
function valuesOf(enm, name) {
|
|
630
|
+
return t.keyof(invert(enm), name);
|
|
373
631
|
}
|
|
374
632
|
//#endregion
|
|
375
633
|
//#region src/findAllWithRegex.ts
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/enum.ts","../src/getKeys.ts","../src/apply.ts","../src/codecTools/decodeCodec.ts","../src/codecTools/dictionary.ts","../src/codecTools/FixedLengthString.ts","../src/codecTools/FixedLengthArray.ts","../src/codecTools/partialRecord.ts","../src/codecTools/isCodecError.ts","../src/codecTools/NonEmptyString.ts","../src/codecTools/toJsonSchema.ts","../src/codecTools/createDefaultCodec.ts","../src/enums.ts","../src/getEntries.ts","../src/getValues.ts","../src/groupBy.ts","../src/gql.ts","../src/invert.ts","../src/valuesOf.ts","../src/findAllWithRegex.ts","../src/aggregateObjects.ts","../src/flattenObject.ts","../src/transposeObjectArray.ts","../src/fromEntries.ts","../src/noExcess.ts"],"sourcesContent":["import type { ObjByString } from './types.js';\n\n// TODO: https://linear.app/transcend/issue/LAK-2351 – Remove deprecated enum utils\n\n/**\n * An enumerated value.\n * @deprecated - Enum utils are deprecated\n */\nexport type Enumerate<T = string, TKey extends string = string> = {\n [key in TKey]: T;\n};\n\n/**\n * A TypeScript enum with string values.\n * @deprecated - Enum utils are deprecated\n */\nexport type TypescriptEnum = { [key in string]: string } | { [key in number]: string };\n\n/**\n * An input when defining an enum can be an object of string -> string or a list\n * of strings.\n * @deprecated - Enum utils are deprecated\n */\nexport type EnumInput<T, TKey extends string = string> = Enumerate<T, TKey> | string[];\n\n/**\n * Convert a list of strings to an enum-like object.\n * @deprecated - Enum utils are deprecated\n */\nexport function listToEnum(attributes: string[]): Enumerate<string> {\n const initialValue: Enumerate<string> = {};\n return attributes.reduce((accumulator, value) => {\n accumulator[value] = value;\n return accumulator;\n }, initialValue);\n}\n\n/**\n * Merge enum-like inputs into a single enum object.\n * @deprecated - Enum utils are deprecated\n */\nexport function createEnum<T = string, TKey extends string = string>(\n ...attributes: EnumInput<T, TKey>[]\n): Enumerate<T, TKey> {\n const objectAttributes = attributes.map((attribute) =>\n Array.isArray(attribute) ? listToEnum(attribute) : attribute,\n );\n\n return Object.assign({}, ...objectAttributes);\n}\n\n/**\n * Filter an enum and return the keys that remain.\n * @deprecated - Enum utils are deprecated\n */\nexport function filterEnum<T extends ObjByString>(\n obj: T,\n filterFunc: (value: T[keyof T], key: keyof T, calculatedEnum: Enumerate<T[keyof T]>) => boolean,\n): (keyof T)[] {\n return (Object.keys(obj) as (keyof T)[])\n .filter((key) => filterFunc(obj[key], key, obj))\n .map((key) => key);\n}\n\n/**\n * Make an enum compatible with type inference without changing its runtime\n * shape.\n * @deprecated – Enum utils are deprecated\n */\nexport function makeEnum<T extends { [index: string]: Value | Value[] }, Value extends string>(\n value: T,\n): T {\n return value;\n}\n","import type { StringKeys } from './types.js';\n\n/**\n * `Object.keys` for string keys only.\n */\nexport function getStringKeys<T extends {}>(obj: T): StringKeys<T>[] {\n return Object.keys(obj).filter((key) => typeof key === 'string') as StringKeys<T>[];\n}\n\n/**\n * `Object.keys` that preserves key types.\n */\nexport function getKeys<T extends {}>(obj: T): (keyof T)[] {\n return Object.keys(obj) as (keyof T)[];\n}\n","import { createEnum } from './enum.js';\nimport { getKeys } from './getKeys.js';\nimport type { ObjByString, StringKeys } from './types.js';\n\n/**\n * Apply a function to each value of an object while preserving the key types.\n */\nexport function apply<TInput extends ObjByString, TOutput>(\n obj: TInput,\n applyFunc: (\n value: TInput[keyof TInput],\n key: StringKeys<TInput>,\n fullObj: typeof obj,\n index: number,\n ) => TOutput,\n): { [key in keyof TInput]: TOutput } {\n const result = Object.keys(obj).reduce(\n (accumulator, key, index) =>\n Object.assign(accumulator, {\n [key]: applyFunc(obj[key], key as StringKeys<TInput>, obj, index),\n }),\n {},\n );\n\n return result as { [key in keyof TInput]: TOutput };\n}\n\n/**\n * Async version of `apply`.\n */\nexport async function asyncApply<TInput extends ObjByString, TOutput>(\n obj: TInput,\n applyFunc: (\n value: TInput[keyof TInput],\n key: StringKeys<TInput>,\n fullObj: typeof obj,\n index: number,\n ) => Promise<TOutput>,\n): Promise<{ [key in keyof TInput]: TOutput }> {\n const entries = await Promise.all(\n getKeys(obj).map(async (key, index) => ({\n key,\n value: await applyFunc(obj[key], key as StringKeys<TInput>, obj, index),\n })),\n );\n\n const result = entries.reduce(\n (accumulator, { key, value }) =>\n Object.assign(accumulator, {\n [key]: value,\n }),\n {},\n );\n\n return result as { [key in keyof TInput]: TOutput };\n}\n\n/**\n * Convert a TypeScript enum to a value-to-value map and then call `apply`.\n */\nexport function applyEnum<TEnum extends string, TOutput>(\n enm: { [key in string]: TEnum },\n applyFunc: (value: TEnum, key: TEnum, fullObj: typeof enm, index: number) => TOutput,\n): { [key in TEnum]: TOutput } {\n const obj = createEnum<TEnum, TEnum>(Object.values(enm));\n return apply(obj, applyFunc) as any;\n}\n","import * as either from 'fp-ts/lib/Either.js';\nimport { pipe } from 'fp-ts/lib/function.js';\nimport * as t from 'io-ts';\n\n/**\n * Determine the codec paths that are invalid.\n */\nfunction getPaths<A>(validation: t.Validation<A>): string[] {\n return pipe(\n validation,\n either.fold(\n (errors) =>\n errors.map((error) => {\n const lastContext = error.context.at(-1);\n const fullPath = error.context.map(({ key }) => key).join('.');\n return `${fullPath} expected type '${lastContext?.type.name}'`;\n }),\n () => ['no errors'],\n ),\n );\n}\n\n/**\n * Get custom error messages for the errors.\n */\nfunction getCustomErrors<A>(\n validation: t.Validation<A>,\n customErrorFromContext: (validationContext: t.Context) => string,\n): string[] {\n return pipe(\n validation,\n either.fold(\n (errors) => errors.map((error) => customErrorFromContext(error.context)),\n () => ['no errors'],\n ),\n );\n}\n\nexport const CODEC_ERROR_MESSAGE = 'Failed to decode codec:';\n\n/**\n * Decode a codec, returning the decoded value or throwing an error.\n */\nexport function decodeCodec<TCodec extends t.Any>(\n codec: TCodec,\n txt: unknown,\n parse = true,\n customErrorFromContext: ((validationContext: t.Context) => string) | undefined = undefined,\n): t.TypeOf<TCodec> {\n const decoded = codec.decode(parse && typeof txt === 'string' ? JSON.parse(txt) : txt);\n\n if (either.isLeft(decoded)) {\n const errorPaths = getPaths(decoded);\n const customError =\n customErrorFromContext !== undefined\n ? JSON.stringify(getCustomErrors(decoded, customErrorFromContext), null, 2)\n : undefined;\n\n throw new Error(\n `${CODEC_ERROR_MESSAGE} ${JSON.stringify(errorPaths, null, 2)}${customError ?? ''}`,\n );\n }\n\n return decoded.right;\n}\n","import { unsafeCoerce } from 'fp-ts/lib/function.js';\nimport * as t from 'io-ts';\n\n/**\n * A record with optional keys.\n */\nexport interface DictionaryC<D extends t.Mixed, C extends t.Mixed> extends t.DictionaryType<\n D,\n C,\n {\n [K in t.TypeOf<D>]?: t.TypeOf<C>;\n },\n {\n [K in t.OutputOf<D>]?: t.OutputOf<C>;\n },\n unknown\n> {}\n\n/**\n * Helper to encode/decode a record with partial keys.\n */\nexport const dictionary = <D extends t.Mixed, C extends t.Mixed>(\n keys: D,\n values: C,\n name?: string,\n): DictionaryC<D, C> => unsafeCoerce(t.record(t.union([keys, t.undefined]), values, name));\n","import * as t from 'io-ts';\n\n/**\n * Brand for strings of fixed length.\n */\nexport type FixedLengthStringBrand<N extends number> = {\n /** The expected length of the string. */\n readonly length: N;\n /** Unique symbol to ensure uniqueness of this type across modules/packages. */\n readonly FixedLengthString: unique symbol;\n};\n\n/**\n * Codec for strings constrained to a fixed length.\n */\nexport const FixedLengthString = <N extends number>(\n len: N,\n): t.BrandC<t.StringC, FixedLengthStringBrand<N>> =>\n t.brand(\n t.string,\n (value): value is t.Branded<string, FixedLengthStringBrand<N>> => value.length === len,\n 'FixedLengthString',\n );\n\n/**\n * Branded fixed-length string type.\n */\nexport type FixedLengthString<N extends number> = t.TypeOf<\n t.BrandC<t.StringC, FixedLengthStringBrand<N>>\n>;\n","import * as t from 'io-ts';\n\n/**\n * Brand for arrays with bounded length.\n */\nexport interface FixedLengthArrayBrand<T> extends Array<T> {\n /** Unique symbol to ensure uniqueness of this type across modules/packages. */\n readonly fixedLengthArray: unique symbol;\n /** The minimum length of the array. */\n readonly min: number;\n /** The maximum length of the array. */\n readonly max: number;\n}\n\n/**\n * Codec for arrays constrained to a fixed length range.\n */\nexport const FixedLengthArray = <C extends t.Mixed>(\n min: number,\n max: number,\n codec: C,\n): t.BrandC<t.ArrayC<C>, FixedLengthArrayBrand<C>> =>\n t.brand(\n t.array(codec),\n (value: Array<C>): value is t.Branded<Array<C>, FixedLengthArrayBrand<C>> =>\n min <= value.length && value.length <= max,\n 'fixedLengthArray',\n );\n\n/**\n * Branded fixed-length array type.\n */\nexport type FixedLengthArray<C extends t.Mixed> = t.TypeOf<\n t.BrandC<t.ArrayC<C>, FixedLengthArrayBrand<C>>\n>;\n","import * as t from 'io-ts';\n\n/**\n * Like `t.record`, but where the keys are all optional to include.\n */\nexport interface PartialRecordC<D extends t.Mixed, C extends t.Mixed> extends t.DictionaryType<\n D,\n C,\n {\n [K in t.TypeOf<D>]?: t.TypeOf<C>;\n },\n {\n [K in t.OutputOf<D>]?: t.OutputOf<C>;\n },\n unknown\n> {}\n\n/**\n * Create an `io-ts` compatible partial record.\n */\nexport const partialRecord = <D extends t.Mixed, C extends t.Mixed>(\n domain: D,\n codomain: C,\n name?: string,\n): PartialRecordC<D, C> =>\n t.record(t.union([domain, t.undefined]), codomain, name) as unknown as PartialRecordC<D, C>;\n","/**\n * Checks an error message to see if it is an `io-ts` codec error.\n */\nexport function isCodecError(err: Error): boolean {\n return err.message.startsWith('Failed to decode codec');\n}\n","import * as t from 'io-ts';\n\n/**\n * Brand for non-empty strings.\n */\ntype NonEmptyStringBrand = {\n /** Unique symbol to ensure uniqueness of this type across modules/packages. */\n readonly NonEmptyString: symbol;\n};\n\n/**\n * Codec for non-empty trimmed strings.\n */\nexport const NonEmptyString = t.brand(\n t.string,\n (value): value is t.Branded<string, NonEmptyStringBrand> => value.trim().length !== 0,\n 'NonEmptyString',\n);\n\n/**\n * Branded non-empty string type.\n */\nexport type NonEmptyString = t.TypeOf<typeof NonEmptyString>;\n","import * as t from 'io-ts';\nimport type { JSONSchema7 } from 'json-schema';\n\n/**\n * `io-ts` types compatible with JSON Schema.\n */\ntype MappableType =\n | t.NumberType\n | t.StringType\n | t.NullType\n | t.BooleanType\n | t.LiteralType<any>\n | t.KeyofType<any>\n | t.InterfaceType<any>\n | t.DictionaryType<any, any>\n | t.PartialType<any>\n | t.UnionType<any>\n | t.ArrayType<any>\n | t.TupleType<any>\n | t.IntersectionType<any>\n | t.RefinementType<any>;\n\n/**\n * Convert an `io-ts` codec to a JSON Schema (v7).\n */\nexport const toJsonSchema = (\n rawType: any,\n strict = false,\n alwaysIncludeRequired = false,\n): JSONSchema7 => {\n const type = rawType as MappableType;\n\n if (type._tag === 'StringType') {\n return { type: 'string' };\n }\n\n if (type._tag === 'NumberType') {\n return { type: 'number' };\n }\n\n if (type._tag === 'NullType') {\n return { type: 'null' };\n }\n\n if (type._tag === 'BooleanType') {\n return { type: 'boolean' };\n }\n\n if (type._tag === 'LiteralType') {\n return { const: type.value };\n }\n\n if (type._tag === 'KeyofType') {\n return { type: 'string', enum: Object.keys(type.keys) };\n }\n\n if (type._tag === 'UnionType') {\n return {\n anyOf: type.types.map((subtype: any) => toJsonSchema(subtype, strict, alwaysIncludeRequired)),\n };\n }\n\n if (type._tag === 'IntersectionType' && !alwaysIncludeRequired) {\n return {\n allOf: type.types.map((subtype: any) => toJsonSchema(subtype, strict, alwaysIncludeRequired)),\n };\n }\n\n if (type._tag === 'IntersectionType' && alwaysIncludeRequired) {\n const results = type.types.map((subtype: any) =>\n toJsonSchema(subtype, strict, alwaysIncludeRequired),\n );\n\n if (!results.every((result: any) => result.type === 'object')) {\n throw new Error('InterfaceType must have all children as type=object');\n }\n\n return {\n type: 'object',\n required: results.map((result: any) => result.required).flat(),\n properties: results.reduce(\n (accumulator: any, result: any) => ({ ...accumulator, ...result.properties }),\n {},\n ),\n ...(strict ? { additionalProperties: false } : {}),\n };\n }\n\n if (type._tag === 'InterfaceType') {\n return {\n type: 'object',\n required: Object.keys(type.props),\n properties: Object.fromEntries(\n Object.entries(type.props).map(([key, subtype]) => [\n key,\n toJsonSchema(subtype as t.Type<any>, strict, alwaysIncludeRequired),\n ]),\n ),\n ...(strict ? { additionalProperties: false } : {}),\n };\n }\n\n if (type._tag === 'DictionaryType') {\n return {\n type: 'object',\n additionalProperties: toJsonSchema(type.codomain, strict, alwaysIncludeRequired),\n };\n }\n\n if (type._tag === 'PartialType') {\n return {\n type: 'object',\n ...(alwaysIncludeRequired ? { required: Object.keys(type.props) } : {}),\n properties: Object.fromEntries(\n Object.entries(type.props).map(([key, subtype]) => {\n const result = toJsonSchema(subtype as t.Type<any>, strict, alwaysIncludeRequired);\n return [\n key,\n alwaysIncludeRequired && result.type\n ? {\n ...result,\n type: [result.type as any, 'null'],\n }\n : result,\n ];\n }),\n ),\n ...(strict ? { additionalProperties: false } : {}),\n };\n }\n\n if (type._tag === 'ArrayType') {\n return {\n type: 'array',\n items: toJsonSchema(type.type, strict, alwaysIncludeRequired),\n };\n }\n\n if (type._tag === 'TupleType') {\n return {\n type: 'array',\n items: type.types.map((subtype: any) => toJsonSchema(subtype, strict, alwaysIncludeRequired)),\n };\n }\n\n if (type._tag === 'RefinementType') {\n if (type.name === 'Int') {\n return { type: 'integer' };\n }\n\n return {\n ...toJsonSchema(type.type, strict, alwaysIncludeRequired),\n description: `Predicate: ${type.predicate.name || type.name}`,\n };\n }\n\n return unhandledType(type as never);\n};\n\nconst unhandledType = (_shouldBeNever: never) => ({});\n","import * as t from 'io-ts';\n\n/**\n * Creates a default value for an `io-ts` codec.\n */\nexport const createDefaultCodec = <C extends t.Mixed>(codec: C): t.TypeOf<C> => {\n if (codec instanceof t.UnionType) {\n const arrayType = codec.types.find((type: any) => type instanceof t.ArrayType);\n if (arrayType) {\n return createDefaultCodec(arrayType);\n }\n\n const objectType = codec.types.find(\n (type: any) =>\n type instanceof t.InterfaceType ||\n type instanceof t.PartialType ||\n type instanceof t.IntersectionType ||\n type instanceof t.ArrayType,\n );\n if (objectType) {\n return createDefaultCodec(objectType);\n }\n\n const hasNull = codec.types.some(\n (type: any) => type instanceof t.NullType || type.name === 'null',\n );\n if (hasNull) {\n return null as t.TypeOf<C>;\n }\n\n return createDefaultCodec(codec.types[0]);\n }\n\n if (codec instanceof t.InterfaceType || codec instanceof t.PartialType) {\n const defaults: Record<string, any> = {};\n Object.entries(codec.props).forEach(([key, type]) => {\n defaults[key] = createDefaultCodec(type as any);\n });\n return defaults as t.TypeOf<C>;\n }\n\n if (codec instanceof t.IntersectionType) {\n return codec.types.reduce(\n (accumulator: t.TypeOf<C>, type: any) => ({\n ...accumulator,\n ...createDefaultCodec(type),\n }),\n {},\n );\n }\n\n if (codec instanceof t.ArrayType) {\n const elementType = codec.type;\n const isObjectType =\n elementType instanceof t.InterfaceType ||\n elementType instanceof t.PartialType ||\n elementType instanceof t.IntersectionType;\n\n return (isObjectType ? [createDefaultCodec(elementType)] : []) as t.TypeOf<C>;\n }\n\n if (codec instanceof t.LiteralType) {\n return codec.value as t.TypeOf<C>;\n }\n\n if (codec instanceof t.ObjectType) {\n return {} as t.TypeOf<C>;\n }\n\n switch (codec.name) {\n case 'string':\n return '' as t.TypeOf<C>;\n case 'number':\n return 0 as t.TypeOf<C>;\n case 'boolean':\n return false as t.TypeOf<C>;\n case 'null':\n return null as t.TypeOf<C>;\n case 'undefined':\n return undefined as t.TypeOf<C>;\n default:\n return null as t.TypeOf<C>;\n }\n};\n","import { makeEnum } from './enum.js';\n\n/**\n * The HTTP method types.\n */\nexport const HttpMethod = {\n /** A GET request. */\n Get: 'GET',\n /** A POST request. */\n Post: 'POST',\n /** A DELETE request. */\n Delete: 'DELETE',\n /** A PUT request. */\n Put: 'PUT',\n /** A PATCH request. */\n Patch: 'PATCH',\n} as const;\n\n/**\n * The HTTP method string union.\n */\nexport type HttpMethod = (typeof HttpMethod)[keyof typeof HttpMethod];\n","import type { ObjByString } from './types.js';\n\n/**\n * `Object.entries` that preserves entry types.\n */\nexport function getEntries<TKey extends keyof TObj, TObj extends ObjByString>(\n obj: TObj,\n): [TKey, TObj[TKey]][] {\n return Object.entries(obj) as any;\n}\n","/**\n * `Object.values` that preserves value types.\n */\nexport function getValues<TValue>(obj: {\n [key in string | number | symbol]: TValue;\n}): TValue[] {\n return Object.values(obj) as TValue[];\n}\n","/**\n * A typed version of lodash's `groupBy`.\n */\nexport function groupBy<TItem, TKey>(\n iterable: TItem[],\n getKey: (item: TItem) => TKey,\n): Map<TKey, TItem[]> {\n return iterable.reduce((groupedItems, item) => {\n const groupedKey = getKey(item);\n return groupedItems.set(groupedKey, [...(groupedItems.get(groupedKey) ?? []), item]);\n }, new Map<TKey, TItem[]>());\n}\n","/**\n * Identify whether a string looks like a GraphQL interface/type/input\n * declaration.\n */\nexport const INTERFACE_REGEX = /(interface|type|input) [a-zA-Z0-9]* (implements .+?|){([\\s\\S]+?)}/;\n\n/**\n * A `gql` is simply a string branded with the associated GraphQL type.\n */\nexport type Gql<TGraphQLType extends object> = string & {\n /** The TypeScript type definition that relates to the gql string. */\n graphQLType: TGraphQLType;\n};\n\n/**\n * Template tag for GraphQL fragments with a small amount of interpolation\n * support for interface bodies.\n */\nexport function gql<TGraphQLType extends object>(\n strings: TemplateStringsArray,\n ...expressions: (string | number)[]\n): Gql<TGraphQLType> {\n if (expressions.length === 0) {\n return strings[0] as Gql<TGraphQLType>;\n }\n\n const count = strings.length - 1;\n let result = '';\n for (let index = 0; index < count; index += 1) {\n const expression = expressions[index]!;\n const text = typeof expression === 'string' ? expression : expression.toString();\n const useExpression = INTERFACE_REGEX.test(text)\n ? (INTERFACE_REGEX.exec(text) || [])[3]\n : expression;\n result += (strings[index] ?? '') + (useExpression ?? '');\n }\n\n result += strings[count] ?? '';\n return result as Gql<TGraphQLType>;\n}\n","import { getEntries } from './getEntries.js';\n\n/**\n * Invert an object so the values look up the keys. Arrays are expanded and map\n * back to arrays of keys.\n */\nexport function invert<TKey extends string, TValue extends string | string[]>(\n obj: { [key in TKey]?: TValue },\n throwOnDuplicate = true,\n): {\n [key in TValue extends (infer Item)[] ? Item : TValue]: TValue extends any[] ? TKey[] : TKey;\n} {\n const result: any = {};\n\n getEntries(obj).forEach(([key, instance]: [TKey, TValue | undefined]) => {\n if (instance === undefined) {\n throw new Error('inverse found undefined value, this is not supported');\n }\n\n if (Array.isArray(instance)) {\n instance.forEach((listKey) => {\n if (!result[listKey]) {\n result[listKey] = [key];\n } else {\n result[listKey].push(key);\n }\n });\n return;\n }\n\n if (result[instance] && throwOnDuplicate) {\n throw new Error(\n `Encountered duplicate value inverting object: \"${instance}: ${key} and ${result[instance]}\"`,\n );\n }\n\n result[instance] = key;\n });\n\n return result;\n}\n\n/**\n * Safely invert an object into `{ [value]: key[] }`.\n */\nexport function invertSafe<TKey extends string, TValue extends string>(obj: {\n [key in TKey]: TValue | TValue[];\n}): {\n [key in TValue]: TKey[];\n} {\n const result: any = {};\n\n getEntries(obj).forEach(([key, instance]) => {\n if (instance === undefined) {\n throw new Error('inverse found undefined value, this is not supported');\n }\n\n if (Array.isArray(instance)) {\n instance.forEach((listKey) => {\n if (!result[listKey]) {\n result[listKey] = [key];\n } else {\n result[listKey].push(key);\n }\n });\n return;\n }\n\n if (!result[instance]) {\n result[instance] = [key];\n return;\n }\n\n result[instance].push(key);\n });\n\n return result;\n}\n","import * as t from 'io-ts';\n\nimport { invert } from './invert.js';\n\n/**\n * Build an `io-ts` codec over the values of an enum-like object.\n */\nexport function valuesOf<TEnum extends string>(enm: {\n [key in string]: TEnum;\n}): t.KeyofC<{ [key in TEnum]: unknown }> {\n return t.keyof(invert(enm) as any);\n}\n","/**\n * The full match returned when `regex.exec` finds a match.\n */\nexport interface RegExpMatch {\n /** The full regex match. */\n fullMatch: string;\n /** The index in the text where the match was found. */\n matchIndex: number;\n /** Whether the match satisfies an optional stricter regex. */\n isStrict?: boolean;\n}\n\n/**\n * Definition for finding all regex matches and mapping capture groups to keys.\n */\nexport interface FindAllRegExp<TMatchKeys extends string> {\n /** The regex to test. */\n value: RegExp;\n /**\n * A stricter regex used to annotate matches that satisfy a more exact\n * standard.\n */\n strict?: RegExp;\n /** Capture group names mapped by index. */\n matches: readonly TMatchKeys[];\n /** When true, skip validation of matches being the expected length. */\n skipMatchValidation?: boolean;\n}\n\n/**\n * Use a regex with the global flag to find all matches and return the list with\n * capture groups mapped to named properties.\n */\nexport function findAllWithRegex<TMatchKeys extends string>(\n regex: FindAllRegExp<TMatchKeys>,\n text: string,\n): ({ [key in TMatchKeys]: string } & RegExpMatch)[] {\n if (!regex.value.flags.includes('g')) {\n throw new Error('Regex.value must have a g flag');\n }\n\n const matchParams = ['fullMatch', ...regex.matches];\n const results: ({ [key in TMatchKeys]: string } & RegExpMatch)[] = [];\n\n let match = regex.value.exec(text);\n let index = 0;\n\n while (match) {\n if (matchParams.length !== match.length && !regex.skipMatchValidation) {\n throw new Error(\n `Mismatch in match length at index [${index}]: \"${match.length}\" vs expected: \"${matchParams.length}\"`,\n );\n }\n\n const result = match.reduce(\n (accumulator, matchResult, matchIndex) =>\n Object.assign(accumulator, {\n [matchParams[matchIndex] as string]: matchResult,\n }),\n {},\n ) as { [key in TMatchKeys]: string } & RegExpMatch;\n\n result.matchIndex = match.index;\n\n if (regex.strict) {\n result.isStrict = regex.strict.test(result.fullMatch);\n }\n\n results.push(result);\n\n match = regex.value.exec(text);\n index += 1;\n }\n\n return results;\n}\n","/**\n * Aggregates multiple objects into a single object by combining values of\n * matching keys into comma-separated strings.\n */\nexport const aggregateObjects = ({\n objs,\n wrap = false,\n}: {\n /** The objects to aggregate in a single one. */\n objs: any[];\n /** Whether to wrap the concatenated values in `[]`. */\n wrap?: boolean;\n}): any => {\n const allKeys = Array.from(\n new Set(objs.flatMap((obj) => (obj && typeof obj === 'object' ? Object.keys(obj) : []))),\n );\n\n return allKeys.reduce(\n (accumulator, key) => {\n const values = objs\n .map((obj) => (wrap ? `[${obj?.[key] ?? ''}]` : (obj?.[key] ?? '')))\n .join(',');\n accumulator[key] = values;\n return accumulator;\n },\n {} as Record<string, any>,\n );\n};\n","import { aggregateObjects } from './aggregateObjects.js';\n\n/**\n * Flattens a nested object into a single-level object with concatenated key\n * names.\n */\nexport const flattenObject = ({\n obj,\n prefix = '',\n}: {\n /** The object to flatten. */\n obj: any;\n /** The prefix to prepend to keys while recursing. */\n prefix?: string;\n}): any =>\n !obj\n ? {}\n : Object.keys(obj ?? []).reduce(\n (accumulator, key) => {\n const newKey = prefix ? `${prefix}_${key}` : key;\n const entry = obj[key];\n\n if (\n Array.isArray(entry) &&\n entry.length > 0 &&\n entry.some((item) => typeof item === 'object' && item !== null)\n ) {\n const objectEntries = entry.filter((item) => typeof item === 'object' && item !== null);\n const flattenedObjects = objectEntries.map((item) => flattenObject({ obj: item }));\n const aggregated = aggregateObjects({ objs: flattenedObjects });\n Object.entries(aggregated).forEach(([aggregatedKey, value]) => {\n accumulator[`${newKey}_${aggregatedKey}`] = value;\n });\n } else if (typeof entry === 'object' && entry !== null && !Array.isArray(entry)) {\n Object.assign(accumulator, flattenObject({ obj: entry, prefix: newKey }));\n } else {\n accumulator[newKey] = Array.isArray(entry)\n ? entry\n .map((item) => {\n if (typeof item === 'string') {\n return item.replaceAll(',', '');\n }\n\n return item ?? '';\n })\n .join(',')\n : typeof entry === 'string'\n ? entry.replaceAll(',', '')\n : (entry ?? '');\n }\n\n return accumulator;\n },\n {} as Record<string, any>,\n );\n","/**\n * Type representing a transposed array of objects.\n */\ntype TransposedObjectArray<T, K extends keyof T> = {\n [P in K]: Array<T[P]>;\n} & {\n /** Properties not selected for transposition. */\n rest: Array<Omit<T, K>>;\n};\n\n/**\n * Transpose an array of objects by converting selected properties into arrays\n * while keeping the remaining properties grouped in `rest`.\n */\nexport const transposeObjectArray = <T extends object, K extends keyof T>({\n objects,\n properties,\n options = { includeOtherProperties: true },\n}: {\n /** Array of objects to transpose. */\n objects: T[];\n /** Property keys to transpose into arrays. */\n properties: K[];\n /** Options for how to transpose the array. */\n options?: {\n /** Whether to include non-transposed properties in the final result. */\n includeOtherProperties?: boolean;\n };\n}): TransposedObjectArray<T, K> =>\n objects.reduce(\n (accumulator, item) => {\n const result = { ...accumulator } as TransposedObjectArray<T, K>;\n\n properties.forEach((property) => {\n const currentArray = (accumulator[property] || []) as T[K][];\n result[property] = [...currentArray, item[property]] as any;\n });\n\n const restObject = {} as Omit<T, K>;\n Object.entries(item).forEach(([key, value]) => {\n if (!properties.includes(key as K)) {\n (restObject as any)[key] = value;\n }\n });\n\n if (options.includeOtherProperties) {\n result.rest = [...(accumulator.rest || []), restObject];\n }\n\n return result;\n },\n {} as TransposedObjectArray<T, K>,\n );\n","/**\n * `Object.fromEntries` that preserves entry types.\n */\nexport function fromEntries<const TEntries extends ReadonlyArray<readonly [PropertyKey, unknown]>>(\n entries: TEntries,\n): { [K in TEntries[number] as K[0]]: K[1] } {\n return Object.fromEntries(entries) as { [K in TEntries[number] as K[0]]: K[1] };\n}\n","import type { Either, Right } from 'fp-ts/lib/Either.js';\nimport * as either from 'fp-ts/lib/Either.js';\nimport { pipe } from 'fp-ts/lib/function.js';\nimport * as t from 'io-ts';\n\n/**\n * Creates a type guard function that checks if a codec matches a specific tag.\n */\nconst getIsCodec =\n <T extends t.Any>(tag: string) =>\n (codec: t.Any): codec is T =>\n (codec as any)._tag === tag;\n\nconst isInterfaceCodec = getIsCodec<t.InterfaceType<t.Props>>('InterfaceType');\nconst isPartialCodec = getIsCodec<t.PartialType<t.Props>>('PartialType');\n\n/**\n * Extract property definitions from various codec types.\n */\nconst getProps = (codec: t.HasProps): t.Props => {\n switch (codec._tag) {\n case 'RefinementType':\n case 'ReadonlyType':\n return getProps(codec.type);\n case 'InterfaceType':\n case 'StrictType':\n case 'PartialType':\n return codec.props;\n case 'IntersectionType':\n return codec.types.reduce<t.Props>((props, type) => Object.assign(props, getProps(type)), {});\n default:\n return {};\n }\n};\n\n/**\n * Generate a string representation of props for type naming.\n */\nconst getNameFromProps = (props: t.Props): string =>\n Object.keys(props)\n .map((key) => `${key}: ${props[key]!.name}`)\n .join(', ');\n\n/**\n * Wrap a type name with `Partial<>`.\n */\nconst getPartialTypeName = (inner: string): string => `Partial<${inner}>`;\n\n/**\n * Generate a human-readable type name for the no-excess wrapper.\n */\nconst getNoExcessTypeName = (codec: t.Any): string => {\n if (isInterfaceCodec(codec)) {\n return `{| ${getNameFromProps(codec.props)} |}`;\n }\n\n if (isPartialCodec(codec)) {\n return getPartialTypeName(`{| ${getNameFromProps(codec.props)} |}`);\n }\n\n return `Excess<${codec.name}>`;\n};\n\n/**\n * Compare an object's keys against expected properties and return either the\n * object or a list of excess keys.\n */\nconst stripKeys = <T = any>(obj: T, props: t.Props): Either<string[], T> => {\n const keys = Object.getOwnPropertyNames(obj);\n const propKeys = Object.getOwnPropertyNames(props);\n\n propKeys.forEach((propKey) => {\n const index = keys.indexOf(propKey);\n if (index !== -1) {\n keys.splice(index, 1);\n }\n });\n\n return keys.length ? either.left(keys) : either.right(obj);\n};\n\n/**\n * Wrap an `io-ts` codec so validation fails when excess properties are present.\n */\nexport const noExcess = <C extends t.HasProps>(\n codec: C,\n name: string = getNoExcessTypeName(codec),\n): NoExcessType<C> => {\n const props: t.Props = getProps(codec);\n\n return new NoExcessType<C>(\n name,\n (value): value is C => either.isRight(stripKeys(value, props)) && codec.is(value),\n (value, context) => {\n const unknownRecordValidation = t.UnknownRecord.validate(value, context);\n if (either.isLeft(unknownRecordValidation)) {\n return unknownRecordValidation;\n }\n\n const codecValidation = codec.validate(value, context);\n if (either.isLeft(codecValidation)) {\n return codecValidation;\n }\n\n return pipe(\n stripKeys<C>(codecValidation.right, props),\n either.mapLeft((keys) =>\n keys.map((key) => ({\n value: codecValidation.right[key],\n context,\n message: `excess key \"${key}\" found`,\n })),\n ),\n );\n },\n (value) => codec.encode((stripKeys(value, props) as Right<any>).right),\n codec,\n );\n};\n\n/**\n * A wrapper type used with `io-ts` to ensure there are not any excess keys.\n */\nexport class NoExcessType<C extends t.Any, A = C['_A'], O = A, I = unknown> extends t.Type<\n A,\n O,\n I\n> {\n public readonly _tag = 'NoExcessType' as const;\n\n public constructor(\n name: string,\n is: NoExcessType<C, A, O, I>['is'],\n validate: NoExcessType<C, A, O, I>['validate'],\n encode: NoExcessType<C, A, O, I>['encode'],\n public readonly type: C,\n ) {\n super(name, is, validate, encode);\n }\n}\n"],"mappings":";;;;;;;;AA6BA,SAAgB,WAAW,YAAyC;AAElE,QAAO,WAAW,QAAQ,aAAa,UAAU;AAC/C,cAAY,SAAS;AACrB,SAAO;IACN,EAAY,CAAC;;;;;;AAOlB,SAAgB,WACd,GAAG,YACiB;CACpB,MAAM,mBAAmB,WAAW,KAAK,cACvC,MAAM,QAAQ,UAAU,G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AAb,cAAoF,EAAE,KAIpF;CACA,OAAuB;CAEvB,YACE,MACA,IACA,UACA,QACA,MACA;AACA,QAAM,MAAM,IAAI,UAAU,OAAO;AAFjB,OAAA,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/enum.ts","../src/getKeys.ts","../src/apply.ts","../src/codecTools/decodeCodec.ts","../src/codecTools/dictionary.ts","../src/codecTools/FixedLengthString.ts","../src/codecTools/FixedLengthArray.ts","../src/codecTools/partialRecord.ts","../src/codecTools/isCodecError.ts","../src/codecTools/NonEmptyString.ts","../src/codecTools/toJsonSchema.ts","../src/codecTools/createDefaultCodec.ts","../src/enums.ts","../src/getEntries.ts","../src/getValues.ts","../src/groupBy.ts","../src/gql.ts","../src/invert.ts","../src/valuesOf.ts","../src/findAllWithRegex.ts","../src/aggregateObjects.ts","../src/flattenObject.ts","../src/transposeObjectArray.ts","../src/fromEntries.ts","../src/noExcess.ts"],"sourcesContent":["import type { ObjByString } from './types.js';\n\n// TODO: https://linear.app/transcend/issue/LAK-2351 – Remove deprecated enum utils\n\n/**\n * An enumerated value.\n * @deprecated - Enum utils are deprecated\n */\nexport type Enumerate<T = string, TKey extends string = string> = {\n [key in TKey]: T;\n};\n\n/**\n * A TypeScript enum with string values.\n * @deprecated - Enum utils are deprecated\n */\nexport type TypescriptEnum = { [key in string]: string } | { [key in number]: string };\n\n/**\n * An input when defining an enum can be an object of string -> string or a list\n * of strings.\n * @deprecated - Enum utils are deprecated\n */\nexport type EnumInput<T, TKey extends string = string> = Enumerate<T, TKey> | string[];\n\n/**\n * Convert a list of strings to an enum-like object.\n * @deprecated - Enum utils are deprecated\n */\nexport function listToEnum(attributes: string[]): Enumerate<string> {\n const initialValue: Enumerate<string> = {};\n return attributes.reduce((accumulator, value) => {\n accumulator[value] = value;\n return accumulator;\n }, initialValue);\n}\n\n/**\n * Merge enum-like inputs into a single enum object.\n * @deprecated - Enum utils are deprecated\n */\nexport function createEnum<T = string, TKey extends string = string>(\n ...attributes: EnumInput<T, TKey>[]\n): Enumerate<T, TKey> {\n const objectAttributes = attributes.map((attribute) =>\n Array.isArray(attribute) ? listToEnum(attribute) : attribute,\n );\n\n return Object.assign({}, ...objectAttributes);\n}\n\n/**\n * Filter an enum and return the keys that remain.\n * @deprecated - Enum utils are deprecated\n */\nexport function filterEnum<T extends ObjByString>(\n obj: T,\n filterFunc: (value: T[keyof T], key: keyof T, calculatedEnum: Enumerate<T[keyof T]>) => boolean,\n): (keyof T)[] {\n return (Object.keys(obj) as (keyof T)[])\n .filter((key) => filterFunc(obj[key], key, obj))\n .map((key) => key);\n}\n\n/**\n * Make an enum compatible with type inference without changing its runtime\n * shape.\n * @deprecated – Enum utils are deprecated\n */\nexport function makeEnum<T extends { [index: string]: Value | Value[] }, Value extends string>(\n value: T,\n): T {\n return value;\n}\n","import type { StringKeys } from './types.js';\n\n/**\n * `Object.keys` for string keys only.\n */\nexport function getStringKeys<T extends {}>(obj: T): StringKeys<T>[] {\n return Object.keys(obj).filter((key) => typeof key === 'string') as StringKeys<T>[];\n}\n\n/**\n * `Object.keys` that preserves key types.\n */\nexport function getKeys<T extends {}>(obj: T): (keyof T)[] {\n return Object.keys(obj) as (keyof T)[];\n}\n","import { createEnum } from './enum.js';\nimport { getKeys } from './getKeys.js';\nimport type { ObjByString, StringKeys } from './types.js';\n\n/**\n * Apply a function to each value of an object while preserving the key types.\n */\nexport function apply<TInput extends ObjByString, TOutput>(\n obj: TInput,\n applyFunc: (\n value: TInput[keyof TInput],\n key: StringKeys<TInput>,\n fullObj: typeof obj,\n index: number,\n ) => TOutput,\n): { [key in keyof TInput]: TOutput } {\n const result = Object.keys(obj).reduce(\n (accumulator, key, index) =>\n Object.assign(accumulator, {\n [key]: applyFunc(obj[key], key as StringKeys<TInput>, obj, index),\n }),\n {},\n );\n\n return result as { [key in keyof TInput]: TOutput };\n}\n\n/**\n * Async version of `apply`.\n */\nexport async function asyncApply<TInput extends ObjByString, TOutput>(\n obj: TInput,\n applyFunc: (\n value: TInput[keyof TInput],\n key: StringKeys<TInput>,\n fullObj: typeof obj,\n index: number,\n ) => Promise<TOutput>,\n): Promise<{ [key in keyof TInput]: TOutput }> {\n const entries = await Promise.all(\n getKeys(obj).map(async (key, index) => ({\n key,\n value: await applyFunc(obj[key], key as StringKeys<TInput>, obj, index),\n })),\n );\n\n const result = entries.reduce(\n (accumulator, { key, value }) =>\n Object.assign(accumulator, {\n [key]: value,\n }),\n {},\n );\n\n return result as { [key in keyof TInput]: TOutput };\n}\n\n/**\n * Convert a TypeScript enum to a value-to-value map and then call `apply`.\n */\nexport function applyEnum<TEnum extends string, TOutput>(\n enm: { [key in string]: TEnum },\n applyFunc: (value: TEnum, key: TEnum, fullObj: typeof enm, index: number) => TOutput,\n): { [key in TEnum]: TOutput } {\n const obj = createEnum<TEnum, TEnum>(Object.values(enm));\n return apply(obj, applyFunc) as any;\n}\n","import * as either from 'fp-ts/lib/Either.js';\nimport { pipe } from 'fp-ts/lib/function.js';\nimport * as t from 'io-ts';\n\n/**\n * Determine the codec paths that are invalid.\n */\nfunction getPaths<A>(validation: t.Validation<A>): string[] {\n return pipe(\n validation,\n either.fold(\n (errors) =>\n errors.map((error) => {\n const lastContext = error.context.at(-1);\n const fullPath = error.context.map(({ key }) => key).join('.');\n return `${fullPath} expected type '${lastContext?.type.name}'`;\n }),\n () => ['no errors'],\n ),\n );\n}\n\n/**\n * Get custom error messages for the errors.\n */\nfunction getCustomErrors<A>(\n validation: t.Validation<A>,\n customErrorFromContext: (validationContext: t.Context) => string,\n): string[] {\n return pipe(\n validation,\n either.fold(\n (errors) => errors.map((error) => customErrorFromContext(error.context)),\n () => ['no errors'],\n ),\n );\n}\n\nexport const CODEC_ERROR_MESSAGE = 'Failed to decode codec:';\n\n/**\n * Decode a codec, returning the decoded value or throwing an error.\n */\nexport function decodeCodec<TCodec extends t.Any>(\n codec: TCodec,\n txt: unknown,\n parse = true,\n customErrorFromContext: ((validationContext: t.Context) => string) | undefined = undefined,\n): t.TypeOf<TCodec> {\n const decoded = codec.decode(parse && typeof txt === 'string' ? JSON.parse(txt) : txt);\n\n if (either.isLeft(decoded)) {\n const errorPaths = getPaths(decoded);\n const customError =\n customErrorFromContext !== undefined\n ? JSON.stringify(getCustomErrors(decoded, customErrorFromContext), null, 2)\n : undefined;\n\n throw new Error(\n `${CODEC_ERROR_MESSAGE} ${JSON.stringify(errorPaths, null, 2)}${customError ?? ''}`,\n );\n }\n\n return decoded.right;\n}\n","import { unsafeCoerce } from 'fp-ts/lib/function.js';\nimport * as t from 'io-ts';\n\n/**\n * A record with optional keys.\n */\nexport interface DictionaryC<D extends t.Mixed, C extends t.Mixed> extends t.DictionaryType<\n D,\n C,\n {\n [K in t.TypeOf<D>]?: t.TypeOf<C>;\n },\n {\n [K in t.OutputOf<D>]?: t.OutputOf<C>;\n },\n unknown\n> {}\n\n/**\n * Helper to encode/decode a record with partial keys.\n */\nexport const dictionary = <D extends t.Mixed, C extends t.Mixed>(\n keys: D,\n values: C,\n name?: string,\n): DictionaryC<D, C> => unsafeCoerce(t.record(t.union([keys, t.undefined]), values, name));\n","import * as t from 'io-ts';\n\n/**\n * Brand for strings of fixed length.\n */\nexport type FixedLengthStringBrand<N extends number> = {\n /** The expected length of the string. */\n readonly length: N;\n /** Unique symbol to ensure uniqueness of this type across modules/packages. */\n readonly FixedLengthString: unique symbol;\n};\n\n/**\n * Codec for strings constrained to a fixed length.\n */\nexport const FixedLengthString = <N extends number>(\n len: N,\n): t.BrandC<t.StringC, FixedLengthStringBrand<N>> =>\n t.brand(\n t.string,\n (value): value is t.Branded<string, FixedLengthStringBrand<N>> => value.length === len,\n 'FixedLengthString',\n );\n\n/**\n * Branded fixed-length string type.\n */\nexport type FixedLengthString<N extends number> = t.TypeOf<\n t.BrandC<t.StringC, FixedLengthStringBrand<N>>\n>;\n","import * as t from 'io-ts';\n\n/**\n * Brand for arrays with bounded length.\n */\nexport interface FixedLengthArrayBrand<T> extends Array<T> {\n /** Unique symbol to ensure uniqueness of this type across modules/packages. */\n readonly fixedLengthArray: unique symbol;\n /** The minimum length of the array. */\n readonly min: number;\n /** The maximum length of the array. */\n readonly max: number;\n}\n\n/**\n * Codec for arrays constrained to a fixed length range.\n */\nexport const FixedLengthArray = <C extends t.Mixed>(\n min: number,\n max: number,\n codec: C,\n): t.BrandC<t.ArrayC<C>, FixedLengthArrayBrand<C>> =>\n t.brand(\n t.array(codec),\n (value: Array<C>): value is t.Branded<Array<C>, FixedLengthArrayBrand<C>> =>\n min <= value.length && value.length <= max,\n 'fixedLengthArray',\n );\n\n/**\n * Branded fixed-length array type.\n */\nexport type FixedLengthArray<C extends t.Mixed> = t.TypeOf<\n t.BrandC<t.ArrayC<C>, FixedLengthArrayBrand<C>>\n>;\n","import * as t from 'io-ts';\n\n/**\n * Like `t.record`, but where the keys are all optional to include.\n */\nexport interface PartialRecordC<D extends t.Mixed, C extends t.Mixed> extends t.DictionaryType<\n D,\n C,\n {\n [K in t.TypeOf<D>]?: t.TypeOf<C>;\n },\n {\n [K in t.OutputOf<D>]?: t.OutputOf<C>;\n },\n unknown\n> {}\n\n/**\n * Create an `io-ts` compatible partial record.\n */\nexport const partialRecord = <D extends t.Mixed, C extends t.Mixed>(\n domain: D,\n codomain: C,\n name?: string,\n): PartialRecordC<D, C> =>\n t.record(t.union([domain, t.undefined]), codomain, name) as unknown as PartialRecordC<D, C>;\n","/**\n * Checks an error message to see if it is an `io-ts` codec error.\n */\nexport function isCodecError(err: Error): boolean {\n return err.message.startsWith('Failed to decode codec');\n}\n","import * as t from 'io-ts';\n\n/**\n * Brand for non-empty strings.\n */\ntype NonEmptyStringBrand = {\n /** Unique symbol to ensure uniqueness of this type across modules/packages. */\n readonly NonEmptyString: symbol;\n};\n\n/**\n * Codec for non-empty trimmed strings.\n */\nexport const NonEmptyString = t.brand(\n t.string,\n (value): value is t.Branded<string, NonEmptyStringBrand> => value.trim().length !== 0,\n 'NonEmptyString',\n);\n\n/**\n * Branded non-empty string type.\n */\nexport type NonEmptyString = t.TypeOf<typeof NonEmptyString>;\n","import * as t from 'io-ts';\nimport type { JSONSchema7 } from 'json-schema';\n\n/**\n * `io-ts` types compatible with JSON Schema.\n */\ntype MappableType =\n | t.NumberType\n | t.StringType\n | t.NullType\n | t.BooleanType\n | t.LiteralType<any>\n | t.KeyofType<any>\n | t.InterfaceType<any>\n | t.DictionaryType<any, any>\n | t.PartialType<any>\n | t.UnionType<any>\n | t.ArrayType<any>\n | t.TupleType<any>\n | t.IntersectionType<any>\n | t.RefinementType<any>;\n\n/**\n * Options for converting an `io-ts` codec to JSON Schema.\n */\nexport interface ToJsonSchemaOptions {\n /**\n * Replace reused codecs with local draft-07 `definitions` references when\n * doing so makes the serialized schema smaller.\n */\n useReferences?: boolean;\n}\n\n/**\n * State shared while an `io-ts` codec graph is converted.\n */\ninterface ConversionContext {\n /** Codec identity associated with each generated schema object. */\n schemaCodecs: WeakMap<JSONSchema7, object>;\n}\n\n/**\n * A reused codec schema that may be moved into `definitions`.\n */\ninterface CodecSchemaCandidate {\n /** Codec object represented by the generated schemas. */\n codec: object;\n /** Number of occurrences in the generated schema. */\n occurrences: number;\n /** Generated schema objects representing this codec and schema variant. */\n schemas: JSONSchema7[];\n /** Serialized schema used to identify structural matches. */\n serializedSchema: string;\n /** Generated schema used as the definition body. */\n schema: JSONSchema7;\n}\n\n/**\n * Runtime metadata exposed by an `io-ts` codec.\n */\ninterface CodecMetadata {\n /** Human-readable codec name. */\n name?: unknown;\n /** Internal `io-ts` codec tag. */\n _tag?: unknown;\n}\n\n/**\n * Convert an `io-ts` codec to a JSON Schema (v7).\n */\nexport const toJsonSchema = (\n rawType: any,\n strict = false,\n alwaysIncludeRequired = false,\n options: ToJsonSchemaOptions = {},\n): JSONSchema7 => {\n const context: ConversionContext = {\n schemaCodecs: new WeakMap(),\n };\n const schema = convertToJsonSchema(rawType, strict, alwaysIncludeRequired, context);\n return options.useReferences ? addCodecReferences(schema, context) : schema;\n};\n\n/**\n * Recursively convert an `io-ts` codec to an inline JSON Schema.\n *\n * Keeping this pass reference-free is important because parent codecs inspect\n * and transform their generated child schemas.\n */\nconst convertToJsonSchema = (\n rawType: any,\n strict: boolean,\n alwaysIncludeRequired: boolean,\n context: ConversionContext,\n): JSONSchema7 => {\n const type = rawType as MappableType;\n const tracked = (schema: JSONSchema7): JSONSchema7 => trackSchema(type, schema, context);\n\n if (type._tag === 'StringType') {\n return tracked({ type: 'string' });\n }\n\n if (type._tag === 'NumberType') {\n return tracked({ type: 'number' });\n }\n\n if (type._tag === 'NullType') {\n return tracked({ type: 'null' });\n }\n\n if (type._tag === 'BooleanType') {\n return tracked({ type: 'boolean' });\n }\n\n if (type._tag === 'LiteralType') {\n return tracked({ const: type.value });\n }\n\n if (type._tag === 'KeyofType') {\n return tracked({ type: 'string', enum: Object.keys(type.keys) });\n }\n\n if (type._tag === 'UnionType') {\n return tracked({\n anyOf: type.types.map((subtype: any) =>\n convertToJsonSchema(subtype, strict, alwaysIncludeRequired, context),\n ),\n });\n }\n\n if (type._tag === 'IntersectionType' && !alwaysIncludeRequired) {\n return tracked({\n allOf: type.types.map((subtype: any) =>\n convertToJsonSchema(subtype, strict, alwaysIncludeRequired, context),\n ),\n });\n }\n\n if (type._tag === 'IntersectionType' && alwaysIncludeRequired) {\n const results = type.types.map((subtype: any) =>\n convertToJsonSchema(subtype, strict, alwaysIncludeRequired, context),\n );\n\n if (!results.every((result: any) => result.type === 'object')) {\n throw new Error('InterfaceType must have all children as type=object');\n }\n\n return tracked({\n type: 'object',\n required: results.map((result: any) => result.required).flat(),\n properties: results.reduce(\n (accumulator: any, result: any) => ({ ...accumulator, ...result.properties }),\n {},\n ),\n ...(strict ? { additionalProperties: false } : {}),\n });\n }\n\n if (type._tag === 'InterfaceType') {\n return tracked({\n type: 'object',\n required: Object.keys(type.props),\n properties: Object.fromEntries(\n Object.entries(type.props).map(([key, subtype]) => [\n key,\n convertToJsonSchema(subtype as t.Type<any>, strict, alwaysIncludeRequired, context),\n ]),\n ),\n ...(strict ? { additionalProperties: false } : {}),\n });\n }\n\n if (type._tag === 'DictionaryType') {\n return tracked({\n type: 'object',\n additionalProperties: convertToJsonSchema(\n type.codomain,\n strict,\n alwaysIncludeRequired,\n context,\n ),\n });\n }\n\n if (type._tag === 'PartialType') {\n return tracked({\n type: 'object',\n ...(alwaysIncludeRequired ? { required: Object.keys(type.props) } : {}),\n properties: Object.fromEntries(\n Object.entries(type.props).map(([key, subtype]) => {\n const result = convertToJsonSchema(\n subtype as t.Type<any>,\n strict,\n alwaysIncludeRequired,\n context,\n );\n const transformedResult =\n alwaysIncludeRequired && result.type\n ? trackSchema(\n subtype as object,\n {\n ...result,\n type: [result.type as any, 'null'],\n },\n context,\n )\n : result;\n return [key, transformedResult];\n }),\n ),\n ...(strict ? { additionalProperties: false } : {}),\n });\n }\n\n if (type._tag === 'ArrayType') {\n return tracked({\n type: 'array',\n items: convertToJsonSchema(type.type, strict, alwaysIncludeRequired, context),\n });\n }\n\n if (type._tag === 'TupleType') {\n return tracked({\n type: 'array',\n items: type.types.map((subtype: any) =>\n convertToJsonSchema(subtype, strict, alwaysIncludeRequired, context),\n ),\n });\n }\n\n if (type._tag === 'RefinementType') {\n if (type.name === 'Int') {\n return tracked({ type: 'integer' });\n }\n\n return tracked({\n ...convertToJsonSchema(type.type, strict, alwaysIncludeRequired, context),\n description: `Predicate: ${type.predicate.name || type.name}`,\n });\n }\n\n return tracked(unhandledType(type as never));\n};\n\n/**\n * Associate a generated schema object with the codec that produced it.\n *\n * @param codec - Source codec\n * @param schema - Generated schema\n * @param context - Shared conversion state\n * @returns The generated schema\n */\nfunction trackSchema(codec: object, schema: JSONSchema7, context: ConversionContext): JSONSchema7 {\n context.schemaCodecs.set(schema, codec);\n return schema;\n}\n\n/**\n * Move schemas produced by reused codec objects into local draft-07\n * definitions.\n *\n * @param schema - Fully generated inline schema\n * @param context - Shared conversion state\n * @returns A smaller equivalent schema when references are beneficial\n */\nfunction addCodecReferences(schema: JSONSchema7, context: ConversionContext): JSONSchema7 {\n const candidates = new Map<object, Map<string, CodecSchemaCandidate>>();\n collectCodecCandidates(schema, context, candidates);\n\n const definitionNames = new WeakMap<JSONSchema7, string>();\n const selectedCandidates = new Map<string, CodecSchemaCandidate>();\n const usedDefinitionNames = new Set<string>();\n\n for (const variants of candidates.values()) {\n for (const candidate of variants.values()) {\n if (candidate.occurrences < 2) {\n continue;\n }\n\n const definitionName = buildDefinitionName(candidate, usedDefinitionNames);\n const reference = { $ref: `#/definitions/${definitionName}` };\n const inlineSize = candidate.serializedSchema.length * candidate.occurrences;\n const referencedSize =\n candidate.serializedSchema.length +\n JSON.stringify(definitionName).length +\n 1 +\n JSON.stringify(reference).length * candidate.occurrences;\n\n if (referencedSize < inlineSize) {\n usedDefinitionNames.add(definitionName);\n selectedCandidates.set(definitionName, candidate);\n candidate.schemas.forEach((candidateSchema) =>\n definitionNames.set(candidateSchema, definitionName),\n );\n }\n }\n }\n\n if (selectedCandidates.size === 0) {\n return schema;\n }\n\n const definitions: Record<string, JSONSchema7> = {};\n const referencedSchema = replaceCodecCandidates(\n schema,\n definitionNames,\n selectedCandidates,\n definitions,\n ) as JSONSchema7;\n const result = inlineUnprofitableDefinitions(referencedSchema, definitions);\n\n return JSON.stringify(result).length < JSON.stringify(schema).length ? result : schema;\n}\n\n/**\n * Collect schema variants by the identity of the codec that produced them.\n *\n * A codec can produce different schemas in different parent contexts, so its\n * serialized schema is a secondary key.\n *\n * @param value - Current generated schema value\n * @param context - Shared conversion state\n * @param candidates - Candidates grouped by codec identity and schema variant\n */\nfunction collectCodecCandidates(\n value: unknown,\n context: ConversionContext,\n candidates: Map<object, Map<string, CodecSchemaCandidate>>,\n): void {\n if (Array.isArray(value)) {\n value.forEach((item) => collectCodecCandidates(item, context, candidates));\n return;\n }\n\n if (!isRecord(value)) {\n return;\n }\n\n const schema = value as JSONSchema7;\n const codec = context.schemaCodecs.get(schema);\n\n if (codec) {\n const serializedSchema = JSON.stringify(schema);\n const variants = candidates.get(codec) ?? new Map<string, CodecSchemaCandidate>();\n const candidate = variants.get(serializedSchema);\n\n if (candidate) {\n candidate.occurrences += 1;\n candidate.schemas.push(schema);\n } else {\n variants.set(serializedSchema, {\n codec,\n occurrences: 1,\n schemas: [schema],\n serializedSchema,\n schema,\n });\n candidates.set(codec, variants);\n }\n }\n\n Object.values(value).forEach((child) => collectCodecCandidates(child, context, candidates));\n}\n\n/**\n * Replace selected codec schemas with references, creating definitions lazily\n * so unused nested candidates are omitted.\n *\n * @param value - Current generated schema value\n * @param definitionNames - Definition name for each selected schema object\n * @param selectedCandidates - Selected candidates indexed by definition name\n * @param definitions - Definitions created while replacing candidates\n * @returns A copy with selected codec schemas replaced\n */\nfunction replaceCodecCandidates(\n value: unknown,\n definitionNames: WeakMap<JSONSchema7, string>,\n selectedCandidates: Map<string, CodecSchemaCandidate>,\n definitions: Record<string, JSONSchema7>,\n): unknown {\n if (Array.isArray(value)) {\n return value.map((item) =>\n replaceCodecCandidates(item, definitionNames, selectedCandidates, definitions),\n );\n }\n\n if (!isRecord(value)) {\n return value;\n }\n\n const definitionName = definitionNames.get(value as JSONSchema7);\n if (definitionName) {\n ensureDefinition(definitionName, definitionNames, selectedCandidates, definitions);\n return { $ref: `#/definitions/${definitionName}` };\n }\n\n return replaceSchemaChildren(value, definitionNames, selectedCandidates, definitions);\n}\n\n/**\n * Create a selected definition and replace any nested selected codecs.\n *\n * @param definitionName - Definition to create\n * @param definitionNames - Definition name for each selected schema object\n * @param selectedCandidates - Selected candidates indexed by definition name\n * @param definitions - Definitions created while replacing candidates\n */\nfunction ensureDefinition(\n definitionName: string,\n definitionNames: WeakMap<JSONSchema7, string>,\n selectedCandidates: Map<string, CodecSchemaCandidate>,\n definitions: Record<string, JSONSchema7>,\n): void {\n if (Object.hasOwn(definitions, definitionName)) {\n return;\n }\n\n definitions[definitionName] = {};\n const candidate = selectedCandidates.get(definitionName)!;\n definitions[definitionName] = replaceSchemaChildren(\n candidate.schema,\n definitionNames,\n selectedCandidates,\n definitions,\n ) as JSONSchema7;\n}\n\n/**\n * Replace selected codecs below a schema object without replacing the object\n * itself.\n *\n * @param schema - Schema whose children should be replaced\n * @param definitionNames - Definition name for each selected schema object\n * @param selectedCandidates - Selected candidates indexed by definition name\n * @param definitions - Definitions created while replacing candidates\n * @returns Schema object with replaced children\n */\nfunction replaceSchemaChildren(\n schema: object,\n definitionNames: WeakMap<JSONSchema7, string>,\n selectedCandidates: Map<string, CodecSchemaCandidate>,\n definitions: Record<string, JSONSchema7>,\n): Record<string, unknown> {\n return Object.fromEntries(\n Object.entries(schema).map(([key, child]) => [\n key,\n replaceCodecCandidates(child, definitionNames, selectedCandidates, definitions),\n ]),\n );\n}\n\n/**\n * Inline definitions whose remaining references cost at least as much as the\n * repeated schema bodies. This removes nested candidates that became\n * single-use after a parent codec was moved into a definition.\n *\n * @param schema - Root schema without its definitions\n * @param definitions - Generated definitions\n * @returns Schema with only profitable definitions\n */\nfunction inlineUnprofitableDefinitions(\n schema: JSONSchema7,\n definitions: Record<string, JSONSchema7>,\n): JSONSchema7 {\n let result = schema;\n const remainingDefinitions = { ...definitions };\n\n while (true) {\n const referenceCounts = new Map<string, number>();\n countDefinitionReferences(result, referenceCounts);\n Object.values(remainingDefinitions).forEach((definition) =>\n countDefinitionReferences(definition, referenceCounts),\n );\n\n const definitionNames = Object.keys(remainingDefinitions);\n const definitionName =\n definitionNames.find((name) => (referenceCounts.get(name) ?? 0) < 2) ??\n definitionNames.find((name) => {\n const definition = remainingDefinitions[name]!;\n const occurrences = referenceCounts.get(name) ?? 0;\n const referenceSize = JSON.stringify({ $ref: `#/definitions/${name}` }).length;\n const definitionSize = JSON.stringify(definition).length + JSON.stringify(name).length + 1;\n return (\n JSON.stringify(definition).length * occurrences <=\n definitionSize + referenceSize * occurrences\n );\n });\n\n if (!definitionName) {\n break;\n }\n\n const definition = remainingDefinitions[definitionName]!;\n delete remainingDefinitions[definitionName];\n result = replaceDefinitionReference(result, definitionName, definition) as JSONSchema7;\n\n for (const [name, remainingDefinition] of Object.entries(remainingDefinitions)) {\n remainingDefinitions[name] = replaceDefinitionReference(\n remainingDefinition,\n definitionName,\n definition,\n ) as JSONSchema7;\n }\n }\n\n return Object.keys(remainingDefinitions).length > 0\n ? { ...result, definitions: remainingDefinitions }\n : result;\n}\n\n/**\n * Count local references to generated definitions.\n *\n * @param value - Current schema value\n * @param referenceCounts - Counts indexed by definition name\n */\nfunction countDefinitionReferences(value: unknown, referenceCounts: Map<string, number>): void {\n if (Array.isArray(value)) {\n value.forEach((item) => countDefinitionReferences(item, referenceCounts));\n return;\n }\n\n if (!isRecord(value)) {\n return;\n }\n\n if (typeof value.$ref === 'string' && value.$ref.startsWith('#/definitions/')) {\n const definitionName = value.$ref.slice('#/definitions/'.length);\n referenceCounts.set(definitionName, (referenceCounts.get(definitionName) ?? 0) + 1);\n }\n\n Object.values(value).forEach((child) => countDefinitionReferences(child, referenceCounts));\n}\n\n/**\n * Inline every bare reference to one generated definition.\n *\n * @param value - Current schema value\n * @param definitionName - Definition to inline\n * @param definition - Definition body\n * @returns Schema value with matching references replaced\n */\nfunction replaceDefinitionReference(\n value: unknown,\n definitionName: string,\n definition: JSONSchema7,\n): unknown {\n if (Array.isArray(value)) {\n return value.map((item) => replaceDefinitionReference(item, definitionName, definition));\n }\n\n if (!isRecord(value)) {\n return value;\n }\n\n if (Object.keys(value).length === 1 && value.$ref === `#/definitions/${definitionName}`) {\n return definition;\n }\n\n return Object.fromEntries(\n Object.entries(value).map(([key, child]) => [\n key,\n replaceDefinitionReference(child, definitionName, definition),\n ]),\n );\n}\n\n/**\n * Build a stable, JSON Pointer-safe definition name.\n *\n * Explicit simple codec names are preferred. Generated io-ts expression names\n * fall back to a codec tag and content hash.\n *\n * @param candidate - Codec schema being named\n * @param usedDefinitionNames - Definition names already allocated\n * @returns Definition name\n */\nfunction buildDefinitionName(\n candidate: CodecSchemaCandidate,\n usedDefinitionNames: Set<string>,\n): string {\n const metadata = candidate.codec as CodecMetadata;\n const explicitName =\n typeof metadata.name === 'string' && /^[A-Za-z_][A-Za-z0-9_-]*$/u.test(metadata.name)\n ? metadata.name\n : undefined;\n const codecTag =\n typeof metadata._tag === 'string'\n ? metadata._tag.replace(/Type$/u, '').toLowerCase()\n : 'schema';\n const baseName =\n explicitName ?? `${codecTag || 'schema'}-${hashString(candidate.serializedSchema)}`;\n let definitionName = baseName;\n let suffix = 2;\n\n while (usedDefinitionNames.has(definitionName)) {\n definitionName = `${baseName}-${suffix}`;\n suffix += 1;\n }\n\n return definitionName;\n}\n\n/**\n * Produce a compact deterministic hash for a definition name.\n *\n * Hash collisions cannot affect correctness because definition names are\n * checked against their serialized schemas before use.\n *\n * @param value - Value to hash\n * @returns Unsigned base-36 FNV-1a hash\n */\nfunction hashString(value: string): string {\n let hash = 2_166_136_261;\n\n for (let index = 0; index < value.length; index += 1) {\n hash ^= value.charCodeAt(index);\n hash = Math.imul(hash, 16_777_619);\n }\n\n return (hash >>> 0).toString(36);\n}\n\n/**\n * Check whether a value is a non-null object record.\n *\n * @param value - Value to check\n * @returns Whether the value is a record\n */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null;\n}\n\nconst unhandledType = (_shouldBeNever: never) => ({});\n","import * as t from 'io-ts';\n\n/**\n * Creates a default value for an `io-ts` codec.\n */\nexport const createDefaultCodec = <C extends t.Mixed>(codec: C): t.TypeOf<C> => {\n if (codec instanceof t.UnionType) {\n const arrayType = codec.types.find((type: any) => type instanceof t.ArrayType);\n if (arrayType) {\n return createDefaultCodec(arrayType);\n }\n\n const objectType = codec.types.find(\n (type: any) =>\n type instanceof t.InterfaceType ||\n type instanceof t.PartialType ||\n type instanceof t.IntersectionType ||\n type instanceof t.ArrayType,\n );\n if (objectType) {\n return createDefaultCodec(objectType);\n }\n\n const hasNull = codec.types.some(\n (type: any) => type instanceof t.NullType || type.name === 'null',\n );\n if (hasNull) {\n return null as t.TypeOf<C>;\n }\n\n return createDefaultCodec(codec.types[0]);\n }\n\n if (codec instanceof t.InterfaceType || codec instanceof t.PartialType) {\n const defaults: Record<string, any> = {};\n Object.entries(codec.props).forEach(([key, type]) => {\n defaults[key] = createDefaultCodec(type as any);\n });\n return defaults as t.TypeOf<C>;\n }\n\n if (codec instanceof t.IntersectionType) {\n return codec.types.reduce(\n (accumulator: t.TypeOf<C>, type: any) => ({\n ...accumulator,\n ...createDefaultCodec(type),\n }),\n {},\n );\n }\n\n if (codec instanceof t.ArrayType) {\n const elementType = codec.type;\n const isObjectType =\n elementType instanceof t.InterfaceType ||\n elementType instanceof t.PartialType ||\n elementType instanceof t.IntersectionType;\n\n return (isObjectType ? [createDefaultCodec(elementType)] : []) as t.TypeOf<C>;\n }\n\n if (codec instanceof t.LiteralType) {\n return codec.value as t.TypeOf<C>;\n }\n\n if (codec instanceof t.ObjectType) {\n return {} as t.TypeOf<C>;\n }\n\n switch (codec.name) {\n case 'string':\n return '' as t.TypeOf<C>;\n case 'number':\n return 0 as t.TypeOf<C>;\n case 'boolean':\n return false as t.TypeOf<C>;\n case 'null':\n return null as t.TypeOf<C>;\n case 'undefined':\n return undefined as t.TypeOf<C>;\n default:\n return null as t.TypeOf<C>;\n }\n};\n","import { makeEnum } from './enum.js';\n\n/**\n * The HTTP method types.\n */\nexport const HttpMethod = {\n /** A GET request. */\n Get: 'GET',\n /** A POST request. */\n Post: 'POST',\n /** A DELETE request. */\n Delete: 'DELETE',\n /** A PUT request. */\n Put: 'PUT',\n /** A PATCH request. */\n Patch: 'PATCH',\n} as const;\n\n/**\n * The HTTP method string union.\n */\nexport type HttpMethod = (typeof HttpMethod)[keyof typeof HttpMethod];\n","import type { ObjByString } from './types.js';\n\n/**\n * `Object.entries` that preserves entry types.\n */\nexport function getEntries<TKey extends keyof TObj, TObj extends ObjByString>(\n obj: TObj,\n): [TKey, TObj[TKey]][] {\n return Object.entries(obj) as any;\n}\n","/**\n * `Object.values` that preserves value types.\n */\nexport function getValues<TValue>(obj: {\n [key in string | number | symbol]: TValue;\n}): TValue[] {\n return Object.values(obj) as TValue[];\n}\n","/**\n * A typed version of lodash's `groupBy`.\n */\nexport function groupBy<TItem, TKey>(\n iterable: TItem[],\n getKey: (item: TItem) => TKey,\n): Map<TKey, TItem[]> {\n return iterable.reduce((groupedItems, item) => {\n const groupedKey = getKey(item);\n return groupedItems.set(groupedKey, [...(groupedItems.get(groupedKey) ?? []), item]);\n }, new Map<TKey, TItem[]>());\n}\n","/**\n * Identify whether a string looks like a GraphQL interface/type/input\n * declaration.\n */\nexport const INTERFACE_REGEX = /(interface|type|input) [a-zA-Z0-9]* (implements .+?|){([\\s\\S]+?)}/;\n\n/**\n * A `gql` is simply a string branded with the associated GraphQL type.\n */\nexport type Gql<TGraphQLType extends object> = string & {\n /** The TypeScript type definition that relates to the gql string. */\n graphQLType: TGraphQLType;\n};\n\n/**\n * Template tag for GraphQL fragments with a small amount of interpolation\n * support for interface bodies.\n */\nexport function gql<TGraphQLType extends object>(\n strings: TemplateStringsArray,\n ...expressions: (string | number)[]\n): Gql<TGraphQLType> {\n if (expressions.length === 0) {\n return strings[0] as Gql<TGraphQLType>;\n }\n\n const count = strings.length - 1;\n let result = '';\n for (let index = 0; index < count; index += 1) {\n const expression = expressions[index]!;\n const text = typeof expression === 'string' ? expression : expression.toString();\n const useExpression = INTERFACE_REGEX.test(text)\n ? (INTERFACE_REGEX.exec(text) || [])[3]\n : expression;\n result += (strings[index] ?? '') + (useExpression ?? '');\n }\n\n result += strings[count] ?? '';\n return result as Gql<TGraphQLType>;\n}\n","import { getEntries } from './getEntries.js';\n\n/**\n * Invert an object so the values look up the keys. Arrays are expanded and map\n * back to arrays of keys.\n */\nexport function invert<TKey extends string, TValue extends string | string[]>(\n obj: { [key in TKey]?: TValue },\n throwOnDuplicate = true,\n): {\n [key in TValue extends (infer Item)[] ? Item : TValue]: TValue extends any[] ? TKey[] : TKey;\n} {\n const result: any = {};\n\n getEntries(obj).forEach(([key, instance]: [TKey, TValue | undefined]) => {\n if (instance === undefined) {\n throw new Error('inverse found undefined value, this is not supported');\n }\n\n if (Array.isArray(instance)) {\n instance.forEach((listKey) => {\n if (!result[listKey]) {\n result[listKey] = [key];\n } else {\n result[listKey].push(key);\n }\n });\n return;\n }\n\n if (result[instance] && throwOnDuplicate) {\n throw new Error(\n `Encountered duplicate value inverting object: \"${instance}: ${key} and ${result[instance]}\"`,\n );\n }\n\n result[instance] = key;\n });\n\n return result;\n}\n\n/**\n * Safely invert an object into `{ [value]: key[] }`.\n */\nexport function invertSafe<TKey extends string, TValue extends string>(obj: {\n [key in TKey]: TValue | TValue[];\n}): {\n [key in TValue]: TKey[];\n} {\n const result: any = {};\n\n getEntries(obj).forEach(([key, instance]) => {\n if (instance === undefined) {\n throw new Error('inverse found undefined value, this is not supported');\n }\n\n if (Array.isArray(instance)) {\n instance.forEach((listKey) => {\n if (!result[listKey]) {\n result[listKey] = [key];\n } else {\n result[listKey].push(key);\n }\n });\n return;\n }\n\n if (!result[instance]) {\n result[instance] = [key];\n return;\n }\n\n result[instance].push(key);\n });\n\n return result;\n}\n","import * as t from 'io-ts';\n\nimport { invert } from './invert.js';\n\n/**\n * Build an `io-ts` codec over the values of an enum-like object.\n *\n * @param enm - Enum-like object\n * @param name - Optional stable codec name\n * @returns Codec accepting the enum values\n */\nexport function valuesOf<TEnum extends string>(\n enm: {\n [key in string]: TEnum;\n },\n name?: string,\n): t.KeyofC<{ [key in TEnum]: unknown }> {\n return t.keyof(invert(enm) as any, name);\n}\n","/**\n * The full match returned when `regex.exec` finds a match.\n */\nexport interface RegExpMatch {\n /** The full regex match. */\n fullMatch: string;\n /** The index in the text where the match was found. */\n matchIndex: number;\n /** Whether the match satisfies an optional stricter regex. */\n isStrict?: boolean;\n}\n\n/**\n * Definition for finding all regex matches and mapping capture groups to keys.\n */\nexport interface FindAllRegExp<TMatchKeys extends string> {\n /** The regex to test. */\n value: RegExp;\n /**\n * A stricter regex used to annotate matches that satisfy a more exact\n * standard.\n */\n strict?: RegExp;\n /** Capture group names mapped by index. */\n matches: readonly TMatchKeys[];\n /** When true, skip validation of matches being the expected length. */\n skipMatchValidation?: boolean;\n}\n\n/**\n * Use a regex with the global flag to find all matches and return the list with\n * capture groups mapped to named properties.\n */\nexport function findAllWithRegex<TMatchKeys extends string>(\n regex: FindAllRegExp<TMatchKeys>,\n text: string,\n): ({ [key in TMatchKeys]: string } & RegExpMatch)[] {\n if (!regex.value.flags.includes('g')) {\n throw new Error('Regex.value must have a g flag');\n }\n\n const matchParams = ['fullMatch', ...regex.matches];\n const results: ({ [key in TMatchKeys]: string } & RegExpMatch)[] = [];\n\n let match = regex.value.exec(text);\n let index = 0;\n\n while (match) {\n if (matchParams.length !== match.length && !regex.skipMatchValidation) {\n throw new Error(\n `Mismatch in match length at index [${index}]: \"${match.length}\" vs expected: \"${matchParams.length}\"`,\n );\n }\n\n const result = match.reduce(\n (accumulator, matchResult, matchIndex) =>\n Object.assign(accumulator, {\n [matchParams[matchIndex] as string]: matchResult,\n }),\n {},\n ) as { [key in TMatchKeys]: string } & RegExpMatch;\n\n result.matchIndex = match.index;\n\n if (regex.strict) {\n result.isStrict = regex.strict.test(result.fullMatch);\n }\n\n results.push(result);\n\n match = regex.value.exec(text);\n index += 1;\n }\n\n return results;\n}\n","/**\n * Aggregates multiple objects into a single object by combining values of\n * matching keys into comma-separated strings.\n */\nexport const aggregateObjects = ({\n objs,\n wrap = false,\n}: {\n /** The objects to aggregate in a single one. */\n objs: any[];\n /** Whether to wrap the concatenated values in `[]`. */\n wrap?: boolean;\n}): any => {\n const allKeys = Array.from(\n new Set(objs.flatMap((obj) => (obj && typeof obj === 'object' ? Object.keys(obj) : []))),\n );\n\n return allKeys.reduce(\n (accumulator, key) => {\n const values = objs\n .map((obj) => (wrap ? `[${obj?.[key] ?? ''}]` : (obj?.[key] ?? '')))\n .join(',');\n accumulator[key] = values;\n return accumulator;\n },\n {} as Record<string, any>,\n );\n};\n","import { aggregateObjects } from './aggregateObjects.js';\n\n/**\n * Flattens a nested object into a single-level object with concatenated key\n * names.\n */\nexport const flattenObject = ({\n obj,\n prefix = '',\n}: {\n /** The object to flatten. */\n obj: any;\n /** The prefix to prepend to keys while recursing. */\n prefix?: string;\n}): any =>\n !obj\n ? {}\n : Object.keys(obj ?? []).reduce(\n (accumulator, key) => {\n const newKey = prefix ? `${prefix}_${key}` : key;\n const entry = obj[key];\n\n if (\n Array.isArray(entry) &&\n entry.length > 0 &&\n entry.some((item) => typeof item === 'object' && item !== null)\n ) {\n const objectEntries = entry.filter((item) => typeof item === 'object' && item !== null);\n const flattenedObjects = objectEntries.map((item) => flattenObject({ obj: item }));\n const aggregated = aggregateObjects({ objs: flattenedObjects });\n Object.entries(aggregated).forEach(([aggregatedKey, value]) => {\n accumulator[`${newKey}_${aggregatedKey}`] = value;\n });\n } else if (typeof entry === 'object' && entry !== null && !Array.isArray(entry)) {\n Object.assign(accumulator, flattenObject({ obj: entry, prefix: newKey }));\n } else {\n accumulator[newKey] = Array.isArray(entry)\n ? entry\n .map((item) => {\n if (typeof item === 'string') {\n return item.replaceAll(',', '');\n }\n\n return item ?? '';\n })\n .join(',')\n : typeof entry === 'string'\n ? entry.replaceAll(',', '')\n : (entry ?? '');\n }\n\n return accumulator;\n },\n {} as Record<string, any>,\n );\n","/**\n * Type representing a transposed array of objects.\n */\ntype TransposedObjectArray<T, K extends keyof T> = {\n [P in K]: Array<T[P]>;\n} & {\n /** Properties not selected for transposition. */\n rest: Array<Omit<T, K>>;\n};\n\n/**\n * Transpose an array of objects by converting selected properties into arrays\n * while keeping the remaining properties grouped in `rest`.\n */\nexport const transposeObjectArray = <T extends object, K extends keyof T>({\n objects,\n properties,\n options = { includeOtherProperties: true },\n}: {\n /** Array of objects to transpose. */\n objects: T[];\n /** Property keys to transpose into arrays. */\n properties: K[];\n /** Options for how to transpose the array. */\n options?: {\n /** Whether to include non-transposed properties in the final result. */\n includeOtherProperties?: boolean;\n };\n}): TransposedObjectArray<T, K> =>\n objects.reduce(\n (accumulator, item) => {\n const result = { ...accumulator } as TransposedObjectArray<T, K>;\n\n properties.forEach((property) => {\n const currentArray = (accumulator[property] || []) as T[K][];\n result[property] = [...currentArray, item[property]] as any;\n });\n\n const restObject = {} as Omit<T, K>;\n Object.entries(item).forEach(([key, value]) => {\n if (!properties.includes(key as K)) {\n (restObject as any)[key] = value;\n }\n });\n\n if (options.includeOtherProperties) {\n result.rest = [...(accumulator.rest || []), restObject];\n }\n\n return result;\n },\n {} as TransposedObjectArray<T, K>,\n );\n","/**\n * `Object.fromEntries` that preserves entry types.\n */\nexport function fromEntries<const TEntries extends ReadonlyArray<readonly [PropertyKey, unknown]>>(\n entries: TEntries,\n): { [K in TEntries[number] as K[0]]: K[1] } {\n return Object.fromEntries(entries) as { [K in TEntries[number] as K[0]]: K[1] };\n}\n","import type { Either, Right } from 'fp-ts/lib/Either.js';\nimport * as either from 'fp-ts/lib/Either.js';\nimport { pipe } from 'fp-ts/lib/function.js';\nimport * as t from 'io-ts';\n\n/**\n * Creates a type guard function that checks if a codec matches a specific tag.\n */\nconst getIsCodec =\n <T extends t.Any>(tag: string) =>\n (codec: t.Any): codec is T =>\n (codec as any)._tag === tag;\n\nconst isInterfaceCodec = getIsCodec<t.InterfaceType<t.Props>>('InterfaceType');\nconst isPartialCodec = getIsCodec<t.PartialType<t.Props>>('PartialType');\n\n/**\n * Extract property definitions from various codec types.\n */\nconst getProps = (codec: t.HasProps): t.Props => {\n switch (codec._tag) {\n case 'RefinementType':\n case 'ReadonlyType':\n return getProps(codec.type);\n case 'InterfaceType':\n case 'StrictType':\n case 'PartialType':\n return codec.props;\n case 'IntersectionType':\n return codec.types.reduce<t.Props>((props, type) => Object.assign(props, getProps(type)), {});\n default:\n return {};\n }\n};\n\n/**\n * Generate a string representation of props for type naming.\n */\nconst getNameFromProps = (props: t.Props): string =>\n Object.keys(props)\n .map((key) => `${key}: ${props[key]!.name}`)\n .join(', ');\n\n/**\n * Wrap a type name with `Partial<>`.\n */\nconst getPartialTypeName = (inner: string): string => `Partial<${inner}>`;\n\n/**\n * Generate a human-readable type name for the no-excess wrapper.\n */\nconst getNoExcessTypeName = (codec: t.Any): string => {\n if (isInterfaceCodec(codec)) {\n return `{| ${getNameFromProps(codec.props)} |}`;\n }\n\n if (isPartialCodec(codec)) {\n return getPartialTypeName(`{| ${getNameFromProps(codec.props)} |}`);\n }\n\n return `Excess<${codec.name}>`;\n};\n\n/**\n * Compare an object's keys against expected properties and return either the\n * object or a list of excess keys.\n */\nconst stripKeys = <T = any>(obj: T, props: t.Props): Either<string[], T> => {\n const keys = Object.getOwnPropertyNames(obj);\n const propKeys = Object.getOwnPropertyNames(props);\n\n propKeys.forEach((propKey) => {\n const index = keys.indexOf(propKey);\n if (index !== -1) {\n keys.splice(index, 1);\n }\n });\n\n return keys.length ? either.left(keys) : either.right(obj);\n};\n\n/**\n * Wrap an `io-ts` codec so validation fails when excess properties are present.\n */\nexport const noExcess = <C extends t.HasProps>(\n codec: C,\n name: string = getNoExcessTypeName(codec),\n): NoExcessType<C> => {\n const props: t.Props = getProps(codec);\n\n return new NoExcessType<C>(\n name,\n (value): value is C => either.isRight(stripKeys(value, props)) && codec.is(value),\n (value, context) => {\n const unknownRecordValidation = t.UnknownRecord.validate(value, context);\n if (either.isLeft(unknownRecordValidation)) {\n return unknownRecordValidation;\n }\n\n const codecValidation = codec.validate(value, context);\n if (either.isLeft(codecValidation)) {\n return codecValidation;\n }\n\n return pipe(\n stripKeys<C>(codecValidation.right, props),\n either.mapLeft((keys) =>\n keys.map((key) => ({\n value: codecValidation.right[key],\n context,\n message: `excess key \"${key}\" found`,\n })),\n ),\n );\n },\n (value) => codec.encode((stripKeys(value, props) as Right<any>).right),\n codec,\n );\n};\n\n/**\n * A wrapper type used with `io-ts` to ensure there are not any excess keys.\n */\nexport class NoExcessType<C extends t.Any, A = C['_A'], O = A, I = unknown> extends t.Type<\n A,\n O,\n I\n> {\n public readonly _tag = 'NoExcessType' as const;\n\n public constructor(\n name: string,\n is: NoExcessType<C, A, O, I>['is'],\n validate: NoExcessType<C, A, O, I>['validate'],\n encode: NoExcessType<C, A, O, I>['encode'],\n public readonly type: C,\n ) {\n super(name, is, validate, encode);\n }\n}\n"],"mappings":";;;;;;;;AA6BA,SAAgB,WAAW,YAAyC;AAElE,QAAO,WAAW,QAAQ,aAAa,UAAU;AAC/C,cAAY,SAAS;AACrB,SAAO;IACN,EAAY,CAAC;;;;;;AAOlB,SAAgB,WACd,GAAG,YACiB;CACpB,MAAM,mBAAmB,WAAW,KAAK,cACvC,MAAM,QAAQ,UAAU,GAAG,WAAW,UAAU,GAAG,UACpD;AAED,QAAO,OAAO,OAAO,EAAE,EAAE,GAAG,iBAAiB;;;;;;AAO/C,SAAgB,WACd,KACA,YACa;AACb,QAAQ,OAAO,KAAK,IAAI,CACrB,QAAQ,QAAQ,WAAW,IAAI,MAAM,KAAK,IAAI,CAAC,CAC/C,KAAK,QAAQ,IAAI;;;;;;;AAQtB,SAAgB,SACd,OACG;AACH,QAAO;;;;;;;ACnET,SAAgB,cAA4B,KAAyB;AACnE,QAAO,OAAO,KAAK,IAAI,CAAC,QAAQ,QAAQ,OAAO,QAAQ,SAAS;;;;;AAMlE,SAAgB,QAAsB,KAAqB;AACzD,QAAO,OAAO,KAAK,IAAI;;;;;;;ACNzB,SAAgB,MACd,KACA,WAMoC;AASpC,QARe,OAAO,KAAK,IAAI,CAAC,QAC7B,aAAa,KAAK,UACjB,OAAO,OAAO,aAAa,GACxB,MAAM,UAAU,IAAI,MAAM,KAA2B,KAAK,MAAM,EAClE,CAAC,EACJ,EAAE,CAGS;;;;;AAMf,eAAsB,WACpB,KACA,WAM6C;AAgB7C,SARe,MAPO,QAAQ,IAC5B,QAAQ,IAAI,CAAC,IAAI,OAAO,KAAK,WAAW;EACtC;EACA,OAAO,MAAM,UAAU,IAAI,MAAM,KAA2B,KAAK,MAAM;EACxE,EAAE,CACJ,EAEsB,QACpB,aAAa,EAAE,KAAK,YACnB,OAAO,OAAO,aAAa,GACxB,MAAM,O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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@transcend-io/type-utils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "Typed runtime and compile-time utilities for the Transcend developer tools monorepo.",
|
|
5
5
|
"homepage": "https://github.com/transcend-io/tools/tree/main/packages/type-utils",
|
|
6
6
|
"license": "Apache-2.0",
|