arri 0.0.6 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/codegen.cjs CHANGED
@@ -1,9 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./shared/arri.d77f4d0e.cjs');
4
- const index$1 = require('./shared/arri.38ad6cd0.cjs');
3
+ const index = require('./shared/arri.8e602d87.cjs');
4
+ const dart = require('./shared/arri.835c5c3c.cjs');
5
5
  const fs = require('fs');
6
- const require$$1 = require('child_process');
7
6
  require('module');
8
7
  require('url');
9
8
  require('path');
@@ -14,13 +13,10 @@ require('assert');
14
13
  require('fs/promises');
15
14
  require('v8');
16
15
  require('util');
17
-
18
- function defineClientGeneratorPlugin(plugin) {
19
- return plugin;
20
- }
16
+ require('child_process');
21
17
 
22
18
  let createdModels = [];
23
- const typescriptClientGenerator = defineClientGeneratorPlugin(
19
+ const typescriptClientGenerator = dart.defineClientGeneratorPlugin(
24
20
  (options) => ({
25
21
  generator: async (def) => {
26
22
  if (!options.clientName) {
@@ -42,14 +38,20 @@ async function createTypescriptClient(def, prefix = "Client") {
42
38
  createdModels = [];
43
39
  const services = index.unflattenObject(def.procedures);
44
40
  const serviceParts = [];
41
+ const procedureParts = [];
45
42
  const modelParts = [];
46
43
  Object.keys(services).forEach((key) => {
47
- const serviceName = index.pascalCase(`${prefix}_${key}_service`);
48
- serviceParts.push({
49
- name: serviceName,
50
- key,
51
- content: tsServiceFromServiceDefinition(serviceName, services[key])
52
- });
44
+ const item = services[key];
45
+ if (index.isServiceDefinition(item)) {
46
+ const serviceName = index.pascalCase(`${prefix}_${key}_service`);
47
+ serviceParts.push({
48
+ name: serviceName,
49
+ key,
50
+ content: tsServiceFromServiceDefinition(serviceName, item)
51
+ });
52
+ return;
53
+ }
54
+ procedureParts.push(tsRpcFromProcedureDefinition(key, item));
53
55
  });
54
56
  Object.keys(def.models).forEach((key) => {
55
57
  const modelName = index.pascalCase(`${key}`);
@@ -58,17 +60,23 @@ async function createTypescriptClient(def, prefix = "Client") {
58
60
  createdModels.push(modelName);
59
61
  }
60
62
  });
61
- return index$1.format2(
63
+ return dart.format2(
62
64
  `/* eslint-disable */
63
65
  import { arriRequest, ArriRequestError } from 'arri-client';
64
66
 
65
67
  export class ${prefix} {
68
+ private baseUrl: string;
69
+ private headers: Record<string, string>;
66
70
  ${serviceParts.map((service) => `${service.key}: ${service.name}`).join("\n")}
67
71
  constructor(opts: { baseUrl?: string; headers?: Record<string, string> }) {
72
+ this.baseUrl = opts.baseUrl ?? "";
73
+ this.headers = opts.headers ?? {};
68
74
  ${serviceParts.map(
69
75
  (service) => `this.${service.key} = new ${service.name}(opts);`
70
76
  ).join("\n")}
71
77
  }
78
+
79
+ ${procedureParts.join("\n")}
72
80
  }
73
81
 
74
82
  ${serviceParts.map((service) => service.content).join("\n")}
@@ -227,617 +235,20 @@ function tsInterfaceScalarField(key, prop, isOptional = false) {
227
235
  }
228
236
  }
229
237
 
230
- const dartClientGenerator = defineClientGeneratorPlugin(
231
- (options) => {
232
- return {
233
- generator: async (def) => {
234
- if (!options.clientName) {
235
- throw new Error(
236
- 'Missing "clientName" cannot generate dart client'
237
- );
238
- }
239
- if (!options.outputFile) {
240
- throw new Error(
241
- 'Missing "outputFile" cannot generate dart client'
242
- );
243
- }
244
- const result = createDartClient(def, options.clientName);
245
- fs.writeFileSync(options.outputFile, result);
246
- require$$1.execSync(`dart format ${options.outputFile}`);
247
- },
248
- options
249
- };
250
- }
251
- );
252
- const generatedModels = [];
253
- function createDartClient(appDef, prefix = "Client") {
254
- const { models, procedures } = appDef;
255
- const serviceParts = [];
256
- const services = index.unflattenObject(procedures);
257
- Object.keys(services).forEach((k) => {
258
- const service = services[k];
259
- const serviceName = index.pascalCase(`$_${prefix}_${k}_service`);
260
- serviceParts.push({
261
- name: serviceName,
262
- key: k,
263
- content: dartServiceFromServiceDefinition(
264
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
265
- serviceName,
266
- service,
267
- prefix
268
- )
269
- });
270
- });
271
- const endpoints = {};
272
- Object.keys(procedures).forEach((key) => {
273
- const rpc = procedures[key];
274
- endpoints[rpc.path] = rpc.method;
275
- });
276
- const modelParts = [];
277
- Object.keys(models).forEach((key) => {
278
- const model = models[key];
279
- const typeName = `${prefix}${index.pascalCase(key)}`;
280
- const objModel = model;
281
- if (!generatedModels.includes(typeName)) {
282
- modelParts.push(
283
- dartModelFromJsonSchema(
284
- `${prefix}${index.pascalCase(key)}`,
285
- objModel
286
- )
287
- );
288
- generatedModels.push(typeName);
289
- }
290
- });
291
- return `// This code was autogenerated by arri. Do not modify directly.
292
- import "dart:convert";
293
- import "package:http/http.dart" as http;
294
- import "package:arri_client/arri_client.dart";
295
-
296
- class ${prefix} {
297
- final String _baseUrl;
298
- final Map<String, String> _headers;
299
- const ${prefix}({
300
- String baseUrl = "",
301
- Map<String, String> headers = const {},
302
- }): _headers = headers,
303
- _baseUrl = baseUrl;
304
- ${prefix} withHeaders(Map<String, String> headers) {
305
- return ${prefix}(
306
- baseUrl: _baseUrl,
307
- headers: headers,
308
- );
309
- }
310
- ${serviceParts.map(
311
- (service) => `${service.name} get ${service.key} {
312
- return ${service.name}(
313
- baseUrl: _baseUrl, headers: _headers,
314
- );
315
- }`
316
- ).join("\n ")}
317
- Future<http.Response> rawRequest(
318
- ${prefix}Endpoints endpoint, {
319
- Map<String, String>? query,
320
- dynamic body,
321
- Map<String, String>? headers,
322
- Encoding? encoding,
323
- }) async {
324
- return arriRequest(
325
- "$_baseUrl\${endpoint.path}",
326
- method: endpoint.method,
327
- headers: headers ?? this._headers,
328
- body: body,
329
- query: query,
330
- encoding: encoding,
331
- );
332
- }
333
- }
334
- ${serviceParts.map((item) => item.content).join("\n")}
335
- ${modelParts.join("\n")}
336
-
337
- enum ${prefix}Endpoints implements Comparable<${prefix}Endpoints>, ArriEndpoint {
338
- ${Object.keys(endpoints).map(
339
- (key) => `${index.camelCase(key.split("/").join("_"))}(
340
- path: "${key}",
341
- method: HttpMethod.${endpoints[key]},
342
- )`
343
- ).join(",\n ")};
344
-
345
- const ${prefix}Endpoints({
346
- required this.path, required this.method,
347
- });
348
- @override
349
- final String path;
350
- @override
351
- final HttpMethod method;
352
-
353
- @override
354
- compareTo(${prefix}Endpoints other) => name.compareTo(other.name);
355
- }`;
356
- }
357
- function dartServiceFromServiceDefinition(name, def, prefix = "") {
358
- const rpcParts = [];
359
- const subServiceParts = [];
360
- const serviceName = `${name}`;
361
- Object.keys(def).forEach((key) => {
362
- const item = def[key];
363
- if (index.isProcedureDefinition(item)) {
364
- let returnType = `Future<String>`;
365
- let returnTypeName = "String";
366
- if (item.response) {
367
- returnType = `Future<${prefix}${item.response}>`;
368
- returnTypeName = `${prefix}${item.response}`;
369
- } else {
370
- returnType = "Future<void>";
371
- }
372
- let paramsInput = "";
373
- if (item.params) {
374
- paramsInput = `${prefix}${item.params} params`;
375
- }
376
- let responseParser = "(body) => body;";
377
- switch (returnType) {
378
- case "Future<String>":
379
- break;
380
- case "Future<int>":
381
- responseParser = `(body) => Int.parse(body)`;
382
- break;
383
- case "Future<double>":
384
- responseParser = `(body) => Double.parse(body)`;
385
- break;
386
- case "Future<void>":
387
- responseParser = `(body) {}`;
388
- break;
389
- case "Future<bool>":
390
- responseParser = `(body) {
391
- switch(body) {
392
- case "true":
393
- case "1":
394
- return true;
395
- case "false":
396
- case "0":
397
- default:
398
- return false;
399
- }
400
- }`;
401
- break;
402
- default:
403
- responseParser = `(body) => ${returnTypeName}.fromJson(json.decode(body))`;
404
- break;
405
- }
406
- rpcParts.push(`${returnType} ${key}(${paramsInput}) {
407
- return parsedArriRequest(
408
- "$_baseUrl${item.path}",
409
- method: HttpMethod.${item.method},
410
- headers: _headers,
411
- params: ${paramsInput.length ? `params.toJson()` : "null"},
412
- parser: ${responseParser},
413
- );
414
- }`);
415
- return;
416
- }
417
- const subServiceName = index.pascalCase(`${name}_${key}_Service`);
418
- const subService = dartServiceFromServiceDefinition(
419
- index.pascalCase(`${name}_${key}_Service`),
420
- item,
421
- prefix
422
- );
423
- subServiceParts.push({
424
- name: subServiceName,
425
- key,
426
- content: subService
427
- });
428
- });
429
- return `class ${serviceName} {
430
- final String _baseUrl;
431
- final Map<String, String> _headers;
432
- const ${serviceName}({
433
- String baseUrl = "",
434
- Map<String, String> headers = const {},
435
- }): _baseUrl = baseUrl,
436
- _headers = headers;
437
- ${subServiceParts.map(
438
- (sub) => `${sub.name} get ${sub.key} {
439
- return ${sub.name}(
440
- baseUrl: _baseUrl,
441
- headers: _headers,
442
- );
443
- }`
444
- ).join("\n")}
445
- ${rpcParts.join("\n ")}
446
- }
447
- ${subServiceParts.map((sub) => sub.content).join("\n")}
448
- `;
449
- }
450
- function dartModelFromJsonSchema(name, schema) {
451
- const fields = [];
452
- const subModelParts = [];
453
- Object.entries(schema.properties ?? {}).forEach(([key, val]) => {
454
- if (typeof val !== "object") {
455
- return;
456
- }
457
- const [dartType, subTypes] = dartPropertyTypeFromSchema(
458
- name,
459
- key,
460
- schema
461
- );
462
- if (subTypes?.length) {
463
- for (const sub of subTypes) {
464
- subModelParts.push(sub);
465
- }
466
- }
467
- fields.push({ type: dartType, name: key });
468
- if (!isDartType(dartType) && "type" in val && val.type === "object") {
469
- subModelParts.push(
470
- dartModelFromJsonSchema(dartType.replace("?", ""), val)
471
- );
472
- }
473
- });
474
- return `class ${name} {
475
- ${fields.map((field) => `final ${field.type} ${field.name};`).join("\n ")}
476
- const ${name}({
477
- ${fields.map(
478
- (field) => field.type.includes("?") ? `this.${field.name},` : `required this.${field.name},`
479
- ).join("\n ")}
480
- });
481
- factory ${name}.fromJson(Map<String, dynamic> json) {
482
- return ${name}(
483
- ${fields.map((field) => `${dartParsedJsonField(field.name, field.type)},`).join("\n ")}
484
- );
485
- }
486
- Map<String, dynamic> toJson() {
487
- return {
488
- ${fields.map((field) => {
489
- const isNullable = field.type.endsWith("?");
490
- const typeName = field.type.replace("?", "");
491
- if (isDartTypeWithNullables(field.type)) {
492
- const transformer = transformers[typeName];
493
- return transformer.toJsonBody(field.name, isNullable);
494
- }
495
- if (field.type.includes("List<")) {
496
- return classListTransformer(typeName).toJsonBody(
497
- field.name,
498
- isNullable
499
- );
500
- }
501
- return classTransformer(typeName, isNullable).toJsonBody(
502
- field.name,
503
- isNullable
504
- );
505
- }).join(",\n ")},
506
- };
507
- }
508
- ${name} copyWith({
509
- ${fields.map((field) => `${field.type.replace("?", "")}? ${field.name},`).join("\n ")}
510
- }) {
511
- return ${name}(
512
- ${fields.map((field) => `${field.name}: ${field.name} ?? this.${field.name},`).join("\n ")}
513
- );
514
- }
515
- }
516
-
517
- ${subModelParts.join("\n")}`;
518
- }
519
- function dartPropertyTypeFromSchema(objectName, propertyName, schema) {
520
- const prop = schema.properties?.[propertyName];
521
- const isOptional = !schema.required?.includes(propertyName);
522
- let finalType = "";
523
- const subTypes = [];
524
- if (index.isJsonSchemaEnum(prop)) {
525
- const enumName = index.pascalCase(`${objectName}_${propertyName}`);
526
- finalType = isOptional ? `${enumName}?` : enumName;
527
- const options = [];
528
- for (const opt of prop.anyOf) {
529
- if (opt.type === "string") {
530
- options.push({
531
- name: opt.const.toString(),
532
- type: "String",
533
- value: opt.const
534
- });
535
- }
536
- if (opt.type === "number" || opt.type === "integer") {
537
- options.push({
538
- name: index.camelCase(
539
- `num_${opt.const}`.split(".").join("Point")
540
- ),
541
- type: opt.type === "number" ? "double" : "int",
542
- value: opt.const
543
- });
544
- }
545
- }
546
- subTypes.push(`enum ${enumName} implements Comparable<${enumName}> {
547
- ${options.map(
548
- (opt) => `${opt.name}(${opt.type === "String" ? `"${opt.value}"` : opt.value})`
549
- ).join(",\n ")};
550
- const ${enumName}(this.value);
551
- final dynamic value;
552
-
553
- @override
554
- compareTo(${enumName} other) => name.compareTo(other.name);
555
-
556
- factory ${enumName}.fromJson(dynamic input) {
557
- for(final val in values) {
558
- if(val.value == input) {
559
- return val;
560
- }
561
- }
562
- return ${options[0].name};
563
- }
564
-
565
- dynamic toJson() {
566
- return value;
567
- }
568
- }`);
569
- return [finalType, subTypes];
570
- }
571
- if (index.isJsonSchemaNullType(prop)) {
572
- finalType = "null";
573
- return [finalType, subTypes];
574
- }
575
- if (index.isJsonSchemaScalarType(prop)) {
576
- switch (prop.type) {
577
- case "string":
578
- finalType = isOptional ? "String?" : "String";
579
- break;
580
- case "integer":
581
- finalType = isOptional ? "int?" : "int";
582
- break;
583
- case "number":
584
- finalType = isOptional ? "double?" : "double";
585
- break;
586
- case "Date":
587
- finalType = isOptional ? "DateTime?" : "DateTime";
588
- break;
589
- case "boolean":
590
- finalType = isOptional ? "bool?" : "bool";
591
- break;
592
- }
593
- }
594
- if (index.isJsonSchemaObject(prop)) {
595
- const joinedPropName = index.pascalCase(
596
- `${objectName}_${propertyName}`
597
- );
598
- finalType = isOptional ? `${joinedPropName}?` : joinedPropName;
599
- }
600
- if (index.isJsonSchemaArray(prop)) {
601
- const item = prop.items;
602
- const type = item.type;
603
- if (typeof type !== "string") {
604
- throw new Error(
605
- "Union types are not supported in arrays at this time"
606
- );
607
- }
608
- switch (type) {
609
- case "string":
610
- finalType = isOptional ? "List<String>?" : "List<String>";
611
- break;
612
- case "integer":
613
- finalType = isOptional ? "List<int>?" : "List<int>";
614
- break;
615
- case "number":
616
- finalType = isOptional ? "List<double>?" : "List<double>";
617
- break;
618
- case "null":
619
- finalType = isOptional ? "List<null>?" : "List<null>";
620
- break;
621
- case "boolean":
622
- finalType = isOptional ? "List<bool>?" : "List<bool>";
623
- break;
624
- case "Date":
625
- finalType = isOptional ? "List<DateTime>?" : "List<DateTime>";
626
- break;
627
- case "object": {
628
- const subTypeName = item.$id ?? index.pascalCase(`${objectName}_${propertyName}_item`);
629
- const model = dartModelFromJsonSchema(subTypeName, item);
630
- if (!generatedModels.includes(subTypeName)) {
631
- subTypes.push(model);
632
- generatedModels.push(subTypeName);
633
- }
634
- finalType = isOptional ? `List<${subTypeName}>?` : `List<${subTypeName}>`;
635
- break;
636
- }
637
- }
638
- }
639
- return [finalType, subTypes.length ? subTypes : void 0];
640
- }
641
- function dartParsedJsonField(fieldName, dartType) {
642
- if (isDartTypeWithNullables(dartType)) {
643
- switch (dartType) {
644
- case "String":
645
- return transformers.String.fromJsonBody(fieldName, '""');
646
- case "String?":
647
- return transformers.String.fromJsonBody(fieldName, "null");
648
- case "bool":
649
- return transformers.bool.fromJsonBody(fieldName, "false");
650
- case "double":
651
- return transformers.double.fromJsonBody(fieldName, "0.0");
652
- case "int":
653
- return transformers.int.fromJsonBody(fieldName, "0");
654
- case "null":
655
- return transformers.null.fromJsonBody(fieldName, "");
656
- case "DateTime":
657
- return transformers.DateTime.fromJsonBody(
658
- fieldName,
659
- "DateTime(0)"
660
- );
661
- case "DateTime?":
662
- return transformers.DateTime.fromJsonBody(fieldName, "null");
663
- case "List<String>":
664
- case "List<bool>":
665
- case "List<double>":
666
- case "List<int>":
667
- case "List<null>":
668
- return defaultListFromJsonBody(
669
- fieldName,
670
- dartType.replace("List<", "").replace(">", ""),
671
- "[]"
672
- );
673
- default:
674
- return `${fieldName}: json["${fieldName}"] is ${dartType.replace(
675
- "?",
676
- ""
677
- )} ? json["${fieldName}"] : null`;
678
- }
679
- }
680
- if (dartType.includes("List<")) {
681
- const innerType = dartType.replace("List<", "").replace(">", "").replace("?", "");
682
- return classListTransformer(innerType).fromJsonBody(
683
- fieldName,
684
- dartType.endsWith("?") ? "null" : "[]"
685
- );
686
- }
687
- const classType = dartType.split("?").join("").trim();
688
- return classTransformer(classType, dartType.endsWith("?")).fromJsonBody(
689
- fieldName,
690
- classType
691
- );
692
- }
693
- const dartTypeMap = {
694
- integer: "int",
695
- bigint: "int",
696
- number: "double",
697
- string: "String",
698
- boolean: "bool",
699
- null: "null",
700
- Date: "DateTime",
701
- object: void 0,
702
- list: void 0,
703
- // eslint-disable-next-line object-shorthand
704
- undefined: void 0,
705
- array: void 0,
706
- Uint8Array: "Uint8List"
707
- };
708
- const transformers = {
709
- null: {
710
- fromJsonBody: (_) => `null`,
711
- toJsonBody: defaultToJsonBody
712
- },
713
- int: {
714
- fromJsonBody: (key, fallback) => defaultFromJsonBody(key, "int", fallback),
715
- toJsonBody: defaultToJsonBody
716
- },
717
- double: {
718
- fromJsonBody: (key, fallback) => defaultFromJsonBody(key, "double", fallback),
719
- toJsonBody: defaultToJsonBody
720
- },
721
- String: {
722
- fromJsonBody: (key, fallback) => defaultFromJsonBody(key, "String", fallback),
723
- toJsonBody: defaultToJsonBody
724
- },
725
- bool: {
726
- fromJsonBody: (key, fallback) => defaultFromJsonBody(key, "bool", fallback),
727
- toJsonBody: defaultToJsonBody
728
- },
729
- DateTime: {
730
- fromJsonBody: (key, fallback) => `${key}: json["${key}"] is String ? DateTime.parse(json["${key}"]) : ${fallback}`,
731
- toJsonBody: (key, isNullable) => `"${key}": ${key}${isNullable ? "?" : ""}.toIso8601String()`
732
- },
733
- "List<null>": {
734
- fromJsonBody: (key, fallback) => defaultListFromJsonBody(key, "null", fallback),
735
- toJsonBody: defaultToJsonBody
736
- },
737
- "List<int>": {
738
- fromJsonBody: (key, fallback) => defaultListFromJsonBody(key, "int", fallback),
739
- toJsonBody: defaultToJsonBody
740
- },
741
- "List<double>": {
742
- fromJsonBody: (key, fallback) => defaultListFromJsonBody(key, "double", fallback),
743
- toJsonBody: defaultToJsonBody
744
- },
745
- "List<String>": {
746
- fromJsonBody: (key, fallback) => defaultListFromJsonBody(key, "String", fallback),
747
- toJsonBody: defaultToJsonBody
748
- },
749
- "List<bool>": {
750
- fromJsonBody: (key, fallback) => defaultListFromJsonBody(key, "bool", fallback),
751
- toJsonBody: defaultToJsonBody
752
- },
753
- "List<DateTime>": {
754
- fromJsonBody: (key, fallback) => `${key}: json["${key}"] is List<String> ?
755
- (json["${key}"] as List<String>)
756
- .map((item) => DateTime.parse(item)).toList() : ${fallback}`,
757
- toJsonBody: (key, isNullable) => `"${key}": ${key}${isNullable ? "?" : ""}.map((val) => val.toIso8601String()).toList()`
758
- },
759
- Uint8List: {
760
- fromJsonBody: (key, fallback) => `${key}: json["${key}"] is List ? Uint8List.fromList(json["${key}"]) : ${fallback}`,
761
- toJsonBody: (key, isNullable) => `"${key}": ${key}${isNullable ? "?" : ""}.toList()`
762
- },
763
- "List<Uint8List>": {
764
- fromJsonBody: (key, fallback) => `${key}: json["${key}"] is List && (json["${key}"] as List).isNotEmpty && (json["${key}"] as List).first is List ? json["${key}"] : ${fallback}`,
765
- toJsonBody: (key, isNullable) => `"${key}": ${key}${isNullable ? "?" : ""}.map((val) => val.toList()).toList()`
766
- }
767
- };
768
- function defaultFromJsonBody(key, typename, fallback) {
769
- return `${key}: json["${key}"] is ${typename} ? json["${key}"] : ${fallback}`;
770
- }
771
- function defaultListFromJsonBody(key, typename, fallback) {
772
- return `${key}: json["${key}"] is List<${typename}> ? json["${key}"] : ${fallback}`;
773
- }
774
- function defaultToJsonBody(key) {
775
- return `"${key}": ${key}`;
776
- }
777
- const classTransformer = (typename, nullable) => {
778
- return {
779
- fromJsonBody: (key, fallback) => {
780
- if (nullable) {
781
- return `${key}: json["${key}"] is Map<String, dynamic> ?
782
- ${typename}.fromJson(json["${key}"]) : null`;
783
- }
784
- return `${key}: ${typename}.fromJson(json["${key}"])`;
785
- },
786
- toJsonBody: (key, isNullable) => `"${key}": ${key}${isNullable ? "?" : ""}.toJson()`
787
- };
788
- };
789
- const classListTransformer = (typename) => {
790
- return {
791
- fromJsonBody: (key, fallback) => {
792
- return `${key}: json["${key}"] is List<Map<String, dynamic>> ?
793
- (json["${key}"] as List<Map<String, dynamic>>)
794
- .map((val) => ${typename}.fromJson(val)).toList() : ${fallback}`;
795
- },
796
- toJsonBody: (key, isNullable) => `"${key}": ${key}${isNullable ? "?" : ""}.map((val) => val.toJson()).toList()`
797
- };
798
- };
799
- function isDartType(input) {
800
- if (typeof input !== "string") {
801
- return false;
802
- }
803
- for (const val of Object.values(dartTypeMap)) {
804
- if (input === val) {
805
- return true;
806
- }
807
- if (input.replace("List<", "").replace(">", "") === val) {
808
- return true;
809
- }
810
- }
811
- return false;
812
- }
813
- function isDartTypeWithNullables(input) {
814
- if (typeof input !== "string") {
815
- return false;
816
- }
817
- for (const val of Object.values(dartTypeMap)) {
818
- if (input.replace("?", "") === val) {
819
- return true;
820
- }
821
- if (input.replace("?", "").replace("List<", "").replace(">", "") === val) {
822
- return true;
823
- }
824
- }
825
- return false;
826
- }
827
-
828
- exports.classListTransformer = classListTransformer;
829
- exports.classTransformer = classTransformer;
830
- exports.createDartClient = createDartClient;
238
+ exports.classListTransformer = dart.classListTransformer;
239
+ exports.classTransformer = dart.classTransformer;
240
+ exports.createDartClient = dart.createDartClient;
241
+ exports.dartClientGenerator = dart.dartClientGenerator;
242
+ exports.dartModelFromJsonSchema = dart.dartModelFromJsonSchema;
243
+ exports.dartParsedJsonField = dart.dartParsedJsonField;
244
+ exports.dartProcedureFromServiceDefinition = dart.dartProcedureFromServiceDefinition;
245
+ exports.dartPropertyTypeFromSchema = dart.dartPropertyTypeFromSchema;
246
+ exports.dartServiceFromServiceDefinition = dart.dartServiceFromServiceDefinition;
247
+ exports.defineClientGeneratorPlugin = dart.defineClientGeneratorPlugin;
248
+ exports.isDartType = dart.isDartType;
249
+ exports.isDartTypeWithNullables = dart.isDartTypeWithNullables;
250
+ exports.transformers = dart.transformers;
831
251
  exports.createTypescriptClient = createTypescriptClient;
832
- exports.dartClientGenerator = dartClientGenerator;
833
- exports.dartModelFromJsonSchema = dartModelFromJsonSchema;
834
- exports.dartParsedJsonField = dartParsedJsonField;
835
- exports.dartPropertyTypeFromSchema = dartPropertyTypeFromSchema;
836
- exports.dartServiceFromServiceDefinition = dartServiceFromServiceDefinition;
837
- exports.defineClientGeneratorPlugin = defineClientGeneratorPlugin;
838
- exports.isDartType = isDartType;
839
- exports.isDartTypeWithNullables = isDartTypeWithNullables;
840
- exports.transformers = transformers;
841
252
  exports.tsModelFromDefinition = tsModelFromDefinition;
842
253
  exports.tsRpcFromProcedureDefinition = tsRpcFromProcedureDefinition;
843
254
  exports.tsServiceFromServiceDefinition = tsServiceFromServiceDefinition;