arri 0.0.42 → 0.0.44
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/chunks/index.cjs +1 -1
- package/dist/chunks/index.mjs +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/codegen.cjs +1 -1
- package/dist/codegen.mjs +2 -2
- package/dist/shared/{arri.33c6d46f.cjs → arri.bda2f011.cjs} +10 -6
- package/dist/shared/{arri.b38c19c1.mjs → arri.dfab1c78.mjs} +10 -6
- package/package.json +1 -1
package/dist/chunks/index.cjs
CHANGED
package/dist/chunks/index.mjs
CHANGED
package/dist/cli.cjs
CHANGED
|
@@ -29,7 +29,7 @@ const utils$l = require('./shared/arri.0752aa2b.cjs');
|
|
|
29
29
|
const index = require('./index.cjs');
|
|
30
30
|
require('node:stream');
|
|
31
31
|
const ofetch = require('ofetch');
|
|
32
|
-
const dart = require('./shared/arri.
|
|
32
|
+
const dart = require('./shared/arri.bda2f011.cjs');
|
|
33
33
|
const listhen = require('listhen');
|
|
34
34
|
require('@sinclair/typebox');
|
|
35
35
|
require('h3');
|
package/dist/cli.mjs
CHANGED
|
@@ -27,7 +27,7 @@ import { c as camelCase, r as removeDisallowedChars, k as kebabCase, d as isAppl
|
|
|
27
27
|
import { defaultConfig, DEV_DEFINITION_ENDPOINT } from './index.mjs';
|
|
28
28
|
import 'node:stream';
|
|
29
29
|
import { ofetch } from 'ofetch';
|
|
30
|
-
import { g as dartClientGenerator } from './shared/arri.
|
|
30
|
+
import { g as dartClientGenerator } from './shared/arri.dfab1c78.mjs';
|
|
31
31
|
import { listenAndWatch } from 'listhen';
|
|
32
32
|
import '@sinclair/typebox';
|
|
33
33
|
import 'h3';
|
package/dist/codegen.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const require$$0 = require('fs');
|
|
4
4
|
const prettier = require('prettier');
|
|
5
5
|
const utils = require('./shared/arri.0752aa2b.cjs');
|
|
6
|
-
const dart = require('./shared/arri.
|
|
6
|
+
const dart = require('./shared/arri.bda2f011.cjs');
|
|
7
7
|
require('child_process');
|
|
8
8
|
|
|
9
9
|
let generatedModels = [];
|
package/dist/codegen.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { writeFileSync } from 'fs';
|
|
|
2
2
|
import { format } from 'prettier';
|
|
3
3
|
import { u as unflattenObject, i as isServiceDef, p as pascalCase, a as isProcedureDef, b as unflattenProcedures, c as camelCase } from './shared/arri.ebf86912.mjs';
|
|
4
4
|
export { d as isApplicationDef, n as normalizeWhitespace, r as removeDisallowedChars, s as setNestedObjectProperty } from './shared/arri.ebf86912.mjs';
|
|
5
|
-
import { d as defineClientGeneratorPlugin, i as isJsonSchemaScalarType, a as isJsonSchemaNullType, b as isJsonSchemaObject, c as isJsonSchemaRecord, e as isJsonSchemaEnum, f as isJsonSchemaArray } from './shared/arri.
|
|
6
|
-
export { p as classListTransformer, o as classTransformer, h as createDartClient, g as dartClientGenerator, l as dartModelFromJsonSchema, n as dartParsedJsonField, k as dartProcedureFromServiceDefinition, m as dartPropertyTypeFromSchema, j as dartServiceFromServiceDefinition, q as isDartType, r as isDartTypeWithNullables, t as transformers } from './shared/arri.
|
|
5
|
+
import { d as defineClientGeneratorPlugin, i as isJsonSchemaScalarType, a as isJsonSchemaNullType, b as isJsonSchemaObject, c as isJsonSchemaRecord, e as isJsonSchemaEnum, f as isJsonSchemaArray } from './shared/arri.dfab1c78.mjs';
|
|
6
|
+
export { p as classListTransformer, o as classTransformer, h as createDartClient, g as dartClientGenerator, l as dartModelFromJsonSchema, n as dartParsedJsonField, k as dartProcedureFromServiceDefinition, m as dartPropertyTypeFromSchema, j as dartServiceFromServiceDefinition, q as isDartType, r as isDartTypeWithNullables, t as transformers } from './shared/arri.dfab1c78.mjs';
|
|
7
7
|
import 'child_process';
|
|
8
8
|
|
|
9
9
|
let generatedModels = [];
|
|
@@ -353,6 +353,9 @@ function dartModelFromJsonSchema(modelName, schema, opts) {
|
|
|
353
353
|
if (typeName === "dynamic") {
|
|
354
354
|
return `"${field.jsonKey}": ${field.name}`;
|
|
355
355
|
}
|
|
356
|
+
if (typeName === "List<dynamic>" || typeName === "List<dynamic>?") {
|
|
357
|
+
return `"${field.jsonKey}": ${field.name}`;
|
|
358
|
+
}
|
|
356
359
|
if (isDartTypeWithNullables(field.type)) {
|
|
357
360
|
const transformer = transformers[typeName];
|
|
358
361
|
return transformer.toJsonBody(
|
|
@@ -477,11 +480,6 @@ function dartPropertyTypeFromSchema(objectName, propertyName, schema, opts) {
|
|
|
477
480
|
if (isJsonSchemaArray(prop)) {
|
|
478
481
|
const item = prop.items;
|
|
479
482
|
const type = item.type;
|
|
480
|
-
if (typeof type !== "string") {
|
|
481
|
-
throw new Error(
|
|
482
|
-
"Union types are not supported in arrays at this time"
|
|
483
|
-
);
|
|
484
|
-
}
|
|
485
483
|
switch (type) {
|
|
486
484
|
case "string":
|
|
487
485
|
finalType = isOptional ? "List<String>?" : "List<String>";
|
|
@@ -517,6 +515,9 @@ function dartPropertyTypeFromSchema(objectName, propertyName, schema, opts) {
|
|
|
517
515
|
}
|
|
518
516
|
break;
|
|
519
517
|
}
|
|
518
|
+
default:
|
|
519
|
+
finalType = isOptional ? "List<dynamic>?" : "List<dynamic>";
|
|
520
|
+
break;
|
|
520
521
|
}
|
|
521
522
|
}
|
|
522
523
|
return [finalType, subTypes.length ? subTypes : void 0];
|
|
@@ -525,6 +526,9 @@ function dartParsedJsonField(fieldName, jsonKey, dartType) {
|
|
|
525
526
|
if (dartType === "dynamic") {
|
|
526
527
|
return `${fieldName}: json["${jsonKey}"]`;
|
|
527
528
|
}
|
|
529
|
+
if (dartType === "List<dynamic>" || dartType === "List<dynamic>?") {
|
|
530
|
+
return `${fieldName}: json["${jsonKey}"]`;
|
|
531
|
+
}
|
|
528
532
|
if (isDartTypeWithNullables(dartType)) {
|
|
529
533
|
switch (dartType) {
|
|
530
534
|
case "String":
|
|
@@ -726,7 +730,7 @@ const classListTransformer = (typename) => {
|
|
|
726
730
|
return {
|
|
727
731
|
fromJsonBody: (key, jsonKey, fallback) => {
|
|
728
732
|
return `${key}: json["${jsonKey}"] is List ?
|
|
729
|
-
(json["${jsonKey}"] as List<
|
|
733
|
+
(json["${jsonKey}"] as List<dynamic>)
|
|
730
734
|
.map((val) => ${typename}.fromJson(val)).toList() : ${fallback}`;
|
|
731
735
|
},
|
|
732
736
|
toJsonBody: (key, jsonKey, isNullable) => `"${jsonKey}": ${key}${isNullable ? "?" : ""}.map((val) => val.toJson()).toList()`
|
|
@@ -351,6 +351,9 @@ function dartModelFromJsonSchema(modelName, schema, opts) {
|
|
|
351
351
|
if (typeName === "dynamic") {
|
|
352
352
|
return `"${field.jsonKey}": ${field.name}`;
|
|
353
353
|
}
|
|
354
|
+
if (typeName === "List<dynamic>" || typeName === "List<dynamic>?") {
|
|
355
|
+
return `"${field.jsonKey}": ${field.name}`;
|
|
356
|
+
}
|
|
354
357
|
if (isDartTypeWithNullables(field.type)) {
|
|
355
358
|
const transformer = transformers[typeName];
|
|
356
359
|
return transformer.toJsonBody(
|
|
@@ -475,11 +478,6 @@ function dartPropertyTypeFromSchema(objectName, propertyName, schema, opts) {
|
|
|
475
478
|
if (isJsonSchemaArray(prop)) {
|
|
476
479
|
const item = prop.items;
|
|
477
480
|
const type = item.type;
|
|
478
|
-
if (typeof type !== "string") {
|
|
479
|
-
throw new Error(
|
|
480
|
-
"Union types are not supported in arrays at this time"
|
|
481
|
-
);
|
|
482
|
-
}
|
|
483
481
|
switch (type) {
|
|
484
482
|
case "string":
|
|
485
483
|
finalType = isOptional ? "List<String>?" : "List<String>";
|
|
@@ -515,6 +513,9 @@ function dartPropertyTypeFromSchema(objectName, propertyName, schema, opts) {
|
|
|
515
513
|
}
|
|
516
514
|
break;
|
|
517
515
|
}
|
|
516
|
+
default:
|
|
517
|
+
finalType = isOptional ? "List<dynamic>?" : "List<dynamic>";
|
|
518
|
+
break;
|
|
518
519
|
}
|
|
519
520
|
}
|
|
520
521
|
return [finalType, subTypes.length ? subTypes : void 0];
|
|
@@ -523,6 +524,9 @@ function dartParsedJsonField(fieldName, jsonKey, dartType) {
|
|
|
523
524
|
if (dartType === "dynamic") {
|
|
524
525
|
return `${fieldName}: json["${jsonKey}"]`;
|
|
525
526
|
}
|
|
527
|
+
if (dartType === "List<dynamic>" || dartType === "List<dynamic>?") {
|
|
528
|
+
return `${fieldName}: json["${jsonKey}"]`;
|
|
529
|
+
}
|
|
526
530
|
if (isDartTypeWithNullables(dartType)) {
|
|
527
531
|
switch (dartType) {
|
|
528
532
|
case "String":
|
|
@@ -724,7 +728,7 @@ const classListTransformer = (typename) => {
|
|
|
724
728
|
return {
|
|
725
729
|
fromJsonBody: (key, jsonKey, fallback) => {
|
|
726
730
|
return `${key}: json["${jsonKey}"] is List ?
|
|
727
|
-
(json["${jsonKey}"] as List<
|
|
731
|
+
(json["${jsonKey}"] as List<dynamic>)
|
|
728
732
|
.map((val) => ${typename}.fromJson(val)).toList() : ${fallback}`;
|
|
729
733
|
},
|
|
730
734
|
toJsonBody: (key, jsonKey, isNullable) => `"${jsonKey}": ${key}${isNullable ? "?" : ""}.map((val) => val.toJson()).toList()`
|