arri 0.0.5 → 0.0.7

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.
@@ -1,15 +1,15 @@
1
- import { u as unflattenObject, p as pascalCase, i as isProcedureDefinition, a as isJsonSchemaScalarType, b as isJsonSchemaNullType, c as isJsonSchemaObject, d as isJsonSchemaEnum, e as isJsonSchemaArray, f as camelCase } from '../shared/arri.215ad025.mjs';
2
1
  import { createRequire, builtinModules } from 'module';
3
2
  import { fileURLToPath, pathToFileURL, URL } from 'url';
4
- import path6, { dirname } from 'path';
3
+ import require$$0, { dirname } from 'path';
5
4
  import process4 from 'process';
6
- import os from 'os';
5
+ import require$$0$1 from 'os';
7
6
  import tty from 'tty';
8
7
  import fs$1, { realpathSync, statSync, Stats, writeFileSync } from 'fs';
9
8
  import assert4 from 'assert';
10
9
  import fs from 'fs/promises';
11
10
  import v8 from 'v8';
12
11
  import { format, inspect } from 'util';
12
+ import { g as unflattenProcedures, i as isServiceDefinition, p as pascalCase, h as camelCase, a as isProcedureDefinition, e as isJsonSchemaEnum, c as isJsonSchemaNullType, b as isJsonSchemaScalarType, d as isJsonSchemaObject, f as isJsonSchemaArray } from './arri.1f1b9dfc.mjs';
13
13
  import { execSync } from 'child_process';
14
14
 
15
15
  const require$1 = createRequire(import.meta.url);
@@ -21403,7 +21403,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
21403
21403
  return min;
21404
21404
  }
21405
21405
  if (process4.platform === "win32") {
21406
- const osRelease = os.release().split(".");
21406
+ const osRelease = require$$0$1.release().split(".");
21407
21407
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
21408
21408
  return Number(osRelease[2]) >= 14931 ? 3 : 2;
21409
21409
  }
@@ -25999,10 +25999,10 @@ var partition_default = partition2;
25999
25999
  var import_editorconfig = __toESM(require_src(), 1);
26000
26000
  var import_editorconfig_to_prettier = __toESM(require_editorconfig_to_prettier(), 1);
26001
26001
  var MARKERS = [".git", ".hg"];
26002
- var markerExists = (directory) => MARKERS.some((mark) => fs$1.existsSync(path6.join(directory, mark)));
26002
+ var markerExists = (directory) => MARKERS.some((mark) => fs$1.existsSync(require$$0.join(directory, mark)));
26003
26003
  function findProjectRoot(directory) {
26004
26004
  while (!markerExists(directory)) {
26005
- const parentDirectory = path6.resolve(directory, "..");
26005
+ const parentDirectory = require$$0.resolve(directory, "..");
26006
26006
  if (parentDirectory === directory) {
26007
26007
  break;
26008
26008
  }
@@ -26015,7 +26015,7 @@ var find_project_root_default = findProjectRoot;
26015
26015
  // src/config/resolve-editorconfig.js
26016
26016
  async function loadEditorConfig(filePath) {
26017
26017
  const editorConfig = await import_editorconfig.default.parse(filePath, {
26018
- root: find_project_root_default(path6.dirname(path6.resolve(filePath)))
26018
+ root: find_project_root_default(require$$0.dirname(require$$0.resolve(filePath)))
26019
26019
  });
26020
26020
  const config = (0, import_editorconfig_to_prettier.default)(editorConfig);
26021
26021
  if (config) {
@@ -26392,7 +26392,7 @@ var package_json_reader_default = reader;
26392
26392
  function read(jsonPath) {
26393
26393
  try {
26394
26394
  const string = fs$1.readFileSync(
26395
- path6.toNamespacedPath(path6.join(path6.dirname(jsonPath), "package.json")),
26395
+ require$$0.toNamespacedPath(require$$0.join(require$$0.dirname(jsonPath), "package.json")),
26396
26396
  "utf8"
26397
26397
  );
26398
26398
  return { string };
@@ -26735,7 +26735,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
26735
26735
  if (!preserveSymlinks) {
26736
26736
  const real = realpathSync(filePath);
26737
26737
  const { search, hash } = resolved;
26738
- resolved = pathToFileURL(real + (filePath.endsWith(path6.sep) ? "/" : ""));
26738
+ resolved = pathToFileURL(real + (filePath.endsWith(require$$0.sep) ? "/" : ""));
26739
26739
  resolved.search = search;
26740
26740
  resolved.hash = hash;
26741
26741
  }
@@ -27534,7 +27534,7 @@ async function resolveConfig(filePath, options8) {
27534
27534
  };
27535
27535
  if (Array.isArray(merged.plugins)) {
27536
27536
  merged.plugins = merged.plugins.map(
27537
- (value) => typeof value === "string" && value.startsWith(".") ? path6.resolve(path6.dirname(result.filepath), value) : value
27537
+ (value) => typeof value === "string" && value.startsWith(".") ? require$$0.resolve(require$$0.dirname(result.filepath), value) : value
27538
27538
  );
27539
27539
  }
27540
27540
  return merged;
@@ -27548,7 +27548,7 @@ function mergeOverrides(configResult, filePath) {
27548
27548
  const { config, filepath: configPath } = configResult || {};
27549
27549
  const { overrides, ...options8 } = config || {};
27550
27550
  if (filePath && overrides) {
27551
- const relativeFilePath = path6.relative(path6.dirname(configPath), filePath);
27551
+ const relativeFilePath = require$$0.relative(require$$0.dirname(configPath), filePath);
27552
27552
  for (const override of overrides) {
27553
27553
  if (pathMatchesGlobs(
27554
27554
  relativeFilePath,
@@ -27594,7 +27594,7 @@ var read_file_default = readFile;
27594
27594
 
27595
27595
  // src/utils/ignore.js
27596
27596
  var createIgnore = import_ignore.default.default;
27597
- var slash = path6.sep === "\\" ? (filepath) => string_replace_all_default(
27597
+ var slash = require$$0.sep === "\\" ? (filepath) => string_replace_all_default(
27598
27598
  /* isOptionalObject*/
27599
27599
  false,
27600
27600
  filepath,
@@ -27616,8 +27616,8 @@ async function createSingleIsIgnoredFunction(ignoreFilePath, withNodeModules) {
27616
27616
  allowRelativePaths: true
27617
27617
  }).add(content);
27618
27618
  return (filepath) => {
27619
- filepath = path6.resolve(filepath);
27620
- const relativePath = ignoreFilePath ? path6.relative(path6.dirname(ignoreFilePath), filepath) : path6.relative(process.cwd(), filepath);
27619
+ filepath = require$$0.resolve(filepath);
27620
+ const relativePath = ignoreFilePath ? require$$0.relative(require$$0.dirname(ignoreFilePath), filepath) : require$$0.relative(process.cwd(), filepath);
27621
27621
  return ignore.ignores(slash(relativePath));
27622
27622
  };
27623
27623
  }
@@ -27667,7 +27667,7 @@ async function getParser(filePath, options8) {
27667
27667
  }
27668
27668
  var get_file_info_default = getFileInfo;
27669
27669
  function importFromDirectory(specifier, directory) {
27670
- return import_from_file_default(specifier, path6.join(directory, "noop.js"));
27670
+ return import_from_file_default(specifier, require$$0.join(directory, "noop.js"));
27671
27671
  }
27672
27672
  var import_from_directory_default = importFromDirectory;
27673
27673
 
@@ -27682,7 +27682,7 @@ var loadPluginFromDirectory = mem(
27682
27682
  );
27683
27683
  var importPlugin = mem(async (name) => {
27684
27684
  try {
27685
- return await import(pathToFileURL(path6.resolve(name)).href);
27685
+ return await import(pathToFileURL(require$$0.resolve(name)).href);
27686
27686
  } catch {
27687
27687
  return import_from_directory_default(name, process.cwd());
27688
27688
  }
@@ -29033,211 +29033,6 @@ function defineClientGeneratorPlugin(plugin) {
29033
29033
  return plugin;
29034
29034
  }
29035
29035
 
29036
- let createdModels = [];
29037
- const typescriptClientGenerator = defineClientGeneratorPlugin(
29038
- (options) => ({
29039
- generator: async (def) => {
29040
- if (!options.name) {
29041
- throw new Error("Name is requires");
29042
- }
29043
- if (!options.outputFile) {
29044
- throw new Error("No output file specified");
29045
- }
29046
- const result = await createTypescriptClient(def, options.name);
29047
- writeFileSync(options.outputFile, result);
29048
- },
29049
- options
29050
- })
29051
- );
29052
- async function createTypescriptClient(def, prefix = "Client") {
29053
- createdModels = [];
29054
- const services = unflattenObject(def.procedures);
29055
- const serviceParts = [];
29056
- const modelParts = [];
29057
- Object.keys(services).forEach((key) => {
29058
- const serviceName = pascalCase(`${prefix}_${key}_service`);
29059
- serviceParts.push({
29060
- name: serviceName,
29061
- key,
29062
- content: tsServiceFromServiceDefinition(serviceName, services[key])
29063
- });
29064
- });
29065
- Object.keys(def.models).forEach((key) => {
29066
- const modelName = pascalCase(`${key}`);
29067
- if (!createdModels.includes(modelName)) {
29068
- modelParts.push(tsModelFromDefinition(modelName, def.models[key]));
29069
- createdModels.push(modelName);
29070
- }
29071
- });
29072
- return format2(
29073
- `/* eslint-disable */
29074
- import { arriRequest, ArriRequestError } from 'arri-client';
29075
-
29076
- export class ${prefix} {
29077
- ${serviceParts.map((service) => `${service.key}: ${service.name}`).join("\n")}
29078
- constructor(opts: { baseUrl?: string; headers?: Record<string, string> }) {
29079
- ${serviceParts.map(
29080
- (service) => `this.${service.key} = new ${service.name}(opts);`
29081
- ).join("\n")}
29082
- }
29083
- }
29084
-
29085
- ${serviceParts.map((service) => service.content).join("\n")}
29086
- ${modelParts.join("\n")}`,
29087
- {
29088
- parser: "typescript"
29089
- }
29090
- );
29091
- }
29092
- function tsServiceFromServiceDefinition(name, def) {
29093
- const rpcParts = [];
29094
- const subServiceParts = [];
29095
- Object.keys(def).forEach((key) => {
29096
- const val = def[key];
29097
- if (isProcedureDefinition(val)) {
29098
- rpcParts.push(tsRpcFromProcedureDefinition(key, val));
29099
- return;
29100
- }
29101
- const subServiceName = pascalCase(
29102
- `${name.split("Service").join("")}_${key}_service`
29103
- );
29104
- subServiceParts.push({
29105
- name: subServiceName,
29106
- key,
29107
- content: tsServiceFromServiceDefinition(subServiceName, val)
29108
- });
29109
- });
29110
- return `export class ${name} {
29111
- baseUrl: string;
29112
- headers: Record<string, string>;
29113
- ${subServiceParts.map((service) => `${service.key}: ${service.name};`).join("\n")}
29114
- constructor(opts: { baseUrl?: string; headers?: Record<string, string> }) {
29115
- this.baseUrl = opts.baseUrl ?? "";
29116
- this.headers = opts.headers ?? {};
29117
- ${subServiceParts.map(
29118
- (service) => `this.${service.key} = new ${service.name}(opts);`
29119
- ).join("\n")}
29120
- }
29121
- ${rpcParts.join("\n")}
29122
- }
29123
- ${subServiceParts.map((service) => service.content).join("\n")}`;
29124
- }
29125
- function tsRpcFromProcedureDefinition(name, def) {
29126
- let paramStr = "";
29127
- let responseName = "";
29128
- if (def.params) {
29129
- paramStr = `params: ${def.params}`;
29130
- }
29131
- if (def.response) {
29132
- responseName = def.response;
29133
- }
29134
- return `async ${name}(${paramStr}) {
29135
- return arriRequest<${responseName || "undefined"}>({
29136
- url: \`\${this.baseUrl}${def.path}\`,
29137
- method: '${def.method}',
29138
- ${paramStr.length ? `params,` : ""}
29139
- headers: this.headers,
29140
- });
29141
- }`;
29142
- }
29143
- function tsModelFromDefinition(name, def) {
29144
- const fieldParts = [];
29145
- const subModelParts = [];
29146
- Object.keys(def.properties ?? {}).forEach((key) => {
29147
- const isOptional = !def.required?.includes(key);
29148
- const prop = def.properties?.[key];
29149
- const keyPart = isOptional ? `${key}?` : key;
29150
- if (isJsonSchemaScalarType(prop)) {
29151
- fieldParts.push(
29152
- tsInterfaceScalarField(key, prop, isOptional) ?? ""
29153
- );
29154
- return;
29155
- }
29156
- if (isJsonSchemaNullType(prop)) {
29157
- switch (prop.type) {
29158
- case "null":
29159
- fieldParts.push(`${keyPart}: null;`);
29160
- break;
29161
- case "undefined":
29162
- fieldParts.push(`${keyPart}: undefined`);
29163
- break;
29164
- }
29165
- return;
29166
- }
29167
- if (isJsonSchemaObject(prop)) {
29168
- const subModelName = prop.$id ?? pascalCase(`${name}_${key}`);
29169
- if (!createdModels.includes(subModelName)) {
29170
- const content = tsModelFromDefinition(
29171
- subModelName,
29172
- prop
29173
- );
29174
- subModelParts.push(content);
29175
- }
29176
- fieldParts.push(`${keyPart}: ${subModelName};`);
29177
- return;
29178
- }
29179
- if (isJsonSchemaEnum(prop)) {
29180
- const vals = prop.anyOf.map(
29181
- (opt) => opt.type === "string" ? `'${opt.const}'` : `${opt.const}`
29182
- );
29183
- fieldParts.push(`${keyPart}: ${vals.join(" | ")};`);
29184
- return;
29185
- }
29186
- if (isJsonSchemaArray(prop)) {
29187
- if (isJsonSchemaScalarType(prop.items)) {
29188
- const part = tsInterfaceScalarField(
29189
- key,
29190
- prop.items,
29191
- isOptional
29192
- ).replace(";", "[];");
29193
- fieldParts.push(part);
29194
- return;
29195
- }
29196
- if (isJsonSchemaNullType(prop.items)) {
29197
- if (prop.items.type === "null") {
29198
- fieldParts.push(`${keyPart}: null[]`);
29199
- return;
29200
- }
29201
- fieldParts.push(`${keyPart}: undefined[]`);
29202
- return;
29203
- }
29204
- if (isJsonSchemaObject(prop.items)) {
29205
- const subModelName = prop.items.$id ?? pascalCase(`${name}_${key}_item`);
29206
- if (!createdModels.includes(subModelName)) {
29207
- subModelParts.push(
29208
- tsModelFromDefinition(subModelName, prop.items)
29209
- );
29210
- }
29211
- fieldParts.push(`${keyPart}: ${subModelName}[];`);
29212
- }
29213
- }
29214
- });
29215
- return `export interface ${name} {
29216
- ${fieldParts.join("\n")}
29217
- }
29218
- ${subModelParts.join("\n")}`;
29219
- }
29220
- function tsInterfaceScalarField(key, prop, isOptional = false) {
29221
- const keyPart = isOptional ? `${key}?` : key;
29222
- switch (prop.type) {
29223
- case "string":
29224
- return `${keyPart}: string;`;
29225
- case "bigint":
29226
- return `${keyPart}: bigint;`;
29227
- case "Date":
29228
- return `${keyPart}: Date;`;
29229
- case "boolean":
29230
- return `${keyPart}: boolean;`;
29231
- case "integer":
29232
- return `/**
29233
- * must be an integer
29234
- */
29235
- ${keyPart}: number;`;
29236
- case "number":
29237
- return `${keyPart}: number;`;
29238
- }
29239
- }
29240
-
29241
29036
  const dartClientGenerator = defineClientGeneratorPlugin(
29242
29037
  (options) => {
29243
29038
  return {
@@ -29264,20 +29059,27 @@ const generatedModels = [];
29264
29059
  function createDartClient(appDef, prefix = "Client") {
29265
29060
  const { models, procedures } = appDef;
29266
29061
  const serviceParts = [];
29267
- const services = unflattenObject(procedures);
29062
+ const procedureParts = [];
29063
+ const services = unflattenProcedures(procedures);
29268
29064
  Object.keys(services).forEach((k) => {
29269
- const service = services[k];
29270
- const serviceName = pascalCase(`$_${prefix}_${k}_service`);
29271
- serviceParts.push({
29272
- name: serviceName,
29273
- key: k,
29274
- content: dartServiceFromServiceDefinition(
29275
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
29276
- serviceName,
29277
- service,
29278
- prefix
29279
- )
29280
- });
29065
+ const item = services[k];
29066
+ if (isServiceDefinition(item)) {
29067
+ const serviceName = pascalCase(`${prefix}_${k}_service`);
29068
+ serviceParts.push({
29069
+ name: serviceName,
29070
+ key: k,
29071
+ content: dartServiceFromServiceDefinition(
29072
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
29073
+ serviceName,
29074
+ item,
29075
+ prefix
29076
+ )
29077
+ });
29078
+ return;
29079
+ }
29080
+ procedureParts.push(
29081
+ dartProcedureFromServiceDefinition(prefix, k, item)
29082
+ );
29281
29083
  });
29282
29084
  const endpoints = {};
29283
29085
  Object.keys(procedures).forEach((key) => {
@@ -29305,22 +29107,18 @@ import "package:http/http.dart" as http;
29305
29107
  import "package:arri_client/arri_client.dart";
29306
29108
 
29307
29109
  class ${prefix} {
29308
- final String baseUrl;
29309
- final Map<String, String> headers;
29110
+ final String _baseUrl;
29111
+ final Map<String, String> _headers;
29310
29112
  const ${prefix}({
29311
- this.baseUrl = "",
29312
- this.headers = const {},
29313
- });
29314
- ${prefix} withHeaders(Map<String, String> headers) {
29315
- return ${prefix}(
29316
- baseUrl: baseUrl,
29317
- headers: headers,
29318
- );
29319
- }
29113
+ String baseUrl = "",
29114
+ Map<String, String> headers = const {},
29115
+ }): _headers = headers,
29116
+ _baseUrl = baseUrl;
29117
+ ${procedureParts.join("\n")}
29320
29118
  ${serviceParts.map(
29321
29119
  (service) => `${service.name} get ${service.key} {
29322
29120
  return ${service.name}(
29323
- baseUrl: baseUrl, headers: headers,
29121
+ baseUrl: _baseUrl, headers: _headers,
29324
29122
  );
29325
29123
  }`
29326
29124
  ).join("\n ")}
@@ -29332,9 +29130,9 @@ class ${prefix} {
29332
29130
  Encoding? encoding,
29333
29131
  }) async {
29334
29132
  return arriRequest(
29335
- "$baseUrl\${endpoint.path}",
29133
+ "$_baseUrl\${endpoint.path}",
29336
29134
  method: endpoint.method,
29337
- headers: headers ?? this.headers,
29135
+ headers: headers ?? this._headers,
29338
29136
  body: body,
29339
29137
  query: query,
29340
29138
  encoding: encoding,
@@ -29361,7 +29159,7 @@ enum ${prefix}Endpoints implements Comparable<${prefix}Endpoints>, ArriEndpoint
29361
29159
  final HttpMethod method;
29362
29160
 
29363
29161
  @override
29364
- compareTo(BackendEndpoints other) => name.compareTo(other.name);
29162
+ compareTo(${prefix}Endpoints other) => name.compareTo(other.name);
29365
29163
  }`;
29366
29164
  }
29367
29165
  function dartServiceFromServiceDefinition(name, def, prefix = "") {
@@ -29371,62 +29169,18 @@ function dartServiceFromServiceDefinition(name, def, prefix = "") {
29371
29169
  Object.keys(def).forEach((key) => {
29372
29170
  const item = def[key];
29373
29171
  if (isProcedureDefinition(item)) {
29374
- let returnType = `Future<String>`;
29375
- let returnTypeName = "String";
29376
- if (item.response) {
29377
- returnType = `Future<${prefix}${item.response}>`;
29378
- returnTypeName = `${prefix}${item.response}`;
29379
- } else {
29380
- returnType = "Future<void>";
29381
- }
29382
- let paramsInput = "";
29383
- if (item.params) {
29384
- paramsInput = `${prefix}${item.params} params`;
29385
- }
29386
- let responseParser = "(body) => body;";
29387
- switch (returnType) {
29388
- case "Future<String>":
29389
- break;
29390
- case "Future<int>":
29391
- responseParser = `(body) => Int.parse(body)`;
29392
- break;
29393
- case "Future<double>":
29394
- responseParser = `(body) => Double.parse(body)`;
29395
- break;
29396
- case "Future<void>":
29397
- responseParser = `(body) {}`;
29398
- break;
29399
- case "Future<bool>":
29400
- responseParser = `(body) {
29401
- switch(body) {
29402
- case "true":
29403
- case "1":
29404
- return true;
29405
- case "false":
29406
- case "0":
29407
- default:
29408
- return false;
29409
- }
29410
- }`;
29411
- break;
29412
- default:
29413
- responseParser = `(body) => ${returnTypeName}.fromJson(json.decode(body))`;
29414
- break;
29415
- }
29416
- rpcParts.push(`${returnType} ${key}(${paramsInput}) {
29417
- return parsedArriRequest(
29418
- "$baseUrl${item.path}",
29419
- method: HttpMethod.${item.method},
29420
- headers: headers,
29421
- params: ${paramsInput.length ? `params.toJson()` : "null"},
29422
- parser: ${responseParser},
29423
- );
29424
- }`);
29172
+ rpcParts.push(
29173
+ dartProcedureFromServiceDefinition(prefix, key, item)
29174
+ );
29425
29175
  return;
29426
29176
  }
29427
- const subServiceName = pascalCase(`${name}_${key}_Service`);
29177
+ const nameParts = name.split("Service");
29178
+ nameParts.pop();
29179
+ const subServiceName = pascalCase(
29180
+ `${nameParts.join("")}_${key}_Service`
29181
+ );
29428
29182
  const subService = dartServiceFromServiceDefinition(
29429
- pascalCase(`${name}_${key}_Service`),
29183
+ subServiceName,
29430
29184
  item,
29431
29185
  prefix
29432
29186
  );
@@ -29437,17 +29191,18 @@ function dartServiceFromServiceDefinition(name, def, prefix = "") {
29437
29191
  });
29438
29192
  });
29439
29193
  return `class ${serviceName} {
29440
- final String baseUrl;
29441
- final Map<String, String> headers;
29194
+ final String _baseUrl;
29195
+ final Map<String, String> _headers;
29442
29196
  const ${serviceName}({
29443
- this.baseUrl = "",
29444
- this.headers = const {},
29445
- });
29197
+ String baseUrl = "",
29198
+ Map<String, String> headers = const {},
29199
+ }): _baseUrl = baseUrl,
29200
+ _headers = headers;
29446
29201
  ${subServiceParts.map(
29447
29202
  (sub) => `${sub.name} get ${sub.key} {
29448
29203
  return ${sub.name}(
29449
- baseUrl: baseUrl,
29450
- headers: headers,
29204
+ baseUrl: _baseUrl,
29205
+ headers: _headers,
29451
29206
  );
29452
29207
  }`
29453
29208
  ).join("\n")}
@@ -29456,6 +29211,59 @@ function dartServiceFromServiceDefinition(name, def, prefix = "") {
29456
29211
  ${subServiceParts.map((sub) => sub.content).join("\n")}
29457
29212
  `;
29458
29213
  }
29214
+ function dartProcedureFromServiceDefinition(clientName, key, def) {
29215
+ let returnType = `Future<String>`;
29216
+ let returnTypeName = "String";
29217
+ if (def.response) {
29218
+ returnType = `Future<${clientName}${def.response}>`;
29219
+ returnTypeName = `${clientName}${def.response}`;
29220
+ } else {
29221
+ returnType = "Future<void>";
29222
+ }
29223
+ let paramsInput = "";
29224
+ if (def.params) {
29225
+ paramsInput = `${clientName}${def.params} params`;
29226
+ }
29227
+ let responseParser = "(body) => body;";
29228
+ switch (returnType) {
29229
+ case "Future<String>":
29230
+ break;
29231
+ case "Future<int>":
29232
+ responseParser = `(body) => Int.parse(body)`;
29233
+ break;
29234
+ case "Future<double>":
29235
+ responseParser = `(body) => Double.parse(body)`;
29236
+ break;
29237
+ case "Future<void>":
29238
+ responseParser = `(body) {}`;
29239
+ break;
29240
+ case "Future<bool>":
29241
+ responseParser = `(body) {
29242
+ switch(body) {
29243
+ case "true":
29244
+ case "1":
29245
+ return true;
29246
+ case "false":
29247
+ case "0":
29248
+ default:
29249
+ return false;
29250
+ }
29251
+ }`;
29252
+ break;
29253
+ default:
29254
+ responseParser = `(body) => ${returnTypeName}.fromJson(json.decode(body))`;
29255
+ break;
29256
+ }
29257
+ return `${returnType} ${key}(${paramsInput}) {
29258
+ return parsedArriRequest(
29259
+ "$_baseUrl${def.path}",
29260
+ method: HttpMethod.${def.method},
29261
+ headers: _headers,
29262
+ params: ${paramsInput.length ? `params.toJson()` : "null"},
29263
+ parser: ${responseParser},
29264
+ );
29265
+ }`;
29266
+ }
29459
29267
  function dartModelFromJsonSchema(name, schema) {
29460
29268
  const fields = [];
29461
29269
  const subModelParts = [];
@@ -29537,7 +29345,7 @@ function dartPropertyTypeFromSchema(objectName, propertyName, schema) {
29537
29345
  for (const opt of prop.anyOf) {
29538
29346
  if (opt.type === "string") {
29539
29347
  options.push({
29540
- name: opt.const.toString(),
29348
+ name: camelCase(opt.const.toString()),
29541
29349
  type: "String",
29542
29350
  value: opt.const
29543
29351
  });
@@ -29834,4 +29642,4 @@ function isDartTypeWithNullables(input) {
29834
29642
  return false;
29835
29643
  }
29836
29644
 
29837
- export { classListTransformer, classTransformer, createDartClient, createTypescriptClient, dartClientGenerator, dartModelFromJsonSchema, dartParsedJsonField, dartPropertyTypeFromSchema, dartServiceFromServiceDefinition, defineClientGeneratorPlugin, isDartType, isDartTypeWithNullables, transformers, tsModelFromDefinition, tsRpcFromProcedureDefinition, tsServiceFromServiceDefinition, typescriptClientGenerator };
29645
+ export { dartClientGenerator as a, dartServiceFromServiceDefinition as b, createDartClient as c, defineClientGeneratorPlugin as d, dartProcedureFromServiceDefinition as e, format2 as f, dartModelFromJsonSchema as g, dartPropertyTypeFromSchema as h, dartParsedJsonField as i, classTransformer as j, classListTransformer as k, isDartType as l, isDartTypeWithNullables as m, transformers as t };