@elqnt/entity 2.1.1 → 2.1.2
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 +210 -0
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/chunk-4GC36G4D.js.map +1 -1
- package/dist/chunk-GQJJP4YL.js.map +1 -1
- package/dist/chunk-SXBB42DJ.js.map +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js.map +1 -1
- package/dist/models/index.js.map +1 -1
- package/package.json +13 -15
package/README.md
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# @elqnt/entity
|
|
2
|
+
|
|
3
|
+
Complete entity management for Eloquent platform - models, API, hooks, and store.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @elqnt/entity
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
Create app-specific hooks that wrap `useEntities` internally:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
// hooks/use-contacts.ts
|
|
17
|
+
import { useEntities } from "@elqnt/entity/hooks";
|
|
18
|
+
import type { EntityRecord } from "@elqnt/entity/models";
|
|
19
|
+
import { useAppConfig } from "@/app/providers";
|
|
20
|
+
|
|
21
|
+
// App-specific model (camelCase)
|
|
22
|
+
interface Contact {
|
|
23
|
+
id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
email: string;
|
|
26
|
+
company?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Transform EntityRecord → App model
|
|
30
|
+
function toContact(record: EntityRecord): Contact {
|
|
31
|
+
return {
|
|
32
|
+
id: record.id,
|
|
33
|
+
name: record.fields.name,
|
|
34
|
+
email: record.fields.email,
|
|
35
|
+
company: record.fields.company,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function useContacts() {
|
|
40
|
+
const config = useAppConfig();
|
|
41
|
+
const { queryRecords, getRecord, createRecord, updateRecord, deleteRecord, loading, error } = useEntities({
|
|
42
|
+
baseUrl: config.apiGatewayUrl,
|
|
43
|
+
orgId: config.orgId,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const fetchContacts = async (filters?: Record<string, unknown>) => {
|
|
47
|
+
const result = await queryRecords("contact", { filters });
|
|
48
|
+
return result?.records?.map(toContact) ?? [];
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const getContact = async (id: string) => {
|
|
52
|
+
const record = await getRecord("contact", id);
|
|
53
|
+
return record ? toContact(record) : null;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const createContact = async (data: Omit<Contact, "id">) => {
|
|
57
|
+
const record = await createRecord("contact", { fields: data });
|
|
58
|
+
return record ? toContact(record) : null;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const updateContact = async (id: string, data: Partial<Contact>) => {
|
|
62
|
+
const record = await updateRecord("contact", id, { fields: data });
|
|
63
|
+
return record ? toContact(record) : null;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return { fetchContacts, getContact, createContact, updateContact, deleteContact: deleteRecord, loading, error };
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Usage in components:
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
// components/contact-list.tsx
|
|
74
|
+
function ContactList() {
|
|
75
|
+
const { fetchContacts, loading, error } = useContacts();
|
|
76
|
+
const [contacts, setContacts] = useState<Contact[]>([]);
|
|
77
|
+
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
fetchContacts({ status: "active" }).then(setContacts);
|
|
80
|
+
}, []);
|
|
81
|
+
|
|
82
|
+
if (loading) return <Spinner />;
|
|
83
|
+
if (error) return <Error message={error} />;
|
|
84
|
+
return <List items={contacts} />;
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Recommended Pattern
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
@elqnt/entity/hooks (useEntities)
|
|
92
|
+
↓
|
|
93
|
+
App-specific hook (useContacts, useTickets, etc.)
|
|
94
|
+
↓
|
|
95
|
+
React Component
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Key points:**
|
|
99
|
+
- `useEntities` handles loading states, error handling, and authentication
|
|
100
|
+
- App hooks transform `EntityRecord` → domain models (camelCase)
|
|
101
|
+
- Components consume app hooks, not `useEntities` directly
|
|
102
|
+
|
|
103
|
+
## Exports
|
|
104
|
+
|
|
105
|
+
### `/hooks` - React Hooks
|
|
106
|
+
|
|
107
|
+
| Hook | Description |
|
|
108
|
+
|------|-------------|
|
|
109
|
+
| `useEntities(options)` | Full CRUD operations with loading/error states |
|
|
110
|
+
|
|
111
|
+
Use `useEntities` inside your app-specific hooks (not directly in components):
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
// Inside your custom hook
|
|
115
|
+
import { useEntities } from "@elqnt/entity/hooks";
|
|
116
|
+
|
|
117
|
+
export function useMyEntities() {
|
|
118
|
+
const {
|
|
119
|
+
queryRecords, // Query multiple records with filters/pagination
|
|
120
|
+
getRecord, // Get single record by ID
|
|
121
|
+
createRecord, // Create new record
|
|
122
|
+
updateRecord, // Update existing record
|
|
123
|
+
deleteRecord, // Delete record
|
|
124
|
+
listDefinitions,// List entity definitions
|
|
125
|
+
getDefinition, // Get entity definition by name
|
|
126
|
+
loading, // Loading state
|
|
127
|
+
error, // Error message
|
|
128
|
+
} = useEntities({ baseUrl, orgId });
|
|
129
|
+
|
|
130
|
+
// Transform and expose domain-specific functions
|
|
131
|
+
// ...
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### `/api` - API Functions
|
|
136
|
+
|
|
137
|
+
Low-level API functions for direct HTTP calls.
|
|
138
|
+
|
|
139
|
+
```tsx
|
|
140
|
+
import {
|
|
141
|
+
// Entity Definitions
|
|
142
|
+
listEntityDefinitionsApi,
|
|
143
|
+
getEntityDefinitionApi,
|
|
144
|
+
createEntityDefinitionApi,
|
|
145
|
+
updateEntityDefinitionApi,
|
|
146
|
+
deleteEntityDefinitionApi,
|
|
147
|
+
|
|
148
|
+
// Entity Records
|
|
149
|
+
queryEntityRecordsApi,
|
|
150
|
+
getEntityRecordApi,
|
|
151
|
+
createEntityRecordApi,
|
|
152
|
+
updateEntityRecordApi,
|
|
153
|
+
deleteEntityRecordApi,
|
|
154
|
+
|
|
155
|
+
// Bulk Operations
|
|
156
|
+
bulkCreateEntityRecordsApi,
|
|
157
|
+
bulkUpdateEntityRecordsApi,
|
|
158
|
+
bulkDeleteEntityRecordsApi,
|
|
159
|
+
|
|
160
|
+
// Count
|
|
161
|
+
countEntityRecordsApi,
|
|
162
|
+
} from "@elqnt/entity/api";
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### `/models` - TypeScript Types
|
|
166
|
+
|
|
167
|
+
Types generated from Go via tygo.
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
import type {
|
|
171
|
+
EntityDefinition,
|
|
172
|
+
EntityRecord,
|
|
173
|
+
EntityQuery,
|
|
174
|
+
Filter,
|
|
175
|
+
Sort,
|
|
176
|
+
ListEntityRecordsResponse,
|
|
177
|
+
GetEntityRecordResponse,
|
|
178
|
+
} from "@elqnt/entity/models";
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Main Entry Point
|
|
182
|
+
|
|
183
|
+
You can also import everything from the main entry:
|
|
184
|
+
|
|
185
|
+
```tsx
|
|
186
|
+
import { useEntities, EntityRecord, queryEntityRecordsApi } from "@elqnt/entity";
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Options
|
|
190
|
+
|
|
191
|
+
```tsx
|
|
192
|
+
interface UseEntitiesOptions {
|
|
193
|
+
baseUrl: string; // API Gateway URL
|
|
194
|
+
orgId: string; // Organization ID
|
|
195
|
+
userId?: string; // Optional user ID for headers
|
|
196
|
+
userEmail?: string; // Optional user email for headers
|
|
197
|
+
}
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Query Options
|
|
201
|
+
|
|
202
|
+
```tsx
|
|
203
|
+
interface QueryOptions {
|
|
204
|
+
page?: number; // Page number (default: 1)
|
|
205
|
+
pageSize?: number; // Items per page (default: 20)
|
|
206
|
+
filters?: Record<string, unknown>; // Filter conditions
|
|
207
|
+
sortBy?: string; // Field to sort by
|
|
208
|
+
sortOrder?: "asc" | "desc"; // Sort direction
|
|
209
|
+
}
|
|
210
|
+
```
|
package/dist/api/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiClientOptions, ApiResponse } from '@elqnt/api-client';
|
|
2
2
|
import { ResponseMetadata } from '@elqnt/types';
|
|
3
|
-
import {
|
|
3
|
+
import { ListEntityDefinitionsResponse, EntityDefinitionResponse, EntityDefinition, ListEntityRecordsResponse, EntityRecordResponse, EntityRecord } from '../models/index.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Entity API functions
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ApiClientOptions, ApiResponse } from '@elqnt/api-client';
|
|
2
2
|
import { ResponseMetadata } from '@elqnt/types';
|
|
3
|
-
import {
|
|
3
|
+
import { ListEntityDefinitionsResponse, EntityDefinitionResponse, EntityDefinition, ListEntityRecordsResponse, EntityRecordResponse, EntityRecord } from '../models/index.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Entity API functions
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/api/index.js"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,uiCAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/api/index.js"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages/@elqnt/entity/dist/chunk-4GC36G4D.js","../models/entity.ts"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACA;ACQO,IAAM,WAAA,EAAmC,IAAA;AAIzC,IAAM,WAAA,EAAmC,IAAA;AAIzC,IAAM,WAAA,EAAmC,IAAA;AAIzC,IAAM,YAAA,EAAoC,KAAA;AAI1C,IAAM,WAAA,EAAmC,IAAA;AAIzC,IAAM,YAAA,EAAoC,KAAA;AAI1C,IAAM,WAAA,EAAmC,IAAA;AAIzC,IAAM,YAAA,EAAoC,KAAA;AAI1C,IAAM,iBAAA,EAAyC,UAAA;AAI/C,IAAM,mBAAA,EAA2C,YAAA;AAIjD,IAAM,iBAAA,EAAyC,UAAA;AAI/C,IAAM,eAAA,EAAuC,QAAA;AAI7C,IAAM,cAAA,EAAsC,OAAA;AAI5C,IAAM,gBAAA,EAAwC,SAAA;AAE9C,IAAM,sBAAA,EAAwB;AAAA,EACnC,EAAA,EAAI,EAAE,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,WAAW,CAAA;AAAA,EACrC,EAAA,EAAI,EAAE,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,eAAe,CAAA;AAAA,EACzC,EAAA,EAAI,EAAE,KAAA,EAAO,IAAA,EAAM,KAAA,EAAO,eAAe,CAAA;AAAA,EACzC,GAAA,EAAK,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,2BAA2B,CAAA;AAAA,EACvD,EAA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A,EAAqB,sBAAA;AAC3B,IAAM,oBAAA,EAAsB,uBAAA;AAC5B,IAAM,wBAAA,EAA0B,4BAAA;AAChC,IAAM,yBAAA,EAA2B,6BAAA;AACjC,IAAM,wBAAA,EAA0B,4BAAA;AAChC,IAAM,yBAAA,EAA2B,6BAAA;AACjC,IAAM,wBAAA,EAA0B,4BAAA;AAChC,IAAM,yBAAA,EAA2B,6BAAA;AACjC,IAAM,iBAAA,EAAmB,oBAAA;AACzB,IAAM,kBAAA,EAAoB,qBAAA;AAC1B,IAAM,iBAAA,EAAmB,oBAAA;AACzB,IAAM,kBAAA,EAAoB,qBAAA;AAC1B,IAAM,iBAAA,EAAmB,oBAAA;AACzB,IAAM,kBAAA,EAAoB,qBAAA;AAC1B,IAAM,eAAA,EAAiB,kBAAA;ADjZ9B;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,0hHAAC","file":"/home/runner/work/eloquent/eloquent/packages/@elqnt/entity/dist/chunk-4GC36G4D.js","sourcesContent":[null,"// Code generated by tygo. DO NOT EDIT.\nimport { JSONSchema } from \"@elqnt/types\";\n\n//////////\n// source: constants.go\n\nexport type EntityFilterOperator = string;\n/**\n * todo: move to types package\n */\nexport const OperatorEq: EntityFilterOperator = \"eq\";\n/**\n * todo: move to types package\n */\nexport const OperatorNe: EntityFilterOperator = \"ne\";\n/**\n * todo: move to types package\n */\nexport const OperatorGt: EntityFilterOperator = \"gt\";\n/**\n * todo: move to types package\n */\nexport const OperatorGte: EntityFilterOperator = \"gte\";\n/**\n * todo: move to types package\n */\nexport const OperatorLt: EntityFilterOperator = \"lt\";\n/**\n * todo: move to types package\n */\nexport const OperatorLte: EntityFilterOperator = \"lte\";\n/**\n * todo: move to types package\n */\nexport const OperatorIn: EntityFilterOperator = \"in\";\n/**\n * todo: move to types package\n */\nexport const OperatorNin: EntityFilterOperator = \"nin\";\n/**\n * todo: move to types package\n */\nexport const OperatorContains: EntityFilterOperator = \"contains\";\n/**\n * todo: move to types package\n */\nexport const OperatorStartsWith: EntityFilterOperator = \"startsWith\";\n/**\n * todo: move to types package\n */\nexport const OperatorEndsWith: EntityFilterOperator = \"endsWith\";\n/**\n * todo: move to types package\n */\nexport const OperatorExists: EntityFilterOperator = \"exists\";\n/**\n * todo: move to types package\n */\nexport const OperatorEmpty: EntityFilterOperator = \"empty\";\n/**\n * todo: move to types package\n */\nexport const OperatorBetween: EntityFilterOperator = \"between\";\n\nexport const EntityFilterOperators = {\n eq: { value: 'eq', label: 'Equal to' },\n ne: { value: 'ne', label: 'Not equal to' },\n gt: { value: 'gt', label: 'Greater than' },\n gte: { value: 'gte', label: 'Greater than or equal to' },\n lt: { value: 'lt', label: 'Less than' },\n lte: { value: 'lte', label: 'Less than or equal to' },\n in: { value: 'in', label: 'In' },\n nin: { value: 'nin', label: 'Not in' },\n contains: { value: 'contains', label: 'Contains' },\n startsWith: { value: 'startsWith', label: 'Starts with' },\n endsWith: { value: 'endsWith', label: 'Ends with' },\n exists: { value: 'exists', label: 'Exists' },\n empty: { value: 'empty', label: 'Empty' },\n between: { value: 'between', label: 'Between' }\n} as const;\n\nexport type EntityFilterOperatorTS = keyof typeof EntityFilterOperators;\nexport type EntityFilterOperatorOptionTS = typeof EntityFilterOperators[EntityFilterOperatorTS];\n\nexport type EntityFieldType = string;\nexport const EntityFieldTypeString: EntityFieldType = \"string\";\nexport const EntityFieldTypeStringMultiline: EntityFieldType = \"stringMultiline\";\nexport const EntityFieldTypeText: EntityFieldType = \"text\";\nexport const EntityFieldTypeInt: EntityFieldType = \"int\";\nexport const EntityFieldTypeFloat: EntityFieldType = \"float\";\nexport const EntityFieldTypeBool: EntityFieldType = \"bool\";\nexport const EntityFieldTypeDate: EntityFieldType = \"date\";\nexport const EntityFieldTypeDateTime: EntityFieldType = \"datetime\";\nexport const EntityFieldTypeEmail: EntityFieldType = \"email\";\nexport const EntityFieldTypePhone: EntityFieldType = \"phone\";\nexport const EntityFieldTypeURL: EntityFieldType = \"url\";\nexport const EntityFieldTypeDropdown: EntityFieldType = \"dropdown\";\nexport const EntityFieldTypeMultiSelect: EntityFieldType = \"multiselect\";\nexport const EntityFieldTypeLookup: EntityFieldType = \"lookup\";\nexport const EntityFieldTypeMultiLookup: EntityFieldType = \"multilookup\";\nexport const EntityFieldTypeCurrency: EntityFieldType = \"currency\";\nexport const EntityFieldTypeFile: EntityFieldType = \"file\";\nexport const EntityFieldTypeImage: EntityFieldType = \"image\";\nexport const EntityFieldTypeJSON: EntityFieldType = \"json\";\n\nexport const EntityFieldTypes = {\n string: { value: 'string', label: 'Short Text' },\n stringMultiline: { value: 'stringMultiline', label: 'Long Text' },\n text: { value: 'text', label: 'Rich Text Editor' },\n int: { value: 'int', label: 'Integer' },\n float: { value: 'float', label: 'Decimal' },\n bool: { value: 'bool', label: 'Boolean' },\n date: { value: 'date', label: 'Date' },\n datetime: { value: 'datetime', label: 'Date & Time' },\n email: { value: 'email', label: 'Email' },\n phone: { value: 'phone', label: 'Phone' },\n url: { value: 'url', label: 'URL' },\n dropdown: { value: 'dropdown', label: 'Dropdown' },\n multiselect: { value: 'multiselect', label: 'Multi Select' },\n lookup: { value: 'lookup', label: 'Lookup' },\n multilookup: { value: 'multilookup', label: 'Multi Lookup' },\n currency: { value: 'currency', label: 'Currency' },\n file: { value: 'file', label: 'File' },\n image: { value: 'image', label: 'Image' },\n json: { value: 'json', label: 'JSON' }\n} as const;\n\nexport type EntityFieldTypeTS = keyof typeof EntityFieldTypes;\nexport type EntityFieldTypeOptionTS = typeof EntityFieldTypes[EntityFieldTypeTS];\n\n\n//////////\n// source: entities-models.go\n\nexport interface EntityDefinition {\n id: string /* uuid */;\n name: string;\n displayName: string;\n module: string;\n description: string;\n schema: JSONSchema;\n defaultViewId: string /* uuid */;\n metadata?: { [key: string]: any};\n createdAt: string /* RFC3339 */;\n updatedAt: string /* RFC3339 */;\n isActive: boolean;\n version: number /* int */;\n}\nexport interface EntityRecord {\n id: string /* uuid */;\n entityId: string /* uuid */;\n name: string;\n fields: { [key: string]: any}; // ** must match the entity definition schema\n tags?: string[];\n metadata?: { [key: string]: any};\n createdAt: string /* RFC3339 */;\n updatedAt: string /* RFC3339 */;\n isActive: boolean;\n version: number /* int */;\n}\n/**\n * View defines how to display entity records in a list\n */\nexport interface View {\n id: string /* uuid */;\n entityId: string /* uuid */;\n name: string;\n displayName: string;\n description?: string;\n isDefault: boolean;\n columns: ViewColumn[];\n filters: Filter[];\n sort: Sort[];\n}\nexport interface Filter {\n field: string;\n operator: EntityFilterOperator;\n value: any;\n}\nexport interface Sort {\n field: string;\n direction: number /* int */; // 1 for asc, -1 for desc\n}\nexport interface FieldValidation {\n required: boolean;\n min?: number /* float64 */;\n max?: number /* float64 */;\n minLength?: number /* int */;\n maxLength?: number /* int */;\n pattern?: string;\n customRules?: ValidationRule[];\n}\nexport interface ValidationRule {\n name: string;\n conditions: ValidationRuleCondition[];\n}\nexport interface ValidationRuleCondition {\n field: string;\n operator: string;\n value: any;\n}\nexport interface RecordReference {\n entityName: string;\n recordId: string /* uuid */;\n fieldName: string;\n referencedAt: string /* RFC3339 */;\n}\nexport interface InsertOneResult {\n insertedId: string;\n success: boolean;\n error: string;\n}\n/**\n * Query related models\n */\nexport interface EntityQuery {\n filters: { [key: string]: any};\n page: number /* int64 */;\n pageSize: number /* int64 */;\n sortBy: string;\n sortOrder: number /* int */;\n includeLookups?: LookupInclude[];\n include?: string[]; // Fields to include\n exclude?: string[]; // Fields to exclude\n}\nexport interface LookupInclude {\n entityName: string;\n fieldName: string;\n fields?: string[];\n}\nexport interface QueryRequest {\n orgId: string;\n entityName: string;\n viewId?: string /* uuid */;\n query: EntityQuery;\n}\n/**\n * Request/Response models\n */\nexport interface CreateEntityDefinitionRequest {\n orgId: string;\n definition: EntityDefinition;\n}\nexport interface CreateOrgSchemaRequest {\n orgId: string /* uuid */;\n}\nexport interface CreateOrgSchemaResponse {\n metadata: ResponseMetadata;\n}\nexport interface DropOrgSchemaRequest {\n orgId: string /* uuid */;\n}\nexport interface DropOrgSchemaResponse {\n metadata: ResponseMetadata;\n}\nexport interface CreateRecordRequest {\n orgId: string;\n entityName: string;\n record: EntityRecord;\n}\nexport interface UpdateRecordRequest {\n orgId: string;\n entityName: string;\n recordId: string /* uuid */;\n record: EntityRecord;\n}\nexport interface DeleteRecordRequest {\n orgId: string;\n entityName: string;\n recordId: string;\n}\n/**\n * View models\n */\nexport interface EntityView {\n id: string /* uuid */;\n name: string;\n displayName: string;\n entityName: string;\n columns: ViewColumn[];\n filters: ViewFilter[];\n lookups: LookupInclude[];\n sortBy?: string;\n sortOrder?: number /* int */;\n isDefault: boolean;\n createdAt: string /* RFC3339 */;\n updatedAt: string /* RFC3339 */;\n isActive: boolean;\n version: number /* int */;\n}\nexport interface ViewColumn {\n fieldName: string;\n displayName: string;\n width: number /* int */;\n sortable: boolean;\n visible: boolean;\n order: number /* int */;\n}\nexport interface ViewFilter {\n fieldName: string;\n operator: string;\n value: any;\n}\n/**\n * Bulk operation models\n */\nexport interface BulkCreateRequest {\n orgId: string;\n entityName: string;\n records: EntityRecord[];\n}\nexport interface BulkUpdateRequest {\n orgId: string;\n entityName: string;\n records: EntityRecord[];\n}\nexport interface BulkDeleteRequest {\n orgId: string;\n entityName: string;\n recordIds: string /* uuid */[];\n}\nexport interface UpdateEntityDefinitionRequest {\n orgId: string;\n entityName: string; // Identify which entity to update\n definition: EntityDefinition;\n}\nexport interface GetEntityDefinitionRequest {\n orgId: string;\n entityName: string;\n}\nexport interface DeleteEntityDefinitionRequest {\n orgId: string;\n entityName: string;\n deleteRecords?: boolean; // If true, delete all entity records before deleting definition\n hardDelete?: boolean; // If true, permanently delete from database instead of soft delete\n}\nexport interface ListEntityDefinitionsRequest {\n orgId: string;\n module?: string; // Optional: filter by module (sales, marketing, etc)\n status?: string; // Optional: active, inactive, etc\n}\n/**\n * View related requests\n */\nexport interface CreateViewRequest {\n orgId: string;\n entityName: string;\n view: EntityView;\n}\nexport interface UpdateViewRequest {\n orgId: string;\n view: EntityView;\n}\nexport interface DeleteViewRequest {\n orgId: string;\n viewId: string /* uuid */;\n}\nexport interface GetViewRequest {\n orgId: string;\n viewId: string /* uuid */;\n}\nexport interface ListViewsRequest {\n orgId: string;\n entityName: string;\n}\n/**\n * Response models\n */\nexport interface EntityDefinitionResponse {\n definition: EntityDefinition;\n metadata: ResponseMetadata;\n}\nexport interface ListEntityDefinitionsResponse {\n definitions: EntityDefinition[];\n metadata: ResponseMetadata;\n}\nexport interface EntityViewResponse {\n view: EntityView;\n metadata: ResponseMetadata;\n}\nexport interface ListViewsResponse {\n views: EntityView[];\n metadata: ResponseMetadata;\n}\nexport interface EntityRecordResponse {\n record: EntityRecord;\n metadata: ResponseMetadata;\n}\nexport interface ListEntityRecordsResponse {\n records?: ListResult<EntityRecord>;\n metadata: ResponseMetadata;\n}\n/**\n * Common response metadata\n */\nexport interface ResponseMetadata {\n success: boolean;\n timestamp: string /* RFC3339 */;\n message?: string;\n error?: string;\n}\nexport interface ListOptions {\n Page: number /* int64 */;\n PageSize: number /* int64 */;\n SortBy: string;\n SortOrder: number /* int */;\n Filters: { [key: string]: any};\n Include: string[];\n Exclude: string[];\n}\nexport interface ListResult<T extends any> {\n items: T[];\n totalCount: number /* int64 */;\n currentPage: number /* int64 */;\n pageSize: number /* int64 */;\n totalPages: number /* int64 */;\n}\nexport interface GetEntityRecordRequest {\n orgId: string;\n entityName: string;\n recordId: string;\n}\nexport interface GetEntityRecordResponse {\n record?: EntityRecord;\n metadata: ResponseMetadata;\n}\nexport interface CountEntityRecordsRequest {\n orgId: string;\n entityName: string;\n filters?: { [key: string]: any};\n}\nexport interface CountEntityRecordsResponse {\n count: number /* int64 */;\n metadata: ResponseMetadata;\n}\n\n//////////\n// source: events.go\n\nexport interface EntityRecordChangeEvent {\n orgId: string;\n entityName: string;\n recordId: string;\n record?: EntityRecord;\n changes?: RecordChange;\n action: RecordChangeAction; // created, updated, deleted\n timestamp: string /* RFC3339 */;\n}\nexport interface RecordChange {\n /**\n * OldValues map[string]TypedValue `json:\"oldValues,omitempty\"`\n * NewValues map[string]TypedValue `json:\"newValues,omitempty\"`\n */\n changedAt: string /* RFC3339 */;\n changedBy: string /* ObjectID */;\n fields: string[]; // List of changed field names for quick reference\n}\nexport interface EntityDefinitionChangeEvent {\n orgId: string;\n definition?: EntityDefinition;\n action: string; // created, updated, deleted\n timestamp: string /* RFC3339 */;\n}\nexport interface EntityViewChangeEvent {\n orgId: string;\n entityName: string;\n view?: EntityView;\n action: string; // created, updated, deleted\n timestamp: string /* RFC3339 */;\n}\nexport type RecordChangeAction = string;\nexport const RecordChangeActionCreated: RecordChangeAction = \"created\";\nexport const RecordChangeActionUpdated: RecordChangeAction = \"updated\";\nexport const RecordChangeActionDeleted: RecordChangeAction = \"deleted\";\n\n//////////\n// source: subjects.go\n\nexport const EntityOrgSchemaCreate = \"entity.org.schema.create\";\nexport const EntityOrgSchemaDrop = \"entity.org.schema.drop\";\nexport const EntityDefinitionCreate = \"entity.definition.create\";\nexport const EntityDefinitionCreated = \"entity.definition.created\";\nexport const EntityDefinitionUpdate = \"entity.definition.update\";\nexport const EntityDefinitionGet = \"entity.definition.get\";\nexport const EntityDefinitionGetServer = \"entity.definition.get.server\";\nexport const EntityDefinitionList = \"entity.definition.list\";\nexport const EntityDefinitionUpdated = \"entity.definition.updated\";\nexport const EntityDefinitionDelete = \"entity.definition.delete\";\nexport const EntityDefinitionDeleted = \"entity.definition.deleted\";\nexport const EntityRecordCreate = \"entity.record.create\";\nexport const EntityRecordCreated = \"entity.record.created\";\nexport const EntityRecordGet = \"entity.record.get\";\nexport const EntityRecordQuery = \"entity.record.query\";\nexport const EntityRecordCount = \"entity.record.count\";\nexport const EntityRecordUpdate = \"entity.record.update\";\nexport const EntityRecordUpdated = \"entity.record.updated\";\nexport const EntityRecordDelete = \"entity.record.delete\";\nexport const EntityRecordDeleted = \"entity.record.deleted\";\nexport const EntityRecordsBulkCreate = \"entity.records.bulk.create\";\nexport const EntityRecordsBulkCreated = \"entity.records.bulk.created\";\nexport const EntityRecordsBulkUpdate = \"entity.records.bulk.update\";\nexport const EntityRecordsBulkUpdated = \"entity.records.bulk.updated\";\nexport const EntityRecordsBulkDelete = \"entity.records.bulk.delete\";\nexport const EntityRecordsBulkDeleted = \"entity.records.bulk.deleted\";\nexport const EntityViewCreate = \"entity.view.create\";\nexport const EntityViewCreated = \"entity.view.created\";\nexport const EntityViewUpdate = \"entity.view.update\";\nexport const EntityViewUpdated = \"entity.view.updated\";\nexport const EntityViewDelete = \"entity.view.delete\";\nexport const EntityViewDeleted = \"entity.view.deleted\";\nexport const EntityViewList = \"entity.view.list\";\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/chunk-4GC36G4D.js","../models/entity.ts"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACA;ACQO,IAAM,WAAA,EAAmC,IAAA;AAIzC,IAAM,WAAA,EAAmC,IAAA;AAIzC,IAAM,WAAA,EAAmC,IAAA;AAIzC,IAAM,YAAA,EAAoC,KAAA;AAI1C,IAAM,WAAA,EAAmC,IAAA;AAIzC,IAAM,YAAA,EAAoC,KAAA;AAI1C,IAAM,WAAA,EAAmC,IAAA;AAIzC,IAAM,YAAA,EAAoC,KAAA;AAI1C,IAAM,iBAAA,EAAyC,UAAA;AAI/C,IAAM,mBAAA,EAA2C,YAAA;AAIjD,IAAM,iBAAA,EAAyC,UAAA;AAI/C,IAAM,eAAA,EAAuC,QAAA;AAI7C,IAAM,cA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A;AACA;AACA;AACA;AACA;AACA;AACF,0hHAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/chunk-4GC36G4D.js","sourcesContent":[null,"// Code generated by tygo. DO NOT EDIT.\nimport { JSONSchema } from \"@elqnt/types\";\n\n//////////\n// source: constants.go\n\nexport type EntityFilterOperator = string;\n/**\n * todo: move to types package\n */\nexport const OperatorEq: EntityFilterOperator = \"eq\";\n/**\n * todo: move to types package\n */\nexport const OperatorNe: EntityFilterOperator = \"ne\";\n/**\n * todo: move to types package\n */\nexport const OperatorGt: EntityFilterOperator = \"gt\";\n/**\n * todo: move to types package\n */\nexport const OperatorGte: EntityFilterOperator = \"gte\";\n/**\n * todo: move to types package\n */\nexport const OperatorLt: EntityFilterOperator = \"lt\";\n/**\n * todo: move to types package\n */\nexport const OperatorLte: EntityFilterOperator = \"lte\";\n/**\n * todo: move to types package\n */\nexport const OperatorIn: EntityFilterOperator = \"in\";\n/**\n * todo: move to types package\n */\nexport const OperatorNin: EntityFilterOperator = \"nin\";\n/**\n * todo: move to types package\n */\nexport const OperatorContains: EntityFilterOperator = \"contains\";\n/**\n * todo: move to types package\n */\nexport const OperatorStartsWith: EntityFilterOperator = \"startsWith\";\n/**\n * todo: move to types package\n */\nexport const OperatorEndsWith: EntityFilterOperator = \"endsWith\";\n/**\n * todo: move to types package\n */\nexport const OperatorExists: EntityFilterOperator = \"exists\";\n/**\n * todo: move to types package\n */\nexport const OperatorEmpty: EntityFilterOperator = \"empty\";\n/**\n * todo: move to types package\n */\nexport const OperatorBetween: EntityFilterOperator = \"between\";\n\nexport const EntityFilterOperators = {\n eq: { value: 'eq', label: 'Equal to' },\n ne: { value: 'ne', label: 'Not equal to' },\n gt: { value: 'gt', label: 'Greater than' },\n gte: { value: 'gte', label: 'Greater than or equal to' },\n lt: { value: 'lt', label: 'Less than' },\n lte: { value: 'lte', label: 'Less than or equal to' },\n in: { value: 'in', label: 'In' },\n nin: { value: 'nin', label: 'Not in' },\n contains: { value: 'contains', label: 'Contains' },\n startsWith: { value: 'startsWith', label: 'Starts with' },\n endsWith: { value: 'endsWith', label: 'Ends with' },\n exists: { value: 'exists', label: 'Exists' },\n empty: { value: 'empty', label: 'Empty' },\n between: { value: 'between', label: 'Between' }\n} as const;\n\nexport type EntityFilterOperatorTS = keyof typeof EntityFilterOperators;\nexport type EntityFilterOperatorOptionTS = typeof EntityFilterOperators[EntityFilterOperatorTS];\n\nexport type EntityFieldType = string;\nexport const EntityFieldTypeString: EntityFieldType = \"string\";\nexport const EntityFieldTypeStringMultiline: EntityFieldType = \"stringMultiline\";\nexport const EntityFieldTypeText: EntityFieldType = \"text\";\nexport const EntityFieldTypeInt: EntityFieldType = \"int\";\nexport const EntityFieldTypeFloat: EntityFieldType = \"float\";\nexport const EntityFieldTypeBool: EntityFieldType = \"bool\";\nexport const EntityFieldTypeDate: EntityFieldType = \"date\";\nexport const EntityFieldTypeDateTime: EntityFieldType = \"datetime\";\nexport const EntityFieldTypeEmail: EntityFieldType = \"email\";\nexport const EntityFieldTypePhone: EntityFieldType = \"phone\";\nexport const EntityFieldTypeURL: EntityFieldType = \"url\";\nexport const EntityFieldTypeDropdown: EntityFieldType = \"dropdown\";\nexport const EntityFieldTypeMultiSelect: EntityFieldType = \"multiselect\";\nexport const EntityFieldTypeLookup: EntityFieldType = \"lookup\";\nexport const EntityFieldTypeMultiLookup: EntityFieldType = \"multilookup\";\nexport const EntityFieldTypeCurrency: EntityFieldType = \"currency\";\nexport const EntityFieldTypeFile: EntityFieldType = \"file\";\nexport const EntityFieldTypeImage: EntityFieldType = \"image\";\nexport const EntityFieldTypeJSON: EntityFieldType = \"json\";\n\nexport const EntityFieldTypes = {\n string: { value: 'string', label: 'Short Text' },\n stringMultiline: { value: 'stringMultiline', label: 'Long Text' },\n text: { value: 'text', label: 'Rich Text Editor' },\n int: { value: 'int', label: 'Integer' },\n float: { value: 'float', label: 'Decimal' },\n bool: { value: 'bool', label: 'Boolean' },\n date: { value: 'date', label: 'Date' },\n datetime: { value: 'datetime', label: 'Date & Time' },\n email: { value: 'email', label: 'Email' },\n phone: { value: 'phone', label: 'Phone' },\n url: { value: 'url', label: 'URL' },\n dropdown: { value: 'dropdown', label: 'Dropdown' },\n multiselect: { value: 'multiselect', label: 'Multi Select' },\n lookup: { value: 'lookup', label: 'Lookup' },\n multilookup: { value: 'multilookup', label: 'Multi Lookup' },\n currency: { value: 'currency', label: 'Currency' },\n file: { value: 'file', label: 'File' },\n image: { value: 'image', label: 'Image' },\n json: { value: 'json', label: 'JSON' }\n} as const;\n\nexport type EntityFieldTypeTS = keyof typeof EntityFieldTypes;\nexport type EntityFieldTypeOptionTS = typeof EntityFieldTypes[EntityFieldTypeTS];\n\n\n//////////\n// source: entities-models.go\n\nexport interface EntityDefinition {\n id: string /* uuid */;\n name: string;\n displayName: string;\n module: string;\n description: string;\n schema: JSONSchema;\n defaultViewId: string /* uuid */;\n metadata?: { [key: string]: any};\n createdAt: string /* RFC3339 */;\n updatedAt: string /* RFC3339 */;\n isActive: boolean;\n version: number /* int */;\n}\nexport interface EntityRecord {\n id: string /* uuid */;\n entityId: string /* uuid */;\n name: string;\n fields: { [key: string]: any}; // ** must match the entity definition schema\n tags?: string[];\n metadata?: { [key: string]: any};\n createdAt: string /* RFC3339 */;\n updatedAt: string /* RFC3339 */;\n isActive: boolean;\n version: number /* int */;\n}\n/**\n * View defines how to display entity records in a list\n */\nexport interface View {\n id: string /* uuid */;\n entityId: string /* uuid */;\n name: string;\n displayName: string;\n description?: string;\n isDefault: boolean;\n columns: ViewColumn[];\n filters: Filter[];\n sort: Sort[];\n}\nexport interface Filter {\n field: string;\n operator: EntityFilterOperator;\n value: any;\n}\nexport interface Sort {\n field: string;\n direction: number /* int */; // 1 for asc, -1 for desc\n}\nexport interface FieldValidation {\n required: boolean;\n min?: number /* float64 */;\n max?: number /* float64 */;\n minLength?: number /* int */;\n maxLength?: number /* int */;\n pattern?: string;\n customRules?: ValidationRule[];\n}\nexport interface ValidationRule {\n name: string;\n conditions: ValidationRuleCondition[];\n}\nexport interface ValidationRuleCondition {\n field: string;\n operator: string;\n value: any;\n}\nexport interface RecordReference {\n entityName: string;\n recordId: string /* uuid */;\n fieldName: string;\n referencedAt: string /* RFC3339 */;\n}\nexport interface InsertOneResult {\n insertedId: string;\n success: boolean;\n error: string;\n}\n/**\n * Query related models\n */\nexport interface EntityQuery {\n filters: { [key: string]: any};\n page: number /* int64 */;\n pageSize: number /* int64 */;\n sortBy: string;\n sortOrder: number /* int */;\n includeLookups?: LookupInclude[];\n include?: string[]; // Fields to include\n exclude?: string[]; // Fields to exclude\n}\nexport interface LookupInclude {\n entityName: string;\n fieldName: string;\n fields?: string[];\n}\nexport interface QueryRequest {\n orgId: string;\n entityName: string;\n viewId?: string /* uuid */;\n query: EntityQuery;\n}\n/**\n * Request/Response models\n */\nexport interface CreateEntityDefinitionRequest {\n orgId: string;\n definition: EntityDefinition;\n}\nexport interface CreateOrgSchemaRequest {\n orgId: string /* uuid */;\n}\nexport interface CreateOrgSchemaResponse {\n metadata: ResponseMetadata;\n}\nexport interface DropOrgSchemaRequest {\n orgId: string /* uuid */;\n}\nexport interface DropOrgSchemaResponse {\n metadata: ResponseMetadata;\n}\nexport interface CreateRecordRequest {\n orgId: string;\n entityName: string;\n record: EntityRecord;\n}\nexport interface UpdateRecordRequest {\n orgId: string;\n entityName: string;\n recordId: string /* uuid */;\n record: EntityRecord;\n}\nexport interface DeleteRecordRequest {\n orgId: string;\n entityName: string;\n recordId: string;\n}\n/**\n * View models\n */\nexport interface EntityView {\n id: string /* uuid */;\n name: string;\n displayName: string;\n entityName: string;\n columns: ViewColumn[];\n filters: ViewFilter[];\n lookups: LookupInclude[];\n sortBy?: string;\n sortOrder?: number /* int */;\n isDefault: boolean;\n createdAt: string /* RFC3339 */;\n updatedAt: string /* RFC3339 */;\n isActive: boolean;\n version: number /* int */;\n}\nexport interface ViewColumn {\n fieldName: string;\n displayName: string;\n width: number /* int */;\n sortable: boolean;\n visible: boolean;\n order: number /* int */;\n}\nexport interface ViewFilter {\n fieldName: string;\n operator: string;\n value: any;\n}\n/**\n * Bulk operation models\n */\nexport interface BulkCreateRequest {\n orgId: string;\n entityName: string;\n records: EntityRecord[];\n}\nexport interface BulkUpdateRequest {\n orgId: string;\n entityName: string;\n records: EntityRecord[];\n}\nexport interface BulkDeleteRequest {\n orgId: string;\n entityName: string;\n recordIds: string /* uuid */[];\n}\nexport interface UpdateEntityDefinitionRequest {\n orgId: string;\n entityName: string; // Identify which entity to update\n definition: EntityDefinition;\n}\nexport interface GetEntityDefinitionRequest {\n orgId: string;\n entityName: string;\n}\nexport interface DeleteEntityDefinitionRequest {\n orgId: string;\n entityName: string;\n deleteRecords?: boolean; // If true, delete all entity records before deleting definition\n hardDelete?: boolean; // If true, permanently delete from database instead of soft delete\n}\nexport interface ListEntityDefinitionsRequest {\n orgId: string;\n module?: string; // Optional: filter by module (sales, marketing, etc)\n status?: string; // Optional: active, inactive, etc\n}\n/**\n * View related requests\n */\nexport interface CreateViewRequest {\n orgId: string;\n entityName: string;\n view: EntityView;\n}\nexport interface UpdateViewRequest {\n orgId: string;\n view: EntityView;\n}\nexport interface DeleteViewRequest {\n orgId: string;\n viewId: string /* uuid */;\n}\nexport interface GetViewRequest {\n orgId: string;\n viewId: string /* uuid */;\n}\nexport interface ListViewsRequest {\n orgId: string;\n entityName: string;\n}\n/**\n * Response models\n */\nexport interface EntityDefinitionResponse {\n definition: EntityDefinition;\n metadata: ResponseMetadata;\n}\nexport interface ListEntityDefinitionsResponse {\n definitions: EntityDefinition[];\n metadata: ResponseMetadata;\n}\nexport interface EntityViewResponse {\n view: EntityView;\n metadata: ResponseMetadata;\n}\nexport interface ListViewsResponse {\n views: EntityView[];\n metadata: ResponseMetadata;\n}\nexport interface EntityRecordResponse {\n record: EntityRecord;\n metadata: ResponseMetadata;\n}\nexport interface ListEntityRecordsResponse {\n records?: ListResult<EntityRecord>;\n metadata: ResponseMetadata;\n}\n/**\n * Common response metadata\n */\nexport interface ResponseMetadata {\n success: boolean;\n timestamp: string /* RFC3339 */;\n message?: string;\n error?: string;\n}\nexport interface ListOptions {\n Page: number /* int64 */;\n PageSize: number /* int64 */;\n SortBy: string;\n SortOrder: number /* int */;\n Filters: { [key: string]: any};\n Include: string[];\n Exclude: string[];\n}\nexport interface ListResult<T extends any> {\n items: T[];\n totalCount: number /* int64 */;\n currentPage: number /* int64 */;\n pageSize: number /* int64 */;\n totalPages: number /* int64 */;\n}\nexport interface GetEntityRecordRequest {\n orgId: string;\n entityName: string;\n recordId: string;\n}\nexport interface GetEntityRecordResponse {\n record?: EntityRecord;\n metadata: ResponseMetadata;\n}\nexport interface CountEntityRecordsRequest {\n orgId: string;\n entityName: string;\n filters?: { [key: string]: any};\n}\nexport interface CountEntityRecordsResponse {\n count: number /* int64 */;\n metadata: ResponseMetadata;\n}\n\n//////////\n// source: events.go\n\nexport interface EntityRecordChangeEvent {\n orgId: string;\n entityName: string;\n recordId: string;\n record?: EntityRecord;\n changes?: RecordChange;\n action: RecordChangeAction; // created, updated, deleted\n timestamp: string /* RFC3339 */;\n}\nexport interface RecordChange {\n /**\n * OldValues map[string]TypedValue `json:\"oldValues,omitempty\"`\n * NewValues map[string]TypedValue `json:\"newValues,omitempty\"`\n */\n changedAt: string /* RFC3339 */;\n changedBy: string /* ObjectID */;\n fields: string[]; // List of changed field names for quick reference\n}\nexport interface EntityDefinitionChangeEvent {\n orgId: string;\n definition?: EntityDefinition;\n action: string; // created, updated, deleted\n timestamp: string /* RFC3339 */;\n}\nexport interface EntityViewChangeEvent {\n orgId: string;\n entityName: string;\n view?: EntityView;\n action: string; // created, updated, deleted\n timestamp: string /* RFC3339 */;\n}\nexport type RecordChangeAction = string;\nexport const RecordChangeActionCreated: RecordChangeAction = \"created\";\nexport const RecordChangeActionUpdated: RecordChangeAction = \"updated\";\nexport const RecordChangeActionDeleted: RecordChangeAction = \"deleted\";\n\n//////////\n// source: subjects.go\n\nexport const EntityOrgSchemaCreate = \"entity.org.schema.create\";\nexport const EntityOrgSchemaDrop = \"entity.org.schema.drop\";\nexport const EntityDefinitionCreate = \"entity.definition.create\";\nexport const EntityDefinitionCreated = \"entity.definition.created\";\nexport const EntityDefinitionUpdate = \"entity.definition.update\";\nexport const EntityDefinitionGet = \"entity.definition.get\";\nexport const EntityDefinitionGetServer = \"entity.definition.get.server\";\nexport const EntityDefinitionList = \"entity.definition.list\";\nexport const EntityDefinitionUpdated = \"entity.definition.updated\";\nexport const EntityDefinitionDelete = \"entity.definition.delete\";\nexport const EntityDefinitionDeleted = \"entity.definition.deleted\";\nexport const EntityRecordCreate = \"entity.record.create\";\nexport const EntityRecordCreated = \"entity.record.created\";\nexport const EntityRecordGet = \"entity.record.get\";\nexport const EntityRecordQuery = \"entity.record.query\";\nexport const EntityRecordCount = \"entity.record.count\";\nexport const EntityRecordUpdate = \"entity.record.update\";\nexport const EntityRecordUpdated = \"entity.record.updated\";\nexport const EntityRecordDelete = \"entity.record.delete\";\nexport const EntityRecordDeleted = \"entity.record.deleted\";\nexport const EntityRecordsBulkCreate = \"entity.records.bulk.create\";\nexport const EntityRecordsBulkCreated = \"entity.records.bulk.created\";\nexport const EntityRecordsBulkUpdate = \"entity.records.bulk.update\";\nexport const EntityRecordsBulkUpdated = \"entity.records.bulk.updated\";\nexport const EntityRecordsBulkDelete = \"entity.records.bulk.delete\";\nexport const EntityRecordsBulkDeleted = \"entity.records.bulk.deleted\";\nexport const EntityViewCreate = \"entity.view.create\";\nexport const EntityViewCreated = \"entity.view.created\";\nexport const EntityViewUpdate = \"entity.view.update\";\nexport const EntityViewUpdated = \"entity.view.updated\";\nexport const EntityViewDelete = \"entity.view.delete\";\nexport const EntityViewDeleted = \"entity.view.deleted\";\nexport const EntityViewList = \"entity.view.list\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages/@elqnt/entity/dist/chunk-GQJJP4YL.js","../hooks/use-entities.ts"],"names":[],"m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AA,IACA,CAAC,OAAO;AAAA,EACV,CAAA;AAEA,EAAA,MAAM,aAAA,EAAe,gCAAA;AAAA,IACnB,MAAA,CAAO,UAAA,EAAoB,QAAA,EAAA,GAAuC;AAChE,MAAA,UAAA,CAAW,IAAI,CAAA;AACf,MAAA,QAAA,CAAS,IAAI,CAAA;AACb,MAAA,IAAI;AACF,QAAA,MAAM,SAAA,EAAW,MAAM,oDAAA,UAAsB,EAAY,QAAA,EAAU,OAAO,CAAA;AAC1E,QAAA,GAAA,CAAI,QAAA,CAAS,KAAA,EAAO;AAClB,UAAA,QAAA,CAAS,QAAA,CAAS,KAAK,CAAA;AACvB,UAAA,OAAO,KAAA;AAAA,QACT;AACA,QAAA,OAAO,IAAA;AAAA,MACT,EAAA,MAAA,CAAS,GAAA,EAAK;AACZ,QAAA,MAAM,QAAA,EAAU,IAAA,WAAe,MAAA,EAAQ,GAAA,CAAI,QAAA,EAAU,yBAAA;AACrD,QAAA,QAAA,CAAS,OAAO,CAAA;AAChB,QAAA,OAAO,KAAA;AAAA,MACT,EAAA,QAAE;AACA,QAAA,UAAA,CAAW,KAAK,CAAA;AAAA,MAClB;AAAA,IACF,CAAA;AAAA,IACA,CAAC,OAAO;AAAA,EACV,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,KAAA;AAAA,IACA,eAAA;AAAA,IACA,aAAA;AAAA,IACA,YAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA,EACF,CAAA;AACF;ADhEA;AACA;AACE;AACF,kCAAC","file":"/home/runner/work/eloquent/eloquent/packages/@elqnt/entity/dist/chunk-GQJJP4YL.js","sourcesContent":[null,"\"use client\";\n\n/**\n * Entity hooks for React applications\n *\n * Provides React hooks for entity CRUD operations with loading/error states.\n */\n\nimport { useState, useCallback } from \"react\";\nimport type { ApiClientOptions } from \"@elqnt/api-client\";\nimport type { EntityDefinition, EntityRecord } from \"../models\";\nimport {\n listEntityDefinitionsApi,\n getEntityDefinitionApi,\n queryEntityRecordsApi,\n getEntityRecordApi,\n createEntityRecordApi,\n updateEntityRecordApi,\n deleteEntityRecordApi,\n} from \"../api\";\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport type UseEntitiesOptions = ApiClientOptions;\n\nexport interface QueryOptions {\n page?: number;\n pageSize?: number;\n filters?: Record<string, unknown>;\n sortBy?: string;\n sortOrder?: \"asc\" | \"desc\";\n}\n\nexport interface QueryResult {\n records: EntityRecord[];\n total: number;\n page: number;\n pageSize: number;\n}\n\n// =============================================================================\n// USE ENTITIES HOOK\n// =============================================================================\n\n/**\n * Hook for entity CRUD operations\n *\n * @example\n * ```tsx\n * const { loading, error, queryRecords, createRecord } = useEntities({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * userId: user?.id,\n * userEmail: user?.email,\n * });\n *\n * const records = await queryRecords(\"contacts\", { page: 1, pageSize: 20 });\n * ```\n */\nexport function useEntities(options: UseEntitiesOptions) {\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const listDefinitions = useCallback(async (): Promise<EntityDefinition[]> => {\n setLoading(true);\n setError(null);\n try {\n const response = await listEntityDefinitionsApi(options);\n if (response.error) {\n setError(response.error);\n return [];\n }\n return response.data?.definitions || [];\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to load definitions\";\n setError(message);\n return [];\n } finally {\n setLoading(false);\n }\n }, [options]);\n\n const getDefinition = useCallback(\n async (entityName: string): Promise<EntityDefinition | null> => {\n setLoading(true);\n setError(null);\n try {\n const response = await getEntityDefinitionApi(entityName, options);\n if (response.error) {\n setError(response.error);\n return null;\n }\n return response.data?.definition || null;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to get definition\";\n setError(message);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const queryRecords = useCallback(\n async (entityName: string, query: QueryOptions = {}): Promise<QueryResult> => {\n setLoading(true);\n setError(null);\n try {\n const queryParams: Record<string, unknown> = {\n page: query.page || 1,\n pageSize: query.pageSize || 20,\n };\n if (query.filters) {\n queryParams.filters = JSON.stringify(query.filters);\n }\n if (query.sortBy) {\n queryParams.sortBy = query.sortBy;\n }\n if (query.sortOrder) {\n queryParams.sortOrder = query.sortOrder;\n }\n\n const response = await queryEntityRecordsApi(entityName, queryParams, options);\n if (response.error) {\n setError(response.error);\n return { records: [], total: 0, page: 1, pageSize: 20 };\n }\n\n // Handle both direct records array and nested ListResult structure\n const data = response.data;\n if (data?.records?.items) {\n // ListEntityRecordsResponse with ListResult\n return {\n records: data.records.items,\n total: data.records.totalCount,\n page: data.records.currentPage,\n pageSize: data.records.pageSize,\n };\n }\n // Fallback for simpler response structure\n return {\n records: (data as any)?.records || [],\n total: (data as any)?.total || 0,\n page: (data as any)?.page || 1,\n pageSize: (data as any)?.pageSize || 20,\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to query records\";\n setError(message);\n return { records: [], total: 0, page: 1, pageSize: 20 };\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const getRecord = useCallback(\n async (entityName: string, recordId: string): Promise<EntityRecord | null> => {\n setLoading(true);\n setError(null);\n try {\n const response = await getEntityRecordApi(entityName, recordId, options);\n if (response.error) {\n setError(response.error);\n return null;\n }\n return response.data?.record || null;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to get record\";\n setError(message);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const createRecord = useCallback(\n async (entityName: string, record: Partial<EntityRecord>): Promise<EntityRecord | null> => {\n setLoading(true);\n setError(null);\n try {\n const response = await createEntityRecordApi(entityName, record, options);\n if (response.error) {\n setError(response.error);\n return null;\n }\n return response.data?.record || null;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to create record\";\n setError(message);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const updateRecord = useCallback(\n async (\n entityName: string,\n recordId: string,\n record: Partial<EntityRecord>\n ): Promise<EntityRecord | null> => {\n setLoading(true);\n setError(null);\n try {\n const response = await updateEntityRecordApi(entityName, recordId, record, options);\n if (response.error) {\n setError(response.error);\n return null;\n }\n return response.data?.record || null;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to update record\";\n setError(message);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const deleteRecord = useCallback(\n async (entityName: string, recordId: string): Promise<boolean> => {\n setLoading(true);\n setError(null);\n try {\n const response = await deleteEntityRecordApi(entityName, recordId, options);\n if (response.error) {\n setError(response.error);\n return false;\n }\n return true;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to delete record\";\n setError(message);\n return false;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n return {\n loading,\n error,\n listDefinitions,\n getDefinition,\n queryRecords,\n getRecord,\n createRecord,\n updateRecord,\n deleteRecord,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/chunk-GQJJP4YL.js","../hooks/use-entities.ts"],"names":[],"mappings":"AAAA,ylBAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACA;ACHA,8BAAsC;AAqD/B,SAAS,WAAA,CAAY,OAAA,EAA6B;AACvD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,EAAA,EAAI,6BAAA,KAAc,CAAA;AAC5C,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,EAAA,EAAI,6BAAA,IAA4B,CAAA;AAEtD,EAAA,MAAM,gBAAA,EAAkB,gCAAA,MAAY,CAAA,EAAA,GAAyC;AAC3E,IAAA,UAAA,CAAW,IAAI,CAAA;AACf,IAAA,QAAA,CAAS,IAAI,CAAA;AACb,IAAA,IAAI;AACF,MAAA,MAAM,SAAA,EAAW,MAAM,uDAAA,OAAgC,CAAA;AACvD,MAAA,GAAA,CAAI,QAAA,CAAS,KAAA,EAAO;AAClB,QAAA,QA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QAAA,EAAU,yBAAA;AACrD,QAAA,QAAA,CAAS,OAAO,CAAA;AAChB,QAAA,OAAO,KAAA;AAAA,MACT,EAAA,QAAE;AACA,QAAA,UAAA,CAAW,KAAK,CAAA;AAAA,MAClB;AAAA,IACF,CAAA;AAAA,IACA,CAAC,OAAO;AAAA,EACV,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,OAAA;AAAA,IACA,KAAA;AAAA,IACA,eAAA;AAAA,IACA,aAAA;AAAA,IACA,YAAA;AAAA,IACA,SAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAA;AAAA,IACA;AAAA,EACF,CAAA;AACF;ADhEA;AACA;AACE;AACF,kCAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/chunk-GQJJP4YL.js","sourcesContent":[null,"\"use client\";\n\n/**\n * Entity hooks for React applications\n *\n * Provides React hooks for entity CRUD operations with loading/error states.\n */\n\nimport { useState, useCallback } from \"react\";\nimport type { ApiClientOptions } from \"@elqnt/api-client\";\nimport type { EntityDefinition, EntityRecord } from \"../models\";\nimport {\n listEntityDefinitionsApi,\n getEntityDefinitionApi,\n queryEntityRecordsApi,\n getEntityRecordApi,\n createEntityRecordApi,\n updateEntityRecordApi,\n deleteEntityRecordApi,\n} from \"../api\";\n\n// =============================================================================\n// TYPES\n// =============================================================================\n\nexport type UseEntitiesOptions = ApiClientOptions;\n\nexport interface QueryOptions {\n page?: number;\n pageSize?: number;\n filters?: Record<string, unknown>;\n sortBy?: string;\n sortOrder?: \"asc\" | \"desc\";\n}\n\nexport interface QueryResult {\n records: EntityRecord[];\n total: number;\n page: number;\n pageSize: number;\n}\n\n// =============================================================================\n// USE ENTITIES HOOK\n// =============================================================================\n\n/**\n * Hook for entity CRUD operations\n *\n * @example\n * ```tsx\n * const { loading, error, queryRecords, createRecord } = useEntities({\n * baseUrl: apiGatewayUrl,\n * orgId: selectedOrgId,\n * userId: user?.id,\n * userEmail: user?.email,\n * });\n *\n * const records = await queryRecords(\"contacts\", { page: 1, pageSize: 20 });\n * ```\n */\nexport function useEntities(options: UseEntitiesOptions) {\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n const listDefinitions = useCallback(async (): Promise<EntityDefinition[]> => {\n setLoading(true);\n setError(null);\n try {\n const response = await listEntityDefinitionsApi(options);\n if (response.error) {\n setError(response.error);\n return [];\n }\n return response.data?.definitions || [];\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to load definitions\";\n setError(message);\n return [];\n } finally {\n setLoading(false);\n }\n }, [options]);\n\n const getDefinition = useCallback(\n async (entityName: string): Promise<EntityDefinition | null> => {\n setLoading(true);\n setError(null);\n try {\n const response = await getEntityDefinitionApi(entityName, options);\n if (response.error) {\n setError(response.error);\n return null;\n }\n return response.data?.definition || null;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to get definition\";\n setError(message);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const queryRecords = useCallback(\n async (entityName: string, query: QueryOptions = {}): Promise<QueryResult> => {\n setLoading(true);\n setError(null);\n try {\n const queryParams: Record<string, unknown> = {\n page: query.page || 1,\n pageSize: query.pageSize || 20,\n };\n if (query.filters) {\n queryParams.filters = JSON.stringify(query.filters);\n }\n if (query.sortBy) {\n queryParams.sortBy = query.sortBy;\n }\n if (query.sortOrder) {\n queryParams.sortOrder = query.sortOrder;\n }\n\n const response = await queryEntityRecordsApi(entityName, queryParams, options);\n if (response.error) {\n setError(response.error);\n return { records: [], total: 0, page: 1, pageSize: 20 };\n }\n\n // Handle both direct records array and nested ListResult structure\n const data = response.data;\n if (data?.records?.items) {\n // ListEntityRecordsResponse with ListResult\n return {\n records: data.records.items,\n total: data.records.totalCount,\n page: data.records.currentPage,\n pageSize: data.records.pageSize,\n };\n }\n // Fallback for simpler response structure\n return {\n records: (data as any)?.records || [],\n total: (data as any)?.total || 0,\n page: (data as any)?.page || 1,\n pageSize: (data as any)?.pageSize || 20,\n };\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to query records\";\n setError(message);\n return { records: [], total: 0, page: 1, pageSize: 20 };\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const getRecord = useCallback(\n async (entityName: string, recordId: string): Promise<EntityRecord | null> => {\n setLoading(true);\n setError(null);\n try {\n const response = await getEntityRecordApi(entityName, recordId, options);\n if (response.error) {\n setError(response.error);\n return null;\n }\n return response.data?.record || null;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to get record\";\n setError(message);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const createRecord = useCallback(\n async (entityName: string, record: Partial<EntityRecord>): Promise<EntityRecord | null> => {\n setLoading(true);\n setError(null);\n try {\n const response = await createEntityRecordApi(entityName, record, options);\n if (response.error) {\n setError(response.error);\n return null;\n }\n return response.data?.record || null;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to create record\";\n setError(message);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const updateRecord = useCallback(\n async (\n entityName: string,\n recordId: string,\n record: Partial<EntityRecord>\n ): Promise<EntityRecord | null> => {\n setLoading(true);\n setError(null);\n try {\n const response = await updateEntityRecordApi(entityName, recordId, record, options);\n if (response.error) {\n setError(response.error);\n return null;\n }\n return response.data?.record || null;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to update record\";\n setError(message);\n return null;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n const deleteRecord = useCallback(\n async (entityName: string, recordId: string): Promise<boolean> => {\n setLoading(true);\n setError(null);\n try {\n const response = await deleteEntityRecordApi(entityName, recordId, options);\n if (response.error) {\n setError(response.error);\n return false;\n }\n return true;\n } catch (err) {\n const message = err instanceof Error ? err.message : \"Failed to delete record\";\n setError(message);\n return false;\n } finally {\n setLoading(false);\n }\n },\n [options]\n );\n\n return {\n loading,\n error,\n listDefinitions,\n getDefinition,\n queryRecords,\n getRecord,\n createRecord,\n updateRecord,\n deleteRecord,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/chunk-SXBB42DJ.js","../api/index.ts"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACA;ACKA,oDAAkC;AAgBlC,MAAA,SAAsB,wBAAA,CACpB,OAAA,EACqD;AACrD,EAAA,OAAO,wCAAA,8BAAkB,EAAgC,EAAE,MAAA,EAAQ,KAAA,EAAO,GAAG,QAAQ,CAAC,CAAA;AACxF;AAEA,MAAA,SAAsB,sBAAA,CACpB,UAAA,EACA,OAAA,EACgD;AAChD,EAAA,OAAO,wCAAA,CAAkB,6BAAA,EAAgC,UAAU,CAAA,CAAA;AACrE;AAKkD;AACmB,EAAA;AACrE;AAKE;AAEmE,EAAA;AACrE;AAK0E;AACL,EAAA;AACrE;AAUmD;AACd,EAAA;AACa,EAAA;AACH,IAAA;AACZ,MAAA;AAC/B,IAAA;AACD,EAAA;AACmC,EAAA;AACsB,EAAA;AACM,EAAA;AAClE;AAM8C;AACuB,EAAA;AACrE;AAM8C;AACuB,EAAA;AACrE;AAME;AAEmE,EAAA;AACrE;AAM0E;AACL,EAAA;AACrE;AASE;AAEuD,EAAA;AACzD;AAKE;AAEuD,EAAA;AACzD;AAKE;AAEuD,EAAA;AACzD;AAUuE;AAClC,EAAA;AACe,EAAA;AACL,IAAA;AACZ,MAAA;AAC/B,IAAA;AACD,EAAA;AACmC,EAAA;AAC4B,EAAA;AACA,EAAA;AAClE;AD/FsE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/chunk-SXBB42DJ.js","sourcesContent":[null,"/**\n * Entity API functions\n *\n * Browser-side API client for entity operations.\n * Uses @elqnt/api-client for HTTP requests with automatic token management.\n */\n\nimport { browserApiRequest } from \"@elqnt/api-client/browser\";\nimport type { ApiResponse, ApiClientOptions } from \"@elqnt/api-client\";\nimport type { ResponseMetadata } from \"@elqnt/types\";\nimport type {\n EntityDefinition,\n EntityRecord,\n ListEntityDefinitionsResponse,\n EntityDefinitionResponse,\n ListEntityRecordsResponse,\n EntityRecordResponse,\n} from \"../models\";\n\n// =============================================================================\n// ENTITY DEFINITIONS\n// =============================================================================\n\nexport async function listEntityDefinitionsApi(\n options: ApiClientOptions\n): Promise<ApiResponse<ListEntityDefinitionsResponse>> {\n return browserApiRequest(\"/api/v1/entities/definitions\", { method: \"GET\", ...options });\n}\n\nexport async function getEntityDefinitionApi(\n entityName: string,\n options: ApiClientOptions\n): Promise<ApiResponse<EntityDefinitionResponse>> {\n return browserApiRequest(`/api/v1/entities/definitions/${entityName}`, { method: \"GET\", ...options });\n}\n\nexport async function createEntityDefinitionApi(\n definition: Partial<EntityDefinition>,\n options: ApiClientOptions\n): Promise<ApiResponse<EntityDefinitionResponse>> {\n return browserApiRequest(\"/api/v1/entities/definitions\", { method: \"POST\", body: definition, ...options });\n}\n\nexport async function updateEntityDefinitionApi(\n entityName: string,\n definition: Partial<EntityDefinition>,\n options: ApiClientOptions\n): Promise<ApiResponse<EntityDefinitionResponse>> {\n return browserApiRequest(`/api/v1/entities/definitions/${entityName}`, { method: \"PUT\", body: definition, ...options });\n}\n\nexport async function deleteEntityDefinitionApi(\n entityName: string,\n options: ApiClientOptions\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/entities/definitions/${entityName}`, { method: \"DELETE\", ...options });\n}\n\n// =============================================================================\n// ENTITY RECORDS\n// =============================================================================\n\nexport async function queryEntityRecordsApi(\n entityName: string,\n query: Record<string, unknown>,\n options: ApiClientOptions\n): Promise<ApiResponse<ListEntityRecordsResponse>> {\n const params = new URLSearchParams();\n Object.entries(query).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n params.set(key, String(value));\n }\n });\n const queryString = params.toString();\n const endpoint = `/api/v1/entities/${entityName}/records${queryString ? `?${queryString}` : \"\"}`;\n return browserApiRequest(endpoint, { method: \"GET\", ...options });\n}\n\nexport async function getEntityRecordApi(\n entityName: string,\n recordId: string,\n options: ApiClientOptions\n): Promise<ApiResponse<EntityRecordResponse>> {\n return browserApiRequest(`/api/v1/entities/${entityName}/records/${recordId}`, { method: \"GET\", ...options });\n}\n\nexport async function createEntityRecordApi(\n entityName: string,\n record: Partial<EntityRecord>,\n options: ApiClientOptions\n): Promise<ApiResponse<EntityRecordResponse>> {\n return browserApiRequest(`/api/v1/entities/${entityName}/records`, { method: \"POST\", body: record, ...options });\n}\n\nexport async function updateEntityRecordApi(\n entityName: string,\n recordId: string,\n record: Partial<EntityRecord>,\n options: ApiClientOptions\n): Promise<ApiResponse<EntityRecordResponse>> {\n return browserApiRequest(`/api/v1/entities/${entityName}/records/${recordId}`, { method: \"PUT\", body: record, ...options });\n}\n\nexport async function deleteEntityRecordApi(\n entityName: string,\n recordId: string,\n options: ApiClientOptions\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/entities/${entityName}/records/${recordId}`, { method: \"DELETE\", ...options });\n}\n\n// =============================================================================\n// BULK OPERATIONS\n// =============================================================================\n\nexport async function bulkCreateEntityRecordsApi(\n entityName: string,\n records: Partial<EntityRecord>[],\n options: ApiClientOptions\n): Promise<ApiResponse<{ records: EntityRecord[]; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/entities/${entityName}/records/bulk`, { method: \"POST\", body: { records }, ...options });\n}\n\nexport async function bulkUpdateEntityRecordsApi(\n entityName: string,\n records: Partial<EntityRecord>[],\n options: ApiClientOptions\n): Promise<ApiResponse<{ records: EntityRecord[]; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/entities/${entityName}/records/bulk`, { method: \"PUT\", body: { records }, ...options });\n}\n\nexport async function bulkDeleteEntityRecordsApi(\n entityName: string,\n recordIds: string[],\n options: ApiClientOptions\n): Promise<ApiResponse<{ success: boolean; metadata: ResponseMetadata }>> {\n return browserApiRequest(`/api/v1/entities/${entityName}/records/bulk`, { method: \"DELETE\", body: { recordIds }, ...options });\n}\n\n// =============================================================================\n// COUNT\n// =============================================================================\n\nexport async function countEntityRecordsApi(\n entityName: string,\n filters: Record<string, unknown>,\n options: ApiClientOptions\n): Promise<ApiResponse<{ count: number; metadata: ResponseMetadata }>> {\n const params = new URLSearchParams();\n Object.entries(filters).forEach(([key, value]) => {\n if (value !== undefined && value !== null) {\n params.set(key, String(value));\n }\n });\n const queryString = params.toString();\n const endpoint = `/api/v1/entities/${entityName}/records/count${queryString ? `?${queryString}` : \"\"}`;\n return browserApiRequest(endpoint, { method: \"GET\", ...options });\n}\n"]}
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ApiClientOptions } from '@elqnt/api-client';
|
|
2
|
-
import {
|
|
2
|
+
import { EntityDefinition, EntityRecord } from '../models/index.mjs';
|
|
3
3
|
import '@elqnt/types';
|
|
4
4
|
|
|
5
5
|
type UseEntitiesOptions = ApiClientOptions;
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/hooks/index.js"],"names":[],"mappings":"AAAA,qFAAY;AACZ,YAAY;AACZ;AACE;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,mDAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/hooks/index.js"}
|
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import { EntityDefinition, EntityView, EntityRecord, EntityQuery, ListResult } f
|
|
|
2
2
|
export { BulkCreateRequest, BulkDeleteRequest, BulkUpdateRequest, CountEntityRecordsRequest, CountEntityRecordsResponse, CreateEntityDefinitionRequest, CreateOrgSchemaRequest, CreateOrgSchemaResponse, CreateRecordRequest, CreateViewRequest, DeleteEntityDefinitionRequest, DeleteRecordRequest, DeleteViewRequest, DropOrgSchemaRequest, DropOrgSchemaResponse, EntityDefinitionChangeEvent, EntityDefinitionCreate, EntityDefinitionCreated, EntityDefinitionDelete, EntityDefinitionDeleted, EntityDefinitionGet, EntityDefinitionGetServer, EntityDefinitionList, EntityDefinitionResponse, EntityDefinitionUpdate, EntityDefinitionUpdated, EntityFieldType, EntityFieldTypeBool, EntityFieldTypeCurrency, EntityFieldTypeDate, EntityFieldTypeDateTime, EntityFieldTypeDropdown, EntityFieldTypeEmail, EntityFieldTypeFile, EntityFieldTypeFloat, EntityFieldTypeImage, EntityFieldTypeInt, EntityFieldTypeJSON, EntityFieldTypeLookup, EntityFieldTypeMultiLookup, EntityFieldTypeMultiSelect, EntityFieldTypeOptionTS, EntityFieldTypePhone, EntityFieldTypeString, EntityFieldTypeStringMultiline, EntityFieldTypeTS, EntityFieldTypeText, EntityFieldTypeURL, EntityFieldTypes, EntityFilterOperator, EntityFilterOperatorOptionTS, EntityFilterOperatorTS, EntityFilterOperators, EntityOrgSchemaCreate, EntityOrgSchemaDrop, EntityRecordChangeEvent, EntityRecordCount, EntityRecordCreate, EntityRecordCreated, EntityRecordDelete, EntityRecordDeleted, EntityRecordGet, EntityRecordQuery, EntityRecordResponse, EntityRecordUpdate, EntityRecordUpdated, EntityRecordsBulkCreate, EntityRecordsBulkCreated, EntityRecordsBulkDelete, EntityRecordsBulkDeleted, EntityRecordsBulkUpdate, EntityRecordsBulkUpdated, EntityViewChangeEvent, EntityViewCreate, EntityViewCreated, EntityViewDelete, EntityViewDeleted, EntityViewList, EntityViewResponse, EntityViewUpdate, EntityViewUpdated, FieldValidation, Filter, GetEntityDefinitionRequest, GetEntityRecordRequest, GetEntityRecordResponse, GetViewRequest, InsertOneResult, ListEntityDefinitionsRequest, ListEntityDefinitionsResponse, ListEntityRecordsResponse, ListOptions, ListViewsRequest, ListViewsResponse, LookupInclude, OperatorBetween, OperatorContains, OperatorEmpty, OperatorEndsWith, OperatorEq, OperatorExists, OperatorGt, OperatorGte, OperatorIn, OperatorLt, OperatorLte, OperatorNe, OperatorNin, OperatorStartsWith, QueryRequest, RecordChange, RecordChangeAction, RecordChangeActionCreated, RecordChangeActionDeleted, RecordChangeActionUpdated, RecordReference, ResponseMetadata, Sort, UpdateEntityDefinitionRequest, UpdateRecordRequest, UpdateViewRequest, ValidationRule, ValidationRuleCondition, View, ViewColumn, ViewFilter } from './models/index.mjs';
|
|
3
3
|
export { bulkCreateEntityRecordsApi, bulkDeleteEntityRecordsApi, bulkUpdateEntityRecordsApi, countEntityRecordsApi, createEntityDefinitionApi, createEntityRecordApi, deleteEntityDefinitionApi, deleteEntityRecordApi, getEntityDefinitionApi, getEntityRecordApi, listEntityDefinitionsApi, queryEntityRecordsApi, updateEntityDefinitionApi, updateEntityRecordApi } from './api/index.mjs';
|
|
4
4
|
export { QueryOptions, QueryResult, UseEntitiesOptions, useEntities } from './hooks/index.mjs';
|
|
5
|
-
import * as
|
|
5
|
+
import * as redux from 'redux';
|
|
6
6
|
import '@elqnt/types';
|
|
7
7
|
import '@elqnt/api-client';
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ interface EntityDefinitionState {
|
|
|
18
18
|
interface EntityDefinitionSelector {
|
|
19
19
|
entityDefinition: EntityDefinitionState;
|
|
20
20
|
}
|
|
21
|
-
declare const entityDefinitionReducer:
|
|
21
|
+
declare const entityDefinitionReducer: redux.Reducer<EntityDefinitionState>;
|
|
22
22
|
|
|
23
23
|
interface EntityRecordState {
|
|
24
24
|
records: {
|
|
@@ -38,7 +38,7 @@ interface EntityRecordState {
|
|
|
38
38
|
interface EntityRecordSelector {
|
|
39
39
|
entityRecord: EntityRecordState;
|
|
40
40
|
}
|
|
41
|
-
declare const entityRecordReducer:
|
|
41
|
+
declare const entityRecordReducer: redux.Reducer<EntityRecordState>;
|
|
42
42
|
|
|
43
43
|
declare const PREDEFINED_COLORS: {
|
|
44
44
|
value: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { EntityDefinition, EntityView, EntityRecord, EntityQuery, ListResult } f
|
|
|
2
2
|
export { BulkCreateRequest, BulkDeleteRequest, BulkUpdateRequest, CountEntityRecordsRequest, CountEntityRecordsResponse, CreateEntityDefinitionRequest, CreateOrgSchemaRequest, CreateOrgSchemaResponse, CreateRecordRequest, CreateViewRequest, DeleteEntityDefinitionRequest, DeleteRecordRequest, DeleteViewRequest, DropOrgSchemaRequest, DropOrgSchemaResponse, EntityDefinitionChangeEvent, EntityDefinitionCreate, EntityDefinitionCreated, EntityDefinitionDelete, EntityDefinitionDeleted, EntityDefinitionGet, EntityDefinitionGetServer, EntityDefinitionList, EntityDefinitionResponse, EntityDefinitionUpdate, EntityDefinitionUpdated, EntityFieldType, EntityFieldTypeBool, EntityFieldTypeCurrency, EntityFieldTypeDate, EntityFieldTypeDateTime, EntityFieldTypeDropdown, EntityFieldTypeEmail, EntityFieldTypeFile, EntityFieldTypeFloat, EntityFieldTypeImage, EntityFieldTypeInt, EntityFieldTypeJSON, EntityFieldTypeLookup, EntityFieldTypeMultiLookup, EntityFieldTypeMultiSelect, EntityFieldTypeOptionTS, EntityFieldTypePhone, EntityFieldTypeString, EntityFieldTypeStringMultiline, EntityFieldTypeTS, EntityFieldTypeText, EntityFieldTypeURL, EntityFieldTypes, EntityFilterOperator, EntityFilterOperatorOptionTS, EntityFilterOperatorTS, EntityFilterOperators, EntityOrgSchemaCreate, EntityOrgSchemaDrop, EntityRecordChangeEvent, EntityRecordCount, EntityRecordCreate, EntityRecordCreated, EntityRecordDelete, EntityRecordDeleted, EntityRecordGet, EntityRecordQuery, EntityRecordResponse, EntityRecordUpdate, EntityRecordUpdated, EntityRecordsBulkCreate, EntityRecordsBulkCreated, EntityRecordsBulkDelete, EntityRecordsBulkDeleted, EntityRecordsBulkUpdate, EntityRecordsBulkUpdated, EntityViewChangeEvent, EntityViewCreate, EntityViewCreated, EntityViewDelete, EntityViewDeleted, EntityViewList, EntityViewResponse, EntityViewUpdate, EntityViewUpdated, FieldValidation, Filter, GetEntityDefinitionRequest, GetEntityRecordRequest, GetEntityRecordResponse, GetViewRequest, InsertOneResult, ListEntityDefinitionsRequest, ListEntityDefinitionsResponse, ListEntityRecordsResponse, ListOptions, ListViewsRequest, ListViewsResponse, LookupInclude, OperatorBetween, OperatorContains, OperatorEmpty, OperatorEndsWith, OperatorEq, OperatorExists, OperatorGt, OperatorGte, OperatorIn, OperatorLt, OperatorLte, OperatorNe, OperatorNin, OperatorStartsWith, QueryRequest, RecordChange, RecordChangeAction, RecordChangeActionCreated, RecordChangeActionDeleted, RecordChangeActionUpdated, RecordReference, ResponseMetadata, Sort, UpdateEntityDefinitionRequest, UpdateRecordRequest, UpdateViewRequest, ValidationRule, ValidationRuleCondition, View, ViewColumn, ViewFilter } from './models/index.js';
|
|
3
3
|
export { bulkCreateEntityRecordsApi, bulkDeleteEntityRecordsApi, bulkUpdateEntityRecordsApi, countEntityRecordsApi, createEntityDefinitionApi, createEntityRecordApi, deleteEntityDefinitionApi, deleteEntityRecordApi, getEntityDefinitionApi, getEntityRecordApi, listEntityDefinitionsApi, queryEntityRecordsApi, updateEntityDefinitionApi, updateEntityRecordApi } from './api/index.js';
|
|
4
4
|
export { QueryOptions, QueryResult, UseEntitiesOptions, useEntities } from './hooks/index.js';
|
|
5
|
-
import * as
|
|
5
|
+
import * as redux from 'redux';
|
|
6
6
|
import '@elqnt/types';
|
|
7
7
|
import '@elqnt/api-client';
|
|
8
8
|
|
|
@@ -18,7 +18,7 @@ interface EntityDefinitionState {
|
|
|
18
18
|
interface EntityDefinitionSelector {
|
|
19
19
|
entityDefinition: EntityDefinitionState;
|
|
20
20
|
}
|
|
21
|
-
declare const entityDefinitionReducer:
|
|
21
|
+
declare const entityDefinitionReducer: redux.Reducer<EntityDefinitionState>;
|
|
22
22
|
|
|
23
23
|
interface EntityRecordState {
|
|
24
24
|
records: {
|
|
@@ -38,7 +38,7 @@ interface EntityRecordState {
|
|
|
38
38
|
interface EntityRecordSelector {
|
|
39
39
|
entityRecord: EntityRecordState;
|
|
40
40
|
}
|
|
41
|
-
declare const entityRecordReducer:
|
|
41
|
+
declare const entityRecordReducer: redux.Reducer<EntityRecordState>;
|
|
42
42
|
|
|
43
43
|
declare const PREDEFINED_COLORS: {
|
|
44
44
|
value: string;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages/@elqnt/entity/dist/index.js","../store/entity-definition-slice.ts","../store/entity-record-slice.ts","../consts/colors.ts"],"names":["initialState","createSlice","setLoading","setOperationLoading","setError"],"mappings":"AAAA,ylBAAY;AACZ;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACA;AC7FA,2CAA2C;AAgB3C,IAAM,aAAA,EAAsC;AAAA,EAC1C,WAAA,EAAa,CAAC,CAAA;AAAA,EACd,KAAA,EAAO,CAAC,CAAA;AAAA,EACR,SAAA,EAAW,KAAA;AAAA,EACX,aAAA,EAAe,CAAC;AAClB,CAAA;AAEA,IAAM,sBAAA,EAAwB,kCAAA;AAAY,EACxC,IAAA,EAA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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,08LAAC","file":"/home/runner/work/eloquent/eloquent/packages/@elqnt/entity/dist/index.js","sourcesContent":[null,"// store/entityDefinitionSlice.ts\nimport { createSlice, PayloadAction } from \"@reduxjs/toolkit\";\nimport { EntityDefinition, EntityView } from \"../models\";\nexport interface EntityDefinitionState {\n definitions: Record<string, EntityDefinition>;\n selectedDefinition?: EntityDefinition;\n views: Record<string, EntityView[]>;\n selectedView?: EntityView;\n isLoading: boolean;\n error?: string;\n loadingStates: Record<string, boolean>;\n}\n\nexport interface EntityDefinitionSelector {\n entityDefinition: EntityDefinitionState;\n}\n\nconst initialState: EntityDefinitionState = {\n definitions: {},\n views: {},\n isLoading: false,\n loadingStates: {},\n};\n\nconst entityDefinitionSlice = createSlice({\n name: \"entityDefinition\",\n initialState,\n reducers: {\n setLoading: (state, action: PayloadAction<boolean>) => {\n state.isLoading = action.payload;\n },\n setOperationLoading: (\n state,\n action: PayloadAction<{ operation: string; loading: boolean }>\n ) => {\n state.loadingStates[action.payload.operation] = action.payload.loading;\n },\n setError: (state, action: PayloadAction<string | undefined>) => {\n state.error = action.payload;\n },\n setDefinitions: (state, action: PayloadAction<EntityDefinition[]>) => {\n state.definitions = action.payload.reduce(\n (acc, def) => {\n acc[def.name] = def;\n return acc;\n },\n {} as Record<string, EntityDefinition>\n );\n },\n addDefinition: (state, action: PayloadAction<EntityDefinition>) => {\n const definition = action.payload;\n state.definitions[definition.name] = definition;\n },\n updateDefinition: (state, action: PayloadAction<EntityDefinition>) => {\n const definition = action.payload;\n state.definitions[definition.name] = definition;\n if (state.selectedDefinition?.name === definition.name) {\n state.selectedDefinition = definition;\n }\n },\n removeDefinition: (state, action: PayloadAction<string>) => {\n delete state.definitions[action.payload];\n if (state.selectedDefinition?.name === action.payload) {\n state.selectedDefinition = undefined;\n }\n },\n setSelectedDefinition: (\n state,\n action: PayloadAction<EntityDefinition | undefined>\n ) => {\n state.selectedDefinition = action.payload;\n },\n setViews: (\n state,\n action: PayloadAction<{ entityName: string; views: EntityView[] }>\n ) => {\n const { entityName, views } = action.payload;\n state.views[entityName] = views;\n },\n addView: (\n state,\n action: PayloadAction<{ entityName: string; view: EntityView }>\n ) => {\n const { entityName, view } = action.payload;\n if (!state.views[entityName]) {\n state.views[entityName] = [];\n }\n state.views[entityName].push(view);\n },\n updateView: (\n state,\n action: PayloadAction<{ entityName: string; view: EntityView }>\n ) => {\n const { entityName, view } = action.payload;\n const views = state.views[entityName];\n if (views) {\n const index = views.findIndex((v) => v.id === view.id);\n if (index !== -1) {\n views[index] = view;\n if (state.selectedView?.id === view.id) {\n state.selectedView = view;\n }\n }\n }\n },\n removeView: (\n state,\n action: PayloadAction<{ entityName: string; viewId: string }>\n ) => {\n const { entityName, viewId } = action.payload;\n const views = state.views[entityName];\n if (views) {\n state.views[entityName] = views.filter((v) => v.id !== viewId);\n if (state.selectedView?.id === viewId) {\n state.selectedView = undefined;\n }\n }\n },\n setSelectedView: (state, action: PayloadAction<EntityView | undefined>) => {\n state.selectedView = action.payload;\n },\n },\n});\n\nexport const {\n setLoading,\n setOperationLoading,\n setError,\n setDefinitions,\n addDefinition,\n updateDefinition,\n removeDefinition,\n setSelectedDefinition,\n setViews,\n addView,\n updateView,\n removeView,\n setSelectedView,\n} = entityDefinitionSlice.actions;\n\nexport const entityDefinitionReducer = entityDefinitionSlice.reducer;\n","// store/entity-record-slice.ts\nimport { createSlice, PayloadAction } from \"@reduxjs/toolkit\";\nimport { EntityQuery, EntityRecord, EntityView, ListResult } from \"../models\";\n\nexport interface EntityRecordState {\n records: {\n [entityName: string]: {\n items: Record<string, EntityRecord>;\n params: EntityQuery;\n meta: ListResult<EntityRecord>;\n selected: string[]; // Selected record IDs\n };\n };\n selectedRecord?: EntityRecord;\n activeView?: EntityView;\n isLoading: boolean;\n error?: string;\n loadingStates: Record<string, boolean>;\n}\n\nexport interface EntityRecordSelector {\n entityRecord: EntityRecordState;\n}\n\nconst initialState: EntityRecordState = {\n records: {},\n isLoading: false,\n loadingStates: {},\n};\n\nconst entityRecordSlice = createSlice({\n name: \"entityRecord\",\n initialState,\n reducers: {\n setLoading: (state, action: PayloadAction<boolean>) => {\n state.isLoading = action.payload;\n },\n\n setOperationLoading: (\n state,\n action: PayloadAction<{ operation: string; loading: boolean }>\n ) => {\n state.loadingStates[action.payload.operation] = action.payload.loading;\n },\n\n setError: (state, action: PayloadAction<string | undefined>) => {\n state.error = action.payload;\n },\n\n setRecords: (\n state,\n action: PayloadAction<{\n entityName: string;\n records: ListResult<EntityRecord>;\n params: EntityQuery;\n }>\n ) => {\n const { entityName, records, params } = action.payload;\n state.records[entityName] = {\n items: records.items.reduce(\n (acc, record) => {\n acc[record.id] = record;\n return acc;\n },\n {} as Record<string, EntityRecord>\n ),\n params,\n meta: records,\n selected: [],\n };\n },\n\n addRecord: (\n state,\n action: PayloadAction<{ entityName: string; record: EntityRecord }>\n ) => {\n const { entityName, record } = action.payload;\n if (state.records[entityName]) {\n state.records[entityName].items[record.id] = record;\n }\n },\n\n updateRecord: (\n state,\n action: PayloadAction<{ entityName: string; record: EntityRecord }>\n ) => {\n const { entityName, record } = action.payload;\n if (state.records[entityName]) {\n state.records[entityName].items[record.id] = record;\n }\n },\n\n removeRecord: (\n state,\n action: PayloadAction<{ entityName: string; recordId: string }>\n ) => {\n const { entityName, recordId } = action.payload;\n if (state.records[entityName]) {\n delete state.records[entityName].items[recordId];\n state.records[entityName].selected = state.records[\n entityName\n ].selected.filter((id) => id !== recordId);\n }\n },\n\n setSelected: (\n state,\n action: PayloadAction<{ entityName: string; ids: string[] }>\n ) => {\n const { entityName, ids } = action.payload;\n if (state.records[entityName]) {\n state.records[entityName].selected = ids;\n }\n },\n\n setActiveView: (state, action: PayloadAction<EntityView | undefined>) => {\n state.activeView = action.payload;\n },\n\n updateQueryParams: (\n state,\n action: PayloadAction<{\n entityName: string;\n params: Partial<EntityQuery>;\n }>\n ) => {\n const { entityName, params } = action.payload;\n if (state.records[entityName]) {\n state.records[entityName].params = {\n ...state.records[entityName].params,\n ...params,\n };\n }\n },\n\n setSelectedRecord: (\n state,\n action: PayloadAction<{ record: EntityRecord }>\n ) => {\n const { record } = action.payload;\n state.selectedRecord = record;\n },\n },\n});\n\nexport const {\n setLoading,\n setOperationLoading,\n setError,\n setRecords,\n addRecord,\n updateRecord,\n removeRecord,\n setSelected,\n setSelectedRecord,\n setActiveView,\n updateQueryParams,\n} = entityRecordSlice.actions;\n\nexport const entityRecordReducer = entityRecordSlice.reducer;\n","// Predefined colors with their display names\nexport const PREDEFINED_COLORS = [\n { value: \"#EF4444\", name: \"Red\" },\n { value: \"#F97316\", name: \"Orange\" },\n { value: \"#EAB308\", name: \"Yellow\" },\n { value: \"#22C55E\", name: \"Green\" },\n { value: \"#06B6D4\", name: \"Cyan\" },\n { value: \"#3B82F6\", name: \"Blue\" },\n { value: \"#6366F1\", name: \"Indigo\" },\n { value: \"#A855F7\", name: \"Purple\" },\n];\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/index.js","../store/entity-definition-slice.ts","../store/entity-record-slice.ts","../consts/colors.ts"],"names":["initialState","createSlice","setLoading","setOperationLoading","setError"],"mappings":"AAAA,ylBAAY;AACZ;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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SAAA,EAAW,IAAA,EAAM,OAAO,CAAA;AAAA,EACjC,EAAE,KAAA,EAAO,SAAA,EAAW,IAAA,EAAM,OAAO,CAAA;AAAA,EACjC,EAAE,KAAA,EAAO,SAAA,EAAW,IAAA,EAAM,SAAS,CAAA;AAAA,EACnC,EAAE,KAAA,EAAO,SAAA,EAAW,IAAA,EAAM,SAAS;AACrC,CAAA;AHsSA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,08LAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/index.js","sourcesContent":[null,"// store/entityDefinitionSlice.ts\nimport { createSlice, PayloadAction } from \"@reduxjs/toolkit\";\nimport { EntityDefinition, EntityView } from \"../models\";\nexport interface EntityDefinitionState {\n definitions: Record<string, EntityDefinition>;\n selectedDefinition?: EntityDefinition;\n views: Record<string, EntityView[]>;\n selectedView?: EntityView;\n isLoading: boolean;\n error?: string;\n loadingStates: Record<string, boolean>;\n}\n\nexport interface EntityDefinitionSelector {\n entityDefinition: EntityDefinitionState;\n}\n\nconst initialState: EntityDefinitionState = {\n definitions: {},\n views: {},\n isLoading: false,\n loadingStates: {},\n};\n\nconst entityDefinitionSlice = createSlice({\n name: \"entityDefinition\",\n initialState,\n reducers: {\n setLoading: (state, action: PayloadAction<boolean>) => {\n state.isLoading = action.payload;\n },\n setOperationLoading: (\n state,\n action: PayloadAction<{ operation: string; loading: boolean }>\n ) => {\n state.loadingStates[action.payload.operation] = action.payload.loading;\n },\n setError: (state, action: PayloadAction<string | undefined>) => {\n state.error = action.payload;\n },\n setDefinitions: (state, action: PayloadAction<EntityDefinition[]>) => {\n state.definitions = action.payload.reduce(\n (acc, def) => {\n acc[def.name] = def;\n return acc;\n },\n {} as Record<string, EntityDefinition>\n );\n },\n addDefinition: (state, action: PayloadAction<EntityDefinition>) => {\n const definition = action.payload;\n state.definitions[definition.name] = definition;\n },\n updateDefinition: (state, action: PayloadAction<EntityDefinition>) => {\n const definition = action.payload;\n state.definitions[definition.name] = definition;\n if (state.selectedDefinition?.name === definition.name) {\n state.selectedDefinition = definition;\n }\n },\n removeDefinition: (state, action: PayloadAction<string>) => {\n delete state.definitions[action.payload];\n if (state.selectedDefinition?.name === action.payload) {\n state.selectedDefinition = undefined;\n }\n },\n setSelectedDefinition: (\n state,\n action: PayloadAction<EntityDefinition | undefined>\n ) => {\n state.selectedDefinition = action.payload;\n },\n setViews: (\n state,\n action: PayloadAction<{ entityName: string; views: EntityView[] }>\n ) => {\n const { entityName, views } = action.payload;\n state.views[entityName] = views;\n },\n addView: (\n state,\n action: PayloadAction<{ entityName: string; view: EntityView }>\n ) => {\n const { entityName, view } = action.payload;\n if (!state.views[entityName]) {\n state.views[entityName] = [];\n }\n state.views[entityName].push(view);\n },\n updateView: (\n state,\n action: PayloadAction<{ entityName: string; view: EntityView }>\n ) => {\n const { entityName, view } = action.payload;\n const views = state.views[entityName];\n if (views) {\n const index = views.findIndex((v) => v.id === view.id);\n if (index !== -1) {\n views[index] = view;\n if (state.selectedView?.id === view.id) {\n state.selectedView = view;\n }\n }\n }\n },\n removeView: (\n state,\n action: PayloadAction<{ entityName: string; viewId: string }>\n ) => {\n const { entityName, viewId } = action.payload;\n const views = state.views[entityName];\n if (views) {\n state.views[entityName] = views.filter((v) => v.id !== viewId);\n if (state.selectedView?.id === viewId) {\n state.selectedView = undefined;\n }\n }\n },\n setSelectedView: (state, action: PayloadAction<EntityView | undefined>) => {\n state.selectedView = action.payload;\n },\n },\n});\n\nexport const {\n setLoading,\n setOperationLoading,\n setError,\n setDefinitions,\n addDefinition,\n updateDefinition,\n removeDefinition,\n setSelectedDefinition,\n setViews,\n addView,\n updateView,\n removeView,\n setSelectedView,\n} = entityDefinitionSlice.actions;\n\nexport const entityDefinitionReducer = entityDefinitionSlice.reducer;\n","// store/entity-record-slice.ts\nimport { createSlice, PayloadAction } from \"@reduxjs/toolkit\";\nimport { EntityQuery, EntityRecord, EntityView, ListResult } from \"../models\";\n\nexport interface EntityRecordState {\n records: {\n [entityName: string]: {\n items: Record<string, EntityRecord>;\n params: EntityQuery;\n meta: ListResult<EntityRecord>;\n selected: string[]; // Selected record IDs\n };\n };\n selectedRecord?: EntityRecord;\n activeView?: EntityView;\n isLoading: boolean;\n error?: string;\n loadingStates: Record<string, boolean>;\n}\n\nexport interface EntityRecordSelector {\n entityRecord: EntityRecordState;\n}\n\nconst initialState: EntityRecordState = {\n records: {},\n isLoading: false,\n loadingStates: {},\n};\n\nconst entityRecordSlice = createSlice({\n name: \"entityRecord\",\n initialState,\n reducers: {\n setLoading: (state, action: PayloadAction<boolean>) => {\n state.isLoading = action.payload;\n },\n\n setOperationLoading: (\n state,\n action: PayloadAction<{ operation: string; loading: boolean }>\n ) => {\n state.loadingStates[action.payload.operation] = action.payload.loading;\n },\n\n setError: (state, action: PayloadAction<string | undefined>) => {\n state.error = action.payload;\n },\n\n setRecords: (\n state,\n action: PayloadAction<{\n entityName: string;\n records: ListResult<EntityRecord>;\n params: EntityQuery;\n }>\n ) => {\n const { entityName, records, params } = action.payload;\n state.records[entityName] = {\n items: records.items.reduce(\n (acc, record) => {\n acc[record.id] = record;\n return acc;\n },\n {} as Record<string, EntityRecord>\n ),\n params,\n meta: records,\n selected: [],\n };\n },\n\n addRecord: (\n state,\n action: PayloadAction<{ entityName: string; record: EntityRecord }>\n ) => {\n const { entityName, record } = action.payload;\n if (state.records[entityName]) {\n state.records[entityName].items[record.id] = record;\n }\n },\n\n updateRecord: (\n state,\n action: PayloadAction<{ entityName: string; record: EntityRecord }>\n ) => {\n const { entityName, record } = action.payload;\n if (state.records[entityName]) {\n state.records[entityName].items[record.id] = record;\n }\n },\n\n removeRecord: (\n state,\n action: PayloadAction<{ entityName: string; recordId: string }>\n ) => {\n const { entityName, recordId } = action.payload;\n if (state.records[entityName]) {\n delete state.records[entityName].items[recordId];\n state.records[entityName].selected = state.records[\n entityName\n ].selected.filter((id) => id !== recordId);\n }\n },\n\n setSelected: (\n state,\n action: PayloadAction<{ entityName: string; ids: string[] }>\n ) => {\n const { entityName, ids } = action.payload;\n if (state.records[entityName]) {\n state.records[entityName].selected = ids;\n }\n },\n\n setActiveView: (state, action: PayloadAction<EntityView | undefined>) => {\n state.activeView = action.payload;\n },\n\n updateQueryParams: (\n state,\n action: PayloadAction<{\n entityName: string;\n params: Partial<EntityQuery>;\n }>\n ) => {\n const { entityName, params } = action.payload;\n if (state.records[entityName]) {\n state.records[entityName].params = {\n ...state.records[entityName].params,\n ...params,\n };\n }\n },\n\n setSelectedRecord: (\n state,\n action: PayloadAction<{ record: EntityRecord }>\n ) => {\n const { record } = action.payload;\n state.selectedRecord = record;\n },\n },\n});\n\nexport const {\n setLoading,\n setOperationLoading,\n setError,\n setRecords,\n addRecord,\n updateRecord,\n removeRecord,\n setSelected,\n setSelectedRecord,\n setActiveView,\n updateQueryParams,\n} = entityRecordSlice.actions;\n\nexport const entityRecordReducer = entityRecordSlice.reducer;\n","// Predefined colors with their display names\nexport const PREDEFINED_COLORS = [\n { value: \"#EF4444\", name: \"Red\" },\n { value: \"#F97316\", name: \"Orange\" },\n { value: \"#EAB308\", name: \"Yellow\" },\n { value: \"#22C55E\", name: \"Green\" },\n { value: \"#06B6D4\", name: \"Cyan\" },\n { value: \"#3B82F6\", name: \"Blue\" },\n { value: \"#6366F1\", name: \"Indigo\" },\n { value: \"#A855F7\", name: \"Purple\" },\n];\n"]}
|
package/dist/models/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/eloquent/eloquent/packages
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/models/index.js"],"names":[],"mappings":"AAAA,qFAAY;AACZ;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,itJAAC","file":"/home/runner/work/eloquent-packages/eloquent-packages/packages/entity/dist/models/index.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elqnt/entity",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.2",
|
|
4
4
|
"description": "Complete entity management for Eloquent platform - models, API, hooks, and store",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -27,17 +27,21 @@
|
|
|
27
27
|
"require": "./dist/hooks/index.js"
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
"files": [
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
"files": ["dist"],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsup",
|
|
33
|
+
"dev": "tsup --watch",
|
|
34
|
+
"clean": "rm -rf dist",
|
|
35
|
+
"typecheck": "tsc --noEmit"
|
|
36
|
+
},
|
|
33
37
|
"repository": {
|
|
34
38
|
"type": "git",
|
|
35
39
|
"url": "git+https://github.com/Blazi-Commerce/eloquent-packages.git",
|
|
36
40
|
"directory": "packages/entity"
|
|
37
41
|
},
|
|
38
42
|
"dependencies": {
|
|
39
|
-
"@elqnt/types": "2.0.
|
|
40
|
-
"@elqnt/api-client": "1.0.
|
|
43
|
+
"@elqnt/types": "^2.0.0",
|
|
44
|
+
"@elqnt/api-client": "^1.0.0"
|
|
41
45
|
},
|
|
42
46
|
"peerDependencies": {
|
|
43
47
|
"@reduxjs/toolkit": "^2.0.0",
|
|
@@ -45,18 +49,12 @@
|
|
|
45
49
|
"react-redux": "^9.0.0"
|
|
46
50
|
},
|
|
47
51
|
"devDependencies": {
|
|
52
|
+
"@elqnt/api-client": "^1.0.0",
|
|
48
53
|
"@reduxjs/toolkit": "^2.3.0",
|
|
49
54
|
"@types/react": "^19.0.0",
|
|
50
55
|
"react": "^19.0.0",
|
|
51
56
|
"react-redux": "^9.1.2",
|
|
52
57
|
"tsup": "^8.0.0",
|
|
53
|
-
"typescript": "^5.0.0"
|
|
54
|
-
"@elqnt/api-client": "1.0.3"
|
|
55
|
-
},
|
|
56
|
-
"scripts": {
|
|
57
|
-
"build": "tsup",
|
|
58
|
-
"dev": "tsup --watch",
|
|
59
|
-
"clean": "rm -rf dist",
|
|
60
|
-
"typecheck": "tsc --noEmit"
|
|
58
|
+
"typescript": "^5.0.0"
|
|
61
59
|
}
|
|
62
|
-
}
|
|
60
|
+
}
|