@ram_28/kf-ai-sdk 1.0.11 → 1.0.13
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 +55 -48
- package/dist/api/client.d.ts +14 -14
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/datetime.d.ts +5 -5
- package/dist/api/datetime.d.ts.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/metadata.d.ts +2 -2
- package/dist/api/metadata.d.ts.map +1 -1
- package/dist/api.cjs +1 -0
- package/dist/api.d.ts +4 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.mjs +27 -0
- package/dist/api.types.cjs +1 -0
- package/dist/api.types.d.ts +4 -0
- package/dist/api.types.d.ts.map +1 -0
- package/dist/api.types.mjs +1 -0
- package/dist/auth/AuthProvider.d.ts +3 -3
- package/dist/auth/AuthProvider.d.ts.map +1 -1
- package/dist/auth/authClient.d.ts +4 -4
- package/dist/auth/authClient.d.ts.map +1 -1
- package/dist/auth/authConfig.d.ts +5 -5
- package/dist/auth/authConfig.d.ts.map +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/types.d.ts +21 -21
- package/dist/auth/types.d.ts.map +1 -1
- package/dist/auth/useAuth.d.ts +2 -2
- package/dist/auth/useAuth.d.ts.map +1 -1
- package/dist/auth.cjs +1 -0
- package/dist/auth.d.ts +5 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.mjs +280 -0
- package/dist/auth.types.cjs +1 -0
- package/dist/auth.types.d.ts +2 -0
- package/dist/auth.types.d.ts.map +1 -0
- package/dist/auth.types.mjs +1 -0
- package/dist/base-types.d.ts +2 -0
- package/dist/base-types.d.ts.map +1 -0
- package/dist/client-C15j4O5B.cjs +1 -0
- package/dist/client-CfvLiGfP.js +233 -0
- package/dist/cn-Dr87sK3i.js +2775 -0
- package/dist/cn-mXUIg4vp.cjs +1 -0
- package/dist/components/hooks/index.d.ts +3 -3
- package/dist/components/hooks/index.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/index.d.ts +2 -2
- package/dist/components/hooks/useFilter/index.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/types.d.ts +19 -31
- package/dist/components/hooks/useFilter/types.d.ts.map +1 -1
- package/dist/components/hooks/useFilter/useFilter.d.ts +2 -2
- package/dist/components/hooks/useFilter/useFilter.d.ts.map +1 -1
- package/dist/components/hooks/useForm/apiClient.d.ts +6 -6
- package/dist/components/hooks/useForm/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts +7 -7
- package/dist/components/hooks/useForm/expressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/index.d.ts +5 -5
- package/dist/components/hooks/useForm/index.d.ts.map +1 -1
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts +10 -10
- package/dist/components/hooks/useForm/optimizedExpressionValidator.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts +7 -12
- package/dist/components/hooks/useForm/ruleClassifier.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts +7 -7
- package/dist/components/hooks/useForm/schemaParser.utils.d.ts.map +1 -1
- package/dist/components/hooks/useForm/types.d.ts +67 -76
- package/dist/components/hooks/useForm/types.d.ts.map +1 -1
- package/dist/components/hooks/useForm/useForm.d.ts +2 -2
- package/dist/components/hooks/useForm/useForm.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/apiClient.d.ts +16 -16
- package/dist/components/hooks/useKanban/apiClient.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/context.d.ts +3 -3
- package/dist/components/hooks/useKanban/context.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/dragDropManager.d.ts +7 -7
- package/dist/components/hooks/useKanban/dragDropManager.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/index.d.ts +1 -1
- package/dist/components/hooks/useKanban/index.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/types.d.ts +65 -67
- package/dist/components/hooks/useKanban/types.d.ts.map +1 -1
- package/dist/components/hooks/useKanban/useKanban.d.ts +2 -2
- package/dist/components/hooks/useKanban/useKanban.d.ts.map +1 -1
- package/dist/components/hooks/useTable/index.d.ts +1 -1
- package/dist/components/hooks/useTable/index.d.ts.map +1 -1
- package/dist/components/hooks/useTable/types.d.ts +10 -10
- package/dist/components/hooks/useTable/types.d.ts.map +1 -1
- package/dist/components/hooks/useTable/useTable.d.ts +2 -2
- package/dist/components/hooks/useTable/useTable.d.ts.map +1 -1
- package/dist/filter.cjs +1 -0
- package/dist/filter.d.ts +3 -0
- package/dist/filter.d.ts.map +1 -0
- package/dist/filter.mjs +6 -0
- package/dist/filter.types.cjs +1 -0
- package/dist/filter.types.d.ts +2 -0
- package/dist/filter.types.d.ts.map +1 -0
- package/dist/filter.types.mjs +1 -0
- package/dist/form.cjs +1 -0
- package/dist/form.d.ts +3 -0
- package/dist/form.d.ts.map +1 -0
- package/dist/form.mjs +2355 -0
- package/dist/form.types.cjs +1 -0
- package/dist/form.types.d.ts +2 -0
- package/dist/form.types.d.ts.map +1 -0
- package/dist/form.types.mjs +1 -0
- package/dist/jsx-runtime-BYECrxsp.cjs +30 -0
- package/dist/jsx-runtime-DGlMoOmv.js +630 -0
- package/dist/kanban.cjs +13 -0
- package/dist/kanban.d.ts +5 -0
- package/dist/kanban.d.ts.map +1 -0
- package/dist/kanban.mjs +1060 -0
- package/dist/kanban.types.cjs +1 -0
- package/dist/kanban.types.d.ts +2 -0
- package/dist/kanban.types.d.ts.map +1 -0
- package/dist/kanban.types.mjs +1 -0
- package/dist/kanban.ui.cjs +1 -0
- package/dist/kanban.ui.d.ts +2 -0
- package/dist/kanban.ui.d.ts.map +1 -0
- package/dist/kanban.ui.mjs +104 -0
- package/dist/metadata-2FLBsFcf.cjs +1 -0
- package/dist/metadata-DBcoDth-.js +43 -0
- package/dist/table.cjs +1 -0
- package/dist/table.d.ts +2 -0
- package/dist/table.d.ts.map +1 -0
- package/dist/table.mjs +148 -0
- package/dist/table.types.cjs +1 -0
- package/dist/table.types.d.ts +2 -0
- package/dist/table.types.d.ts.map +1 -0
- package/dist/table.types.mjs +1 -0
- package/dist/types/base-fields.d.ts +45 -45
- package/dist/types/base-fields.d.ts.map +1 -1
- package/dist/types/common.d.ts +45 -61
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types.cjs +1 -0
- package/dist/types.mjs +1 -0
- package/dist/useFilter-CXFqEHyI.js +129 -0
- package/dist/useFilter-D-bCDo6Z.cjs +1 -0
- package/dist/useQuery-BScHEo7x.cjs +1 -0
- package/dist/useQuery-KpZFg80c.js +748 -0
- package/dist/utils/formatting.d.ts +4 -4
- package/dist/utils/formatting.d.ts.map +1 -1
- package/dist/utils.cjs +4 -0
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.mjs +105 -0
- package/package.json +147 -9
- package/sdk/api/client.ts +51 -51
- package/sdk/api/datetime.ts +5 -5
- package/sdk/api/index.ts +28 -33
- package/sdk/api/metadata.ts +4 -4
- package/sdk/api.ts +24 -0
- package/sdk/api.types.ts +58 -0
- package/sdk/auth/AuthProvider.tsx +18 -18
- package/sdk/auth/authClient.ts +9 -9
- package/sdk/auth/authConfig.ts +9 -9
- package/sdk/auth/index.ts +5 -5
- package/sdk/auth/types.ts +21 -21
- package/sdk/auth/useAuth.ts +2 -2
- package/sdk/auth.ts +22 -0
- package/sdk/auth.types.ts +28 -0
- package/sdk/base-types.ts +45 -0
- package/sdk/components/hooks/index.ts +22 -22
- package/sdk/components/hooks/useFilter/index.ts +8 -14
- package/sdk/components/hooks/useFilter/types.ts +29 -58
- package/sdk/components/hooks/useFilter/useFilter.ts +41 -44
- package/sdk/components/hooks/useForm/apiClient.ts +8 -8
- package/sdk/components/hooks/useForm/expressionValidator.utils.ts +18 -18
- package/sdk/components/hooks/useForm/index.ts +24 -24
- package/sdk/components/hooks/useForm/optimizedExpressionValidator.utils.ts +22 -22
- package/sdk/components/hooks/useForm/ruleClassifier.utils.ts +26 -62
- package/sdk/components/hooks/useForm/schemaParser.utils.ts +24 -24
- package/sdk/components/hooks/useForm/types.ts +66 -82
- package/sdk/components/hooks/useForm/useForm.ts +15 -21
- package/sdk/components/hooks/useKanban/apiClient.ts +54 -54
- package/sdk/components/hooks/useKanban/context.ts +3 -3
- package/sdk/components/hooks/useKanban/dragDropManager.ts +19 -19
- package/sdk/components/hooks/useKanban/index.ts +26 -26
- package/sdk/components/hooks/useKanban/types.ts +69 -71
- package/sdk/components/hooks/useKanban/useKanban.ts +43 -51
- package/sdk/components/hooks/useKanban/useKanbanSimple.ts +4 -4
- package/sdk/components/hooks/useTable/index.ts +5 -1
- package/sdk/components/hooks/useTable/types.ts +10 -10
- package/sdk/components/hooks/useTable/useTable.ts +10 -10
- package/sdk/filter.ts +13 -0
- package/sdk/filter.types.ts +17 -0
- package/sdk/form.ts +15 -0
- package/sdk/form.types.ts +46 -0
- package/sdk/kanban.ts +23 -0
- package/sdk/kanban.types.ts +50 -0
- package/sdk/kanban.ui.ts +16 -0
- package/sdk/table.ts +7 -0
- package/sdk/table.types.ts +13 -0
- package/sdk/types/base-fields.ts +47 -47
- package/sdk/types/common.ts +47 -71
- package/sdk/types/index.ts +1 -1
- package/sdk/utils/formatting.ts +4 -4
- package/sdk/utils.ts +10 -0
- package/dist/index.cjs +0 -45
- package/dist/index.mjs +0 -6387
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CurrencyValueType, JSONValueType } from '../types/base-fields';
|
|
2
2
|
/**
|
|
3
3
|
* Data formatting utilities for display and conversion
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* Format currency value for display
|
|
7
7
|
*/
|
|
8
|
-
export declare function formatCurrency(value:
|
|
8
|
+
export declare function formatCurrency(value: CurrencyValueType): string;
|
|
9
9
|
/**
|
|
10
10
|
* Parse currency string to currency object
|
|
11
11
|
*/
|
|
12
|
-
export declare function parseCurrency(value: string):
|
|
12
|
+
export declare function parseCurrency(value: string): CurrencyValueType | null;
|
|
13
13
|
/**
|
|
14
14
|
* Format date for display
|
|
15
15
|
*/
|
|
@@ -25,7 +25,7 @@ export declare function formatNumber(value: number, precision?: number): string;
|
|
|
25
25
|
/**
|
|
26
26
|
* Format JSON value for display
|
|
27
27
|
*/
|
|
28
|
-
export declare function formatJSON(value:
|
|
28
|
+
export declare function formatJSON(value: JSONValueType, indent?: number): string;
|
|
29
29
|
/**
|
|
30
30
|
* Format array values for display
|
|
31
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../sdk/utils/formatting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../sdk/utils/formatting.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE7E;;GAEG;AAEH;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAc/D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAcrE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAE,OAAO,GAAG,QAAQ,GAAG,MAAiB,GAAG,MAAM,CAY7F;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,GAAE,OAAO,GAAG,QAAQ,GAAG,MAAiB,GAAG,MAAM,CAYjG;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,GAAE,MAAU,GAAG,MAAM,CAMzE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,CAM3E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,KAAK,EAAE,CAAC,EAAE,EACV,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,EAC/B,SAAS,GAAE,MAAa,GACvB,MAAM,CAUR;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE;IACtD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,MAAM,CAQT;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,GAAE,MAAW,GAAG,MAAM,CAU5E;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAYvE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,GAAG,EACV,SAAS,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,OAAO,GACpH,MAAM,CAsCR"}
|
package/dist/utils.cjs
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./cn-mXUIg4vp.cjs");function i(r){return typeof r=="string"?r:typeof r=="object"&&r!==null?new Intl.NumberFormat("en-US",{style:"currency",currency:r.currency}).format(r.value):"Invalid Currency"}function l(r){const t=r.match(/^(?:([A-Z]{3})\s+(\d+\.?\d*))|(?:(\d+\.?\d*)\s+([A-Z]{3}))$/);if(t){const n=t[1]||t[4],e=parseFloat(t[2]||t[3]);if(!isNaN(e))return{value:e,currency:n}}return null}function o(r,t="medium"){if(!(r instanceof Date)||isNaN(r.getTime()))return"Invalid Date";const n={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"}}[t];return new Intl.DateTimeFormat("en-US",n).format(r)}function a(r,t="medium"){if(!(r instanceof Date)||isNaN(r.getTime()))return"Invalid Date";const n={short:{dateStyle:"short",timeStyle:"short"},medium:{dateStyle:"medium",timeStyle:"medium"},long:{dateStyle:"long",timeStyle:"long"}}[t];return new Intl.DateTimeFormat("en-US",n).format(r)}function c(r,t=2){return typeof r!="number"||isNaN(r)?"Invalid Number":r.toFixed(t)}function f(r,t=2){try{return JSON.stringify(r,null,t)}catch{return"Invalid JSON"}}function m(r,t,n=", "){return Array.isArray(r)?t?r.map(t).join(n):r.map(e=>String(e)).join(n):"Invalid Array"}function u(r,t){return typeof r!="boolean"?"Invalid Boolean":r?(t==null?void 0:t.trueLabel)||"Yes":(t==null?void 0:t.falseLabel)||"No"}function d(r,t=50){return typeof r!="string"?"Invalid String":r.length<=t?r:r.slice(0,t-3)+"..."}function s(r,t){if(typeof r!="string")return"Invalid Text";const n=r.split(`
|
|
2
|
+
`);return t&&n.length>t?n.slice(0,t).join(`
|
|
3
|
+
`)+`
|
|
4
|
+
...`:r}function S(r,t){if(r==null)return"";switch(t||(typeof r=="boolean"?t="boolean":typeof r=="number"?t="number":r instanceof Date?t="datetime":Array.isArray(r)?t="array":typeof r=="object"?t="json":t="string"),t){case"id":case"string":return String(r);case"textarea":return s(String(r));case"number":return c(r);case"boolean":return u(r);case"date":return o(r);case"datetime":return a(r);case"currency":return i(r);case"json":return f(r);case"array":return m(r);default:return String(r)}}exports.cn=y.cn;exports.formatArray=m;exports.formatBoolean=u;exports.formatCurrency=i;exports.formatDate=o;exports.formatDateTime=a;exports.formatFieldValue=S;exports.formatJSON=f;exports.formatNumber=c;exports.formatTextArea=s;exports.parseCurrency=l;exports.truncateString=d;
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../sdk/utils.ts"],"names":[],"mappings":"AAMA,cAAc,oBAAoB,CAAC;AAGnC,cAAc,YAAY,CAAC"}
|
package/dist/utils.mjs
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { c as b } from "./cn-Dr87sK3i.js";
|
|
2
|
+
function i(r) {
|
|
3
|
+
return typeof r == "string" ? r : typeof r == "object" && r !== null ? new Intl.NumberFormat("en-US", {
|
|
4
|
+
style: "currency",
|
|
5
|
+
currency: r.currency
|
|
6
|
+
}).format(r.value) : "Invalid Currency";
|
|
7
|
+
}
|
|
8
|
+
function y(r) {
|
|
9
|
+
const t = r.match(/^(?:([A-Z]{3})\s+(\d+\.?\d*))|(?:(\d+\.?\d*)\s+([A-Z]{3}))$/);
|
|
10
|
+
if (t) {
|
|
11
|
+
const n = t[1] || t[4], e = parseFloat(t[2] || t[3]);
|
|
12
|
+
if (!isNaN(e))
|
|
13
|
+
return { value: e, currency: n };
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
function o(r, t = "medium") {
|
|
18
|
+
if (!(r instanceof Date) || isNaN(r.getTime()))
|
|
19
|
+
return "Invalid Date";
|
|
20
|
+
const n = {
|
|
21
|
+
short: { dateStyle: "short" },
|
|
22
|
+
medium: { dateStyle: "medium" },
|
|
23
|
+
long: { dateStyle: "long" }
|
|
24
|
+
}[t];
|
|
25
|
+
return new Intl.DateTimeFormat("en-US", n).format(r);
|
|
26
|
+
}
|
|
27
|
+
function c(r, t = "medium") {
|
|
28
|
+
if (!(r instanceof Date) || isNaN(r.getTime()))
|
|
29
|
+
return "Invalid Date";
|
|
30
|
+
const n = {
|
|
31
|
+
short: { dateStyle: "short", timeStyle: "short" },
|
|
32
|
+
medium: { dateStyle: "medium", timeStyle: "medium" },
|
|
33
|
+
long: { dateStyle: "long", timeStyle: "long" }
|
|
34
|
+
}[t];
|
|
35
|
+
return new Intl.DateTimeFormat("en-US", n).format(r);
|
|
36
|
+
}
|
|
37
|
+
function a(r, t = 2) {
|
|
38
|
+
return typeof r != "number" || isNaN(r) ? "Invalid Number" : r.toFixed(t);
|
|
39
|
+
}
|
|
40
|
+
function f(r, t = 2) {
|
|
41
|
+
try {
|
|
42
|
+
return JSON.stringify(r, null, t);
|
|
43
|
+
} catch {
|
|
44
|
+
return "Invalid JSON";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function m(r, t, n = ", ") {
|
|
48
|
+
return Array.isArray(r) ? t ? r.map(t).join(n) : r.map((e) => String(e)).join(n) : "Invalid Array";
|
|
49
|
+
}
|
|
50
|
+
function u(r, t) {
|
|
51
|
+
return typeof r != "boolean" ? "Invalid Boolean" : r ? (t == null ? void 0 : t.trueLabel) || "Yes" : (t == null ? void 0 : t.falseLabel) || "No";
|
|
52
|
+
}
|
|
53
|
+
function l(r, t = 50) {
|
|
54
|
+
return typeof r != "string" ? "Invalid String" : r.length <= t ? r : r.slice(0, t - 3) + "...";
|
|
55
|
+
}
|
|
56
|
+
function s(r, t) {
|
|
57
|
+
if (typeof r != "string")
|
|
58
|
+
return "Invalid Text";
|
|
59
|
+
const n = r.split(`
|
|
60
|
+
`);
|
|
61
|
+
return t && n.length > t ? n.slice(0, t).join(`
|
|
62
|
+
`) + `
|
|
63
|
+
...` : r;
|
|
64
|
+
}
|
|
65
|
+
function d(r, t) {
|
|
66
|
+
if (r == null)
|
|
67
|
+
return "";
|
|
68
|
+
switch (t || (typeof r == "boolean" ? t = "boolean" : typeof r == "number" ? t = "number" : r instanceof Date ? t = "datetime" : Array.isArray(r) ? t = "array" : typeof r == "object" ? t = "json" : t = "string"), t) {
|
|
69
|
+
case "id":
|
|
70
|
+
case "string":
|
|
71
|
+
return String(r);
|
|
72
|
+
case "textarea":
|
|
73
|
+
return s(String(r));
|
|
74
|
+
case "number":
|
|
75
|
+
return a(r);
|
|
76
|
+
case "boolean":
|
|
77
|
+
return u(r);
|
|
78
|
+
case "date":
|
|
79
|
+
return o(r);
|
|
80
|
+
case "datetime":
|
|
81
|
+
return c(r);
|
|
82
|
+
case "currency":
|
|
83
|
+
return i(r);
|
|
84
|
+
case "json":
|
|
85
|
+
return f(r);
|
|
86
|
+
case "array":
|
|
87
|
+
return m(r);
|
|
88
|
+
default:
|
|
89
|
+
return String(r);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
b as cn,
|
|
94
|
+
m as formatArray,
|
|
95
|
+
u as formatBoolean,
|
|
96
|
+
i as formatCurrency,
|
|
97
|
+
o as formatDate,
|
|
98
|
+
c as formatDateTime,
|
|
99
|
+
d as formatFieldValue,
|
|
100
|
+
f as formatJSON,
|
|
101
|
+
a as formatNumber,
|
|
102
|
+
s as formatTextArea,
|
|
103
|
+
y as parseCurrency,
|
|
104
|
+
l as truncateString
|
|
105
|
+
};
|
package/package.json
CHANGED
|
@@ -1,22 +1,160 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ram_28/kf-ai-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "Type-safe, AI-driven SDK for building modern web applications with role-based access control",
|
|
5
5
|
"author": "Ramprasad",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"
|
|
9
|
-
"module": "./dist/index.mjs",
|
|
10
|
-
"types": "./dist/index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
11
9
|
"exports": {
|
|
12
|
-
"
|
|
10
|
+
"./form": {
|
|
13
11
|
"import": {
|
|
14
|
-
"types": "./dist/
|
|
15
|
-
"default": "./dist/
|
|
12
|
+
"types": "./dist/form.d.ts",
|
|
13
|
+
"default": "./dist/form.mjs"
|
|
16
14
|
},
|
|
17
15
|
"require": {
|
|
18
|
-
"types": "./dist/
|
|
19
|
-
"default": "./dist/
|
|
16
|
+
"types": "./dist/form.d.ts",
|
|
17
|
+
"default": "./dist/form.cjs"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"./form/types": {
|
|
21
|
+
"import": {
|
|
22
|
+
"types": "./dist/form.types.d.ts",
|
|
23
|
+
"default": "./dist/form.types.mjs"
|
|
24
|
+
},
|
|
25
|
+
"require": {
|
|
26
|
+
"types": "./dist/form.types.d.ts",
|
|
27
|
+
"default": "./dist/form.types.cjs"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"./table": {
|
|
31
|
+
"import": {
|
|
32
|
+
"types": "./dist/table.d.ts",
|
|
33
|
+
"default": "./dist/table.mjs"
|
|
34
|
+
},
|
|
35
|
+
"require": {
|
|
36
|
+
"types": "./dist/table.d.ts",
|
|
37
|
+
"default": "./dist/table.cjs"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"./table/types": {
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "./dist/table.types.d.ts",
|
|
43
|
+
"default": "./dist/table.types.mjs"
|
|
44
|
+
},
|
|
45
|
+
"require": {
|
|
46
|
+
"types": "./dist/table.types.d.ts",
|
|
47
|
+
"default": "./dist/table.types.cjs"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"./kanban": {
|
|
51
|
+
"import": {
|
|
52
|
+
"types": "./dist/kanban.d.ts",
|
|
53
|
+
"default": "./dist/kanban.mjs"
|
|
54
|
+
},
|
|
55
|
+
"require": {
|
|
56
|
+
"types": "./dist/kanban.d.ts",
|
|
57
|
+
"default": "./dist/kanban.cjs"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"./kanban/types": {
|
|
61
|
+
"import": {
|
|
62
|
+
"types": "./dist/kanban.types.d.ts",
|
|
63
|
+
"default": "./dist/kanban.types.mjs"
|
|
64
|
+
},
|
|
65
|
+
"require": {
|
|
66
|
+
"types": "./dist/kanban.types.d.ts",
|
|
67
|
+
"default": "./dist/kanban.types.cjs"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"./kanban/ui": {
|
|
71
|
+
"import": {
|
|
72
|
+
"types": "./dist/kanban.ui.d.ts",
|
|
73
|
+
"default": "./dist/kanban.ui.mjs"
|
|
74
|
+
},
|
|
75
|
+
"require": {
|
|
76
|
+
"types": "./dist/kanban.ui.d.ts",
|
|
77
|
+
"default": "./dist/kanban.ui.cjs"
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
"./filter": {
|
|
81
|
+
"import": {
|
|
82
|
+
"types": "./dist/filter.d.ts",
|
|
83
|
+
"default": "./dist/filter.mjs"
|
|
84
|
+
},
|
|
85
|
+
"require": {
|
|
86
|
+
"types": "./dist/filter.d.ts",
|
|
87
|
+
"default": "./dist/filter.cjs"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
"./filter/types": {
|
|
91
|
+
"import": {
|
|
92
|
+
"types": "./dist/filter.types.d.ts",
|
|
93
|
+
"default": "./dist/filter.types.mjs"
|
|
94
|
+
},
|
|
95
|
+
"require": {
|
|
96
|
+
"types": "./dist/filter.types.d.ts",
|
|
97
|
+
"default": "./dist/filter.types.cjs"
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"./auth": {
|
|
101
|
+
"import": {
|
|
102
|
+
"types": "./dist/auth.d.ts",
|
|
103
|
+
"default": "./dist/auth.mjs"
|
|
104
|
+
},
|
|
105
|
+
"require": {
|
|
106
|
+
"types": "./dist/auth.d.ts",
|
|
107
|
+
"default": "./dist/auth.cjs"
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"./auth/types": {
|
|
111
|
+
"import": {
|
|
112
|
+
"types": "./dist/auth.types.d.ts",
|
|
113
|
+
"default": "./dist/auth.types.mjs"
|
|
114
|
+
},
|
|
115
|
+
"require": {
|
|
116
|
+
"types": "./dist/auth.types.d.ts",
|
|
117
|
+
"default": "./dist/auth.types.cjs"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"./api": {
|
|
121
|
+
"import": {
|
|
122
|
+
"types": "./dist/api.d.ts",
|
|
123
|
+
"default": "./dist/api.mjs"
|
|
124
|
+
},
|
|
125
|
+
"require": {
|
|
126
|
+
"types": "./dist/api.d.ts",
|
|
127
|
+
"default": "./dist/api.cjs"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"./api/types": {
|
|
131
|
+
"import": {
|
|
132
|
+
"types": "./dist/api.types.d.ts",
|
|
133
|
+
"default": "./dist/api.types.mjs"
|
|
134
|
+
},
|
|
135
|
+
"require": {
|
|
136
|
+
"types": "./dist/api.types.d.ts",
|
|
137
|
+
"default": "./dist/api.types.cjs"
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"./utils": {
|
|
141
|
+
"import": {
|
|
142
|
+
"types": "./dist/utils.d.ts",
|
|
143
|
+
"default": "./dist/utils.mjs"
|
|
144
|
+
},
|
|
145
|
+
"require": {
|
|
146
|
+
"types": "./dist/utils.d.ts",
|
|
147
|
+
"default": "./dist/utils.cjs"
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
"./types": {
|
|
151
|
+
"import": {
|
|
152
|
+
"types": "./dist/base-types.d.ts",
|
|
153
|
+
"default": "./dist/types.mjs"
|
|
154
|
+
},
|
|
155
|
+
"require": {
|
|
156
|
+
"types": "./dist/base-types.d.ts",
|
|
157
|
+
"default": "./dist/types.cjs"
|
|
20
158
|
}
|
|
21
159
|
}
|
|
22
160
|
},
|
package/sdk/api/client.ts
CHANGED
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
// ============================================================
|
|
4
4
|
|
|
5
5
|
import type {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
ListOptionsType,
|
|
7
|
+
ListResponseType,
|
|
8
|
+
ReadResponseType,
|
|
9
|
+
CreateUpdateResponseType,
|
|
10
|
+
DeleteResponseType,
|
|
11
|
+
CountResponseType,
|
|
12
|
+
DateTimeEncodedType,
|
|
13
|
+
DateEncodedType,
|
|
14
|
+
MetricOptionsType,
|
|
15
|
+
MetricResponseType,
|
|
16
|
+
PivotOptionsType,
|
|
17
|
+
PivotResponseType,
|
|
18
|
+
DraftResponseType,
|
|
19
|
+
FieldsResponseType,
|
|
20
|
+
FetchFieldOptionType,
|
|
21
|
+
FetchFieldResponseType,
|
|
22
22
|
} from "../types/common";
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -33,19 +33,19 @@ export interface ResourceClient<T = any> {
|
|
|
33
33
|
get(id: string): Promise<T>;
|
|
34
34
|
|
|
35
35
|
/** Create new record */
|
|
36
|
-
create(data: Partial<T> & { _id?: string }): Promise<
|
|
36
|
+
create(data: Partial<T> & { _id?: string }): Promise<CreateUpdateResponseType>;
|
|
37
37
|
|
|
38
38
|
/** Update existing record */
|
|
39
|
-
update(id: string, data: Partial<T>): Promise<
|
|
39
|
+
update(id: string, data: Partial<T>): Promise<CreateUpdateResponseType>;
|
|
40
40
|
|
|
41
41
|
/** Delete record by ID */
|
|
42
|
-
delete(id: string): Promise<
|
|
42
|
+
delete(id: string): Promise<DeleteResponseType>;
|
|
43
43
|
|
|
44
44
|
/** List records with optional filtering, sorting, and pagination */
|
|
45
|
-
list(options?:
|
|
45
|
+
list(options?: ListOptionsType): Promise<ListResponseType<T>>;
|
|
46
46
|
|
|
47
47
|
/** Get count of records matching the same criteria as list */
|
|
48
|
-
count(options?:
|
|
48
|
+
count(options?: ListOptionsType): Promise<CountResponseType>;
|
|
49
49
|
|
|
50
50
|
// ============================================================
|
|
51
51
|
// DRAFT/INTERACTIVE OPERATIONS
|
|
@@ -55,19 +55,19 @@ export interface ResourceClient<T = any> {
|
|
|
55
55
|
* Create draft - compute fields without persisting
|
|
56
56
|
* POST /{bo_id}/draft
|
|
57
57
|
*/
|
|
58
|
-
draft(data: Partial<T>): Promise<
|
|
58
|
+
draft(data: Partial<T>): Promise<DraftResponseType>;
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Update draft (commit) - compute and prepare for update
|
|
62
62
|
* POST /{bo_id}/{instance_id}/draft
|
|
63
63
|
*/
|
|
64
|
-
draftUpdate(id: string, data: Partial<T>): Promise<
|
|
64
|
+
draftUpdate(id: string, data: Partial<T>): Promise<CreateUpdateResponseType>;
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* Update draft (patch) - compute fields during editing
|
|
68
68
|
* PATCH /{bo_id}/{instance_id}/draft
|
|
69
69
|
*/
|
|
70
|
-
draftPatch(id: string, data: Partial<T>): Promise<
|
|
70
|
+
draftPatch(id: string, data: Partial<T>): Promise<DraftResponseType>;
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
73
|
* Interactive draft - create/update draft without instance ID
|
|
@@ -76,7 +76,7 @@ export interface ResourceClient<T = any> {
|
|
|
76
76
|
*/
|
|
77
77
|
draftInteraction(
|
|
78
78
|
data: Partial<T> & { _id?: string }
|
|
79
|
-
): Promise<
|
|
79
|
+
): Promise<DraftResponseType & { _id: string }>;
|
|
80
80
|
|
|
81
81
|
// ============================================================
|
|
82
82
|
// QUERY OPERATIONS
|
|
@@ -86,13 +86,13 @@ export interface ResourceClient<T = any> {
|
|
|
86
86
|
* Get aggregated metrics grouped by dimensions
|
|
87
87
|
* POST /{bo_id}/metric
|
|
88
88
|
*/
|
|
89
|
-
metric(options: Omit<
|
|
89
|
+
metric(options: Omit<MetricOptionsType, "Type">): Promise<MetricResponseType>;
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* Get pivot table data
|
|
93
93
|
* POST /{bo_id}/pivot
|
|
94
94
|
*/
|
|
95
|
-
pivot(options: Omit<
|
|
95
|
+
pivot(options: Omit<PivotOptionsType, "Type">): Promise<PivotResponseType>;
|
|
96
96
|
|
|
97
97
|
// ============================================================
|
|
98
98
|
// METADATA OPERATIONS
|
|
@@ -102,13 +102,13 @@ export interface ResourceClient<T = any> {
|
|
|
102
102
|
* Get field definitions for this Business Object
|
|
103
103
|
* GET /{bo_id}/fields
|
|
104
104
|
*/
|
|
105
|
-
fields(): Promise<
|
|
105
|
+
fields(): Promise<FieldsResponseType>;
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* Fetch reference data for a specific field (for lookup and dropdown fields)
|
|
109
109
|
* GET /{bo_id}/{instance_id}/field/{field_id}/fetch
|
|
110
110
|
*/
|
|
111
|
-
fetchField(instanceId: string, fieldId: string): Promise<
|
|
111
|
+
fetchField(instanceId: string, fieldId: string): Promise<FetchFieldOptionType[]>;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
/**
|
|
@@ -172,12 +172,12 @@ function decodeResponseData<T>(data: any): T {
|
|
|
172
172
|
if (typeof data === "object") {
|
|
173
173
|
// Check for datetime encoding
|
|
174
174
|
if ("$__dt__" in data) {
|
|
175
|
-
return new Date((data as
|
|
175
|
+
return new Date((data as DateTimeEncodedType).$__dt__ * 1000) as T;
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
// Check for date encoding
|
|
179
179
|
if ("$__d__" in data) {
|
|
180
|
-
return new Date((data as
|
|
180
|
+
return new Date((data as DateEncodedType).$__d__) as T;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
// Recursively process object properties
|
|
@@ -211,13 +211,13 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
211
211
|
throw new Error(`Failed to get ${bo_id} ${id}: ${response.statusText}`);
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
const responseData:
|
|
214
|
+
const responseData: ReadResponseType<T> = await response.json();
|
|
215
215
|
return decodeResponseData<T>(responseData.Data);
|
|
216
216
|
},
|
|
217
217
|
|
|
218
218
|
async create(
|
|
219
219
|
data: Partial<T> & { _id?: string }
|
|
220
|
-
): Promise<
|
|
220
|
+
): Promise<CreateUpdateResponseType> {
|
|
221
221
|
const response = await fetch(`${baseUrl}/api/app/${bo_id}/create`, {
|
|
222
222
|
method: "POST",
|
|
223
223
|
headers: defaultHeaders,
|
|
@@ -231,7 +231,7 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
231
231
|
return response.json();
|
|
232
232
|
},
|
|
233
233
|
|
|
234
|
-
async update(id: string, data: Partial<T>): Promise<
|
|
234
|
+
async update(id: string, data: Partial<T>): Promise<CreateUpdateResponseType> {
|
|
235
235
|
const response = await fetch(`${baseUrl}/api/app/${bo_id}/${id}/update`, {
|
|
236
236
|
method: "POST",
|
|
237
237
|
headers: defaultHeaders,
|
|
@@ -247,7 +247,7 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
247
247
|
return response.json();
|
|
248
248
|
},
|
|
249
249
|
|
|
250
|
-
async delete(id: string): Promise<
|
|
250
|
+
async delete(id: string): Promise<DeleteResponseType> {
|
|
251
251
|
const response = await fetch(`${baseUrl}/api/app/${bo_id}/${id}/delete`, {
|
|
252
252
|
method: "DELETE",
|
|
253
253
|
headers: defaultHeaders,
|
|
@@ -262,8 +262,8 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
262
262
|
return response.json();
|
|
263
263
|
},
|
|
264
264
|
|
|
265
|
-
async list(options?:
|
|
266
|
-
const requestBody:
|
|
265
|
+
async list(options?: ListOptionsType): Promise<ListResponseType<T>> {
|
|
266
|
+
const requestBody: ListOptionsType = {
|
|
267
267
|
Type: "List",
|
|
268
268
|
...options,
|
|
269
269
|
};
|
|
@@ -278,13 +278,13 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
278
278
|
throw new Error(`Failed to list ${bo_id}: ${response.statusText}`);
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
const responseData:
|
|
281
|
+
const responseData: ListResponseType<any> = await response.json();
|
|
282
282
|
return {
|
|
283
283
|
Data: responseData.Data.map((item) => decodeResponseData<T>(item)),
|
|
284
284
|
};
|
|
285
285
|
},
|
|
286
286
|
|
|
287
|
-
async count(options?:
|
|
287
|
+
async count(options?: ListOptionsType): Promise<CountResponseType> {
|
|
288
288
|
// Note: Count uses metric endpoint with Count aggregation
|
|
289
289
|
const requestBody = {
|
|
290
290
|
Type: "Metric",
|
|
@@ -313,7 +313,7 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
313
313
|
// DRAFT/INTERACTIVE OPERATIONS
|
|
314
314
|
// ============================================================
|
|
315
315
|
|
|
316
|
-
async draft(data: Partial<T>): Promise<
|
|
316
|
+
async draft(data: Partial<T>): Promise<DraftResponseType> {
|
|
317
317
|
const response = await fetch(`${baseUrl}/api/app/${bo_id}/draft`, {
|
|
318
318
|
method: "POST",
|
|
319
319
|
headers: defaultHeaders,
|
|
@@ -332,7 +332,7 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
332
332
|
async draftUpdate(
|
|
333
333
|
id: string,
|
|
334
334
|
data: Partial<T>
|
|
335
|
-
): Promise<
|
|
335
|
+
): Promise<CreateUpdateResponseType> {
|
|
336
336
|
const response = await fetch(`${baseUrl}/api/app/${bo_id}/${id}/draft`, {
|
|
337
337
|
method: "POST",
|
|
338
338
|
headers: defaultHeaders,
|
|
@@ -348,7 +348,7 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
348
348
|
return response.json();
|
|
349
349
|
},
|
|
350
350
|
|
|
351
|
-
async draftPatch(id: string, data: Partial<T>): Promise<
|
|
351
|
+
async draftPatch(id: string, data: Partial<T>): Promise<DraftResponseType> {
|
|
352
352
|
const response = await fetch(`${baseUrl}/api/app/${bo_id}/${id}/draft`, {
|
|
353
353
|
method: "PATCH",
|
|
354
354
|
headers: defaultHeaders,
|
|
@@ -366,7 +366,7 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
366
366
|
|
|
367
367
|
async draftInteraction(
|
|
368
368
|
data: Partial<T> & { _id?: string }
|
|
369
|
-
): Promise<
|
|
369
|
+
): Promise<DraftResponseType & { _id: string }> {
|
|
370
370
|
const response = await fetch(`${baseUrl}/api/app/${bo_id}/draft`, {
|
|
371
371
|
method: "PATCH",
|
|
372
372
|
headers: defaultHeaders,
|
|
@@ -387,9 +387,9 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
387
387
|
// ============================================================
|
|
388
388
|
|
|
389
389
|
async metric(
|
|
390
|
-
options: Omit<
|
|
391
|
-
): Promise<
|
|
392
|
-
const requestBody:
|
|
390
|
+
options: Omit<MetricOptionsType, "Type">
|
|
391
|
+
): Promise<MetricResponseType> {
|
|
392
|
+
const requestBody: MetricOptionsType = {
|
|
393
393
|
Type: "Metric",
|
|
394
394
|
...options,
|
|
395
395
|
};
|
|
@@ -409,8 +409,8 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
409
409
|
return response.json();
|
|
410
410
|
},
|
|
411
411
|
|
|
412
|
-
async pivot(options: Omit<
|
|
413
|
-
const requestBody:
|
|
412
|
+
async pivot(options: Omit<PivotOptionsType, "Type">): Promise<PivotResponseType> {
|
|
413
|
+
const requestBody: PivotOptionsType = {
|
|
414
414
|
Type: "Pivot",
|
|
415
415
|
...options,
|
|
416
416
|
};
|
|
@@ -434,7 +434,7 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
434
434
|
// METADATA OPERATIONS
|
|
435
435
|
// ============================================================
|
|
436
436
|
|
|
437
|
-
async fields(): Promise<
|
|
437
|
+
async fields(): Promise<FieldsResponseType> {
|
|
438
438
|
const response = await fetch(`${baseUrl}/api/app/${bo_id}/fields`, {
|
|
439
439
|
method: "GET",
|
|
440
440
|
headers: defaultHeaders,
|
|
@@ -452,7 +452,7 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
452
452
|
async fetchField(
|
|
453
453
|
instanceId: string,
|
|
454
454
|
fieldId: string
|
|
455
|
-
): Promise<
|
|
455
|
+
): Promise<FetchFieldOptionType[]> {
|
|
456
456
|
const response = await fetch(
|
|
457
457
|
`${baseUrl}/api/app/${bo_id}/${instanceId}/field/${fieldId}/fetch`,
|
|
458
458
|
{
|
|
@@ -467,7 +467,7 @@ export function api<T = any>(bo_id: string): ResourceClient<T> {
|
|
|
467
467
|
);
|
|
468
468
|
}
|
|
469
469
|
|
|
470
|
-
const responseData:
|
|
470
|
+
const responseData: FetchFieldResponseType = await response.json();
|
|
471
471
|
return responseData.Data;
|
|
472
472
|
},
|
|
473
473
|
};
|
package/sdk/api/datetime.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { DateTimeEncodedType, DateEncodedType } from '../types/common';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Utility functions for datetime encoding/decoding
|
|
@@ -7,27 +7,27 @@ import type { DateTimeEncoded, DateEncoded } from '../types/common';
|
|
|
7
7
|
/**
|
|
8
8
|
* Encode a Date object to API datetime format
|
|
9
9
|
*/
|
|
10
|
-
export function encodeDatetime(date: Date):
|
|
10
|
+
export function encodeDatetime(date: Date): DateTimeEncodedType {
|
|
11
11
|
return { $__dt__: date.getTime() / 1000 };
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Decode API datetime format to Date object
|
|
16
16
|
*/
|
|
17
|
-
export function decodeDatetime(encoded:
|
|
17
|
+
export function decodeDatetime(encoded: DateTimeEncodedType): Date {
|
|
18
18
|
return new Date(encoded.$__dt__ * 1000);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Encode a Date object to API date format (YYYY-MM-DD)
|
|
23
23
|
*/
|
|
24
|
-
export function encodeDate(date: Date):
|
|
24
|
+
export function encodeDate(date: Date): DateEncodedType {
|
|
25
25
|
return { $__d__: date.toISOString().split('T')[0] };
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Decode API date format to Date object
|
|
30
30
|
*/
|
|
31
|
-
export function decodeDate(encoded:
|
|
31
|
+
export function decodeDate(encoded: DateEncodedType): Date {
|
|
32
32
|
return new Date(encoded.$__d__);
|
|
33
33
|
}
|