@ram_28/kf-ai-sdk 2.0.18 → 2.0.20-beta.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.
Files changed (107) hide show
  1. package/README.md +8 -16
  2. package/dist/{FileField-CZjS2uLh.js → FileField-BWrSHNRq.js} +3 -3
  3. package/dist/{FileField-DU4UWo_t.cjs → FileField-eDeuzln8.cjs} +1 -1
  4. package/dist/api.cjs +1 -1
  5. package/dist/api.mjs +1 -1
  6. package/dist/auth/authClient.d.ts.map +1 -1
  7. package/dist/auth/authConfig.d.ts +1 -1
  8. package/dist/auth/types.d.ts +1 -1
  9. package/dist/auth/types.d.ts.map +1 -1
  10. package/dist/auth.cjs +1 -1
  11. package/dist/auth.mjs +102 -106
  12. package/dist/bdo/core/Item.d.ts +4 -0
  13. package/dist/bdo/core/Item.d.ts.map +1 -1
  14. package/dist/bdo/fields/ReferenceField.d.ts +1 -1
  15. package/dist/bdo/fields/ReferenceField.d.ts.map +1 -1
  16. package/dist/bdo/fields/SelectField.d.ts +1 -1
  17. package/dist/bdo/fields/SelectField.d.ts.map +1 -1
  18. package/dist/bdo/fields/UserField.d.ts +1 -1
  19. package/dist/bdo/fields/UserField.d.ts.map +1 -1
  20. package/dist/bdo.cjs +1 -1
  21. package/dist/bdo.mjs +62 -53
  22. package/dist/components/hooks/useActivityForm/types.d.ts +5 -4
  23. package/dist/components/hooks/useActivityForm/types.d.ts.map +1 -1
  24. package/dist/components/hooks/useActivityForm/useActivityForm.d.ts.map +1 -1
  25. package/dist/components/hooks/useActivityTable/types.d.ts +4 -5
  26. package/dist/components/hooks/useActivityTable/types.d.ts.map +1 -1
  27. package/dist/components/hooks/useActivityTable/useActivityTable.d.ts.map +1 -1
  28. package/dist/components/hooks/useBDOForm/createItemProxy.d.ts +3 -2
  29. package/dist/components/hooks/useBDOForm/createItemProxy.d.ts.map +1 -1
  30. package/dist/components/hooks/useBDOTable/types.d.ts +12 -20
  31. package/dist/components/hooks/useBDOTable/types.d.ts.map +1 -1
  32. package/dist/components/hooks/useBDOTable/useBDOTable.d.ts +2 -2
  33. package/dist/components/hooks/useBDOTable/useBDOTable.d.ts.map +1 -1
  34. package/dist/{constants-Cyi942Yr.js → constants-ConHc1oS.js} +5 -5
  35. package/dist/constants-QX2RX-wu.cjs +1 -0
  36. package/dist/filter.cjs +1 -1
  37. package/dist/filter.mjs +1 -1
  38. package/dist/form.cjs +1 -1
  39. package/dist/form.mjs +243 -226
  40. package/dist/table.cjs +1 -1
  41. package/dist/table.mjs +16 -15
  42. package/dist/table.types.d.ts +1 -1
  43. package/dist/table.types.d.ts.map +1 -1
  44. package/dist/types/constants.d.ts +1 -1
  45. package/dist/workflow/Activity.d.ts +5 -8
  46. package/dist/workflow/Activity.d.ts.map +1 -1
  47. package/dist/workflow.cjs +1 -1
  48. package/dist/workflow.mjs +476 -461
  49. package/docs/api.md +95 -0
  50. package/docs/bdo.md +224 -0
  51. package/docs/gaps.md +360 -0
  52. package/docs/useActivityForm.md +393 -0
  53. package/docs/useActivityTable.md +418 -0
  54. package/docs/useBDOForm.md +498 -0
  55. package/docs/useBDOTable.md +284 -0
  56. package/docs/useFilter.md +188 -0
  57. package/docs/workflow.md +560 -0
  58. package/package.json +14 -15
  59. package/sdk/auth/authClient.ts +15 -21
  60. package/sdk/auth/authConfig.ts +1 -1
  61. package/sdk/auth/types.ts +1 -1
  62. package/sdk/bdo/core/Item.ts +10 -1
  63. package/sdk/bdo/fields/ReferenceField.ts +1 -1
  64. package/sdk/bdo/fields/SelectField.ts +1 -1
  65. package/sdk/bdo/fields/UserField.ts +1 -1
  66. package/sdk/components/hooks/useActivityForm/types.ts +6 -4
  67. package/sdk/components/hooks/useActivityForm/useActivityForm.ts +73 -10
  68. package/sdk/components/hooks/useActivityTable/types.ts +5 -4
  69. package/sdk/components/hooks/useActivityTable/useActivityTable.ts +8 -10
  70. package/sdk/components/hooks/useBDOForm/createItemProxy.ts +58 -17
  71. package/sdk/components/hooks/useBDOTable/types.ts +10 -20
  72. package/sdk/components/hooks/useBDOTable/useBDOTable.ts +8 -12
  73. package/sdk/table.types.ts +0 -2
  74. package/sdk/types/constants.ts +1 -1
  75. package/sdk/workflow/Activity.ts +7 -39
  76. package/dist/constants-DEmYwKfC.cjs +0 -1
  77. package/docs/README.md +0 -57
  78. package/docs/bdo/README.md +0 -161
  79. package/docs/bdo/api_reference.md +0 -281
  80. package/docs/examples/bdo/create-product.md +0 -69
  81. package/docs/examples/bdo/edit-product-dialog.md +0 -95
  82. package/docs/examples/bdo/filtered-product-table.md +0 -100
  83. package/docs/examples/bdo/product-listing.md +0 -73
  84. package/docs/examples/bdo/supplier-dropdown.md +0 -60
  85. package/docs/examples/fields/complex-fields.md +0 -248
  86. package/docs/examples/fields/primitive-fields.md +0 -217
  87. package/docs/examples/workflow/approve-leave-request.md +0 -76
  88. package/docs/examples/workflow/filtered-activity-table.md +0 -101
  89. package/docs/examples/workflow/my-pending-requests.md +0 -90
  90. package/docs/examples/workflow/start-new-workflow.md +0 -47
  91. package/docs/examples/workflow/submit-leave-request.md +0 -72
  92. package/docs/examples/workflow/workflow-progress.md +0 -49
  93. package/docs/fields/README.md +0 -141
  94. package/docs/fields/api_reference.md +0 -134
  95. package/docs/useActivityForm/README.md +0 -244
  96. package/docs/useActivityForm/api_reference.md +0 -279
  97. package/docs/useActivityTable/README.md +0 -263
  98. package/docs/useActivityTable/api_reference.md +0 -294
  99. package/docs/useBDOForm/README.md +0 -175
  100. package/docs/useBDOForm/api_reference.md +0 -244
  101. package/docs/useBDOTable/README.md +0 -242
  102. package/docs/useBDOTable/api_reference.md +0 -253
  103. package/docs/useFilter/README.md +0 -323
  104. package/docs/useFilter/api_reference.md +0 -228
  105. package/docs/workflow/README.md +0 -158
  106. package/docs/workflow/api_reference.md +0 -161
  107. /package/docs/{useAuth/README.md → useAuth.md} +0 -0
package/README.md CHANGED
@@ -461,22 +461,14 @@ cn("text-red-500", condition && "text-blue-500");
461
461
 
462
462
  ## Documentation
463
463
 
464
- Detailed, use-case-driven documentation with examples for each module:
465
-
466
- **Hooks:**
467
- - [useBDOForm](./docs/useBDOForm/README.md) — BDO-integrated forms with validation and API submission
468
- - [useBDOTable](./docs/useBDOTable/README.md) — Data tables with sorting, search, filtering, and pagination
469
- - [useActivityForm](./docs/useActivityForm/README.md) — Workflow activity forms with save-draft and complete
470
- - [useActivityTable](./docs/useActivityTable/README.md) — Activity instance tables for workflow tasks
471
- - [useFilter](./docs/useFilter/README.md) — Filter condition builder with nested groups
472
-
473
- **Core:**
474
- - [BDO](./docs/bdo/README.md) — Type-safe, role-based data access layer
475
- - [Workflow](./docs/workflow/README.md) — Business process orchestration
476
- - [API Client](./docs/api/README.md) — Low-level CRUD, metric, pivot, draft, and attachment operations
477
-
478
- **Auth:**
479
- - [useAuth](./docs/useAuth/README.md) — Cookie-based authentication with session management
464
+ Detailed documentation for each feature:
465
+
466
+ - [useBDOTable Documentation](./docs/useBDOTable.md)
467
+ - [useActivityTable Documentation](./docs/useActivityTable.md)
468
+ - [useFilter Documentation](./docs/useFilter.md)
469
+ - [useBDOForm Documentation](./docs/useBDOForm.md)
470
+ - [useAuth Documentation](./docs/useAuth.md)
471
+ - [API Documentation](./docs/api.md)
480
472
 
481
473
  ## Requirements
482
474
 
@@ -169,7 +169,7 @@ class _ extends s {
169
169
  /**
170
170
  * Fetch dynamic options from the backend, returned as typed SelectOption[]
171
171
  */
172
- async fetchOptions(e = "draft") {
172
+ async fetchOptions(e) {
173
173
  if (!this._parentBoId)
174
174
  throw new Error(
175
175
  `Field ${this.id} not bound to a BDO. Cannot fetch options.`
@@ -217,7 +217,7 @@ class v extends s {
217
217
  * Fetch referenced records from the backend via the fetchField API.
218
218
  * Requires the field to be bound to a parent BDO.
219
219
  */
220
- async fetchOptions(e = "draft") {
220
+ async fetchOptions(e) {
221
221
  if (!this._parentBoId)
222
222
  throw new Error(
223
223
  `Field ${this.id} not bound to a BDO. Cannot fetch options.`
@@ -238,7 +238,7 @@ class g extends s {
238
238
  * Fetch user records from the backend via the fetchField API.
239
239
  * Requires the field to be bound to a parent BDO.
240
240
  */
241
- async fetchOptions(e = "draft") {
241
+ async fetchOptions(e) {
242
242
  if (!this._parentBoId)
243
243
  throw new Error(
244
244
  `Field ${this.id} not bound to a BDO. Cannot fetch options.`
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var o=(r,e,t)=>e in r?l(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var a=(r,e,t)=>o(r,typeof e!="symbol"?e+"":e,t);const n=require("./client-D5k4SYuw.cjs");class i{constructor(e){a(this,"_meta");a(this,"_parentBoId");this._meta=e}get id(){return this._meta._id}get label(){return this._meta.Name||this._meta._id}get readOnly(){return this._meta.ReadOnly??!1}get required(){var e;return((e=this._meta.Constraint)==null?void 0:e.Required)??this._meta.Required??!1}get defaultValue(){var e;return this._meta.DefaultValue??((e=this._meta.Constraint)==null?void 0:e.DefaultValue)}get primaryKey(){var e;return((e=this._meta.Constraint)==null?void 0:e.PrimaryKey)??!1}get meta(){return this._meta}}class d extends i{constructor(e){super(e)}get length(){var e;return(e=this._meta.Constraint)==null?void 0:e.Length}validate(e){return e!=null&&typeof e!="string"?{valid:!1,errors:[`${this.label} must be a string`]}:{valid:!0,errors:[]}}}class u extends i{constructor(e){super(e)}get integerPart(){var e;return((e=this._meta.Constraint)==null?void 0:e.IntegerPart)??9}get fractionPart(){var e;return(e=this._meta.Constraint)==null?void 0:e.FractionPart}validate(e){return e==null||e===""?{valid:!0,errors:[]}:typeof e!="number"||isNaN(e)?{valid:!1,errors:[`${this.label} must be a valid number`]}:{valid:!0,errors:[]}}}class f extends i{constructor(e){super(e)}validate(e){return e!=null&&typeof e!="boolean"?{valid:!1,errors:[`${this.label} must be a boolean`]}:{valid:!0,errors:[]}}}class c extends i{constructor(e){super(e)}validate(e){if(e==null||e==="")return{valid:!0,errors:[]};if(typeof e!="string")return{valid:!1,errors:[`${this.label} must be a valid date string`]};if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return{valid:!1,errors:[`${this.label} must be in YYYY-MM-DD format`]};const t=new Date(e+"T00:00:00");return isNaN(t.getTime())?{valid:!1,errors:[`${this.label} is not a valid date`]}:{valid:!0,errors:[]}}}class h extends i{constructor(e){super(e)}get precision(){var e;return((e=this._meta.Constraint)==null?void 0:e.Precision)??"Second"}validate(e){if(e==null||e==="")return{valid:!0,errors:[]};if(typeof e!="string")return{valid:!1,errors:[`${this.label} must be a valid date string`]};const t=new Date(e);return isNaN(t.getTime())?{valid:!1,errors:[`${this.label} is not a valid date`]}:{valid:!0,errors:[]}}}class m extends i{constructor(e){super(e)}get format(){var e;return((e=this._meta.Constraint)==null?void 0:e.Format)??"Plain"}validate(e){return e!=null&&typeof e!="string"?{valid:!1,errors:[`${this.label} must be a string`]}:{valid:!0,errors:[]}}}class b extends i{constructor(e){super(e)}get options(){var t;return(((t=this._meta.Constraint)==null?void 0:t.Enum)??[]).map(s=>({value:s,label:s}))}validate(e){if(e==null||e==="")return{valid:!0,errors:[]};if(this.options.length===0)return{valid:!0,errors:[]};const t=this.options.map(s=>s.value);return t.includes(e)?{valid:!0,errors:[]}:{valid:!1,errors:[`${this.label} must be one of: ${t.join(", ")}`]}}async fetchOptions(e="draft"){if(!this._parentBoId)throw new Error(`Field ${this.id} not bound to a BDO. Cannot fetch options.`);return(await n.api(this._parentBoId).fetchField(e,this.id)).map(s=>({value:s.Value,label:s.Label}))}}class p extends i{constructor(e){super(e)}get referenceBdo(){var e,t;return((t=(e=this._meta.View)==null?void 0:e.DataObject)==null?void 0:t.Id)??""}get referenceFields(){var e;return((e=this._meta.View)==null?void 0:e.Fields)??["_id"]}get searchFields(){var e;return((e=this._meta.View)==null?void 0:e.Search)??[]}validate(e){if(e==null)return{valid:!0,errors:[]};if(typeof e!="object")return{valid:!1,errors:[`${this.label} must be a valid reference object`]};const t=e;return!("_id"in t)||typeof t._id!="string"?{valid:!1,errors:[`${this.label} must have a valid _id`]}:{valid:!0,errors:[]}}async fetchOptions(e="draft"){if(!this._parentBoId)throw new Error(`Field ${this.id} not bound to a BDO. Cannot fetch options.`);return n.api(this._parentBoId).fetchField(e,this.id)}}class _ extends i{constructor(e){super(e)}get businessEntity(){var e;return(e=this._meta.View)==null?void 0:e.BusinessEntity}async fetchOptions(e="draft"){if(!this._parentBoId)throw new Error(`Field ${this.id} not bound to a BDO. Cannot fetch options.`);return n.api(this._parentBoId).fetchField(e,this.id)}validate(e){if(e==null)return{valid:!0,errors:[]};if(typeof e!="object")return{valid:!1,errors:[`${this.label} must be a valid user object`]};const t=e;return!("_id"in t)||typeof t._id!="string"?{valid:!1,errors:[`${this.label} must have a valid _id`]}:{valid:!0,errors:[]}}}class v extends i{constructor(e){super(e)}validate(e){if(e==null)return{valid:!0,errors:[]};if(!Array.isArray(e))return{valid:!1,errors:[`${this.label} must be an array of file objects`]};for(const t of e)if(!t||typeof t!="object"||!t._id)return{valid:!1,errors:[`Each file in ${this.label} must have an _id`]};return{valid:!0,errors:[]}}}exports.BaseField=i;exports.BooleanField=f;exports.DateField=c;exports.DateTimeField=h;exports.FileField=v;exports.NumberField=u;exports.ReferenceField=p;exports.SelectField=b;exports.StringField=d;exports.TextField=m;exports.UserField=_;
1
+ "use strict";var l=Object.defineProperty;var o=(r,e,t)=>e in r?l(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var a=(r,e,t)=>o(r,typeof e!="symbol"?e+"":e,t);const n=require("./client-D5k4SYuw.cjs");class i{constructor(e){a(this,"_meta");a(this,"_parentBoId");this._meta=e}get id(){return this._meta._id}get label(){return this._meta.Name||this._meta._id}get readOnly(){return this._meta.ReadOnly??!1}get required(){var e;return((e=this._meta.Constraint)==null?void 0:e.Required)??this._meta.Required??!1}get defaultValue(){var e;return this._meta.DefaultValue??((e=this._meta.Constraint)==null?void 0:e.DefaultValue)}get primaryKey(){var e;return((e=this._meta.Constraint)==null?void 0:e.PrimaryKey)??!1}get meta(){return this._meta}}class d extends i{constructor(e){super(e)}get length(){var e;return(e=this._meta.Constraint)==null?void 0:e.Length}validate(e){return e!=null&&typeof e!="string"?{valid:!1,errors:[`${this.label} must be a string`]}:{valid:!0,errors:[]}}}class u extends i{constructor(e){super(e)}get integerPart(){var e;return((e=this._meta.Constraint)==null?void 0:e.IntegerPart)??9}get fractionPart(){var e;return(e=this._meta.Constraint)==null?void 0:e.FractionPart}validate(e){return e==null||e===""?{valid:!0,errors:[]}:typeof e!="number"||isNaN(e)?{valid:!1,errors:[`${this.label} must be a valid number`]}:{valid:!0,errors:[]}}}class f extends i{constructor(e){super(e)}validate(e){return e!=null&&typeof e!="boolean"?{valid:!1,errors:[`${this.label} must be a boolean`]}:{valid:!0,errors:[]}}}class c extends i{constructor(e){super(e)}validate(e){if(e==null||e==="")return{valid:!0,errors:[]};if(typeof e!="string")return{valid:!1,errors:[`${this.label} must be a valid date string`]};if(!/^\d{4}-\d{2}-\d{2}$/.test(e))return{valid:!1,errors:[`${this.label} must be in YYYY-MM-DD format`]};const t=new Date(e+"T00:00:00");return isNaN(t.getTime())?{valid:!1,errors:[`${this.label} is not a valid date`]}:{valid:!0,errors:[]}}}class h extends i{constructor(e){super(e)}get precision(){var e;return((e=this._meta.Constraint)==null?void 0:e.Precision)??"Second"}validate(e){if(e==null||e==="")return{valid:!0,errors:[]};if(typeof e!="string")return{valid:!1,errors:[`${this.label} must be a valid date string`]};const t=new Date(e);return isNaN(t.getTime())?{valid:!1,errors:[`${this.label} is not a valid date`]}:{valid:!0,errors:[]}}}class m extends i{constructor(e){super(e)}get format(){var e;return((e=this._meta.Constraint)==null?void 0:e.Format)??"Plain"}validate(e){return e!=null&&typeof e!="string"?{valid:!1,errors:[`${this.label} must be a string`]}:{valid:!0,errors:[]}}}class b extends i{constructor(e){super(e)}get options(){var t;return(((t=this._meta.Constraint)==null?void 0:t.Enum)??[]).map(s=>({value:s,label:s}))}validate(e){if(e==null||e==="")return{valid:!0,errors:[]};if(this.options.length===0)return{valid:!0,errors:[]};const t=this.options.map(s=>s.value);return t.includes(e)?{valid:!0,errors:[]}:{valid:!1,errors:[`${this.label} must be one of: ${t.join(", ")}`]}}async fetchOptions(e){if(!this._parentBoId)throw new Error(`Field ${this.id} not bound to a BDO. Cannot fetch options.`);return(await n.api(this._parentBoId).fetchField(e,this.id)).map(s=>({value:s.Value,label:s.Label}))}}class p extends i{constructor(e){super(e)}get referenceBdo(){var e,t;return((t=(e=this._meta.View)==null?void 0:e.DataObject)==null?void 0:t.Id)??""}get referenceFields(){var e;return((e=this._meta.View)==null?void 0:e.Fields)??["_id"]}get searchFields(){var e;return((e=this._meta.View)==null?void 0:e.Search)??[]}validate(e){if(e==null)return{valid:!0,errors:[]};if(typeof e!="object")return{valid:!1,errors:[`${this.label} must be a valid reference object`]};const t=e;return!("_id"in t)||typeof t._id!="string"?{valid:!1,errors:[`${this.label} must have a valid _id`]}:{valid:!0,errors:[]}}async fetchOptions(e){if(!this._parentBoId)throw new Error(`Field ${this.id} not bound to a BDO. Cannot fetch options.`);return n.api(this._parentBoId).fetchField(e,this.id)}}class _ extends i{constructor(e){super(e)}get businessEntity(){var e;return(e=this._meta.View)==null?void 0:e.BusinessEntity}async fetchOptions(e){if(!this._parentBoId)throw new Error(`Field ${this.id} not bound to a BDO. Cannot fetch options.`);return n.api(this._parentBoId).fetchField(e,this.id)}validate(e){if(e==null)return{valid:!0,errors:[]};if(typeof e!="object")return{valid:!1,errors:[`${this.label} must be a valid user object`]};const t=e;return!("_id"in t)||typeof t._id!="string"?{valid:!1,errors:[`${this.label} must have a valid _id`]}:{valid:!0,errors:[]}}}class v extends i{constructor(e){super(e)}validate(e){if(e==null)return{valid:!0,errors:[]};if(!Array.isArray(e))return{valid:!1,errors:[`${this.label} must be an array of file objects`]};for(const t of e)if(!t||typeof t!="object"||!t._id)return{valid:!1,errors:[`Each file in ${this.label} must have an _id`]};return{valid:!0,errors:[]}}}exports.BaseField=i;exports.BooleanField=f;exports.DateField=c;exports.DateTimeField=h;exports.FileField=v;exports.NumberField=u;exports.ReferenceField=p;exports.SelectField=b;exports.StringField=d;exports.TextField=m;exports.UserField=_;
package/dist/api.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./client-D5k4SYuw.cjs"),u=require("./metadata-DWXQPDav.cjs"),o=require("./constants-DEmYwKfC.cjs"),p={DATE:"%Y-%m-%d",TIME:"%H:%M:%S",DATE_TIME:"%Y-%m-%d %H:%M:%S"};function D(t){const[e,a,r]=t.$__d__.split("-").map(Number);return new Date(e,a-1,r)}function g(t){return new Date(t.$__dt__*1e3)}function l(t){const e=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${e}-${a}-${r}`}function S(t){const e=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0");return`${e}-${a}-${r} ${s}:${i}:${c}`}function y(t){const[e,a,r]=t.split("-").map(Number);return new Date(e,a-1,r)}function f(t){const[e,a]=t.split(" "),[r,s,i]=e.split("-").map(Number),[c,d,m]=a.split(":").map(Number);return new Date(r,s-1,i,c,d,m)}exports.api=n.api;exports.getApiBaseUrl=n.getApiBaseUrl;exports.getDefaultHeaders=n.getDefaultHeaders;exports.setApiBaseUrl=n.setApiBaseUrl;exports.setDefaultHeaders=n.setDefaultHeaders;exports.getBdoSchema=u.getBdoSchema;exports.listMetadata=u.listMetadata;exports.DateEncodingKey=o.DateEncodingKey;exports.DeleteStatus=o.DeleteStatus;exports.HttpMethod=o.HttpMethod;exports.MetricType=o.MetricType;exports.QueryType=o.QueryType;exports.DatetimeFormat=p;exports.decodeDate=D;exports.decodeDateTime=g;exports.formatDate=l;exports.formatDateTime=S;exports.parseDate=y;exports.parseDateTime=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./client-D5k4SYuw.cjs"),u=require("./metadata-DWXQPDav.cjs"),o=require("./constants-QX2RX-wu.cjs"),p={DATE:"%Y-%m-%d",TIME:"%H:%M:%S",DATE_TIME:"%Y-%m-%d %H:%M:%S"};function D(t){const[e,a,r]=t.$__d__.split("-").map(Number);return new Date(e,a-1,r)}function g(t){return new Date(t.$__dt__*1e3)}function l(t){const e=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0");return`${e}-${a}-${r}`}function S(t){const e=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),i=String(t.getMinutes()).padStart(2,"0"),c=String(t.getSeconds()).padStart(2,"0");return`${e}-${a}-${r} ${s}:${i}:${c}`}function y(t){const[e,a,r]=t.split("-").map(Number);return new Date(e,a-1,r)}function f(t){const[e,a]=t.split(" "),[r,s,i]=e.split("-").map(Number),[c,d,m]=a.split(":").map(Number);return new Date(r,s-1,i,c,d,m)}exports.api=n.api;exports.getApiBaseUrl=n.getApiBaseUrl;exports.getDefaultHeaders=n.getDefaultHeaders;exports.setApiBaseUrl=n.setApiBaseUrl;exports.setDefaultHeaders=n.setDefaultHeaders;exports.getBdoSchema=u.getBdoSchema;exports.listMetadata=u.listMetadata;exports.DateEncodingKey=o.DateEncodingKey;exports.DeleteStatus=o.DeleteStatus;exports.HttpMethod=o.HttpMethod;exports.MetricType=o.MetricType;exports.QueryType=o.QueryType;exports.DatetimeFormat=p;exports.decodeDate=D;exports.decodeDateTime=g;exports.formatDate=l;exports.formatDateTime=S;exports.parseDate=y;exports.parseDateTime=f;
package/dist/api.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { a as f, c as h, g as M, s as $, b as T } from "./client-_ayziI1d.js";
2
2
  import { g as H, l as b } from "./metadata-Cc1mBcLS.js";
3
- import { a as w, b as x, H as A, M as N, Q as Y } from "./constants-Cyi942Yr.js";
3
+ import { a as w, b as x, H as A, M as N, Q as Y } from "./constants-ConHc1oS.js";
4
4
  const m = {
5
5
  /** Date format: "YYYY-MM-DD" */
6
6
  DATE: "%Y-%m-%d",
@@ -1 +1 @@
1
- {"version":3,"file":"authClient.d.ts","sourceRoot":"","sources":["../../sdk/auth/authClient.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAQjB;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAgB,UAAU,EAAE,MAAM,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAKhD;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAuBjE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,CAAC,EAAE,oBAAoB,EAC/B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,KAAK,CAAC,CA0DhB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyB9E"}
1
+ {"version":3,"file":"authClient.d.ts","sourceRoot":"","sources":["../../sdk/auth/authClient.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAIjB;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,SAAgB,UAAU,EAAE,MAAM,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAKhD;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAuBjE;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,CAAC,EAAE,oBAAoB,EAC/B,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,KAAK,CAAC,CA2DhB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CACjC,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,IAAI,CAAC,CAoBf"}
@@ -8,7 +8,7 @@ import type { AuthConfigType, AuthProviderNameType, AuthEndpointConfigType } fro
8
8
  * autoRedirect: true,
9
9
  * providers: {
10
10
  * google: { loginPath: "/api/auth/google/login" },
11
- * azure: { loginPath: "/api/auth/azure/login" },
11
+ * microsoft: { loginPath: "/api/auth/microsoft/login" },
12
12
  * },
13
13
  * });
14
14
  * ```
@@ -22,7 +22,7 @@ export type AuthStatusType = "loading" | "authenticated" | "unauthenticated";
22
22
  /**
23
23
  * Authentication provider type (extensible for multiple OAuth providers)
24
24
  */
25
- export type AuthProviderNameType = "google" | "azure" | "github" | "custom";
25
+ export type AuthProviderNameType = "google" | "microsoft" | "github" | "azure" | "custom";
26
26
  /**
27
27
  * Auth endpoint configuration for a specific provider
28
28
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../sdk/auth/types.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,eAAe,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,QAAQ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9B,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,iBAAiB;IAC7D,uCAAuC;IACvC,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB"}
package/dist/auth.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var J=Object.defineProperty;var X=(e,t,n)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var M=(e,t,n)=>X(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),r=require("react"),N=require("@tanstack/react-query"),L=require("./client-D5k4SYuw.cjs"),W=require("./constants-DEmYwKfC.cjs"),H={sessionEndpoint:"/api/id",providers:{google:{loginPath:"/api/auth/google/login",logoutPath:"/api/auth/logout"}},defaultProvider:"google",autoRedirect:!1,sessionCheckInterval:0,retry:{count:3,delay:1e3},staleTime:5*60*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!0};let h={...H};function Y(e){h={...h,...e,providers:{...h.providers,...e.providers},retry:{...h.retry,...e.retry}}}function Z(e,t){h.providers[e]=t}function b(){return{...h}}function k(){return h.baseUrl||L.getApiBaseUrl()||(typeof window<"u"?window.location.origin:"")}function G(e){return h.providers[e]}function D(){h={...H}}class E extends Error{constructor(n,o){super(n);M(this,"statusCode");this.name="AuthenticationError",this.statusCode=o}}async function ee(){const e=b(),t=k(),n=L.getDefaultHeaders(),o=await fetch(`${t}${e.sessionEndpoint}`,{method:"GET",headers:n,credentials:"include"});if(!o.ok)throw o.status===401||o.status===403?new E("Not authenticated",o.status):new E(`Session check failed: ${o.statusText}`,o.status);return await o.json()}function _(e,t){return new Promise(()=>{const n=b(),o=k();if(!o)throw new Error('Auth base URL is not configured. Call setApiBaseUrl("https://...") or configureAuth({ baseUrl: "https://..." }) first.');const u=e||n.defaultProvider,c=G(u);if(!c){const A=Object.keys(n.providers||{}).join(", ")||"none";throw new Error(`Auth provider "${u}" is not configured. Available providers: ${A}`)}if(!c.loginPath)throw new Error(`Login path not configured for provider "${u}". Configure it with: configureAuth({ providers: { ${u}: { loginPath: '/api/auth/...' } } })`);let f;try{f=new URL(`${o}${c.loginPath}`)}catch{throw new Error(`Failed to construct login URL. Base URL: "${o}", Login path: "${c.loginPath}". Ensure baseUrl is a valid URL (e.g., "https://example.com").`)}(t!=null&&t.callbackUrl||n.callbackUrl)&&f.searchParams.set("callbackUrl",(t==null?void 0:t.callbackUrl)||n.callbackUrl||window.location.href),t!=null&&t.params&&Object.entries(t.params).forEach(([A,v])=>{f.searchParams.set(A,v)}),window.open(f.toString(),"_blank")})}async function te(e){const t=b(),n=k(),o=L.getDefaultHeaders(),u=G(t.defaultProvider),c=u==null?void 0:u.logoutPath;if(c&&(e==null?void 0:e.callLogoutEndpoint)!==!1)try{await fetch(`${n}${c}`,{method:"POST",headers:o,credentials:"include"})}catch(f){console.warn("Logout endpoint call failed:",f)}e!=null&&e.redirectUrl?window.location.href=e.redirectUrl:t.loginRedirectUrl&&(window.location.href=t.loginRedirectUrl)}const V=r.createContext(null),K=["auth","session"];function re({children:e,config:t,onAuthChange:n,onError:o,loadingComponent:u,unauthenticatedComponent:c,skipInitialCheck:f=!1}){const A=r.useRef(!1);t&&!A.current&&(Y(t),A.current=!0);const v=N.useQueryClient(),l=b(),{data:a,isLoading:g,error:U,refetch:R,isFetching:P}=N.useQuery({queryKey:K,queryFn:ee,enabled:!f,retry:(s,w)=>w instanceof E&&(w.statusCode===401||w.statusCode===403)?!1:s<l.retry.count,retryDelay:l.retry.delay,staleTime:l.staleTime,gcTime:l.staleTime*2,refetchOnWindowFocus:l.refetchOnWindowFocus??!0,refetchOnReconnect:l.refetchOnReconnect??!0,refetchInterval:l.sessionCheckInterval||!1}),[x,S]=r.useState(null),d=r.useMemo(()=>g||P?"loading":Object.keys((a==null?void 0:a.userDetails)||{}).length>0?"authenticated":"unauthenticated",[g,P,a]),i=(a==null?void 0:a.userDetails)||null,$=(a==null?void 0:a.staticBaseUrl)||null,O=(a==null?void 0:a.buildId)||null,j=d==="authenticated",C=r.useRef(n);C.current=n;const m=r.useRef(o);m.current=o,r.useEffect(()=>{var s;g||(s=C.current)==null||s.call(C,d,i)},[d,i,g]),r.useEffect(()=>{var s;U&&(S(U),(s=m.current)==null||s.call(m,U))},[U]),r.useEffect(()=>{d==="unauthenticated"&&l.autoRedirect&&!g&&_()},[d,g,l.autoRedirect]);const p=r.useCallback((s,w)=>{_(s,w)},[]),q=r.useCallback(async s=>{v.removeQueries({queryKey:K}),await te(s)},[v]),B=r.useCallback(async()=>{if(P)return a||null;try{return(await R()).data||null}catch(s){return S(s),null}},[R,P,a]),I=r.useCallback(s=>(i==null?void 0:i.Role)===s,[i]),T=r.useCallback(s=>s.includes((i==null?void 0:i.Role)||""),[i]),F=r.useCallback(()=>{S(null)},[]),Q=r.useCallback(()=>{R()},[R]),z=r.useMemo(()=>({user:i,staticBaseUrl:$,buildId:O,status:d,isAuthenticated:j,isLoading:g,login:p,logout:q,refreshSession:B,hasRole:I,hasAnyRole:T,error:x,clearError:F,_forceCheck:Q}),[i,$,O,d,j,g,p,q,B,I,T,x,F,Q]);return d==="loading"&&u?y.jsx(y.Fragment,{children:u}):d==="unauthenticated"&&!l.autoRedirect&&c?y.jsx(y.Fragment,{children:c}):y.jsx(V.Provider,{value:z,children:e})}function ne(){const e=r.useContext(V);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}function oe(){const e=ne();return r.useMemo(()=>({user:e.user,staticBaseUrl:e.staticBaseUrl,buildId:e.buildId,status:e.status,isAuthenticated:e.isAuthenticated,isLoading:e.isLoading,login:e.login,logout:e.logout,refreshSession:e.refreshSession,hasRole:e.hasRole,hasAnyRole:e.hasAnyRole,error:e.error,clearError:e.clearError}),[e.user,e.staticBaseUrl,e.buildId,e.status,e.isAuthenticated,e.isLoading,e.login,e.logout,e.refreshSession,e.hasRole,e.hasAnyRole,e.error,e.clearError])}exports.AuthProviderName=W.AuthProviderName;exports.AuthStatus=W.AuthStatus;exports.AuthProvider=re;exports.AuthenticationError=E;exports.configureAuth=Y;exports.getAuthBaseUrl=k;exports.getAuthConfig=b;exports.resetAuthConfig=D;exports.setAuthProvider=Z;exports.useAuth=oe;
1
+ "use strict";var J=Object.defineProperty;var X=(e,t,o)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var Q=(e,t,o)=>X(e,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("react/jsx-runtime"),n=require("react"),M=require("@tanstack/react-query"),K=require("./client-D5k4SYuw.cjs"),W=require("./constants-QX2RX-wu.cjs"),Y={sessionEndpoint:"/api/id",providers:{google:{loginPath:"/api/auth/google/login",logoutPath:"/api/auth/logout"}},defaultProvider:"google",autoRedirect:!1,sessionCheckInterval:0,retry:{count:3,delay:1e3},staleTime:5*60*1e3,refetchOnWindowFocus:!1,refetchOnReconnect:!0};let h={...Y};function G(e){h={...h,...e,providers:{...h.providers,...e.providers},retry:{...h.retry,...e.retry}}}function Z(e,t){h.providers[e]=t}function b(){return{...h}}function k(){return h.baseUrl||K.getApiBaseUrl()||(typeof window<"u"?window.location.origin:"")}function H(e){return h.providers[e]}function D(){h={...Y}}class m extends Error{constructor(o,r){super(o);Q(this,"statusCode");this.name="AuthenticationError",this.statusCode=r}}async function ee(){const e=b(),t=k(),o=K.getDefaultHeaders(),r=await fetch(`${t}${e.sessionEndpoint}`,{method:"GET",headers:o,credentials:"include"});if(!r.ok)throw r.status===401||r.status===403?new m("Not authenticated",r.status):new m(`Session check failed: ${r.statusText}`,r.status);return await r.json()}function N(e,t){return new Promise(()=>{const o=b(),r=k();if(!r)throw new Error('Auth base URL is not configured. Call setApiBaseUrl("https://...") or configureAuth({ baseUrl: "https://..." }) first.');const i=e||o.defaultProvider,l=H(i);if(!l){const A=Object.keys(o.providers||{}).join(", ")||"none";throw new Error(`Auth provider "${i}" is not configured. Available providers: ${A}`)}if(!l.loginPath)throw new Error(`Login path not configured for provider "${i}". Configure it with: configureAuth({ providers: { ${i}: { loginPath: '/api/auth/...' } } })`);let g;try{g=new URL(`${r}${l.loginPath}`)}catch{throw new Error(`Failed to construct login URL. Base URL: "${r}", Login path: "${l.loginPath}". Ensure baseUrl is a valid URL (e.g., "https://example.com").`)}(t!=null&&t.callbackUrl||o.callbackUrl)&&g.searchParams.set("callbackUrl",(t==null?void 0:t.callbackUrl)||o.callbackUrl||window.location.href),t!=null&&t.params&&Object.entries(t.params).forEach(([A,v])=>{g.searchParams.set(A,v)}),window.open(g.toString(),"_blank")})}async function te(e){const t=b(),o=k(),r=H(t.defaultProvider),i=r==null?void 0:r.logoutPath;if(i&&(e==null?void 0:e.callLogoutEndpoint)!==!1)try{await fetch(`${o}${i}`)}catch(l){console.warn("Logout endpoint call failed:",l)}e!=null&&e.redirectUrl?window.location.href=e.redirectUrl:t.loginRedirectUrl&&(window.location.href=t.loginRedirectUrl)}const V=n.createContext(null),_=["auth","session"];function re({children:e,config:t,onAuthChange:o,onError:r,loadingComponent:i,unauthenticatedComponent:l,skipInitialCheck:g=!1}){const A=n.useRef(!1);t&&!A.current&&(G(t),A.current=!0);const v=M.useQueryClient(),c=b(),{data:u,isLoading:f,error:U,refetch:R,isFetching:C}=M.useQuery({queryKey:_,queryFn:ee,enabled:!g,retry:(s,w)=>w instanceof m&&(w.statusCode===401||w.statusCode===403)?!1:s<c.retry.count,retryDelay:c.retry.delay,staleTime:c.staleTime,gcTime:c.staleTime*2,refetchOnWindowFocus:c.refetchOnWindowFocus??!0,refetchOnReconnect:c.refetchOnReconnect??!0,refetchInterval:c.sessionCheckInterval||!1}),[S,L]=n.useState(null),d=n.useMemo(()=>f||C?"loading":Object.keys((u==null?void 0:u.userDetails)||{}).length>0?"authenticated":"unauthenticated",[f,C,u]),a=(u==null?void 0:u.userDetails)||null,x=(u==null?void 0:u.staticBaseUrl)||null,$=(u==null?void 0:u.buildId)||null,j=d==="authenticated",P=n.useRef(o);P.current=o;const E=n.useRef(r);E.current=r,n.useEffect(()=>{var s;f||(s=P.current)==null||s.call(P,d,a)},[d,a,f]),n.useEffect(()=>{var s;U&&(L(U),(s=E.current)==null||s.call(E,U))},[U]),n.useEffect(()=>{d==="unauthenticated"&&c.autoRedirect&&!f&&N()},[d,f,c.autoRedirect]);const p=n.useCallback((s,w)=>{N(s,w)},[]),q=n.useCallback(async s=>{v.removeQueries({queryKey:_}),await te(s)},[v]),B=n.useCallback(async()=>{if(C)return u||null;try{return(await R()).data||null}catch(s){return L(s),null}},[R,C,u]),O=n.useCallback(s=>(a==null?void 0:a.Role)===s,[a]),I=n.useCallback(s=>s.includes((a==null?void 0:a.Role)||""),[a]),F=n.useCallback(()=>{L(null)},[]),T=n.useCallback(()=>{R()},[R]),z=n.useMemo(()=>({user:a,staticBaseUrl:x,buildId:$,status:d,isAuthenticated:j,isLoading:f,login:p,logout:q,refreshSession:B,hasRole:O,hasAnyRole:I,error:S,clearError:F,_forceCheck:T}),[a,x,$,d,j,f,p,q,B,O,I,S,F,T]);return d==="loading"&&i?y.jsx(y.Fragment,{children:i}):d==="unauthenticated"&&!c.autoRedirect&&l?y.jsx(y.Fragment,{children:l}):y.jsx(V.Provider,{value:z,children:e})}function ne(){const e=n.useContext(V);if(!e)throw new Error("useAuth must be used within an AuthProvider");return e}function oe(){const e=ne();return n.useMemo(()=>({user:e.user,staticBaseUrl:e.staticBaseUrl,buildId:e.buildId,status:e.status,isAuthenticated:e.isAuthenticated,isLoading:e.isLoading,login:e.login,logout:e.logout,refreshSession:e.refreshSession,hasRole:e.hasRole,hasAnyRole:e.hasAnyRole,error:e.error,clearError:e.clearError}),[e.user,e.staticBaseUrl,e.buildId,e.status,e.isAuthenticated,e.isLoading,e.login,e.logout,e.refreshSession,e.hasRole,e.hasAnyRole,e.error,e.clearError])}exports.AuthProviderName=W.AuthProviderName;exports.AuthStatus=W.AuthStatus;exports.AuthProvider=re;exports.AuthenticationError=m;exports.configureAuth=G;exports.getAuthBaseUrl=k;exports.getAuthConfig=b;exports.resetAuthConfig=D;exports.setAuthProvider=Z;exports.useAuth=oe;
package/dist/auth.mjs CHANGED
@@ -1,12 +1,12 @@
1
- var X = Object.defineProperty;
2
- var Z = (e, t, r) => t in e ? X(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var N = (e, t, r) => Z(e, typeof t != "symbol" ? t + "" : t, r);
1
+ var J = Object.defineProperty;
2
+ var X = (e, t, n) => t in e ? J(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var N = (e, t, n) => X(e, typeof t != "symbol" ? t + "" : t, n);
4
4
  import { jsx as C, Fragment as W } from "react/jsx-runtime";
5
- import { useRef as p, useState as D, useMemo as k, useEffect as L, useCallback as g, createContext as ee, useContext as te } from "react";
6
- import { useQueryClient as re, useQuery as ne } from "@tanstack/react-query";
7
- import { c as oe, g as H } from "./client-_ayziI1d.js";
8
- import { c as me, A as be } from "./constants-Cyi942Yr.js";
9
- const M = {
5
+ import { useRef as p, useState as Z, useMemo as k, useEffect as L, useCallback as f, createContext as D, useContext as ee } from "react";
6
+ import { useQueryClient as te, useQuery as re } from "@tanstack/react-query";
7
+ import { c as ne, g as oe } from "./client-_ayziI1d.js";
8
+ import { c as me, A as be } from "./constants-ConHc1oS.js";
9
+ const H = {
10
10
  sessionEndpoint: "/api/id",
11
11
  providers: {
12
12
  google: {
@@ -25,7 +25,7 @@ const M = {
25
25
  refetchOnWindowFocus: !1,
26
26
  refetchOnReconnect: !0
27
27
  };
28
- let d = { ...M };
28
+ let d = { ...H };
29
29
  function ie(e) {
30
30
  d = {
31
31
  ...d,
@@ -43,193 +43,189 @@ function ie(e) {
43
43
  function ge(e, t) {
44
44
  d.providers[e] = t;
45
45
  }
46
- function P() {
46
+ function E() {
47
47
  return { ...d };
48
48
  }
49
- function S() {
50
- return d.baseUrl || oe() || (typeof window < "u" ? window.location.origin : "");
49
+ function $() {
50
+ return d.baseUrl || ne() || (typeof window < "u" ? window.location.origin : "");
51
51
  }
52
- function V(e) {
52
+ function M(e) {
53
53
  return d.providers[e];
54
54
  }
55
55
  function we() {
56
- d = { ...M };
56
+ d = { ...H };
57
57
  }
58
58
  class x extends Error {
59
- constructor(r, n) {
60
- super(r);
59
+ constructor(n, r) {
60
+ super(n);
61
61
  N(this, "statusCode");
62
- this.name = "AuthenticationError", this.statusCode = n;
62
+ this.name = "AuthenticationError", this.statusCode = r;
63
63
  }
64
64
  }
65
65
  async function ae() {
66
- const e = P(), t = S(), r = H(), n = await fetch(`${t}${e.sessionEndpoint}`, {
66
+ const e = E(), t = $(), n = oe(), r = await fetch(`${t}${e.sessionEndpoint}`, {
67
67
  method: "GET",
68
- headers: r,
68
+ headers: n,
69
69
  credentials: "include"
70
70
  });
71
- if (!n.ok)
72
- throw n.status === 401 || n.status === 403 ? new x("Not authenticated", n.status) : new x(
73
- `Session check failed: ${n.statusText}`,
74
- n.status
71
+ if (!r.ok)
72
+ throw r.status === 401 || r.status === 403 ? new x("Not authenticated", r.status) : new x(
73
+ `Session check failed: ${r.statusText}`,
74
+ r.status
75
75
  );
76
- return await n.json();
76
+ return await r.json();
77
77
  }
78
78
  function Y(e, t) {
79
79
  return new Promise(() => {
80
- const r = P(), n = S();
81
- if (!n)
80
+ const n = E(), r = $();
81
+ if (!r)
82
82
  throw new Error(
83
83
  'Auth base URL is not configured. Call setApiBaseUrl("https://...") or configureAuth({ baseUrl: "https://..." }) first.'
84
84
  );
85
- const a = e || r.defaultProvider, c = V(a);
86
- if (!c) {
87
- const w = Object.keys(r.providers || {}).join(", ") || "none";
85
+ const s = e || n.defaultProvider, u = M(s);
86
+ if (!u) {
87
+ const w = Object.keys(n.providers || {}).join(", ") || "none";
88
88
  throw new Error(
89
- `Auth provider "${a}" is not configured. Available providers: ${w}`
89
+ `Auth provider "${s}" is not configured. Available providers: ${w}`
90
90
  );
91
91
  }
92
- if (!c.loginPath)
92
+ if (!u.loginPath)
93
93
  throw new Error(
94
- `Login path not configured for provider "${a}". Configure it with: configureAuth({ providers: { ${a}: { loginPath: '/api/auth/...' } } })`
94
+ `Login path not configured for provider "${s}". Configure it with: configureAuth({ providers: { ${s}: { loginPath: '/api/auth/...' } } })`
95
95
  );
96
- let h;
96
+ let g;
97
97
  try {
98
- h = new URL(`${n}${c.loginPath}`);
98
+ g = new URL(`${r}${u.loginPath}`);
99
99
  } catch {
100
100
  throw new Error(
101
- `Failed to construct login URL. Base URL: "${n}", Login path: "${c.loginPath}". Ensure baseUrl is a valid URL (e.g., "https://example.com").`
101
+ `Failed to construct login URL. Base URL: "${r}", Login path: "${u.loginPath}". Ensure baseUrl is a valid URL (e.g., "https://example.com").`
102
102
  );
103
103
  }
104
- (t != null && t.callbackUrl || r.callbackUrl) && h.searchParams.set(
104
+ (t != null && t.callbackUrl || n.callbackUrl) && g.searchParams.set(
105
105
  "callbackUrl",
106
- (t == null ? void 0 : t.callbackUrl) || r.callbackUrl || window.location.href
106
+ (t == null ? void 0 : t.callbackUrl) || n.callbackUrl || window.location.href
107
107
  ), t != null && t.params && Object.entries(t.params).forEach(([w, A]) => {
108
- h.searchParams.set(w, A);
109
- }), window.open(h.toString(), "_blank");
108
+ g.searchParams.set(w, A);
109
+ }), window.open(g.toString(), "_blank");
110
110
  });
111
111
  }
112
112
  async function se(e) {
113
- const t = P(), r = S(), n = H(), a = V(t.defaultProvider), c = a == null ? void 0 : a.logoutPath;
114
- if (c && (e == null ? void 0 : e.callLogoutEndpoint) !== !1)
113
+ const t = E(), n = $(), r = M(t.defaultProvider), s = r == null ? void 0 : r.logoutPath;
114
+ if (s && (e == null ? void 0 : e.callLogoutEndpoint) !== !1)
115
115
  try {
116
- await fetch(`${r}${c}`, {
117
- method: "POST",
118
- headers: n,
119
- credentials: "include"
120
- });
121
- } catch (h) {
122
- console.warn("Logout endpoint call failed:", h);
116
+ await fetch(`${n}${s}`);
117
+ } catch (u) {
118
+ console.warn("Logout endpoint call failed:", u);
123
119
  }
124
120
  e != null && e.redirectUrl ? window.location.href = e.redirectUrl : t.loginRedirectUrl && (window.location.href = t.loginRedirectUrl);
125
121
  }
126
- const z = ee(null), G = ["auth", "session"];
122
+ const V = D(null), G = ["auth", "session"];
127
123
  function ye({
128
124
  children: e,
129
125
  config: t,
130
- onAuthChange: r,
131
- onError: n,
132
- loadingComponent: a,
133
- unauthenticatedComponent: c,
134
- skipInitialCheck: h = !1
126
+ onAuthChange: n,
127
+ onError: r,
128
+ loadingComponent: s,
129
+ unauthenticatedComponent: u,
130
+ skipInitialCheck: g = !1
135
131
  }) {
136
132
  const w = p(!1);
137
133
  t && !w.current && (ie(t), w.current = !0);
138
- const A = re(), u = P(), {
134
+ const A = te(), c = E(), {
139
135
  data: i,
140
- isLoading: f,
136
+ isLoading: h,
141
137
  error: U,
142
138
  refetch: v,
143
139
  isFetching: m
144
- } = ne({
140
+ } = re({
145
141
  queryKey: G,
146
142
  queryFn: ae,
147
- enabled: !h,
148
- retry: (o, y) => y instanceof x && (y.statusCode === 401 || y.statusCode === 403) ? !1 : o < u.retry.count,
149
- retryDelay: u.retry.delay,
150
- staleTime: u.staleTime,
151
- gcTime: u.staleTime * 2,
152
- refetchOnWindowFocus: u.refetchOnWindowFocus ?? !0,
153
- refetchOnReconnect: u.refetchOnReconnect ?? !0,
154
- refetchInterval: u.sessionCheckInterval || !1
155
- }), [$, E] = D(null), l = k(() => f || m ? "loading" : Object.keys((i == null ? void 0 : i.userDetails) || {}).length > 0 ? "authenticated" : "unauthenticated", [f, m, i]), s = (i == null ? void 0 : i.userDetails) || null, O = (i == null ? void 0 : i.staticBaseUrl) || null, B = (i == null ? void 0 : i.buildId) || null, I = l === "authenticated", b = p(r);
156
- b.current = r;
157
- const R = p(n);
158
- R.current = n, L(() => {
143
+ enabled: !g,
144
+ retry: (o, y) => y instanceof x && (y.statusCode === 401 || y.statusCode === 403) ? !1 : o < c.retry.count,
145
+ retryDelay: c.retry.delay,
146
+ staleTime: c.staleTime,
147
+ gcTime: c.staleTime * 2,
148
+ refetchOnWindowFocus: c.refetchOnWindowFocus ?? !0,
149
+ refetchOnReconnect: c.refetchOnReconnect ?? !0,
150
+ refetchInterval: c.sessionCheckInterval || !1
151
+ }), [S, P] = Z(null), l = k(() => h || m ? "loading" : Object.keys((i == null ? void 0 : i.userDetails) || {}).length > 0 ? "authenticated" : "unauthenticated", [h, m, i]), a = (i == null ? void 0 : i.userDetails) || null, B = (i == null ? void 0 : i.staticBaseUrl) || null, I = (i == null ? void 0 : i.buildId) || null, O = l === "authenticated", b = p(n);
152
+ b.current = n;
153
+ const R = p(r);
154
+ R.current = r, L(() => {
159
155
  var o;
160
- f || (o = b.current) == null || o.call(b, l, s);
161
- }, [l, s, f]), L(() => {
156
+ h || (o = b.current) == null || o.call(b, l, a);
157
+ }, [l, a, h]), L(() => {
162
158
  var o;
163
- U && (E(U), (o = R.current) == null || o.call(R, U));
159
+ U && (P(U), (o = R.current) == null || o.call(R, U));
164
160
  }, [U]), L(() => {
165
- l === "unauthenticated" && u.autoRedirect && !f && Y();
166
- }, [l, f, u.autoRedirect]);
167
- const T = g(
161
+ l === "unauthenticated" && c.autoRedirect && !h && Y();
162
+ }, [l, h, c.autoRedirect]);
163
+ const F = f(
168
164
  (o, y) => {
169
165
  Y(o, y);
170
166
  },
171
167
  []
172
- ), F = g(
168
+ ), T = f(
173
169
  async (o) => {
174
170
  A.removeQueries({ queryKey: G }), await se(o);
175
171
  },
176
172
  [A]
177
- ), j = g(async () => {
173
+ ), j = f(async () => {
178
174
  if (m)
179
175
  return i || null;
180
176
  try {
181
177
  return (await v()).data || null;
182
178
  } catch (o) {
183
- return E(o), null;
179
+ return P(o), null;
184
180
  }
185
- }, [v, m, i]), q = g(
186
- (o) => (s == null ? void 0 : s.Role) === o,
187
- [s]
188
- ), Q = g(
189
- (o) => o.includes((s == null ? void 0 : s.Role) || ""),
190
- [s]
191
- ), _ = g(() => {
192
- E(null);
193
- }, []), K = g(() => {
181
+ }, [v, m, i]), q = f(
182
+ (o) => (a == null ? void 0 : a.Role) === o,
183
+ [a]
184
+ ), Q = f(
185
+ (o) => o.includes((a == null ? void 0 : a.Role) || ""),
186
+ [a]
187
+ ), _ = f(() => {
188
+ P(null);
189
+ }, []), K = f(() => {
194
190
  v();
195
- }, [v]), J = k(
191
+ }, [v]), z = k(
196
192
  () => ({
197
- user: s,
198
- staticBaseUrl: O,
199
- buildId: B,
193
+ user: a,
194
+ staticBaseUrl: B,
195
+ buildId: I,
200
196
  status: l,
201
- isAuthenticated: I,
202
- isLoading: f,
203
- login: T,
204
- logout: F,
197
+ isAuthenticated: O,
198
+ isLoading: h,
199
+ login: F,
200
+ logout: T,
205
201
  refreshSession: j,
206
202
  hasRole: q,
207
203
  hasAnyRole: Q,
208
- error: $,
204
+ error: S,
209
205
  clearError: _,
210
206
  _forceCheck: K
211
207
  }),
212
208
  [
213
- s,
214
- O,
209
+ a,
215
210
  B,
216
- l,
217
211
  I,
218
- f,
219
- T,
212
+ l,
213
+ O,
214
+ h,
220
215
  F,
216
+ T,
221
217
  j,
222
218
  q,
223
219
  Q,
224
- $,
220
+ S,
225
221
  _,
226
222
  K
227
223
  ]
228
224
  );
229
- return l === "loading" && a ? /* @__PURE__ */ C(W, { children: a }) : l === "unauthenticated" && !u.autoRedirect && c ? /* @__PURE__ */ C(W, { children: c }) : /* @__PURE__ */ C(z.Provider, { value: J, children: e });
225
+ return l === "loading" && s ? /* @__PURE__ */ C(W, { children: s }) : l === "unauthenticated" && !c.autoRedirect && u ? /* @__PURE__ */ C(W, { children: u }) : /* @__PURE__ */ C(V.Provider, { value: z, children: e });
230
226
  }
231
227
  function ce() {
232
- const e = te(z);
228
+ const e = ee(V);
233
229
  if (!e)
234
230
  throw new Error("useAuth must be used within an AuthProvider");
235
231
  return e;
@@ -275,8 +271,8 @@ export {
275
271
  be as AuthStatus,
276
272
  x as AuthenticationError,
277
273
  ie as configureAuth,
278
- S as getAuthBaseUrl,
279
- P as getAuthConfig,
274
+ $ as getAuthBaseUrl,
275
+ E as getAuthConfig,
280
276
  we as resetAuthConfig,
281
277
  ge as setAuthProvider,
282
278
  Ae as useAuth
@@ -64,6 +64,10 @@ export declare class Item<T extends Record<string, unknown>> {
64
64
  private readonly _bdo;
65
65
  private readonly _accessorCache;
66
66
  constructor(bdo: BdoLike, data: Partial<T>);
67
+ /**
68
+ * Require instanceId or throw.
69
+ * TODO: Support create flow via draftInteraction to get temp _id
70
+ */
67
71
  private _requireInstanceId;
68
72
  /**
69
73
  * Get or create a field accessor for the given field.
@@ -1 +1 @@
1
- {"version":3,"file":"Item.d.ts","sourceRoot":"","sources":["../../../sdk/bdo/core/Item.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,yBAAyB,EACzB,iBAAiB,EACjB,8BAA8B,EAC9B,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAEV,cAAc,EACd,aAAa,EACd,MAAM,yBAAyB,CAAC;AAYjC;;GAEG;AACH,UAAU,OAAO;IACf,SAAS,IAAI,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC;IAChD,WAAW,IAAI,OAAO,CAAC;IACvB,uBAAuB,CACrB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,EACd,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,oBAAoB,CAAC;IACxB,OAAO,IAAI,MAAM,CAAC;CACnB;AAGD,YAAY,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,CAAC;AAE3G;;GAEG;AACH,KAAK,uBAAuB,CAAC,CAAC,IAC5B;IAAC,CAAC;CAAC,SAAS,CAAC,cAAc,CAAC,GACxB,8BAA8B,GAC9B,CAAC,CAAC,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GG;IACH,OAAO,CAAC,kBAAkB;IAU1B;;;OAGG;IACH,OAAO,CAAC,YAAY;IA6PpB;;OAEG;IACH,QAAQ,IAAI,oBAAoB;IAqChC;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC;CAGrB"}
@@ -28,6 +28,6 @@ export declare class ReferenceField<TRef = unknown> extends BaseField<ReferenceF
28
28
  * Fetch referenced records from the backend via the fetchField API.
29
29
  * Requires the field to be bound to a parent BDO.
30
30
  */
31
- fetchOptions(instanceId?: string): Promise<TRef[]>;
31
+ fetchOptions(instanceId: string): Promise<TRef[]>;
32
32
  }
33
33
  //# sourceMappingURL=ReferenceField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReferenceField.d.ts","sourceRoot":"","sources":["../../../sdk/bdo/fields/ReferenceField.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,sBAAsB,IAAI,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE/G,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAc,CAAC,IAAI,GAAG,OAAO,CAAE,SAAQ,SAAS,CAC3D,kBAAkB,CAAC,IAAI,CAAC,CACzB;gBACa,IAAI,EAAE,yBAAyB;IAI3C,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,IAAI,eAAe,IAAI,SAAS,MAAM,EAAE,CAEvC;IAED,IAAI,YAAY,IAAI,SAAS,MAAM,EAAE,CAEpC;IAED,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC,IAAI,CAAC,GAAG,SAAS,GAAG,oBAAoB;IAuB3E;;;OAGG;IACG,YAAY,CAAC,UAAU,GAAE,MAAgB,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;CAQlE"}
1
+ {"version":3,"file":"ReferenceField.d.ts","sourceRoot":"","sources":["../../../sdk/bdo/fields/ReferenceField.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,sBAAsB,IAAI,yBAAyB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE/G,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,cAAc,CAAC,IAAI,GAAG,OAAO,CAAE,SAAQ,SAAS,CAC3D,kBAAkB,CAAC,IAAI,CAAC,CACzB;gBACa,IAAI,EAAE,yBAAyB;IAI3C,IAAI,YAAY,IAAI,MAAM,CAEzB;IAED,IAAI,eAAe,IAAI,SAAS,MAAM,EAAE,CAEvC;IAED,IAAI,YAAY,IAAI,SAAS,MAAM,EAAE,CAEpC;IAED,QAAQ,CAAC,KAAK,EAAE,kBAAkB,CAAC,IAAI,CAAC,GAAG,SAAS,GAAG,oBAAoB;IAuB3E;;;OAGG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;CAQxD"}
@@ -22,6 +22,6 @@ export declare class SelectField<T extends string | number = string> extends Bas
22
22
  /**
23
23
  * Fetch dynamic options from the backend, returned as typed SelectOption[]
24
24
  */
25
- fetchOptions(instanceId?: string): Promise<SelectOptionType<T>[]>;
25
+ fetchOptions(instanceId: string): Promise<SelectOptionType<T>[]>;
26
26
  }
27
27
  //# sourceMappingURL=SelectField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../../../sdk/bdo/fields/SelectField.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,IAAI,sBAAsB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG3H,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;gBACnE,IAAI,EAAE,sBAAsB;IAIxC,kDAAkD;IAClD,IAAI,OAAO,IAAI,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAG5C;IAED,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,oBAAoB;IAqBpD;;OAEG;IACG,YAAY,CAAC,UAAU,GAAE,MAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;CAejF"}
1
+ {"version":3,"file":"SelectField.d.ts","sourceRoot":"","sources":["../../../sdk/bdo/fields/SelectField.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,IAAI,sBAAsB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG3H,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;;;;;GAaG;AACH,qBAAa,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,CAAE,SAAQ,SAAS,CAAC,CAAC,CAAC;gBACnE,IAAI,EAAE,sBAAsB;IAIxC,kDAAkD;IAClD,IAAI,OAAO,IAAI,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAG5C;IAED,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,oBAAoB;IAqBpD;;OAEG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;CAevE"}
@@ -19,7 +19,7 @@ export declare class UserField extends BaseField<UserFieldType> {
19
19
  * Fetch user records from the backend via the fetchField API.
20
20
  * Requires the field to be bound to a parent BDO.
21
21
  */
22
- fetchOptions(instanceId?: string): Promise<UserFieldType[]>;
22
+ fetchOptions(instanceId: string): Promise<UserFieldType[]>;
23
23
  validate(value: UserFieldType | undefined): ValidationResultType;
24
24
  }
25
25
  //# sourceMappingURL=UserField.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserField.d.ts","sourceRoot":"","sources":["../../../sdk/bdo/fields/UserField.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE7E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;GASG;AACH,qBAAa,SAAU,SAAQ,SAAS,CAAC,aAAa,CAAC;gBACzC,IAAI,EAAE,iBAAiB;IAInC,yCAAyC;IACzC,IAAI,cAAc,IAAI,MAAM,GAAG,SAAS,CAEvC;IAED;;;OAGG;IACG,YAAY,CAAC,UAAU,GAAE,MAAgB,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAS1E,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,oBAAoB;CAsBjE"}
1
+ {"version":3,"file":"UserField.d.ts","sourceRoot":"","sources":["../../../sdk/bdo/fields/UserField.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE7E,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;GASG;AACH,qBAAa,SAAU,SAAQ,SAAS,CAAC,aAAa,CAAC;gBACzC,IAAI,EAAE,iBAAiB;IAInC,yCAAyC;IACzC,IAAI,cAAc,IAAI,MAAM,GAAG,SAAS,CAEvC;IAED;;;OAGG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAShE,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,SAAS,GAAG,oBAAoB;CAsBjE"}