@arrirpc/codegen-dart 0.69.2 → 0.71.0

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.cjs CHANGED
@@ -168,8 +168,7 @@ function getDartClassName(schema, context) {
168
168
  );
169
169
  }
170
170
  function getCodeComments(metadata, leading) {
171
- if (!metadata?.description && !metadata?.isDeprecated)
172
- return "";
171
+ if (!metadata?.description && !metadata?.isDeprecated) return "";
173
172
  if (!metadata.description && metadata.isDeprecated) {
174
173
  return `${leading ?? ""}@deprecated
175
174
  `;
@@ -215,7 +214,8 @@ function dartListFromSchema(schema, context) {
215
214
  modelPrefix: context.modelPrefix,
216
215
  generatedTypes: context.generatedTypes,
217
216
  instancePath: `${context.instancePath}/[Element]`,
218
- schemaPath: `${context.schemaPath}/elements`
217
+ schemaPath: `${context.schemaPath}/elements`,
218
+ clientVersion: context.clientVersion
219
219
  });
220
220
  const typeName = isNullable ? `List<${innerType.typeName}>?` : `List<${innerType.typeName}>`;
221
221
  const defaultValue = isNullable ? "null" : "[]";
@@ -320,7 +320,8 @@ function dartClassFromSchema(schema, context) {
320
320
  modelPrefix: context.modelPrefix,
321
321
  generatedTypes: context.generatedTypes,
322
322
  instancePath: `/${className}/${key}`,
323
- schemaPath: `${context.schemaPath}/properties/${key}`
323
+ schemaPath: `${context.schemaPath}/properties/${key}`,
324
+ clientVersion: context.clientVersion
324
325
  });
325
326
  const propName = validDartIdentifier(key);
326
327
  propNames.push(propName);
@@ -368,7 +369,8 @@ function dartClassFromSchema(schema, context) {
368
369
  generatedTypes: context.generatedTypes,
369
370
  instancePath: `/${className}/${key}`,
370
371
  schemaPath: `${context.schemaPath}/optionalProperties/${key}`,
371
- isOptional: true
372
+ isOptional: true,
373
+ clientVersion: context.clientVersion
372
374
  });
373
375
  const propName = validDartIdentifier(key);
374
376
  propNames.push(propName);
@@ -500,7 +502,8 @@ function dartSealedClassFromSchema(schema, context) {
500
502
  schemaPath: `${context.schemaPath}/mapping/${key}`,
501
503
  discriminatorKey,
502
504
  discriminatorValue,
503
- discriminatorParentId: className
505
+ discriminatorParentId: className,
506
+ clientVersion: context.clientVersion
504
507
  });
505
508
  subTypeParts.push({
506
509
  name: subTypeResult.typeName,
@@ -868,13 +871,13 @@ function dartHttpRpcFromSchema(schema, context) {
868
871
  onClose: onClose,
869
872
  onError: onError != null && _onError != null
870
873
  ? (err, es) {
871
- _onError?.call(onError);
874
+ _onError.call(onError);
872
875
  return onError(err, es);
873
876
  }
874
877
  : onError != null
875
878
  ? onError
876
879
  : _onError != null
877
- ? (err, _) => _onError?.call(err)
880
+ ? (err, _) => _onError.call(err)
878
881
  : null,
879
882
  );
880
883
  }`;
@@ -1013,7 +1016,8 @@ function dartMapFromSchema(schema, context) {
1013
1016
  modelPrefix: context.modelPrefix,
1014
1017
  generatedTypes: context.generatedTypes,
1015
1018
  instancePath: `${context.instancePath}/[entry]`,
1016
- schemaPath: `${context.schemaPath}/values`
1019
+ schemaPath: `${context.schemaPath}/values`,
1020
+ clientVersion: context.clientVersion
1017
1021
  });
1018
1022
  const typeName = isNullable ? `Map<String, ${innerType.typeName}>?` : `Map<String, ${innerType.typeName}>`;
1019
1023
  const defaultValue = isNullable ? "null" : "{}";
package/dist/index.mjs CHANGED
@@ -161,8 +161,7 @@ function getDartClassName(schema, context) {
161
161
  );
162
162
  }
163
163
  function getCodeComments(metadata, leading) {
164
- if (!metadata?.description && !metadata?.isDeprecated)
165
- return "";
164
+ if (!metadata?.description && !metadata?.isDeprecated) return "";
166
165
  if (!metadata.description && metadata.isDeprecated) {
167
166
  return `${leading ?? ""}@deprecated
168
167
  `;
@@ -208,7 +207,8 @@ function dartListFromSchema(schema, context) {
208
207
  modelPrefix: context.modelPrefix,
209
208
  generatedTypes: context.generatedTypes,
210
209
  instancePath: `${context.instancePath}/[Element]`,
211
- schemaPath: `${context.schemaPath}/elements`
210
+ schemaPath: `${context.schemaPath}/elements`,
211
+ clientVersion: context.clientVersion
212
212
  });
213
213
  const typeName = isNullable ? `List<${innerType.typeName}>?` : `List<${innerType.typeName}>`;
214
214
  const defaultValue = isNullable ? "null" : "[]";
@@ -313,7 +313,8 @@ function dartClassFromSchema(schema, context) {
313
313
  modelPrefix: context.modelPrefix,
314
314
  generatedTypes: context.generatedTypes,
315
315
  instancePath: `/${className}/${key}`,
316
- schemaPath: `${context.schemaPath}/properties/${key}`
316
+ schemaPath: `${context.schemaPath}/properties/${key}`,
317
+ clientVersion: context.clientVersion
317
318
  });
318
319
  const propName = validDartIdentifier(key);
319
320
  propNames.push(propName);
@@ -361,7 +362,8 @@ function dartClassFromSchema(schema, context) {
361
362
  generatedTypes: context.generatedTypes,
362
363
  instancePath: `/${className}/${key}`,
363
364
  schemaPath: `${context.schemaPath}/optionalProperties/${key}`,
364
- isOptional: true
365
+ isOptional: true,
366
+ clientVersion: context.clientVersion
365
367
  });
366
368
  const propName = validDartIdentifier(key);
367
369
  propNames.push(propName);
@@ -493,7 +495,8 @@ function dartSealedClassFromSchema(schema, context) {
493
495
  schemaPath: `${context.schemaPath}/mapping/${key}`,
494
496
  discriminatorKey,
495
497
  discriminatorValue,
496
- discriminatorParentId: className
498
+ discriminatorParentId: className,
499
+ clientVersion: context.clientVersion
497
500
  });
498
501
  subTypeParts.push({
499
502
  name: subTypeResult.typeName,
@@ -861,13 +864,13 @@ function dartHttpRpcFromSchema(schema, context) {
861
864
  onClose: onClose,
862
865
  onError: onError != null && _onError != null
863
866
  ? (err, es) {
864
- _onError?.call(onError);
867
+ _onError.call(onError);
865
868
  return onError(err, es);
866
869
  }
867
870
  : onError != null
868
871
  ? onError
869
872
  : _onError != null
870
- ? (err, _) => _onError?.call(err)
873
+ ? (err, _) => _onError.call(err)
871
874
  : null,
872
875
  );
873
876
  }`;
@@ -1006,7 +1009,8 @@ function dartMapFromSchema(schema, context) {
1006
1009
  modelPrefix: context.modelPrefix,
1007
1010
  generatedTypes: context.generatedTypes,
1008
1011
  instancePath: `${context.instancePath}/[entry]`,
1009
- schemaPath: `${context.schemaPath}/values`
1012
+ schemaPath: `${context.schemaPath}/values`,
1013
+ clientVersion: context.clientVersion
1010
1014
  });
1011
1015
  const typeName = isNullable ? `Map<String, ${innerType.typeName}>?` : `Map<String, ${innerType.typeName}>`;
1012
1016
  const defaultValue = isNullable ? "null" : "{}";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/codegen-dart",
3
- "version": "0.69.2",
3
+ "version": "0.71.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -22,7 +22,7 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "pathe": "^1.1.2",
26
- "@arrirpc/codegen-utils": "0.69.2"
25
+ "pathe": "^2.0.1",
26
+ "@arrirpc/codegen-utils": "0.71.0"
27
27
  }
28
28
  }