@powerlines/deepkit 0.7.7 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/{packages/deepkit/schemas/reflection.cjs → capnp-CkbeQ2uR.cjs} +1189 -4
  2. package/dist/{packages/deepkit/schemas/reflection.mjs → capnp-D0NNeu5y.mjs} +1175 -259
  3. package/dist/capnp.cjs +46 -955
  4. package/dist/capnp.d.cts +3 -1
  5. package/dist/capnp.d.mts +3 -1
  6. package/dist/capnp.mjs +2 -911
  7. package/dist/{_virtual/_rolldown/runtime.cjs → chunk-BmvPcxpV.cjs} +12 -2
  8. package/dist/config-ClUYu_c-.d.mts +40 -0
  9. package/dist/config-u7zg69VP.d.cts +40 -0
  10. package/dist/esbuild-plugin.cjs +1 -1
  11. package/dist/esbuild-plugin.d.cts +7 -8
  12. package/dist/esbuild-plugin.d.mts +7 -8
  13. package/dist/index.cjs +3 -2
  14. package/dist/index.mjs +3 -2
  15. package/dist/reflect-type.cjs +3 -3
  16. package/dist/reflect-type.mjs +1 -1
  17. package/dist/{packages/deepkit/schemas/reflection.d.mts → reflection-8fgblw1P.d.cts} +4 -2
  18. package/dist/{packages/deepkit/schemas/reflection.d.cts → reflection-l3nKKCgX.d.mts} +4 -2
  19. package/dist/resolve-reflections.cjs +1 -1
  20. package/dist/rolldown-plugin.cjs +1 -1
  21. package/dist/transformer-BseLGhId.mjs +1360 -0
  22. package/dist/transformer-Ct9lYNRY.cjs +1367 -0
  23. package/dist/transformer.cjs +3 -52
  24. package/dist/transformer.d.cts +1 -1
  25. package/dist/transformer.d.mts +1 -1
  26. package/dist/transformer.mjs +2 -50
  27. package/dist/transpile.cjs +4 -4
  28. package/dist/transpile.d.cts +1 -1
  29. package/dist/transpile.d.mts +1 -1
  30. package/dist/transpile.mjs +2 -2
  31. package/dist/types.d.cts +1 -1
  32. package/dist/types.d.mts +1 -1
  33. package/dist/utilities.cjs +1 -1
  34. package/dist/vendor/{compiler-CqkzeoNX.mjs → compiler-Ba99lbTF.mjs} +11 -12
  35. package/dist/vendor/{compiler-Dz2b4nOM.d.cts → compiler-CZ0k-pTB.d.cts} +6 -6
  36. package/dist/vendor/{compiler-BYhFaVxE.d.mts → compiler-DIcnaeXC.d.mts} +6 -6
  37. package/dist/vendor/{compiler-Ci5aO9pY.cjs → compiler-DYfCGCv5.cjs} +10 -11
  38. package/dist/vendor/{config-eSNKiBGB.mjs → config-BFH3ETeQ.mjs} +16 -15
  39. package/dist/vendor/{config-BTErH18l.d.mts → config-BQtfsjwX.d.mts} +32 -18
  40. package/dist/vendor/{config-BbFVGRVh.cjs → config-Cadu6Rkt.cjs} +18 -17
  41. package/dist/vendor/{config-Cc2qE8fH.d.cts → config-D0jKbRFV.d.cts} +32 -18
  42. package/dist/vendor/core.cjs +97 -120
  43. package/dist/vendor/core.mjs +1 -24
  44. package/dist/vendor/type-compiler/compiler.cjs +1 -1
  45. package/dist/vendor/type-compiler/compiler.d.cts +1 -1
  46. package/dist/vendor/type-compiler/compiler.d.mts +1 -1
  47. package/dist/vendor/type-compiler/compiler.mjs +1 -1
  48. package/dist/vendor/type-compiler/config.cjs +2 -2
  49. package/dist/vendor/type-compiler/config.d.cts +2 -2
  50. package/dist/vendor/type-compiler/config.d.mts +2 -2
  51. package/dist/vendor/type-compiler/config.mjs +2 -2
  52. package/dist/vendor/type-compiler/index.cjs +5 -5
  53. package/dist/vendor/type-compiler/index.d.cts +4 -4
  54. package/dist/vendor/type-compiler/index.d.mts +4 -4
  55. package/dist/vendor/type-compiler/index.mjs +5 -5
  56. package/dist/vendor/type.cjs +11015 -4928
  57. package/dist/vendor/type.d.cts +220 -24
  58. package/dist/vendor/type.d.mts +220 -24
  59. package/dist/vendor/type.mjs +11521 -5630
  60. package/dist/vendor/{string-DoT35ViA.mjs → types--t65boB8.mjs} +25 -2
  61. package/dist/vendor/{string-LTCnMzW_.cjs → types-BzOSMMf1.cjs} +41 -0
  62. package/package.json +4 -4
  63. package/schemas/reflection.capnp +3 -2
  64. package/schemas/reflection.cjs +6 -0
  65. package/schemas/reflection.d.cts +2 -0
  66. package/schemas/reflection.d.mts +2 -0
  67. package/schemas/reflection.mjs +6 -0
  68. package/dist/_virtual/_rolldown/runtime.mjs +0 -8
@@ -1,9 +1,11 @@
1
- const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
1
+ const require_chunk = require('./chunk-BmvPcxpV.cjs');
2
+ let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
3
+ let _stryke_type_checks = require("@stryke/type-checks");
2
4
  let _stryke_capnp = require("@stryke/capnp");
3
- _stryke_capnp = require_runtime.__toESM(_stryke_capnp);
5
+ _stryke_capnp = require_chunk.__toESM(_stryke_capnp);
4
6
 
5
7
  //#region schemas/reflection.ts
6
- const ReflectionVisibility = {
8
+ const ReflectionVisibility$1 = {
7
9
  PUBLIC: 0,
8
10
  PROTECTED: 1,
9
11
  PRIVATE: 2
@@ -62,6 +64,12 @@ var TagsReflection = class extends _stryke_capnp.Struct {
62
64
  set internal(value) {
63
65
  _stryke_capnp.utils.setBit(3, value, this);
64
66
  }
67
+ get runtime() {
68
+ return _stryke_capnp.utils.getBit(4, this);
69
+ }
70
+ set runtime(value) {
71
+ _stryke_capnp.utils.setBit(4, value, this);
72
+ }
65
73
  _adoptPermission(value) {
66
74
  _stryke_capnp.utils.adopt(value, _stryke_capnp.utils.getPointer(2, this));
67
75
  }
@@ -3995,4 +4003,1181 @@ SerializedTypeTemplateLiteral._Types = _stryke_capnp.CompositeList(SerializedTyp
3995
4003
  SerializedTypes._Types = _stryke_capnp.CompositeList(SerializedType);
3996
4004
 
3997
4005
  //#endregion
3998
- exports.ReflectionVisibility = ReflectionVisibility;
4006
+ //#region src/capnp.ts
4007
+ /**
4008
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4009
+ *
4010
+ * @param serializedTypes - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
4011
+ * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
4012
+ */
4013
+ function convertToCapnp(serializedTypes, result) {
4014
+ if (!serializedTypes || !Array.isArray(serializedTypes) || serializedTypes.length === 0) throw new Error("Invalid serialized type provided for conversion.");
4015
+ if (serializedTypes.length !== result.length) throw new Error(`Mismatch in length of serialized types: expected ${result.length}, got ${serializedTypes.length}.`);
4016
+ serializedTypes.filter((serializedType) => (0, _stryke_type_checks.isSetObject)(serializedType) && !(0, _stryke_type_checks.isUndefined)(serializedType.kind)).forEach((serializedType, index) => {
4017
+ convertToCapnpBase(serializedType, result.get(index)._initType());
4018
+ });
4019
+ return result;
4020
+ }
4021
+ /**
4022
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4023
+ *
4024
+ * @param serializedTypes - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema
4025
+ * @returns The [Deepkit](https://deepkit.io/) {@link SerializedTypes | serialized types} converted from the Cap'n Proto serialized type
4026
+ */
4027
+ function convertFromCapnp(serializedTypes) {
4028
+ if (!serializedTypes) throw new Error("Invalid serialized type provided for conversion.");
4029
+ const result = [];
4030
+ serializedTypes.forEach((serializedType) => {
4031
+ const deserializedType = convertFromCapnpBase(serializedType.type);
4032
+ result.push(deserializedType);
4033
+ });
4034
+ return result;
4035
+ }
4036
+ /**
4037
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4038
+ *
4039
+ * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
4040
+ * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
4041
+ */
4042
+ function convertToCapnpTagsReflection(result, serializedType) {
4043
+ if (serializedType?.alias?.length) {
4044
+ const alias = result._initAlias(serializedType.alias.length);
4045
+ serializedType.alias.forEach((a, index) => {
4046
+ alias.set(index, a);
4047
+ });
4048
+ }
4049
+ result.hidden = serializedType?.hidden ?? false;
4050
+ result.ignore = serializedType?.ignore ?? false;
4051
+ result.internal = serializedType?.internal ?? false;
4052
+ result.runtime = serializedType?.runtime ?? false;
4053
+ result.readonly = serializedType?.readonly ?? false;
4054
+ if (serializedType?.title) result.title = serializedType?.title;
4055
+ if (serializedType?.domain) result.domain = serializedType?.domain;
4056
+ if (serializedType?.permission?.length) {
4057
+ const permission = result._initPermission(serializedType.permission.length);
4058
+ serializedType.permission?.forEach((p, index) => {
4059
+ permission.set(index, p);
4060
+ });
4061
+ }
4062
+ return result;
4063
+ }
4064
+ function convertFromCapnpTagsReflection(serializedType) {
4065
+ return serializedType._hasTags() ? {
4066
+ alias: serializedType.tags?.alias?.length ? serializedType.tags?.alias.map((value) => value) : void 0,
4067
+ hidden: serializedType.tags?.hidden,
4068
+ domain: serializedType.tags?.domain ? serializedType.tags.domain : void 0,
4069
+ title: serializedType.tags?.title ? serializedType.tags.title : void 0,
4070
+ ignore: serializedType.tags?.ignore,
4071
+ internal: serializedType.tags?.internal,
4072
+ runtime: serializedType.tags?.runtime,
4073
+ readonly: serializedType.tags?.readonly,
4074
+ permission: serializedType.tags?.permission?.length ? serializedType.tags?.permission?.map((value) => value) : void 0
4075
+ } : void 0;
4076
+ }
4077
+ /**
4078
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4079
+ *
4080
+ * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
4081
+ * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
4082
+ */
4083
+ function convertToCapnpIndexAccessOrigin(result, serializedType) {
4084
+ const indexAccessOriginIndex = result._initIndex();
4085
+ indexAccessOriginIndex.id = serializedType?.index ?? 0;
4086
+ const indexAccessOriginContainer = result._initContainer();
4087
+ indexAccessOriginContainer.id = serializedType?.container ?? 0;
4088
+ return result;
4089
+ }
4090
+ function convertFromCapnpIndexAccessOrigin(serializedType) {
4091
+ return serializedType._hasIndexAccessOrigin() ? {
4092
+ container: Number(serializedType.indexAccessOrigin?.container.id),
4093
+ index: Number(serializedType.indexAccessOrigin?.index.id)
4094
+ } : void 0;
4095
+ }
4096
+ /**
4097
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4098
+ *
4099
+ * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
4100
+ * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
4101
+ */
4102
+ function convertToCapnpBase(serializedType, result) {
4103
+ if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral) convertToCapnpObjectLiteral(serializedType, result._initObjectLiteral());
4104
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.class) convertToCapnpClassType(serializedType, result._initClassType());
4105
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.parameter) convertToCapnpParameter(serializedType, result._initParameter());
4106
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.function) convertToCapnpFunction(serializedType, result._initFunction());
4107
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.method) convertToCapnpMethod(serializedType, result._initMethod());
4108
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.infer) convertToCapnpInfer(serializedType, result._initInfer());
4109
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.union) convertToCapnpUnion(serializedType, result._initUnion());
4110
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.array) convertToCapnpArray(serializedType, result._initArray());
4111
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.intersection) convertToCapnpIntersection(serializedType, result._initIntersection());
4112
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.enum) convertToCapnpEnum(serializedType, result._initEnum());
4113
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.property) convertToCapnpProperty(serializedType, result._initProperty());
4114
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.tuple) convertToCapnpTuple(serializedType, result._initTuple());
4115
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.tupleMember) convertToCapnpTupleMember(serializedType, result._initTupleMember());
4116
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.propertySignature) convertToCapnpPropertySignature(serializedType, result._initPropertySignature());
4117
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.methodSignature) convertToCapnpMethodSignature(serializedType, result._initMethodSignature());
4118
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.literal) convertToCapnpLiteral(serializedType, result._initLiteral());
4119
+ else if (serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.never || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.any || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.unknown || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.void || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.object || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.string || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.number || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.boolean || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.symbol || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.bigint || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.null || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.undefined || serializedType.kind === _powerlines_deepkit_vendor_type.ReflectionKind.regexp) convertToCapnpSimple(serializedType, result._initSimple());
4120
+ else convertToCapnpOther(serializedType, result._initOther());
4121
+ return result;
4122
+ }
4123
+ function convertFromCapnpBase(serializedType) {
4124
+ if (serializedType._isObjectLiteral) return convertFromCapnpObjectLiteral(serializedType.objectLiteral);
4125
+ else if (serializedType._isClassType) return convertFromCapnpClassType(serializedType.classType);
4126
+ else if (serializedType._isParameter) return convertFromCapnpParameter(serializedType.parameter);
4127
+ else if (serializedType._isFunction) return convertFromCapnpFunction(serializedType.function);
4128
+ else if (serializedType._isInfer) return convertFromCapnpInfer(serializedType.infer);
4129
+ else if (serializedType._isMethod) return convertFromCapnpMethod(serializedType.method);
4130
+ else if (serializedType._isUnion) return convertFromCapnpUnion(serializedType.union);
4131
+ else if (serializedType._isArray) return convertFromCapnpArray(serializedType.array);
4132
+ else if (serializedType._isIntersection) return convertFromCapnpIntersection(serializedType.intersection);
4133
+ else if (serializedType._isEnum) return convertFromCapnpEnum(serializedType.enum);
4134
+ else if (serializedType._isProperty) return convertFromCapnpProperty(serializedType.property);
4135
+ else if (serializedType._isTuple) return convertFromCapnpTuple(serializedType.tuple);
4136
+ else if (serializedType._isTupleMember) return convertFromCapnpTupleMember(serializedType.tupleMember);
4137
+ else if (serializedType._isPropertySignature) return convertFromCapnpPropertySignature(serializedType.propertySignature);
4138
+ else if (serializedType._isMethodSignature) return convertFromCapnpMethodSignature(serializedType.methodSignature);
4139
+ else if (serializedType._isLiteral) return convertFromCapnpLiteral(serializedType.literal);
4140
+ else if (serializedType._isSimple) return convertFromCapnpSimple(serializedType.simple);
4141
+ else if (serializedType._isOther) return convertFromCapnpOther(serializedType.other);
4142
+ else throw new Error(`Unsupported serialized type kind: ${serializedType.toString()}`);
4143
+ }
4144
+ function convertFromCapnpOther(serializedType) {
4145
+ return {
4146
+ kind: serializedType.kind,
4147
+ typeName: serializedType.typeName || void 0
4148
+ };
4149
+ }
4150
+ function convertFromCapnpSimple(serializedType) {
4151
+ const result = {
4152
+ kind: serializedType.kind,
4153
+ typeName: serializedType.typeName || void 0,
4154
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4155
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4156
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
4157
+ };
4158
+ if (serializedType._hasOrigin()) result.origin = Number(serializedType.origin.id);
4159
+ return result;
4160
+ }
4161
+ function convertToCapnpOther(serializedType, result) {
4162
+ result.kind = serializedType.kind;
4163
+ result.typeName = serializedType.typeName || "";
4164
+ return result;
4165
+ }
4166
+ function convertToCapnpSimple(serializedType, result) {
4167
+ result.kind = serializedType.kind;
4168
+ result.typeName = serializedType.typeName || "";
4169
+ if (serializedType.origin) {
4170
+ result._initOrigin();
4171
+ result.origin.id = serializedType.origin ?? 0;
4172
+ }
4173
+ if (serializedType.decorators?.length) {
4174
+ const decorators = result._initDecorators(serializedType.decorators.length);
4175
+ serializedType.decorators.forEach((d, index) => {
4176
+ const decorator = decorators.get(index);
4177
+ decorator.id = d;
4178
+ });
4179
+ }
4180
+ if (serializedType.typeArguments?.length) {
4181
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
4182
+ serializedType.typeArguments.forEach((t, index) => {
4183
+ const typeArgument = typeArguments.get(index);
4184
+ typeArgument.id = t;
4185
+ });
4186
+ }
4187
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4188
+ return result;
4189
+ }
4190
+ function convertFromCapnpLiteral(serializedType) {
4191
+ return {
4192
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.literal,
4193
+ literal: serializedType.literal._isString ? serializedType.literal.string : serializedType.literal._isNumber ? serializedType.literal.number : serializedType.literal._isBoolean ? serializedType.literal.boolean : serializedType.literal._isBigint ? {
4194
+ type: "bigint",
4195
+ value: serializedType.literal.bigint.value
4196
+ } : serializedType.literal._isSymbol ? {
4197
+ type: "symbol",
4198
+ name: serializedType.literal.symbol.name
4199
+ } : {
4200
+ type: "regex",
4201
+ regex: serializedType.literal.regex.regex
4202
+ },
4203
+ typeName: serializedType.typeName || void 0,
4204
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4205
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4206
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
4207
+ };
4208
+ }
4209
+ function convertToCapnpLiteral(serializedType, result) {
4210
+ result.kind = serializedType.kind;
4211
+ result.typeName = serializedType.typeName || "";
4212
+ const literalType = result._initLiteral();
4213
+ if (typeof serializedType.literal === "boolean") literalType.boolean = serializedType.literal;
4214
+ else if (typeof serializedType.literal === "number") literalType.number = serializedType.literal;
4215
+ else if (typeof serializedType.literal === "string") literalType.string = serializedType.literal;
4216
+ else if (serializedType.literal.type === "bigint") {
4217
+ const literalTypeBigint = literalType._initBigint();
4218
+ literalTypeBigint.type = "bigint";
4219
+ literalTypeBigint.value = serializedType.literal.value;
4220
+ } else if (serializedType.literal.type === "symbol") {
4221
+ const literalTypeSymbol = literalType._initSymbol();
4222
+ literalTypeSymbol.type = "symbol";
4223
+ literalTypeSymbol.name = serializedType.literal.name.toString().slice(7, -1);
4224
+ } else if (serializedType.literal.type === "regex") {
4225
+ const literalTypeRegex = literalType._initRegex();
4226
+ literalTypeRegex.type = "regex";
4227
+ literalTypeRegex.regex = serializedType.literal.regex;
4228
+ }
4229
+ if (serializedType.decorators?.length) {
4230
+ const decorators = result._initDecorators(serializedType.decorators.length);
4231
+ serializedType.decorators.forEach((d, index) => {
4232
+ const decorator = decorators.get(index);
4233
+ decorator.id = d;
4234
+ });
4235
+ }
4236
+ if (serializedType.typeArguments?.length) {
4237
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
4238
+ serializedType.typeArguments.forEach((t, index) => {
4239
+ const typeArgument = typeArguments.get(index);
4240
+ typeArgument.id = t;
4241
+ });
4242
+ }
4243
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4244
+ return result;
4245
+ }
4246
+ function convertFromCapnpMethodSignature(serializedType) {
4247
+ return {
4248
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.methodSignature,
4249
+ name: serializedType.name,
4250
+ typeName: serializedType.typeName || void 0,
4251
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4252
+ parameters: serializedType._hasParameters() ? serializedType.parameters.map((p) => convertFromCapnpParameter(p)) : [],
4253
+ return: serializedType.return.id,
4254
+ tags: convertFromCapnpTagsReflection(serializedType)
4255
+ };
4256
+ }
4257
+ function convertToCapnpMethodSignature(serializedType, result) {
4258
+ result.kind = serializedType.kind;
4259
+ result.name = String(serializedType.name);
4260
+ result.typeName = serializedType.typeName || "";
4261
+ if (serializedType.decorators?.length) {
4262
+ const decorators = result._initDecorators(serializedType.decorators.length);
4263
+ serializedType.decorators.forEach((d, index) => {
4264
+ const decorator = decorators.get(index);
4265
+ decorator.id = d;
4266
+ });
4267
+ }
4268
+ if (serializedType.typeArguments?.length) {
4269
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
4270
+ serializedType.typeArguments.forEach((t, index) => {
4271
+ const typeArgument = typeArguments.get(index);
4272
+ typeArgument.id = t;
4273
+ });
4274
+ }
4275
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4276
+ if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
4277
+ return result;
4278
+ }
4279
+ function convertFromCapnpPropertySignature(serializedType) {
4280
+ return {
4281
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.propertySignature,
4282
+ name: serializedType.name,
4283
+ typeName: serializedType.typeName || void 0,
4284
+ description: serializedType.description,
4285
+ default: convertFromCapnpDefault(serializedType.default),
4286
+ optional: serializedType.optional ? true : void 0,
4287
+ readonly: serializedType.readonly ? true : void 0,
4288
+ type: serializedType.type.id,
4289
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4290
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4291
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
4292
+ tags: convertFromCapnpTagsReflection(serializedType)
4293
+ };
4294
+ }
4295
+ function convertToCapnpDefault(defaultValue, result) {
4296
+ if (typeof defaultValue !== "undefined" && defaultValue !== "") {
4297
+ result._initValue();
4298
+ if (typeof defaultValue === "string") result.value.string = defaultValue;
4299
+ else if (typeof defaultValue === "number") if ((0, _stryke_type_checks.isInteger)(defaultValue)) result.value.integer = defaultValue;
4300
+ else result.value.float = defaultValue;
4301
+ else if (typeof defaultValue === "boolean") result.value.boolean = defaultValue;
4302
+ }
4303
+ }
4304
+ function convertFromCapnpDefault(serializedType) {
4305
+ if (typeof serializedType.value === "undefined") return;
4306
+ else if (serializedType.value._isBoolean) return serializedType.value.boolean;
4307
+ else if (serializedType.value._isInteger) return serializedType.value.integer;
4308
+ else if (serializedType.value._isFloat) return serializedType.value.float;
4309
+ else if (serializedType.value._isString) return serializedType.value.string;
4310
+ }
4311
+ function convertToCapnpPropertySignature(serializedType, result) {
4312
+ result.kind = serializedType.kind;
4313
+ result.name = String(serializedType.name) || "";
4314
+ result.typeName = serializedType.typeName || "";
4315
+ result.description = serializedType.description || "";
4316
+ result.optional = serializedType.optional ?? false;
4317
+ result.readonly = serializedType.readonly ?? false;
4318
+ if (typeof serializedType.default !== "undefined") {
4319
+ const defaultValue = result._initDefault();
4320
+ convertToCapnpDefault(serializedType.default, defaultValue);
4321
+ }
4322
+ const type = result._initType();
4323
+ type.id = serializedType.type;
4324
+ if (serializedType.decorators?.length) {
4325
+ const decorators = result._initDecorators(serializedType.decorators.length);
4326
+ serializedType.decorators.forEach((d, index) => {
4327
+ const decorator = decorators.get(index);
4328
+ decorator.id = d;
4329
+ });
4330
+ }
4331
+ if (serializedType.typeArguments?.length) {
4332
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
4333
+ serializedType.typeArguments.forEach((t, index) => {
4334
+ const typeArgument = typeArguments.get(index);
4335
+ typeArgument.id = t;
4336
+ });
4337
+ }
4338
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4339
+ if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
4340
+ return result;
4341
+ }
4342
+ function convertToCapnpTupleMember(serializedType, result) {
4343
+ result.kind = serializedType.kind;
4344
+ result.typeName = serializedType.typeName || "";
4345
+ const type = result._initType();
4346
+ type.id = serializedType.type;
4347
+ if (serializedType.decorators?.length) {
4348
+ const decorators = result._initDecorators(serializedType.decorators.length);
4349
+ serializedType.decorators.forEach((d, index) => {
4350
+ const decorator = decorators.get(index);
4351
+ decorator.id = d;
4352
+ });
4353
+ }
4354
+ if (serializedType.typeArguments?.length) {
4355
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
4356
+ serializedType.typeArguments.forEach((t, index) => {
4357
+ const typeArgument = typeArguments.get(index);
4358
+ typeArgument.id = t;
4359
+ });
4360
+ }
4361
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4362
+ return result;
4363
+ }
4364
+ function convertFromCapnpTupleMember(serializedType) {
4365
+ return {
4366
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.tupleMember,
4367
+ type: serializedType.type.id,
4368
+ typeName: serializedType.typeName || void 0,
4369
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4370
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4371
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
4372
+ };
4373
+ }
4374
+ function convertToCapnpTuple(serializedType, result) {
4375
+ result.kind = serializedType.kind;
4376
+ result.typeName = serializedType.typeName || "";
4377
+ const types = result._initTypes(serializedType.types.length);
4378
+ serializedType.types.forEach((t, index) => {
4379
+ convertToCapnpTupleMember(t, types.get(index));
4380
+ });
4381
+ if (serializedType.decorators?.length) {
4382
+ const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
4383
+ serializedType.decorators?.forEach((d, index) => {
4384
+ const decorator = decorators.get(index);
4385
+ decorator.id = d;
4386
+ });
4387
+ }
4388
+ if (serializedType.typeArguments?.length) {
4389
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
4390
+ serializedType.typeArguments?.forEach((t, index) => {
4391
+ const typeArgument = typeArguments.get(index);
4392
+ typeArgument.id = t;
4393
+ });
4394
+ }
4395
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4396
+ return result;
4397
+ }
4398
+ function convertFromCapnpTuple(serializedType) {
4399
+ return {
4400
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.tuple,
4401
+ typeName: serializedType.typeName || void 0,
4402
+ types: serializedType._hasTypes() ? serializedType.types.map((t) => convertFromCapnpTupleMember(t)) : [],
4403
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4404
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4405
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
4406
+ };
4407
+ }
4408
+ function convertToCapnpProperty(serializedType, result) {
4409
+ result.kind = serializedType.kind;
4410
+ result.typeName = serializedType.typeName || "";
4411
+ result.description = serializedType.description || "";
4412
+ result.optional = serializedType.optional ?? false;
4413
+ result.readonly = serializedType.readonly ?? false;
4414
+ result.visibility = serializedType.visibility === _powerlines_deepkit_vendor_type.ReflectionVisibility.public ? ReflectionVisibility$1.PUBLIC : serializedType.visibility === _powerlines_deepkit_vendor_type.ReflectionVisibility.protected ? ReflectionVisibility$1.PROTECTED : ReflectionVisibility$1.PRIVATE;
4415
+ result.abstract = serializedType.abstract ?? false;
4416
+ result.name = String(serializedType.name) || "";
4417
+ if (typeof serializedType.default !== "undefined") {
4418
+ const defaultValue = result._initDefault();
4419
+ convertToCapnpDefault(serializedType.default, defaultValue);
4420
+ }
4421
+ const type = result._initType();
4422
+ type.id = serializedType.type;
4423
+ if (serializedType.decorators?.length) {
4424
+ const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
4425
+ serializedType.decorators?.forEach((d, index) => {
4426
+ const decorator = decorators.get(index);
4427
+ decorator.id = d;
4428
+ });
4429
+ }
4430
+ if (serializedType.typeArguments?.length) {
4431
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
4432
+ serializedType.typeArguments?.forEach((t, index) => {
4433
+ const typeArgument = typeArguments.get(index);
4434
+ typeArgument.id = t;
4435
+ });
4436
+ }
4437
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4438
+ if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
4439
+ return result;
4440
+ }
4441
+ function convertFromCapnpProperty(serializedType) {
4442
+ return {
4443
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.property,
4444
+ typeName: serializedType.typeName || void 0,
4445
+ description: serializedType.description,
4446
+ default: convertFromCapnpDefault(serializedType.default),
4447
+ optional: serializedType.optional ? true : void 0,
4448
+ readonly: serializedType.readonly ? true : void 0,
4449
+ visibility: serializedType.visibility === ReflectionVisibility$1.PUBLIC ? _powerlines_deepkit_vendor_type.ReflectionVisibility.public : serializedType.visibility === ReflectionVisibility$1.PROTECTED ? _powerlines_deepkit_vendor_type.ReflectionVisibility.protected : _powerlines_deepkit_vendor_type.ReflectionVisibility.private,
4450
+ abstract: serializedType.abstract ? true : void 0,
4451
+ name: serializedType.name,
4452
+ type: serializedType.type.id,
4453
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4454
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4455
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
4456
+ tags: convertFromCapnpTagsReflection(serializedType)
4457
+ };
4458
+ }
4459
+ function convertToCapnpEnum(serializedType, result) {
4460
+ result.kind = serializedType.kind;
4461
+ result.typeName = serializedType.typeName || "";
4462
+ const indexType = result._initIndexType();
4463
+ indexType.id = serializedType.indexType;
4464
+ if (serializedType.decorators?.length) {
4465
+ const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
4466
+ serializedType.decorators?.forEach((d, index) => {
4467
+ const decorator = decorators.get(index);
4468
+ decorator.id = d;
4469
+ });
4470
+ }
4471
+ if (serializedType.typeArguments?.length) {
4472
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
4473
+ serializedType.typeArguments?.forEach((t, index) => {
4474
+ const typeArgument = typeArguments.get(index);
4475
+ typeArgument.id = t;
4476
+ });
4477
+ }
4478
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4479
+ if (serializedType.values?.length) {
4480
+ const values = result._initValues(serializedType.values?.length);
4481
+ serializedType.values.forEach((value, index) => {
4482
+ values.set(index, String(value));
4483
+ });
4484
+ }
4485
+ const enumEntries = result._initEnumEntries(Object.keys(serializedType.enum).length ?? 0);
4486
+ Object.entries(serializedType.enum).forEach(([key, value], index) => {
4487
+ const enumEntry = enumEntries.get(index);
4488
+ enumEntry.name = key;
4489
+ enumEntry.value = String(value);
4490
+ });
4491
+ if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
4492
+ return result;
4493
+ }
4494
+ function convertFromCapnpEnum(serializedType) {
4495
+ return {
4496
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.enum,
4497
+ typeName: serializedType.typeName || void 0,
4498
+ indexType: serializedType.indexType.id,
4499
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4500
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4501
+ values: serializedType._hasValues() ? serializedType.values.map((value) => value) : [],
4502
+ enum: serializedType._hasEnumEntries() ? Object.entries(serializedType.enumEntries).reduce((ret, [key, value]) => {
4503
+ ret[key] = value.value;
4504
+ return ret;
4505
+ }, {}) : {},
4506
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
4507
+ tags: convertFromCapnpTagsReflection(serializedType)
4508
+ };
4509
+ }
4510
+ function convertToCapnpIntersection(serializedType, result) {
4511
+ result.kind = serializedType.kind;
4512
+ result.typeName = serializedType.typeName || "";
4513
+ const types = result._initTypes(serializedType.types?.length ?? 0);
4514
+ serializedType.types?.forEach((t, index) => {
4515
+ const serializedTypeType = types.get(index);
4516
+ serializedTypeType.id = t;
4517
+ });
4518
+ if (serializedType.decorators?.length) {
4519
+ const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
4520
+ serializedType.decorators?.forEach((d, index) => {
4521
+ const decorator = decorators.get(index);
4522
+ decorator.id = d;
4523
+ });
4524
+ }
4525
+ if (serializedType.typeArguments?.length) {
4526
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
4527
+ serializedType.typeArguments?.forEach((t, index) => {
4528
+ const typeArgument = typeArguments.get(index);
4529
+ typeArgument.id = t;
4530
+ });
4531
+ }
4532
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4533
+ return result;
4534
+ }
4535
+ function convertFromCapnpIntersection(serializedType) {
4536
+ return {
4537
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.intersection,
4538
+ typeName: serializedType.typeName || void 0,
4539
+ types: serializedType._hasTypes() ? serializedType.types.map((t) => t.id) : [],
4540
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4541
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4542
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
4543
+ };
4544
+ }
4545
+ function convertToCapnpArray(serializedType, result) {
4546
+ result.kind = serializedType.kind;
4547
+ result.typeName = serializedType.typeName || "";
4548
+ const type = result._initType();
4549
+ type.id = serializedType.type;
4550
+ if (serializedType.decorators?.length) {
4551
+ const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
4552
+ serializedType.decorators?.forEach((d, index) => {
4553
+ const decorator = decorators.get(index);
4554
+ decorator.id = d;
4555
+ });
4556
+ }
4557
+ if (serializedType.typeArguments?.length) {
4558
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
4559
+ serializedType.typeArguments?.forEach((t, index) => {
4560
+ const typeArgument = typeArguments.get(index);
4561
+ typeArgument.id = t;
4562
+ });
4563
+ }
4564
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4565
+ if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
4566
+ return result;
4567
+ }
4568
+ function convertFromCapnpArray(serializedType) {
4569
+ return {
4570
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.array,
4571
+ typeName: serializedType.typeName || void 0,
4572
+ type: serializedType.type.id,
4573
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4574
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4575
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
4576
+ tags: convertFromCapnpTagsReflection(serializedType)
4577
+ };
4578
+ }
4579
+ /**
4580
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4581
+ *
4582
+ * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
4583
+ * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
4584
+ */
4585
+ function convertToCapnpUnion(serializedType, result) {
4586
+ result.kind = serializedType.kind;
4587
+ result.typeName = serializedType.typeName || "";
4588
+ const types = result._initTypes(serializedType.types?.length ?? 0);
4589
+ serializedType.types?.forEach((t, index) => {
4590
+ const serializedTypeType = types.get(index);
4591
+ serializedTypeType.id = t;
4592
+ });
4593
+ if (serializedType.decorators?.length) {
4594
+ const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
4595
+ serializedType.decorators?.forEach((d, index) => {
4596
+ const decorator = decorators.get(index);
4597
+ decorator.id = d;
4598
+ });
4599
+ }
4600
+ if (serializedType.typeArguments?.length) {
4601
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
4602
+ serializedType.typeArguments?.forEach((t, index) => {
4603
+ const typeArgument = typeArguments.get(index);
4604
+ typeArgument.id = t;
4605
+ });
4606
+ }
4607
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4608
+ return result;
4609
+ }
4610
+ function convertFromCapnpUnion(serializedType) {
4611
+ return {
4612
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.union,
4613
+ typeName: serializedType.typeName || void 0,
4614
+ types: serializedType._hasTypes() ? serializedType.types.map((t) => t.id) : [],
4615
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4616
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4617
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
4618
+ };
4619
+ }
4620
+ /**
4621
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4622
+ *
4623
+ * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert.
4624
+ * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
4625
+ */
4626
+ function convertToCapnpInfer(serializedType, result) {
4627
+ result.kind = serializedType.kind;
4628
+ result.typeName = serializedType.typeName || "";
4629
+ if (serializedType.decorators?.length) {
4630
+ const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
4631
+ serializedType.decorators?.forEach((d, index) => {
4632
+ const decorator = decorators.get(index);
4633
+ decorator.id = d;
4634
+ });
4635
+ }
4636
+ if (serializedType.typeArguments?.length) {
4637
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
4638
+ serializedType.typeArguments?.forEach((t, index) => {
4639
+ const typeArgument = typeArguments.get(index);
4640
+ typeArgument.id = t;
4641
+ });
4642
+ }
4643
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4644
+ return result;
4645
+ }
4646
+ function convertFromCapnpInfer(serializedType) {
4647
+ return {
4648
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.infer,
4649
+ typeName: serializedType.typeName || void 0,
4650
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4651
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4652
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
4653
+ };
4654
+ }
4655
+ /**
4656
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4657
+ *
4658
+ * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
4659
+ * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
4660
+ */
4661
+ function convertToCapnpFunction(serializedType, result) {
4662
+ result.name = String(serializedType.name) || "";
4663
+ result.kind = serializedType.kind;
4664
+ result.typeName = serializedType.typeName || "";
4665
+ if (serializedType.decorators?.length) {
4666
+ const decorators = result._initDecorators(serializedType.decorators.length);
4667
+ serializedType.decorators.forEach((d, index) => {
4668
+ const decorator = decorators.get(index);
4669
+ decorator.id = d;
4670
+ });
4671
+ }
4672
+ if (serializedType.typeArguments?.length) {
4673
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
4674
+ serializedType.typeArguments.forEach((t, index) => {
4675
+ const typeArgument = typeArguments.get(index);
4676
+ typeArgument.id = t;
4677
+ });
4678
+ }
4679
+ if (serializedType.parameters?.length) {
4680
+ const parameters = result._initParameters(serializedType.parameters.length);
4681
+ serializedType.parameters.forEach((p, index) => {
4682
+ convertToCapnpParameter(p, parameters.get(index));
4683
+ });
4684
+ }
4685
+ const returnType = result._initReturn();
4686
+ returnType.id = serializedType.return;
4687
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4688
+ if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
4689
+ return result;
4690
+ }
4691
+ /**
4692
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4693
+ *
4694
+ * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
4695
+ * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
4696
+ */
4697
+ function convertToCapnpMethod(serializedType, result) {
4698
+ result.name = String(serializedType.name) || "";
4699
+ result.kind = serializedType.kind;
4700
+ result.typeName = serializedType.typeName || "";
4701
+ result.abstract = serializedType.abstract ?? false;
4702
+ result.visibility = serializedType.visibility === _powerlines_deepkit_vendor_type.ReflectionVisibility.public ? ReflectionVisibility$1.PUBLIC : serializedType.visibility === _powerlines_deepkit_vendor_type.ReflectionVisibility.protected ? ReflectionVisibility$1.PROTECTED : ReflectionVisibility$1.PRIVATE;
4703
+ if (serializedType.decorators?.length) {
4704
+ const decorators = result._initDecorators(serializedType.decorators.length);
4705
+ serializedType.decorators.forEach((d, index) => {
4706
+ const decorator = decorators.get(index);
4707
+ decorator.id = d;
4708
+ });
4709
+ }
4710
+ if (serializedType.typeArguments?.length) {
4711
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
4712
+ serializedType.typeArguments.forEach((t, index) => {
4713
+ const typeArgument = typeArguments.get(index);
4714
+ typeArgument.id = t;
4715
+ });
4716
+ }
4717
+ if (serializedType.parameters?.length) {
4718
+ const parameters = result._initParameters(serializedType.parameters.length);
4719
+ serializedType.parameters.forEach((p, index) => {
4720
+ convertToCapnpParameter(p, parameters.get(index));
4721
+ });
4722
+ }
4723
+ const returnType = result._initReturn();
4724
+ returnType.id = serializedType.return;
4725
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4726
+ if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
4727
+ return result;
4728
+ }
4729
+ function convertFromCapnpFunction(serializedType) {
4730
+ return {
4731
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.function,
4732
+ name: serializedType.name,
4733
+ typeName: serializedType.typeName || void 0,
4734
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4735
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4736
+ parameters: serializedType._hasParameters() ? serializedType.parameters.map((p) => convertFromCapnpParameter(p)) : [],
4737
+ return: serializedType.return.id,
4738
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
4739
+ tags: convertFromCapnpTagsReflection(serializedType)
4740
+ };
4741
+ }
4742
+ function convertFromCapnpMethod(serializedType) {
4743
+ return {
4744
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.method,
4745
+ name: serializedType.name,
4746
+ typeName: serializedType.typeName || void 0,
4747
+ abstract: serializedType.abstract ? true : void 0,
4748
+ return: serializedType.return.id,
4749
+ visibility: serializedType.visibility === ReflectionVisibility$1.PUBLIC ? _powerlines_deepkit_vendor_type.ReflectionVisibility.public : serializedType.visibility === ReflectionVisibility$1.PROTECTED ? _powerlines_deepkit_vendor_type.ReflectionVisibility.protected : _powerlines_deepkit_vendor_type.ReflectionVisibility.private,
4750
+ parameters: serializedType._hasParameters() ? serializedType.parameters.map((parameter) => convertFromCapnpParameter(parameter)) : []
4751
+ };
4752
+ }
4753
+ /**
4754
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4755
+ *
4756
+ * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
4757
+ * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
4758
+ */
4759
+ function convertToCapnpClassType(serializedType, result) {
4760
+ result.kind = serializedType.kind;
4761
+ result.typeName = serializedType.typeName || "";
4762
+ result.classType = serializedType.classType || "";
4763
+ result.globalObject = serializedType.globalObject ?? false;
4764
+ if (serializedType.arguments?.length) {
4765
+ const _arguments = result._initArguments(serializedType.arguments.length);
4766
+ serializedType.arguments.forEach((t, index) => {
4767
+ const serializedTypeArguments = _arguments.get(index);
4768
+ serializedTypeArguments.id = t;
4769
+ });
4770
+ }
4771
+ if (serializedType.extendsArguments?.length) {
4772
+ const extendsArguments = result._initArguments(serializedType.extendsArguments.length);
4773
+ serializedType.extendsArguments.forEach((t, index) => {
4774
+ const serializedTypeExtendsArguments = extendsArguments.get(index);
4775
+ serializedTypeExtendsArguments.id = t;
4776
+ });
4777
+ }
4778
+ if (serializedType.decorators?.length) {
4779
+ const decorators = result._initDecorators(serializedType.decorators.length);
4780
+ serializedType.decorators.forEach((d, index) => {
4781
+ const decorator = decorators.get(index);
4782
+ decorator.id = d;
4783
+ });
4784
+ }
4785
+ if (serializedType.typeArguments?.length) {
4786
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
4787
+ serializedType.typeArguments.forEach((t, index) => {
4788
+ const typeArgument = typeArguments.get(index);
4789
+ typeArgument.id = t;
4790
+ });
4791
+ }
4792
+ if (serializedType.superClass) {
4793
+ const superClass = result._initSuperClass();
4794
+ superClass.id = serializedType.superClass;
4795
+ }
4796
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4797
+ if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
4798
+ return result;
4799
+ }
4800
+ function convertFromCapnpClassType(serializedType) {
4801
+ return {
4802
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.class,
4803
+ typeName: serializedType.typeName || void 0,
4804
+ classType: serializedType.classType,
4805
+ globalObject: serializedType.globalObject ? true : void 0,
4806
+ arguments: serializedType._hasArguments() ? serializedType.arguments.map((t) => t.id) : void 0,
4807
+ extendsArguments: serializedType._hasExtendsArguments() ? serializedType.extendsArguments.map((t) => t.id) : void 0,
4808
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4809
+ types: serializedType._hasTypes() ? serializedType.types.map((t) => t.id) : [],
4810
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4811
+ superClass: serializedType._hasSuperClass() ? serializedType.superClass.id : void 0,
4812
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
4813
+ tags: convertFromCapnpTagsReflection(serializedType)
4814
+ };
4815
+ }
4816
+ /**
4817
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4818
+ *
4819
+ * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
4820
+ * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
4821
+ */
4822
+ function convertToCapnpObjectLiteral(serializedType, result) {
4823
+ if (serializedType.decorators?.length) {
4824
+ const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
4825
+ serializedType.decorators.forEach((d, index) => {
4826
+ const decorator = decorators.get(index);
4827
+ decorator.id = d;
4828
+ });
4829
+ }
4830
+ if (serializedType.types?.length) {
4831
+ const types = result._initTypes(serializedType.types.length);
4832
+ serializedType.types.forEach((t, index) => {
4833
+ const serializedTypeType = types.get(index);
4834
+ serializedTypeType.id = t;
4835
+ });
4836
+ }
4837
+ if (serializedType.typeArguments?.length) {
4838
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
4839
+ serializedType.typeArguments.forEach((t, index) => {
4840
+ const serializedTypeTypeArguments = typeArguments.get(index);
4841
+ serializedTypeTypeArguments.id = t;
4842
+ });
4843
+ }
4844
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4845
+ if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
4846
+ return result;
4847
+ }
4848
+ function convertFromCapnpObjectLiteral(serializedType) {
4849
+ return {
4850
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
4851
+ typeName: serializedType.typeName || void 0,
4852
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4853
+ types: serializedType._hasTypes() ? serializedType.types.map((t) => t.id) : [],
4854
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4855
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
4856
+ tags: convertFromCapnpTagsReflection(serializedType)
4857
+ };
4858
+ }
4859
+ /**
4860
+ * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
4861
+ *
4862
+ * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
4863
+ * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
4864
+ */
4865
+ function convertToCapnpParameter(serializedType, result) {
4866
+ result.kind = serializedType.kind;
4867
+ result.typeName = serializedType.typeName || "";
4868
+ result.name = serializedType.name || "";
4869
+ result.optional = serializedType.optional ?? false;
4870
+ result.readonly = serializedType.readonly ?? false;
4871
+ result.visibility = serializedType.visibility === _powerlines_deepkit_vendor_type.ReflectionVisibility.public ? ReflectionVisibility$1.PUBLIC : serializedType.visibility === _powerlines_deepkit_vendor_type.ReflectionVisibility.protected ? ReflectionVisibility$1.PROTECTED : ReflectionVisibility$1.PRIVATE;
4872
+ if (typeof serializedType.default !== "undefined") {
4873
+ const defaultValue = result._initDefault();
4874
+ convertToCapnpDefault(serializedType.default, defaultValue);
4875
+ }
4876
+ const parameterType = result._initType();
4877
+ parameterType.id = serializedType.type;
4878
+ if (serializedType.decorators?.length) {
4879
+ const decorators = result._initDecorators(serializedType.decorators.length);
4880
+ serializedType.decorators.forEach((d, index) => {
4881
+ const decorator = decorators.get(index);
4882
+ decorator.id = d;
4883
+ });
4884
+ }
4885
+ if (serializedType.typeArguments?.length) {
4886
+ const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
4887
+ serializedType.typeArguments.forEach((t, index) => {
4888
+ const typeArgument = typeArguments.get(index);
4889
+ typeArgument.id = t;
4890
+ });
4891
+ }
4892
+ if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
4893
+ if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
4894
+ return result;
4895
+ }
4896
+ function convertFromCapnpParameter(serializedType) {
4897
+ return {
4898
+ kind: _powerlines_deepkit_vendor_type.ReflectionKind.parameter,
4899
+ typeName: serializedType.typeName || void 0,
4900
+ name: serializedType.name,
4901
+ default: convertFromCapnpDefault(serializedType.default),
4902
+ optional: serializedType.optional ? true : void 0,
4903
+ readonly: serializedType.readonly ? true : void 0,
4904
+ visibility: serializedType.visibility === ReflectionVisibility$1.PUBLIC ? _powerlines_deepkit_vendor_type.ReflectionVisibility.public : serializedType.visibility === ReflectionVisibility$1.PROTECTED ? _powerlines_deepkit_vendor_type.ReflectionVisibility.protected : _powerlines_deepkit_vendor_type.ReflectionVisibility.private,
4905
+ type: serializedType.type.id,
4906
+ decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
4907
+ typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
4908
+ indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
4909
+ tags: convertFromCapnpTagsReflection(serializedType)
4910
+ };
4911
+ }
4912
+
4913
+ //#endregion
4914
+ Object.defineProperty(exports, 'convertFromCapnp', {
4915
+ enumerable: true,
4916
+ get: function () {
4917
+ return convertFromCapnp;
4918
+ }
4919
+ });
4920
+ Object.defineProperty(exports, 'convertFromCapnpArray', {
4921
+ enumerable: true,
4922
+ get: function () {
4923
+ return convertFromCapnpArray;
4924
+ }
4925
+ });
4926
+ Object.defineProperty(exports, 'convertFromCapnpBase', {
4927
+ enumerable: true,
4928
+ get: function () {
4929
+ return convertFromCapnpBase;
4930
+ }
4931
+ });
4932
+ Object.defineProperty(exports, 'convertFromCapnpClassType', {
4933
+ enumerable: true,
4934
+ get: function () {
4935
+ return convertFromCapnpClassType;
4936
+ }
4937
+ });
4938
+ Object.defineProperty(exports, 'convertFromCapnpDefault', {
4939
+ enumerable: true,
4940
+ get: function () {
4941
+ return convertFromCapnpDefault;
4942
+ }
4943
+ });
4944
+ Object.defineProperty(exports, 'convertFromCapnpEnum', {
4945
+ enumerable: true,
4946
+ get: function () {
4947
+ return convertFromCapnpEnum;
4948
+ }
4949
+ });
4950
+ Object.defineProperty(exports, 'convertFromCapnpFunction', {
4951
+ enumerable: true,
4952
+ get: function () {
4953
+ return convertFromCapnpFunction;
4954
+ }
4955
+ });
4956
+ Object.defineProperty(exports, 'convertFromCapnpIndexAccessOrigin', {
4957
+ enumerable: true,
4958
+ get: function () {
4959
+ return convertFromCapnpIndexAccessOrigin;
4960
+ }
4961
+ });
4962
+ Object.defineProperty(exports, 'convertFromCapnpInfer', {
4963
+ enumerable: true,
4964
+ get: function () {
4965
+ return convertFromCapnpInfer;
4966
+ }
4967
+ });
4968
+ Object.defineProperty(exports, 'convertFromCapnpIntersection', {
4969
+ enumerable: true,
4970
+ get: function () {
4971
+ return convertFromCapnpIntersection;
4972
+ }
4973
+ });
4974
+ Object.defineProperty(exports, 'convertFromCapnpLiteral', {
4975
+ enumerable: true,
4976
+ get: function () {
4977
+ return convertFromCapnpLiteral;
4978
+ }
4979
+ });
4980
+ Object.defineProperty(exports, 'convertFromCapnpMethodSignature', {
4981
+ enumerable: true,
4982
+ get: function () {
4983
+ return convertFromCapnpMethodSignature;
4984
+ }
4985
+ });
4986
+ Object.defineProperty(exports, 'convertFromCapnpObjectLiteral', {
4987
+ enumerable: true,
4988
+ get: function () {
4989
+ return convertFromCapnpObjectLiteral;
4990
+ }
4991
+ });
4992
+ Object.defineProperty(exports, 'convertFromCapnpOther', {
4993
+ enumerable: true,
4994
+ get: function () {
4995
+ return convertFromCapnpOther;
4996
+ }
4997
+ });
4998
+ Object.defineProperty(exports, 'convertFromCapnpParameter', {
4999
+ enumerable: true,
5000
+ get: function () {
5001
+ return convertFromCapnpParameter;
5002
+ }
5003
+ });
5004
+ Object.defineProperty(exports, 'convertFromCapnpProperty', {
5005
+ enumerable: true,
5006
+ get: function () {
5007
+ return convertFromCapnpProperty;
5008
+ }
5009
+ });
5010
+ Object.defineProperty(exports, 'convertFromCapnpPropertySignature', {
5011
+ enumerable: true,
5012
+ get: function () {
5013
+ return convertFromCapnpPropertySignature;
5014
+ }
5015
+ });
5016
+ Object.defineProperty(exports, 'convertFromCapnpSimple', {
5017
+ enumerable: true,
5018
+ get: function () {
5019
+ return convertFromCapnpSimple;
5020
+ }
5021
+ });
5022
+ Object.defineProperty(exports, 'convertFromCapnpTagsReflection', {
5023
+ enumerable: true,
5024
+ get: function () {
5025
+ return convertFromCapnpTagsReflection;
5026
+ }
5027
+ });
5028
+ Object.defineProperty(exports, 'convertFromCapnpTuple', {
5029
+ enumerable: true,
5030
+ get: function () {
5031
+ return convertFromCapnpTuple;
5032
+ }
5033
+ });
5034
+ Object.defineProperty(exports, 'convertFromCapnpTupleMember', {
5035
+ enumerable: true,
5036
+ get: function () {
5037
+ return convertFromCapnpTupleMember;
5038
+ }
5039
+ });
5040
+ Object.defineProperty(exports, 'convertFromCapnpUnion', {
5041
+ enumerable: true,
5042
+ get: function () {
5043
+ return convertFromCapnpUnion;
5044
+ }
5045
+ });
5046
+ Object.defineProperty(exports, 'convertToCapnp', {
5047
+ enumerable: true,
5048
+ get: function () {
5049
+ return convertToCapnp;
5050
+ }
5051
+ });
5052
+ Object.defineProperty(exports, 'convertToCapnpArray', {
5053
+ enumerable: true,
5054
+ get: function () {
5055
+ return convertToCapnpArray;
5056
+ }
5057
+ });
5058
+ Object.defineProperty(exports, 'convertToCapnpBase', {
5059
+ enumerable: true,
5060
+ get: function () {
5061
+ return convertToCapnpBase;
5062
+ }
5063
+ });
5064
+ Object.defineProperty(exports, 'convertToCapnpClassType', {
5065
+ enumerable: true,
5066
+ get: function () {
5067
+ return convertToCapnpClassType;
5068
+ }
5069
+ });
5070
+ Object.defineProperty(exports, 'convertToCapnpDefault', {
5071
+ enumerable: true,
5072
+ get: function () {
5073
+ return convertToCapnpDefault;
5074
+ }
5075
+ });
5076
+ Object.defineProperty(exports, 'convertToCapnpEnum', {
5077
+ enumerable: true,
5078
+ get: function () {
5079
+ return convertToCapnpEnum;
5080
+ }
5081
+ });
5082
+ Object.defineProperty(exports, 'convertToCapnpFunction', {
5083
+ enumerable: true,
5084
+ get: function () {
5085
+ return convertToCapnpFunction;
5086
+ }
5087
+ });
5088
+ Object.defineProperty(exports, 'convertToCapnpIndexAccessOrigin', {
5089
+ enumerable: true,
5090
+ get: function () {
5091
+ return convertToCapnpIndexAccessOrigin;
5092
+ }
5093
+ });
5094
+ Object.defineProperty(exports, 'convertToCapnpInfer', {
5095
+ enumerable: true,
5096
+ get: function () {
5097
+ return convertToCapnpInfer;
5098
+ }
5099
+ });
5100
+ Object.defineProperty(exports, 'convertToCapnpIntersection', {
5101
+ enumerable: true,
5102
+ get: function () {
5103
+ return convertToCapnpIntersection;
5104
+ }
5105
+ });
5106
+ Object.defineProperty(exports, 'convertToCapnpLiteral', {
5107
+ enumerable: true,
5108
+ get: function () {
5109
+ return convertToCapnpLiteral;
5110
+ }
5111
+ });
5112
+ Object.defineProperty(exports, 'convertToCapnpMethod', {
5113
+ enumerable: true,
5114
+ get: function () {
5115
+ return convertToCapnpMethod;
5116
+ }
5117
+ });
5118
+ Object.defineProperty(exports, 'convertToCapnpMethodSignature', {
5119
+ enumerable: true,
5120
+ get: function () {
5121
+ return convertToCapnpMethodSignature;
5122
+ }
5123
+ });
5124
+ Object.defineProperty(exports, 'convertToCapnpObjectLiteral', {
5125
+ enumerable: true,
5126
+ get: function () {
5127
+ return convertToCapnpObjectLiteral;
5128
+ }
5129
+ });
5130
+ Object.defineProperty(exports, 'convertToCapnpOther', {
5131
+ enumerable: true,
5132
+ get: function () {
5133
+ return convertToCapnpOther;
5134
+ }
5135
+ });
5136
+ Object.defineProperty(exports, 'convertToCapnpParameter', {
5137
+ enumerable: true,
5138
+ get: function () {
5139
+ return convertToCapnpParameter;
5140
+ }
5141
+ });
5142
+ Object.defineProperty(exports, 'convertToCapnpProperty', {
5143
+ enumerable: true,
5144
+ get: function () {
5145
+ return convertToCapnpProperty;
5146
+ }
5147
+ });
5148
+ Object.defineProperty(exports, 'convertToCapnpPropertySignature', {
5149
+ enumerable: true,
5150
+ get: function () {
5151
+ return convertToCapnpPropertySignature;
5152
+ }
5153
+ });
5154
+ Object.defineProperty(exports, 'convertToCapnpSimple', {
5155
+ enumerable: true,
5156
+ get: function () {
5157
+ return convertToCapnpSimple;
5158
+ }
5159
+ });
5160
+ Object.defineProperty(exports, 'convertToCapnpTagsReflection', {
5161
+ enumerable: true,
5162
+ get: function () {
5163
+ return convertToCapnpTagsReflection;
5164
+ }
5165
+ });
5166
+ Object.defineProperty(exports, 'convertToCapnpTuple', {
5167
+ enumerable: true,
5168
+ get: function () {
5169
+ return convertToCapnpTuple;
5170
+ }
5171
+ });
5172
+ Object.defineProperty(exports, 'convertToCapnpTupleMember', {
5173
+ enumerable: true,
5174
+ get: function () {
5175
+ return convertToCapnpTupleMember;
5176
+ }
5177
+ });
5178
+ Object.defineProperty(exports, 'convertToCapnpUnion', {
5179
+ enumerable: true,
5180
+ get: function () {
5181
+ return convertToCapnpUnion;
5182
+ }
5183
+ });