@arrirpc/codegen-dart 0.47.0 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -123,6 +123,7 @@ ${modelParts.join("\n")}`;
123
123
  }
124
124
  return `// this file was autogenerated by arri
125
125
  // ignore_for_file: type=lint, unused_field
126
+ import "dart:async";
126
127
  import "dart:convert";
127
128
  import "package:arri_client/arri_client.dart";
128
129
  import "package:http/http.dart" as http;
@@ -131,11 +132,11 @@ class ${opts.clientName} {
131
132
  final http.Client? _httpClient;
132
133
  final String _baseUrl;
133
134
  final String _clientVersion = "${def.info?.version ?? ""}";
134
- late final Map<String, String> Function()? _headers;
135
+ late final FutureOr<Map<String, String>> Function()? _headers;
135
136
  ${opts.clientName}({
136
137
  http.Client? httpClient,
137
138
  String baseUrl = "",
138
- Map<String, String> Function()? headers,
139
+ FutureOr<Map<String, String>> Function()? headers,
139
140
  }) : _httpClient = httpClient,
140
141
  _baseUrl = baseUrl,
141
142
  _headers = headers;
@@ -179,11 +180,11 @@ function dartServiceFromDefinition(name, def, opts) {
179
180
  final http.Client? _httpClient;
180
181
  final String _baseUrl;
181
182
  final String _clientVersion = "${opts.versionNumber}";
182
- late final Map<String, String> Function()? _headers;
183
+ late final FutureOr<Map<String, String>> Function()? _headers;
183
184
  ${serviceName}Service({
184
185
  http.Client? httpClient,
185
186
  String baseUrl = "",
186
- Map<String, String> Function()? headers,
187
+ FutureOr<Map<String, String>> Function()? headers,
187
188
  }) : _httpClient = httpClient,
188
189
  _baseUrl = baseUrl,
189
190
  _headers = headers;
@@ -219,7 +220,7 @@ function dartHttpRpcFromSchema(key, def, _opts) {
219
220
  if (def.response) {
220
221
  returnTypeName = codegenUtils.pascalCase(def.response);
221
222
  if (def.isEventStream) {
222
- returnType = `EventSource<${returnTypeName}>`;
223
+ returnType = `Future<EventSource<${returnTypeName}>>`;
223
224
  } else {
224
225
  returnType = `Future<${returnTypeName}>`;
225
226
  }
package/dist/index.mjs CHANGED
@@ -121,6 +121,7 @@ ${modelParts.join("\n")}`;
121
121
  }
122
122
  return `// this file was autogenerated by arri
123
123
  // ignore_for_file: type=lint, unused_field
124
+ import "dart:async";
124
125
  import "dart:convert";
125
126
  import "package:arri_client/arri_client.dart";
126
127
  import "package:http/http.dart" as http;
@@ -129,11 +130,11 @@ class ${opts.clientName} {
129
130
  final http.Client? _httpClient;
130
131
  final String _baseUrl;
131
132
  final String _clientVersion = "${def.info?.version ?? ""}";
132
- late final Map<String, String> Function()? _headers;
133
+ late final FutureOr<Map<String, String>> Function()? _headers;
133
134
  ${opts.clientName}({
134
135
  http.Client? httpClient,
135
136
  String baseUrl = "",
136
- Map<String, String> Function()? headers,
137
+ FutureOr<Map<String, String>> Function()? headers,
137
138
  }) : _httpClient = httpClient,
138
139
  _baseUrl = baseUrl,
139
140
  _headers = headers;
@@ -177,11 +178,11 @@ function dartServiceFromDefinition(name, def, opts) {
177
178
  final http.Client? _httpClient;
178
179
  final String _baseUrl;
179
180
  final String _clientVersion = "${opts.versionNumber}";
180
- late final Map<String, String> Function()? _headers;
181
+ late final FutureOr<Map<String, String>> Function()? _headers;
181
182
  ${serviceName}Service({
182
183
  http.Client? httpClient,
183
184
  String baseUrl = "",
184
- Map<String, String> Function()? headers,
185
+ FutureOr<Map<String, String>> Function()? headers,
185
186
  }) : _httpClient = httpClient,
186
187
  _baseUrl = baseUrl,
187
188
  _headers = headers;
@@ -217,7 +218,7 @@ function dartHttpRpcFromSchema(key, def, _opts) {
217
218
  if (def.response) {
218
219
  returnTypeName = pascalCase(def.response);
219
220
  if (def.isEventStream) {
220
- returnType = `EventSource<${returnTypeName}>`;
221
+ returnType = `Future<EventSource<${returnTypeName}>>`;
221
222
  } else {
222
223
  returnType = `Future<${returnTypeName}>`;
223
224
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/codegen-dart",
3
- "version": "0.47.0",
3
+ "version": "0.48.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
- "@arrirpc/codegen-utils": "0.47.0",
26
- "@arrirpc/schema": "0.47.0"
25
+ "@arrirpc/codegen-utils": "0.48.0",
26
+ "@arrirpc/schema": "0.48.0"
27
27
  }
28
28
  }