@powerlines/plugin-date 0.12.260 → 0.12.261

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 (184) hide show
  1. package/dist/components/date-fns.cjs +3 -2
  2. package/dist/components/date-fns.mjs +1 -1
  3. package/dist/components/dayjs.cjs +3 -2
  4. package/dist/components/dayjs.mjs +1 -1
  5. package/dist/components/luxon.cjs +3 -2
  6. package/dist/components/luxon.mjs +1 -1
  7. package/dist/components/moment.cjs +3 -2
  8. package/dist/components/moment.mjs +1 -1
  9. package/dist/index.cjs +3 -2
  10. package/dist/index.d.cts +1 -1
  11. package/dist/index.d.mts +1 -1
  12. package/dist/index.mjs +2 -2
  13. package/dist/types/plugin.d.cts +1 -1
  14. package/dist/types/plugin.d.mts +1 -1
  15. package/package.json +4 -4
  16. package/dist/deepkit/schemas/reflection.cjs +0 -3998
  17. package/dist/deepkit/schemas/reflection.d.cts +0 -1560
  18. package/dist/deepkit/schemas/reflection.d.mts +0 -1560
  19. package/dist/deepkit/schemas/reflection.mjs +0 -3996
  20. package/dist/deepkit/schemas/reflection2.cjs +0 -4112
  21. package/dist/deepkit/schemas/reflection2.mjs +0 -4110
  22. package/dist/deepkit/src/capnp.cjs +0 -913
  23. package/dist/deepkit/src/capnp.mjs +0 -911
  24. package/dist/deepkit/src/esbuild-plugin.cjs +0 -47
  25. package/dist/deepkit/src/esbuild-plugin.mjs +0 -46
  26. package/dist/deepkit/src/reflect-type.cjs +0 -22
  27. package/dist/deepkit/src/reflect-type.mjs +0 -20
  28. package/dist/deepkit/src/resolve-reflections.cjs +0 -16
  29. package/dist/deepkit/src/resolve-reflections.mjs +0 -15
  30. package/dist/deepkit/src/transformer.cjs +0 -52
  31. package/dist/deepkit/src/transformer.mjs +0 -49
  32. package/dist/deepkit/src/transpile.cjs +0 -29
  33. package/dist/deepkit/src/transpile.mjs +0 -27
  34. package/dist/deepkit/src/types.d.cts +0 -10
  35. package/dist/deepkit/src/types.d.mts +0 -10
  36. package/dist/deepkit/src/utilities.cjs +0 -67
  37. package/dist/deepkit/src/utilities.mjs +0 -66
  38. package/dist/plugin-alloy/src/core/components/output.cjs +0 -36
  39. package/dist/plugin-alloy/src/core/components/output.mjs +0 -35
  40. package/dist/plugin-alloy/src/core/components/single-line-comment.cjs +0 -20
  41. package/dist/plugin-alloy/src/core/components/single-line-comment.mjs +0 -19
  42. package/dist/plugin-alloy/src/core/components/source-file.cjs +0 -60
  43. package/dist/plugin-alloy/src/core/components/source-file.mjs +0 -58
  44. package/dist/plugin-alloy/src/core/contexts/context.cjs +0 -38
  45. package/dist/plugin-alloy/src/core/contexts/context.mjs +0 -34
  46. package/dist/plugin-alloy/src/core/contexts/index.cjs +0 -2
  47. package/dist/plugin-alloy/src/core/contexts/index.mjs +0 -4
  48. package/dist/plugin-alloy/src/core/contexts/reflection.cjs +0 -46
  49. package/dist/plugin-alloy/src/core/contexts/reflection.mjs +0 -42
  50. package/dist/plugin-alloy/src/helpers/refkey.cjs +0 -16
  51. package/dist/plugin-alloy/src/helpers/refkey.mjs +0 -15
  52. package/dist/plugin-alloy/src/index.cjs +0 -102
  53. package/dist/plugin-alloy/src/index.mjs +0 -100
  54. package/dist/plugin-alloy/src/markdown/components/markdown-file.cjs +0 -89
  55. package/dist/plugin-alloy/src/markdown/components/markdown-file.mjs +0 -88
  56. package/dist/plugin-alloy/src/markdown/components/markdown-table.cjs +0 -33
  57. package/dist/plugin-alloy/src/markdown/components/markdown-table.mjs +0 -32
  58. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.cjs +0 -18
  59. package/dist/plugin-alloy/src/markdown/contexts/markdown-table.mjs +0 -17
  60. package/dist/plugin-alloy/src/types/components.d.mts +0 -3
  61. package/dist/plugin-alloy/src/types/index.d.mts +0 -2
  62. package/dist/plugin-alloy/src/types/plugin.d.cts +0 -36
  63. package/dist/plugin-alloy/src/types/plugin.d.mts +0 -36
  64. package/dist/plugin-alloy/src/typescript/components/builtin-file.cjs +0 -52
  65. package/dist/plugin-alloy/src/typescript/components/builtin-file.mjs +0 -51
  66. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.cjs +0 -78
  67. package/dist/plugin-alloy/src/typescript/components/tsdoc-reflection.mjs +0 -76
  68. package/dist/plugin-alloy/src/typescript/components/tsdoc.cjs +0 -364
  69. package/dist/plugin-alloy/src/typescript/components/tsdoc.mjs +0 -355
  70. package/dist/plugin-alloy/src/typescript/components/typescript-file.cjs +0 -157
  71. package/dist/plugin-alloy/src/typescript/components/typescript-file.mjs +0 -154
  72. package/dist/plugin-alloy/src/typescript/components/typescript-interface.cjs +0 -57
  73. package/dist/plugin-alloy/src/typescript/components/typescript-interface.mjs +0 -56
  74. package/dist/plugin-alloy/src/typescript/components/typescript-object.cjs +0 -94
  75. package/dist/plugin-alloy/src/typescript/components/typescript-object.mjs +0 -93
  76. package/dist/plugin-automd/src/index.cjs +0 -101
  77. package/dist/plugin-automd/src/index.mjs +0 -98
  78. package/dist/plugin-automd/src/types/plugin.d.cts +0 -38
  79. package/dist/plugin-automd/src/types/plugin.d.mts +0 -40
  80. package/dist/plugin-automd/src/types/toc.d.cts +0 -33
  81. package/dist/plugin-automd/src/types/toc.d.mts +0 -33
  82. package/dist/plugin-babel/src/helpers/ast-utils.cjs +0 -10
  83. package/dist/plugin-babel/src/helpers/ast-utils.mjs +0 -9
  84. package/dist/plugin-babel/src/helpers/create-plugin.cjs +0 -41
  85. package/dist/plugin-babel/src/helpers/create-plugin.mjs +0 -39
  86. package/dist/plugin-babel/src/helpers/filters.cjs +0 -23
  87. package/dist/plugin-babel/src/helpers/filters.mjs +0 -21
  88. package/dist/plugin-babel/src/helpers/index.cjs +0 -5
  89. package/dist/plugin-babel/src/helpers/index.mjs +0 -7
  90. package/dist/plugin-babel/src/helpers/module-helpers.cjs +0 -38
  91. package/dist/plugin-babel/src/helpers/module-helpers.mjs +0 -35
  92. package/dist/plugin-babel/src/helpers/options.cjs +0 -49
  93. package/dist/plugin-babel/src/helpers/options.mjs +0 -46
  94. package/dist/plugin-babel/src/index.cjs +0 -85
  95. package/dist/plugin-babel/src/index.mjs +0 -83
  96. package/dist/plugin-babel/src/types/index.d.mts +0 -1
  97. package/dist/plugin-babel/src/types/plugin.d.cts +0 -15
  98. package/dist/plugin-babel/src/types/plugin.d.mts +0 -15
  99. package/dist/plugin-env/src/babel/index.cjs +0 -1
  100. package/dist/plugin-env/src/babel/index.mjs +0 -3
  101. package/dist/plugin-env/src/babel/plugin.cjs +0 -70
  102. package/dist/plugin-env/src/babel/plugin.mjs +0 -69
  103. package/dist/plugin-env/src/components/docs.cjs +0 -60
  104. package/dist/plugin-env/src/components/docs.mjs +0 -59
  105. package/dist/plugin-env/src/components/env.cjs +0 -497
  106. package/dist/plugin-env/src/components/env.mjs +0 -494
  107. package/dist/plugin-env/src/components/index.cjs +0 -2
  108. package/dist/plugin-env/src/components/index.mjs +0 -4
  109. package/dist/plugin-env/src/helpers/automd-generator.cjs +0 -22
  110. package/dist/plugin-env/src/helpers/automd-generator.mjs +0 -21
  111. package/dist/plugin-env/src/helpers/create-reflection-resource.cjs +0 -55
  112. package/dist/plugin-env/src/helpers/create-reflection-resource.mjs +0 -54
  113. package/dist/plugin-env/src/helpers/docs-helper.cjs +0 -16
  114. package/dist/plugin-env/src/helpers/docs-helper.mjs +0 -15
  115. package/dist/plugin-env/src/helpers/index.cjs +0 -6
  116. package/dist/plugin-env/src/helpers/index.mjs +0 -8
  117. package/dist/plugin-env/src/helpers/load.cjs +0 -84
  118. package/dist/plugin-env/src/helpers/load.mjs +0 -81
  119. package/dist/plugin-env/src/helpers/persistence.cjs +0 -201
  120. package/dist/plugin-env/src/helpers/persistence.mjs +0 -190
  121. package/dist/plugin-env/src/helpers/reflect.cjs +0 -125
  122. package/dist/plugin-env/src/helpers/reflect.mjs +0 -117
  123. package/dist/plugin-env/src/helpers/source-file-env.cjs +0 -24
  124. package/dist/plugin-env/src/helpers/source-file-env.mjs +0 -23
  125. package/dist/plugin-env/src/helpers/template-helpers.cjs +0 -2
  126. package/dist/plugin-env/src/helpers/template-helpers.mjs +0 -4
  127. package/dist/plugin-env/src/index.cjs +0 -174
  128. package/dist/plugin-env/src/index.mjs +0 -172
  129. package/dist/plugin-env/src/types/plugin.d.cts +0 -148
  130. package/dist/plugin-env/src/types/plugin.d.mts +0 -150
  131. package/dist/plugin-env/src/types/runtime.d.cts +0 -789
  132. package/dist/plugin-env/src/types/runtime.d.mts +0 -789
  133. package/dist/powerlines/src/internal/helpers/hooks.d.cts +0 -47
  134. package/dist/powerlines/src/internal/helpers/hooks.d.mts +0 -49
  135. package/dist/powerlines/src/lib/build/esbuild.cjs +0 -93
  136. package/dist/powerlines/src/lib/build/esbuild.mjs +0 -91
  137. package/dist/powerlines/src/lib/constants/environments.cjs +0 -6
  138. package/dist/powerlines/src/lib/constants/environments.mjs +0 -5
  139. package/dist/powerlines/src/lib/entry.cjs +0 -11
  140. package/dist/powerlines/src/lib/entry.mjs +0 -13
  141. package/dist/powerlines/src/lib/logger.cjs +0 -41
  142. package/dist/powerlines/src/lib/logger.mjs +0 -39
  143. package/dist/powerlines/src/lib/unplugin/helpers.cjs +0 -3
  144. package/dist/powerlines/src/lib/unplugin/helpers.mjs +0 -5
  145. package/dist/powerlines/src/lib/unplugin/module-resolution.cjs +0 -66
  146. package/dist/powerlines/src/lib/unplugin/module-resolution.mjs +0 -65
  147. package/dist/powerlines/src/lib/unplugin/plugin.cjs +0 -46
  148. package/dist/powerlines/src/lib/unplugin/plugin.mjs +0 -45
  149. package/dist/powerlines/src/lib/utilities/bundle.cjs +0 -42
  150. package/dist/powerlines/src/lib/utilities/bundle.mjs +0 -40
  151. package/dist/powerlines/src/lib/utilities/file-header.cjs +0 -22
  152. package/dist/powerlines/src/lib/utilities/file-header.mjs +0 -21
  153. package/dist/powerlines/src/lib/utilities/resolve.cjs +0 -50
  154. package/dist/powerlines/src/lib/utilities/resolve.mjs +0 -49
  155. package/dist/powerlines/src/lib/utilities/source-file.cjs +0 -5
  156. package/dist/powerlines/src/lib/utilities/source-file.mjs +0 -5
  157. package/dist/powerlines/src/plugin-utils/paths.cjs +0 -1
  158. package/dist/powerlines/src/plugin-utils/paths.mjs +0 -3
  159. package/dist/powerlines/src/types/api.d.cts +0 -104
  160. package/dist/powerlines/src/types/api.d.mts +0 -104
  161. package/dist/powerlines/src/types/babel.d.cts +0 -22
  162. package/dist/powerlines/src/types/babel.d.mts +0 -22
  163. package/dist/powerlines/src/types/build.cjs +0 -21
  164. package/dist/powerlines/src/types/build.d.cts +0 -185
  165. package/dist/powerlines/src/types/build.d.mts +0 -185
  166. package/dist/powerlines/src/types/build.mjs +0 -21
  167. package/dist/powerlines/src/types/commands.d.cts +0 -8
  168. package/dist/powerlines/src/types/commands.d.mts +0 -9
  169. package/dist/powerlines/src/types/config.d.cts +0 -435
  170. package/dist/powerlines/src/types/config.d.mts +0 -436
  171. package/dist/powerlines/src/types/context.d.cts +0 -514
  172. package/dist/powerlines/src/types/context.d.mts +0 -514
  173. package/dist/powerlines/src/types/fs.d.cts +0 -486
  174. package/dist/powerlines/src/types/fs.d.mts +0 -486
  175. package/dist/powerlines/src/types/hooks.d.cts +0 -32
  176. package/dist/powerlines/src/types/hooks.d.mts +0 -32
  177. package/dist/powerlines/src/types/plugin.d.cts +0 -205
  178. package/dist/powerlines/src/types/plugin.d.mts +0 -205
  179. package/dist/powerlines/src/types/resolved.d.cts +0 -94
  180. package/dist/powerlines/src/types/resolved.d.mts +0 -94
  181. package/dist/powerlines/src/types/tsconfig.d.cts +0 -69
  182. package/dist/powerlines/src/types/tsconfig.d.mts +0 -69
  183. package/dist/powerlines/src/types/unplugin.d.cts +0 -22
  184. package/dist/powerlines/src/types/unplugin.d.mts +0 -23
@@ -1,913 +0,0 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- const require_reflection = require('../schemas/reflection.cjs');
3
- let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
4
- let __stryke_type_checks = require("@stryke/type-checks");
5
-
6
- //#region ../deepkit/src/capnp.ts
7
- /**
8
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
9
- *
10
- * @param serializedTypes - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
11
- * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
12
- */
13
- function convertToCapnp(serializedTypes, result) {
14
- if (!serializedTypes || !Array.isArray(serializedTypes) || serializedTypes.length === 0) throw new Error("Invalid serialized type provided for conversion.");
15
- if (serializedTypes.length !== result.length) throw new Error(`Mismatch in length of serialized types: expected ${result.length}, got ${serializedTypes.length}.`);
16
- serializedTypes.filter((serializedType) => (0, __stryke_type_checks.isSetObject)(serializedType) && !(0, __stryke_type_checks.isUndefined)(serializedType.kind)).forEach((serializedType, index) => {
17
- convertToCapnpBase(serializedType, result.get(index)._initType());
18
- });
19
- return result;
20
- }
21
- /**
22
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
23
- *
24
- * @param serializedTypes - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema
25
- * @returns The [Deepkit](https://deepkit.io/) {@link SerializedTypes | serialized types} converted from the Cap'n Proto serialized type
26
- */
27
- function convertFromCapnp(serializedTypes) {
28
- if (!serializedTypes) throw new Error("Invalid serialized type provided for conversion.");
29
- const result = [];
30
- serializedTypes.forEach((serializedType) => {
31
- const deserializedType = convertFromCapnpBase(serializedType.type);
32
- result.push(deserializedType);
33
- });
34
- return result;
35
- }
36
- /**
37
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
38
- *
39
- * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
40
- * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
41
- */
42
- function convertToCapnpTagsReflection(result, serializedType) {
43
- if (serializedType?.alias?.length) {
44
- const alias = result._initAlias(serializedType.alias.length);
45
- serializedType.alias.forEach((a, index) => {
46
- alias.set(index, a);
47
- });
48
- }
49
- result.hidden = serializedType?.hidden ?? false;
50
- result.ignore = serializedType?.ignore ?? false;
51
- result.internal = serializedType?.internal ?? false;
52
- result.readonly = serializedType?.readonly ?? false;
53
- if (serializedType?.title) result.title = serializedType?.title;
54
- if (serializedType?.domain) result.domain = serializedType?.domain;
55
- if (serializedType?.permission?.length) {
56
- const permission = result._initPermission(serializedType.permission.length);
57
- serializedType.permission?.forEach((p, index) => {
58
- permission.set(index, p);
59
- });
60
- }
61
- return result;
62
- }
63
- function convertFromCapnpTagsReflection(serializedType) {
64
- return serializedType._hasTags() ? {
65
- alias: serializedType.tags?.alias?.length ? serializedType.tags?.alias.map((value) => value) : void 0,
66
- hidden: serializedType.tags?.hidden,
67
- domain: serializedType.tags?.domain ? serializedType.tags.domain : void 0,
68
- title: serializedType.tags?.title ? serializedType.tags.title : void 0,
69
- ignore: serializedType.tags?.ignore,
70
- internal: serializedType.tags?.internal,
71
- readonly: serializedType.tags?.readonly,
72
- permission: serializedType.tags?.permission?.length ? serializedType.tags?.permission?.map((value) => value) : void 0
73
- } : void 0;
74
- }
75
- /**
76
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
77
- *
78
- * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
79
- * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
80
- */
81
- function convertToCapnpIndexAccessOrigin(result, serializedType) {
82
- const indexAccessOriginIndex = result._initIndex();
83
- indexAccessOriginIndex.id = serializedType?.index ?? 0;
84
- const indexAccessOriginContainer = result._initContainer();
85
- indexAccessOriginContainer.id = serializedType?.container ?? 0;
86
- return result;
87
- }
88
- function convertFromCapnpIndexAccessOrigin(serializedType) {
89
- return serializedType._hasIndexAccessOrigin() ? {
90
- container: Number(serializedType.indexAccessOrigin?.container.id),
91
- index: Number(serializedType.indexAccessOrigin?.index.id)
92
- } : void 0;
93
- }
94
- /**
95
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
96
- *
97
- * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
98
- * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
99
- */
100
- function convertToCapnpBase(serializedType, result) {
101
- if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral) convertToCapnpObjectLiteral(serializedType, result._initObjectLiteral());
102
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.class) convertToCapnpClassType(serializedType, result._initClassType());
103
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.parameter) convertToCapnpParameter(serializedType, result._initParameter());
104
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.function) convertToCapnpFunction(serializedType, result._initFunction());
105
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.method) convertToCapnpMethod(serializedType, result._initMethod());
106
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.infer) convertToCapnpInfer(serializedType, result._initInfer());
107
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.union) convertToCapnpUnion(serializedType, result._initUnion());
108
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.array) convertToCapnpArray(serializedType, result._initArray());
109
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.intersection) convertToCapnpIntersection(serializedType, result._initIntersection());
110
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.enum) convertToCapnpEnum(serializedType, result._initEnum());
111
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.property) convertToCapnpProperty(serializedType, result._initProperty());
112
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.tuple) convertToCapnpTuple(serializedType, result._initTuple());
113
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.tupleMember) convertToCapnpTupleMember(serializedType, result._initTupleMember());
114
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.propertySignature) convertToCapnpPropertySignature(serializedType, result._initPropertySignature());
115
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.methodSignature) convertToCapnpMethodSignature(serializedType, result._initMethodSignature());
116
- else if (serializedType.kind === __powerlines_deepkit_vendor_type.ReflectionKind.literal) convertToCapnpLiteral(serializedType, result._initLiteral());
117
- 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());
118
- else convertToCapnpOther(serializedType, result._initOther());
119
- return result;
120
- }
121
- function convertFromCapnpBase(serializedType) {
122
- if (serializedType._isObjectLiteral) return convertFromCapnpObjectLiteral(serializedType.objectLiteral);
123
- else if (serializedType._isClassType) return convertFromCapnpClassType(serializedType.classType);
124
- else if (serializedType._isParameter) return convertFromCapnpParameter(serializedType.parameter);
125
- else if (serializedType._isFunction) return convertFromCapnpFunction(serializedType.function);
126
- else if (serializedType._isInfer) return convertFromCapnpInfer(serializedType.infer);
127
- else if (serializedType._isMethod) return convertFromCapnpMethod(serializedType.method);
128
- else if (serializedType._isUnion) return convertFromCapnpUnion(serializedType.union);
129
- else if (serializedType._isArray) return convertFromCapnpArray(serializedType.array);
130
- else if (serializedType._isIntersection) return convertFromCapnpIntersection(serializedType.intersection);
131
- else if (serializedType._isEnum) return convertFromCapnpEnum(serializedType.enum);
132
- else if (serializedType._isProperty) return convertFromCapnpProperty(serializedType.property);
133
- else if (serializedType._isTuple) return convertFromCapnpTuple(serializedType.tuple);
134
- else if (serializedType._isTupleMember) return convertFromCapnpTupleMember(serializedType.tupleMember);
135
- else if (serializedType._isPropertySignature) return convertFromCapnpPropertySignature(serializedType.propertySignature);
136
- else if (serializedType._isMethodSignature) return convertFromCapnpMethodSignature(serializedType.methodSignature);
137
- else if (serializedType._isLiteral) return convertFromCapnpLiteral(serializedType.literal);
138
- else if (serializedType._isSimple) return convertFromCapnpSimple(serializedType.simple);
139
- else if (serializedType._isOther) return convertFromCapnpOther(serializedType.other);
140
- else throw new Error(`Unsupported serialized type kind: ${serializedType.toString()}`);
141
- }
142
- function convertFromCapnpOther(serializedType) {
143
- return {
144
- kind: serializedType.kind,
145
- typeName: serializedType.typeName || void 0
146
- };
147
- }
148
- function convertFromCapnpSimple(serializedType) {
149
- const result = {
150
- kind: serializedType.kind,
151
- typeName: serializedType.typeName || void 0,
152
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
153
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
154
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
155
- };
156
- if (serializedType._hasOrigin()) result.origin = Number(serializedType.origin.id);
157
- return result;
158
- }
159
- function convertToCapnpOther(serializedType, result) {
160
- result.kind = serializedType.kind;
161
- result.typeName = serializedType.typeName || "";
162
- return result;
163
- }
164
- function convertToCapnpSimple(serializedType, result) {
165
- result.kind = serializedType.kind;
166
- result.typeName = serializedType.typeName || "";
167
- if (serializedType.origin) {
168
- result._initOrigin();
169
- result.origin.id = serializedType.origin ?? 0;
170
- }
171
- if (serializedType.decorators?.length) {
172
- const decorators = result._initDecorators(serializedType.decorators.length);
173
- serializedType.decorators.forEach((d, index) => {
174
- const decorator = decorators.get(index);
175
- decorator.id = d;
176
- });
177
- }
178
- if (serializedType.typeArguments?.length) {
179
- const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
180
- serializedType.typeArguments.forEach((t, index) => {
181
- const typeArgument = typeArguments.get(index);
182
- typeArgument.id = t;
183
- });
184
- }
185
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
186
- return result;
187
- }
188
- function convertFromCapnpLiteral(serializedType) {
189
- return {
190
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.literal,
191
- literal: serializedType.literal._isString ? serializedType.literal.string : serializedType.literal._isNumber ? serializedType.literal.number : serializedType.literal._isBoolean ? serializedType.literal.boolean : serializedType.literal._isBigint ? {
192
- type: "bigint",
193
- value: serializedType.literal.bigint.value
194
- } : serializedType.literal._isSymbol ? {
195
- type: "symbol",
196
- name: serializedType.literal.symbol.name
197
- } : {
198
- type: "regex",
199
- regex: serializedType.literal.regex.regex
200
- },
201
- typeName: serializedType.typeName || void 0,
202
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
203
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
204
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
205
- };
206
- }
207
- function convertToCapnpLiteral(serializedType, result) {
208
- result.kind = serializedType.kind;
209
- result.typeName = serializedType.typeName || "";
210
- const literalType = result._initLiteral();
211
- if (typeof serializedType.literal === "boolean") literalType.boolean = serializedType.literal;
212
- else if (typeof serializedType.literal === "number") literalType.number = serializedType.literal;
213
- else if (typeof serializedType.literal === "string") literalType.string = serializedType.literal;
214
- else if (serializedType.literal.type === "bigint") {
215
- const literalTypeBigint = literalType._initBigint();
216
- literalTypeBigint.type = "bigint";
217
- literalTypeBigint.value = serializedType.literal.value;
218
- } else if (serializedType.literal.type === "symbol") {
219
- const literalTypeSymbol = literalType._initSymbol();
220
- literalTypeSymbol.type = "symbol";
221
- literalTypeSymbol.name = serializedType.literal.name.toString().slice(7, -1);
222
- } else if (serializedType.literal.type === "regex") {
223
- const literalTypeRegex = literalType._initRegex();
224
- literalTypeRegex.type = "regex";
225
- literalTypeRegex.regex = serializedType.literal.regex;
226
- }
227
- if (serializedType.decorators?.length) {
228
- const decorators = result._initDecorators(serializedType.decorators.length);
229
- serializedType.decorators.forEach((d, index) => {
230
- const decorator = decorators.get(index);
231
- decorator.id = d;
232
- });
233
- }
234
- if (serializedType.typeArguments?.length) {
235
- const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
236
- serializedType.typeArguments.forEach((t, index) => {
237
- const typeArgument = typeArguments.get(index);
238
- typeArgument.id = t;
239
- });
240
- }
241
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
242
- return result;
243
- }
244
- function convertFromCapnpMethodSignature(serializedType) {
245
- return {
246
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.methodSignature,
247
- name: serializedType.name,
248
- typeName: serializedType.typeName || void 0,
249
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
250
- parameters: serializedType._hasParameters() ? serializedType.parameters.map((p) => convertFromCapnpParameter(p)) : [],
251
- return: serializedType.return.id,
252
- tags: convertFromCapnpTagsReflection(serializedType)
253
- };
254
- }
255
- function convertToCapnpMethodSignature(serializedType, result) {
256
- result.kind = serializedType.kind;
257
- result.name = String(serializedType.name);
258
- result.typeName = serializedType.typeName || "";
259
- if (serializedType.decorators?.length) {
260
- const decorators = result._initDecorators(serializedType.decorators.length);
261
- serializedType.decorators.forEach((d, index) => {
262
- const decorator = decorators.get(index);
263
- decorator.id = d;
264
- });
265
- }
266
- if (serializedType.typeArguments?.length) {
267
- const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
268
- serializedType.typeArguments.forEach((t, index) => {
269
- const typeArgument = typeArguments.get(index);
270
- typeArgument.id = t;
271
- });
272
- }
273
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
274
- if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
275
- return result;
276
- }
277
- function convertFromCapnpPropertySignature(serializedType) {
278
- return {
279
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.propertySignature,
280
- name: serializedType.name,
281
- typeName: serializedType.typeName || void 0,
282
- description: serializedType.description,
283
- default: convertFromCapnpDefault(serializedType.default),
284
- optional: serializedType.optional ? true : void 0,
285
- readonly: serializedType.readonly ? true : void 0,
286
- type: serializedType.type.id,
287
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
288
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
289
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
290
- tags: convertFromCapnpTagsReflection(serializedType)
291
- };
292
- }
293
- function convertToCapnpDefault(defaultValue, result) {
294
- if (typeof defaultValue !== "undefined" && defaultValue !== "") {
295
- result._initValue();
296
- if (typeof defaultValue === "string") result.value.string = defaultValue;
297
- else if (typeof defaultValue === "number") if ((0, __stryke_type_checks.isInteger)(defaultValue)) result.value.integer = defaultValue;
298
- else result.value.float = defaultValue;
299
- else if (typeof defaultValue === "boolean") result.value.boolean = defaultValue;
300
- }
301
- }
302
- function convertFromCapnpDefault(serializedType) {
303
- if (typeof serializedType.value === "undefined") return;
304
- else if (serializedType.value._isBoolean) return serializedType.value.boolean;
305
- else if (serializedType.value._isInteger) return serializedType.value.integer;
306
- else if (serializedType.value._isFloat) return serializedType.value.float;
307
- else if (serializedType.value._isString) return serializedType.value.string;
308
- }
309
- function convertToCapnpPropertySignature(serializedType, result) {
310
- result.kind = serializedType.kind;
311
- result.name = String(serializedType.name) || "";
312
- result.typeName = serializedType.typeName || "";
313
- result.description = serializedType.description || "";
314
- result.optional = serializedType.optional ?? false;
315
- result.readonly = serializedType.readonly ?? false;
316
- if (typeof serializedType.default !== "undefined") {
317
- const defaultValue = result._initDefault();
318
- convertToCapnpDefault(serializedType.default, defaultValue);
319
- }
320
- const type = result._initType();
321
- type.id = serializedType.type;
322
- if (serializedType.decorators?.length) {
323
- const decorators = result._initDecorators(serializedType.decorators.length);
324
- serializedType.decorators.forEach((d, index) => {
325
- const decorator = decorators.get(index);
326
- decorator.id = d;
327
- });
328
- }
329
- if (serializedType.typeArguments?.length) {
330
- const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
331
- serializedType.typeArguments.forEach((t, index) => {
332
- const typeArgument = typeArguments.get(index);
333
- typeArgument.id = t;
334
- });
335
- }
336
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
337
- if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
338
- return result;
339
- }
340
- function convertToCapnpTupleMember(serializedType, result) {
341
- result.kind = serializedType.kind;
342
- result.typeName = serializedType.typeName || "";
343
- const type = result._initType();
344
- type.id = serializedType.type;
345
- if (serializedType.decorators?.length) {
346
- const decorators = result._initDecorators(serializedType.decorators.length);
347
- serializedType.decorators.forEach((d, index) => {
348
- const decorator = decorators.get(index);
349
- decorator.id = d;
350
- });
351
- }
352
- if (serializedType.typeArguments?.length) {
353
- const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
354
- serializedType.typeArguments.forEach((t, index) => {
355
- const typeArgument = typeArguments.get(index);
356
- typeArgument.id = t;
357
- });
358
- }
359
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
360
- return result;
361
- }
362
- function convertFromCapnpTupleMember(serializedType) {
363
- return {
364
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.tupleMember,
365
- type: serializedType.type.id,
366
- typeName: serializedType.typeName || void 0,
367
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
368
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
369
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
370
- };
371
- }
372
- function convertToCapnpTuple(serializedType, result) {
373
- result.kind = serializedType.kind;
374
- result.typeName = serializedType.typeName || "";
375
- const types = result._initTypes(serializedType.types.length);
376
- serializedType.types.forEach((t, index) => {
377
- convertToCapnpTupleMember(t, types.get(index));
378
- });
379
- if (serializedType.decorators?.length) {
380
- const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
381
- serializedType.decorators?.forEach((d, index) => {
382
- const decorator = decorators.get(index);
383
- decorator.id = d;
384
- });
385
- }
386
- if (serializedType.typeArguments?.length) {
387
- const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
388
- serializedType.typeArguments?.forEach((t, index) => {
389
- const typeArgument = typeArguments.get(index);
390
- typeArgument.id = t;
391
- });
392
- }
393
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
394
- return result;
395
- }
396
- function convertFromCapnpTuple(serializedType) {
397
- return {
398
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.tuple,
399
- typeName: serializedType.typeName || void 0,
400
- types: serializedType._hasTypes() ? serializedType.types.map((t) => convertFromCapnpTupleMember(t)) : [],
401
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
402
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
403
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
404
- };
405
- }
406
- function convertToCapnpProperty(serializedType, result) {
407
- result.kind = serializedType.kind;
408
- result.typeName = serializedType.typeName || "";
409
- result.description = serializedType.description || "";
410
- result.optional = serializedType.optional ?? false;
411
- result.readonly = serializedType.readonly ?? false;
412
- result.visibility = serializedType.visibility === __powerlines_deepkit_vendor_type.ReflectionVisibility.public ? require_reflection.ReflectionVisibility.PUBLIC : serializedType.visibility === __powerlines_deepkit_vendor_type.ReflectionVisibility.protected ? require_reflection.ReflectionVisibility.PROTECTED : require_reflection.ReflectionVisibility.PRIVATE;
413
- result.abstract = serializedType.abstract ?? false;
414
- result.name = String(serializedType.name) || "";
415
- if (typeof serializedType.default !== "undefined") {
416
- const defaultValue = result._initDefault();
417
- convertToCapnpDefault(serializedType.default, defaultValue);
418
- }
419
- const type = result._initType();
420
- type.id = serializedType.type;
421
- if (serializedType.decorators?.length) {
422
- const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
423
- serializedType.decorators?.forEach((d, index) => {
424
- const decorator = decorators.get(index);
425
- decorator.id = d;
426
- });
427
- }
428
- if (serializedType.typeArguments?.length) {
429
- const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
430
- serializedType.typeArguments?.forEach((t, index) => {
431
- const typeArgument = typeArguments.get(index);
432
- typeArgument.id = t;
433
- });
434
- }
435
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
436
- if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
437
- return result;
438
- }
439
- function convertFromCapnpProperty(serializedType) {
440
- return {
441
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.property,
442
- typeName: serializedType.typeName || void 0,
443
- description: serializedType.description,
444
- default: convertFromCapnpDefault(serializedType.default),
445
- optional: serializedType.optional ? true : void 0,
446
- readonly: serializedType.readonly ? true : void 0,
447
- visibility: serializedType.visibility === require_reflection.ReflectionVisibility.PUBLIC ? __powerlines_deepkit_vendor_type.ReflectionVisibility.public : serializedType.visibility === require_reflection.ReflectionVisibility.PROTECTED ? __powerlines_deepkit_vendor_type.ReflectionVisibility.protected : __powerlines_deepkit_vendor_type.ReflectionVisibility.private,
448
- abstract: serializedType.abstract ? true : void 0,
449
- name: serializedType.name,
450
- type: serializedType.type.id,
451
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
452
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
453
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
454
- tags: convertFromCapnpTagsReflection(serializedType)
455
- };
456
- }
457
- function convertToCapnpEnum(serializedType, result) {
458
- result.kind = serializedType.kind;
459
- result.typeName = serializedType.typeName || "";
460
- const indexType = result._initIndexType();
461
- indexType.id = serializedType.indexType;
462
- if (serializedType.decorators?.length) {
463
- const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
464
- serializedType.decorators?.forEach((d, index) => {
465
- const decorator = decorators.get(index);
466
- decorator.id = d;
467
- });
468
- }
469
- if (serializedType.typeArguments?.length) {
470
- const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
471
- serializedType.typeArguments?.forEach((t, index) => {
472
- const typeArgument = typeArguments.get(index);
473
- typeArgument.id = t;
474
- });
475
- }
476
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
477
- if (serializedType.values?.length) {
478
- const values = result._initValues(serializedType.values?.length);
479
- serializedType.values.forEach((value, index) => {
480
- values.set(index, String(value));
481
- });
482
- }
483
- const enumEntries = result._initEnumEntries(Object.keys(serializedType.enum).length ?? 0);
484
- Object.entries(serializedType.enum).forEach(([key, value], index) => {
485
- const enumEntry = enumEntries.get(index);
486
- enumEntry.name = key;
487
- enumEntry.value = String(value);
488
- });
489
- if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
490
- return result;
491
- }
492
- function convertFromCapnpEnum(serializedType) {
493
- return {
494
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.enum,
495
- typeName: serializedType.typeName || void 0,
496
- indexType: serializedType.indexType.id,
497
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
498
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
499
- values: serializedType._hasValues() ? serializedType.values.map((value) => value) : [],
500
- enum: serializedType._hasEnumEntries() ? Object.entries(serializedType.enumEntries).reduce((ret, [key, value]) => {
501
- ret[key] = value.value;
502
- return ret;
503
- }, {}) : {},
504
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
505
- tags: convertFromCapnpTagsReflection(serializedType)
506
- };
507
- }
508
- function convertToCapnpIntersection(serializedType, result) {
509
- result.kind = serializedType.kind;
510
- result.typeName = serializedType.typeName || "";
511
- const types = result._initTypes(serializedType.types?.length ?? 0);
512
- serializedType.types?.forEach((t, index) => {
513
- const serializedTypeType = types.get(index);
514
- serializedTypeType.id = t;
515
- });
516
- if (serializedType.decorators?.length) {
517
- const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
518
- serializedType.decorators?.forEach((d, index) => {
519
- const decorator = decorators.get(index);
520
- decorator.id = d;
521
- });
522
- }
523
- if (serializedType.typeArguments?.length) {
524
- const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
525
- serializedType.typeArguments?.forEach((t, index) => {
526
- const typeArgument = typeArguments.get(index);
527
- typeArgument.id = t;
528
- });
529
- }
530
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
531
- return result;
532
- }
533
- function convertFromCapnpIntersection(serializedType) {
534
- return {
535
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.intersection,
536
- typeName: serializedType.typeName || void 0,
537
- types: serializedType._hasTypes() ? serializedType.types.map((t) => t.id) : [],
538
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
539
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
540
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
541
- };
542
- }
543
- function convertToCapnpArray(serializedType, result) {
544
- result.kind = serializedType.kind;
545
- result.typeName = serializedType.typeName || "";
546
- const type = result._initType();
547
- type.id = serializedType.type;
548
- if (serializedType.decorators?.length) {
549
- const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
550
- serializedType.decorators?.forEach((d, index) => {
551
- const decorator = decorators.get(index);
552
- decorator.id = d;
553
- });
554
- }
555
- if (serializedType.typeArguments?.length) {
556
- const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
557
- serializedType.typeArguments?.forEach((t, index) => {
558
- const typeArgument = typeArguments.get(index);
559
- typeArgument.id = t;
560
- });
561
- }
562
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
563
- if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
564
- return result;
565
- }
566
- function convertFromCapnpArray(serializedType) {
567
- return {
568
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.array,
569
- typeName: serializedType.typeName || void 0,
570
- type: serializedType.type.id,
571
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
572
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
573
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
574
- tags: convertFromCapnpTagsReflection(serializedType)
575
- };
576
- }
577
- /**
578
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
579
- *
580
- * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
581
- * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
582
- */
583
- function convertToCapnpUnion(serializedType, result) {
584
- result.kind = serializedType.kind;
585
- result.typeName = serializedType.typeName || "";
586
- const types = result._initTypes(serializedType.types?.length ?? 0);
587
- serializedType.types?.forEach((t, index) => {
588
- const serializedTypeType = types.get(index);
589
- serializedTypeType.id = t;
590
- });
591
- if (serializedType.decorators?.length) {
592
- const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
593
- serializedType.decorators?.forEach((d, index) => {
594
- const decorator = decorators.get(index);
595
- decorator.id = d;
596
- });
597
- }
598
- if (serializedType.typeArguments?.length) {
599
- const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
600
- serializedType.typeArguments?.forEach((t, index) => {
601
- const typeArgument = typeArguments.get(index);
602
- typeArgument.id = t;
603
- });
604
- }
605
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
606
- return result;
607
- }
608
- function convertFromCapnpUnion(serializedType) {
609
- return {
610
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.union,
611
- typeName: serializedType.typeName || void 0,
612
- types: serializedType._hasTypes() ? serializedType.types.map((t) => t.id) : [],
613
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
614
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
615
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
616
- };
617
- }
618
- /**
619
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
620
- *
621
- * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert.
622
- * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
623
- */
624
- function convertToCapnpInfer(serializedType, result) {
625
- result.kind = serializedType.kind;
626
- result.typeName = serializedType.typeName || "";
627
- if (serializedType.decorators?.length) {
628
- const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
629
- serializedType.decorators?.forEach((d, index) => {
630
- const decorator = decorators.get(index);
631
- decorator.id = d;
632
- });
633
- }
634
- if (serializedType.typeArguments?.length) {
635
- const typeArguments = result._initTypeArguments(serializedType.typeArguments?.length ?? 0);
636
- serializedType.typeArguments?.forEach((t, index) => {
637
- const typeArgument = typeArguments.get(index);
638
- typeArgument.id = t;
639
- });
640
- }
641
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
642
- return result;
643
- }
644
- function convertFromCapnpInfer(serializedType) {
645
- return {
646
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.infer,
647
- typeName: serializedType.typeName || void 0,
648
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
649
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
650
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType)
651
- };
652
- }
653
- /**
654
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
655
- *
656
- * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
657
- * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
658
- */
659
- function convertToCapnpFunction(serializedType, result) {
660
- result.name = String(serializedType.name) || "";
661
- result.kind = serializedType.kind;
662
- result.typeName = serializedType.typeName || "";
663
- if (serializedType.decorators?.length) {
664
- const decorators = result._initDecorators(serializedType.decorators.length);
665
- serializedType.decorators.forEach((d, index) => {
666
- const decorator = decorators.get(index);
667
- decorator.id = d;
668
- });
669
- }
670
- if (serializedType.typeArguments?.length) {
671
- const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
672
- serializedType.typeArguments.forEach((t, index) => {
673
- const typeArgument = typeArguments.get(index);
674
- typeArgument.id = t;
675
- });
676
- }
677
- if (serializedType.parameters?.length) {
678
- const parameters = result._initParameters(serializedType.parameters.length);
679
- serializedType.parameters.forEach((p, index) => {
680
- convertToCapnpParameter(p, parameters.get(index));
681
- });
682
- }
683
- const returnType = result._initReturn();
684
- returnType.id = serializedType.return;
685
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
686
- if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
687
- return result;
688
- }
689
- /**
690
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
691
- *
692
- * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
693
- * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
694
- */
695
- function convertToCapnpMethod(serializedType, result) {
696
- result.name = String(serializedType.name) || "";
697
- result.kind = serializedType.kind;
698
- result.typeName = serializedType.typeName || "";
699
- result.abstract = serializedType.abstract ?? false;
700
- result.visibility = serializedType.visibility === __powerlines_deepkit_vendor_type.ReflectionVisibility.public ? require_reflection.ReflectionVisibility.PUBLIC : serializedType.visibility === __powerlines_deepkit_vendor_type.ReflectionVisibility.protected ? require_reflection.ReflectionVisibility.PROTECTED : require_reflection.ReflectionVisibility.PRIVATE;
701
- if (serializedType.decorators?.length) {
702
- const decorators = result._initDecorators(serializedType.decorators.length);
703
- serializedType.decorators.forEach((d, index) => {
704
- const decorator = decorators.get(index);
705
- decorator.id = d;
706
- });
707
- }
708
- if (serializedType.typeArguments?.length) {
709
- const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
710
- serializedType.typeArguments.forEach((t, index) => {
711
- const typeArgument = typeArguments.get(index);
712
- typeArgument.id = t;
713
- });
714
- }
715
- if (serializedType.parameters?.length) {
716
- const parameters = result._initParameters(serializedType.parameters.length);
717
- serializedType.parameters.forEach((p, index) => {
718
- convertToCapnpParameter(p, parameters.get(index));
719
- });
720
- }
721
- const returnType = result._initReturn();
722
- returnType.id = serializedType.return;
723
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
724
- if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
725
- return result;
726
- }
727
- function convertFromCapnpFunction(serializedType) {
728
- return {
729
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.function,
730
- name: serializedType.name,
731
- typeName: serializedType.typeName || void 0,
732
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
733
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
734
- parameters: serializedType._hasParameters() ? serializedType.parameters.map((p) => convertFromCapnpParameter(p)) : [],
735
- return: serializedType.return.id,
736
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
737
- tags: convertFromCapnpTagsReflection(serializedType)
738
- };
739
- }
740
- function convertFromCapnpMethod(serializedType) {
741
- return {
742
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.method,
743
- name: serializedType.name,
744
- typeName: serializedType.typeName || void 0,
745
- abstract: serializedType.abstract ? true : void 0,
746
- return: serializedType.return.id,
747
- visibility: serializedType.visibility === require_reflection.ReflectionVisibility.PUBLIC ? __powerlines_deepkit_vendor_type.ReflectionVisibility.public : serializedType.visibility === require_reflection.ReflectionVisibility.PROTECTED ? __powerlines_deepkit_vendor_type.ReflectionVisibility.protected : __powerlines_deepkit_vendor_type.ReflectionVisibility.private,
748
- parameters: serializedType._hasParameters() ? serializedType.parameters.map((parameter) => convertFromCapnpParameter(parameter)) : []
749
- };
750
- }
751
- /**
752
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
753
- *
754
- * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
755
- * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
756
- */
757
- function convertToCapnpClassType(serializedType, result) {
758
- result.kind = serializedType.kind;
759
- result.typeName = serializedType.typeName || "";
760
- result.classType = serializedType.classType || "";
761
- result.globalObject = serializedType.globalObject ?? false;
762
- if (serializedType.arguments?.length) {
763
- const _arguments = result._initArguments(serializedType.arguments.length);
764
- serializedType.arguments.forEach((t, index) => {
765
- const serializedTypeArguments = _arguments.get(index);
766
- serializedTypeArguments.id = t;
767
- });
768
- }
769
- if (serializedType.extendsArguments?.length) {
770
- const extendsArguments = result._initArguments(serializedType.extendsArguments.length);
771
- serializedType.extendsArguments.forEach((t, index) => {
772
- const serializedTypeExtendsArguments = extendsArguments.get(index);
773
- serializedTypeExtendsArguments.id = t;
774
- });
775
- }
776
- if (serializedType.decorators?.length) {
777
- const decorators = result._initDecorators(serializedType.decorators.length);
778
- serializedType.decorators.forEach((d, index) => {
779
- const decorator = decorators.get(index);
780
- decorator.id = d;
781
- });
782
- }
783
- if (serializedType.typeArguments?.length) {
784
- const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
785
- serializedType.typeArguments.forEach((t, index) => {
786
- const typeArgument = typeArguments.get(index);
787
- typeArgument.id = t;
788
- });
789
- }
790
- if (serializedType.superClass) {
791
- const superClass = result._initSuperClass();
792
- superClass.id = serializedType.superClass;
793
- }
794
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
795
- if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
796
- return result;
797
- }
798
- function convertFromCapnpClassType(serializedType) {
799
- return {
800
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.class,
801
- typeName: serializedType.typeName || void 0,
802
- classType: serializedType.classType,
803
- globalObject: serializedType.globalObject ? true : void 0,
804
- arguments: serializedType._hasArguments() ? serializedType.arguments.map((t) => t.id) : void 0,
805
- extendsArguments: serializedType._hasExtendsArguments() ? serializedType.extendsArguments.map((t) => t.id) : void 0,
806
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
807
- types: serializedType._hasTypes() ? serializedType.types.map((t) => t.id) : [],
808
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
809
- superClass: serializedType._hasSuperClass() ? serializedType.superClass.id : void 0,
810
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
811
- tags: convertFromCapnpTagsReflection(serializedType)
812
- };
813
- }
814
- /**
815
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
816
- *
817
- * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
818
- * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
819
- */
820
- function convertToCapnpObjectLiteral(serializedType, result) {
821
- if (serializedType.decorators?.length) {
822
- const decorators = result._initDecorators(serializedType.decorators?.length ?? 0);
823
- serializedType.decorators.forEach((d, index) => {
824
- const decorator = decorators.get(index);
825
- decorator.id = d;
826
- });
827
- }
828
- if (serializedType.types?.length) {
829
- const types = result._initTypes(serializedType.types.length);
830
- serializedType.types.forEach((t, index) => {
831
- const serializedTypeType = types.get(index);
832
- serializedTypeType.id = t;
833
- });
834
- }
835
- if (serializedType.typeArguments?.length) {
836
- const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
837
- serializedType.typeArguments.forEach((t, index) => {
838
- const serializedTypeTypeArguments = typeArguments.get(index);
839
- serializedTypeTypeArguments.id = t;
840
- });
841
- }
842
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
843
- if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
844
- return result;
845
- }
846
- function convertFromCapnpObjectLiteral(serializedType) {
847
- return {
848
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral,
849
- typeName: serializedType.typeName || void 0,
850
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
851
- types: serializedType._hasTypes() ? serializedType.types.map((t) => t.id) : [],
852
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
853
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
854
- tags: convertFromCapnpTagsReflection(serializedType)
855
- };
856
- }
857
- /**
858
- * Converts a Deepkit serialized type to a Cap'n Proto serialized type.
859
- *
860
- * @param serializedType - The [Deepkit](https://deepkit.io/) {@link SerializedType | serialized type} to convert
861
- * @param result - The {@link capnp.List | list} object defined in a [Cap'n Proto](https://capnproto.org/) schema to write the converted type to
862
- */
863
- function convertToCapnpParameter(serializedType, result) {
864
- result.kind = serializedType.kind;
865
- result.typeName = serializedType.typeName || "";
866
- result.name = serializedType.name || "";
867
- result.optional = serializedType.optional ?? false;
868
- result.readonly = serializedType.readonly ?? false;
869
- result.visibility = serializedType.visibility === __powerlines_deepkit_vendor_type.ReflectionVisibility.public ? require_reflection.ReflectionVisibility.PUBLIC : serializedType.visibility === __powerlines_deepkit_vendor_type.ReflectionVisibility.protected ? require_reflection.ReflectionVisibility.PROTECTED : require_reflection.ReflectionVisibility.PRIVATE;
870
- if (typeof serializedType.default !== "undefined") {
871
- const defaultValue = result._initDefault();
872
- convertToCapnpDefault(serializedType.default, defaultValue);
873
- }
874
- const parameterType = result._initType();
875
- parameterType.id = serializedType.type;
876
- if (serializedType.decorators?.length) {
877
- const decorators = result._initDecorators(serializedType.decorators.length);
878
- serializedType.decorators.forEach((d, index) => {
879
- const decorator = decorators.get(index);
880
- decorator.id = d;
881
- });
882
- }
883
- if (serializedType.typeArguments?.length) {
884
- const typeArguments = result._initTypeArguments(serializedType.typeArguments.length);
885
- serializedType.typeArguments.forEach((t, index) => {
886
- const typeArgument = typeArguments.get(index);
887
- typeArgument.id = t;
888
- });
889
- }
890
- if (serializedType.indexAccessOrigin) convertToCapnpIndexAccessOrigin(result._initIndexAccessOrigin(), serializedType.indexAccessOrigin);
891
- if (serializedType.tags) convertToCapnpTagsReflection(result._initTags(), serializedType.tags);
892
- return result;
893
- }
894
- function convertFromCapnpParameter(serializedType) {
895
- return {
896
- kind: __powerlines_deepkit_vendor_type.ReflectionKind.parameter,
897
- typeName: serializedType.typeName || void 0,
898
- name: serializedType.name,
899
- default: convertFromCapnpDefault(serializedType.default),
900
- optional: serializedType.optional ? true : void 0,
901
- readonly: serializedType.readonly ? true : void 0,
902
- visibility: serializedType.visibility === require_reflection.ReflectionVisibility.PUBLIC ? __powerlines_deepkit_vendor_type.ReflectionVisibility.public : serializedType.visibility === require_reflection.ReflectionVisibility.PROTECTED ? __powerlines_deepkit_vendor_type.ReflectionVisibility.protected : __powerlines_deepkit_vendor_type.ReflectionVisibility.private,
903
- type: serializedType.type.id,
904
- decorators: serializedType._hasDecorators() ? serializedType.decorators.map((d) => d.id) : void 0,
905
- typeArguments: serializedType._hasTypeArguments() ? serializedType.typeArguments.map((t) => t.id) : void 0,
906
- indexAccessOrigin: convertFromCapnpIndexAccessOrigin(serializedType),
907
- tags: convertFromCapnpTagsReflection(serializedType)
908
- };
909
- }
910
-
911
- //#endregion
912
- exports.convertFromCapnp = convertFromCapnp;
913
- exports.convertToCapnp = convertToCapnp;