@xylex-group/athena 1.6.2 → 1.9.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/README.md +70 -11
- package/bin/athena-js.js +0 -0
- package/dist/cli/index.cjs +150 -53
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +2 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +150 -53
- package/dist/cli/index.js.map +1 -1
- package/dist/index.cjs +709 -53
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +307 -41
- package/dist/index.d.ts +307 -41
- package/dist/index.js +703 -54
- package/dist/index.js.map +1 -1
- package/dist/model-form-Bm_kqCn2.d.ts +92 -0
- package/dist/model-form-DkS48fsh.d.cts +92 -0
- package/dist/pipeline-C-cN0ACi.d.cts +164 -0
- package/dist/pipeline-CQgV-Yfo.d.ts +164 -0
- package/dist/react.cjs +64 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +3 -3
- package/dist/react.d.ts +3 -3
- package/dist/react.js +62 -1
- package/dist/react.js.map +1 -1
- package/dist/types-BnzoaNRC.d.cts +380 -0
- package/dist/types-BnzoaNRC.d.ts +380 -0
- package/package.json +15 -14
- package/dist/errors-1b-LSTum.d.ts +0 -31
- package/dist/errors-BYRK5phv.d.cts +0 -31
- package/dist/pipeline-BQzpSLD3.d.ts +0 -338
- package/dist/pipeline-CA2aexDl.d.cts +0 -338
- package/dist/types-v6UyGg-x.d.cts +0 -195
- package/dist/types-v6UyGg-x.d.ts +0 -195
package/dist/react.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
export { A as AthenaGatewayError, i as isAthenaGatewayError } from './
|
|
1
|
+
import { L as AthenaGatewayHookConfig, N as AthenaGatewayHookResult } from './types-BnzoaNRC.js';
|
|
2
|
+
export { O as AthenaDeletePayload, P as AthenaFetchPayload, f as AthenaGatewayCallOptions, r as AthenaGatewayErrorCode, g as AthenaGatewayErrorDetails, Q as AthenaGatewayResponse, V as AthenaInsertPayload, s as AthenaJsonArray, h as AthenaJsonObject, t as AthenaJsonPrimitive, A as AthenaJsonValue, i as AthenaRpcCallOptions, u as AthenaRpcFilter, v as AthenaRpcFilterOperator, w as AthenaRpcOrder, x as AthenaRpcPayload, W as AthenaUpdatePayload } from './types-BnzoaNRC.js';
|
|
3
|
+
export { A as AthenaGatewayError, M as ModelFormAdapter, a as ModelFormDefaults, b as ModelFormNullishMode, c as ModelFormValues, T as ToModelFormDefaultsOptions, d as ToModelPayloadOptions, e as createModelFormAdapter, i as isAthenaGatewayError, t as toModelFormDefaults, f as toModelPayload } from './model-form-Bm_kqCn2.js';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ReactNode } from 'react';
|
|
6
6
|
|
package/dist/react.js
CHANGED
|
@@ -1492,6 +1492,67 @@ function useMutation(options) {
|
|
|
1492
1492
|
};
|
|
1493
1493
|
}
|
|
1494
1494
|
|
|
1495
|
-
|
|
1495
|
+
// src/schema/model-form.ts
|
|
1496
|
+
function resolveNullishValue(mode) {
|
|
1497
|
+
if (mode === "undefined") return void 0;
|
|
1498
|
+
if (mode === "null") return null;
|
|
1499
|
+
return "";
|
|
1500
|
+
}
|
|
1501
|
+
function isRecord3(value) {
|
|
1502
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1503
|
+
}
|
|
1504
|
+
function isNullableColumn(model, key) {
|
|
1505
|
+
const nullable = model.meta.nullable;
|
|
1506
|
+
return nullable?.[key] === true;
|
|
1507
|
+
}
|
|
1508
|
+
function toModelFormDefaults(model, values, options) {
|
|
1509
|
+
const source = values;
|
|
1510
|
+
if (!isRecord3(source)) {
|
|
1511
|
+
return {};
|
|
1512
|
+
}
|
|
1513
|
+
const mode = options?.nullishMode ?? "empty-string";
|
|
1514
|
+
const nullishValue = resolveNullishValue(mode);
|
|
1515
|
+
const result = {};
|
|
1516
|
+
for (const [key, value] of Object.entries(source)) {
|
|
1517
|
+
if (value === null && isNullableColumn(model, key)) {
|
|
1518
|
+
result[key] = nullishValue;
|
|
1519
|
+
continue;
|
|
1520
|
+
}
|
|
1521
|
+
result[key] = value;
|
|
1522
|
+
}
|
|
1523
|
+
return result;
|
|
1524
|
+
}
|
|
1525
|
+
function toModelPayload(model, formValues, options) {
|
|
1526
|
+
const emptyStringAsNull = options?.emptyStringAsNull ?? true;
|
|
1527
|
+
const stripUndefined = options?.stripUndefined ?? true;
|
|
1528
|
+
const result = {};
|
|
1529
|
+
for (const [key, rawValue] of Object.entries(formValues)) {
|
|
1530
|
+
if (rawValue === void 0 && stripUndefined) {
|
|
1531
|
+
continue;
|
|
1532
|
+
}
|
|
1533
|
+
if (emptyStringAsNull && rawValue === "" && isNullableColumn(model, key)) {
|
|
1534
|
+
result[key] = null;
|
|
1535
|
+
continue;
|
|
1536
|
+
}
|
|
1537
|
+
result[key] = rawValue;
|
|
1538
|
+
}
|
|
1539
|
+
return result;
|
|
1540
|
+
}
|
|
1541
|
+
function createModelFormAdapter(model) {
|
|
1542
|
+
return {
|
|
1543
|
+
model,
|
|
1544
|
+
toDefaults(values, options) {
|
|
1545
|
+
return toModelFormDefaults(model, values, options);
|
|
1546
|
+
},
|
|
1547
|
+
toInsert(values, options) {
|
|
1548
|
+
return toModelPayload(model, values, options);
|
|
1549
|
+
},
|
|
1550
|
+
toUpdate(values, options) {
|
|
1551
|
+
return toModelPayload(model, values, options);
|
|
1552
|
+
}
|
|
1553
|
+
};
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
export { AthenaGatewayError, AthenaQueryClient, AthenaQueryClientProvider, attachStateAdapter, createAthenaQueryClient, createModelFormAdapter, isAthenaGatewayError, toModelFormDefaults, toModelPayload, useAthenaGateway, useAthenaQueryClient, useMutation, useQuery };
|
|
1496
1557
|
//# sourceMappingURL=react.js.map
|
|
1497
1558
|
//# sourceMappingURL=react.js.map
|