@proteos/sdk 0.18.1
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/LICENSE +40 -0
- package/dist/chunk-7RGN4E22.cjs +1185 -0
- package/dist/chunk-7RGN4E22.cjs.map +1 -0
- package/dist/chunk-XJP5WCRZ.js +1125 -0
- package/dist/chunk-XJP5WCRZ.js.map +1 -0
- package/dist/index.cjs +2384 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +5225 -0
- package/dist/index.d.ts +5225 -0
- package/dist/index.js +2146 -0
- package/dist/index.js.map +1 -0
- package/dist/meta/index.cjs +204 -0
- package/dist/meta/index.cjs.map +1 -0
- package/dist/meta/index.d.cts +2 -0
- package/dist/meta/index.d.ts +2 -0
- package/dist/meta/index.js +3 -0
- package/dist/meta/index.js.map +1 -0
- package/dist/types-BNsjfU8N.d.cts +3299 -0
- package/dist/types-BNsjfU8N.d.ts +3299 -0
- package/package.json +86 -0
- package/src/agent/agents.ts +53 -0
- package/src/agent/index.ts +134 -0
- package/src/agent/mcp-servers.ts +102 -0
- package/src/agent/prompts.ts +80 -0
- package/src/agent/session-types.ts +397 -0
- package/src/agent/sessions.ts +197 -0
- package/src/agent/skills.ts +89 -0
- package/src/agent/tools.ts +53 -0
- package/src/agent/types.ts +362 -0
- package/src/auth/index.ts +111 -0
- package/src/auth/me.ts +46 -0
- package/src/auth/organizations.ts +128 -0
- package/src/auth/platform-entities.ts +78 -0
- package/src/auth/roles.ts +213 -0
- package/src/auth/types.ts +294 -0
- package/src/auth/users.ts +226 -0
- package/src/client.ts +441 -0
- package/src/connector/index.ts +120 -0
- package/src/connector/types.ts +150 -0
- package/src/conversation/index.ts +297 -0
- package/src/conversation/types.ts +590 -0
- package/src/conversation/voice.ts +123 -0
- package/src/data/index.ts +53 -0
- package/src/data/queries.ts +66 -0
- package/src/data/records.ts +122 -0
- package/src/data/types.ts +89 -0
- package/src/errors.ts +148 -0
- package/src/events/index.ts +172 -0
- package/src/events/types.ts +77 -0
- package/src/functions/actions.ts +95 -0
- package/src/functions/index.ts +32 -0
- package/src/functions/types.ts +71 -0
- package/src/http/index.ts +2 -0
- package/src/http/query-params.ts +106 -0
- package/src/index.ts +598 -0
- package/src/iterator.ts +183 -0
- package/src/knowledge/graph.ts +35 -0
- package/src/knowledge/index.ts +104 -0
- package/src/knowledge/labels.ts +70 -0
- package/src/knowledge/links.ts +65 -0
- package/src/knowledge/nodes.ts +198 -0
- package/src/knowledge/record-links.ts +66 -0
- package/src/knowledge/types.ts +569 -0
- package/src/meta/apps.ts +107 -0
- package/src/meta/components.ts +124 -0
- package/src/meta/currency/index.ts +202 -0
- package/src/meta/entities.ts +193 -0
- package/src/meta/filters.ts +76 -0
- package/src/meta/index.ts +227 -0
- package/src/meta/layout/common-props.ts +93 -0
- package/src/meta/layout/control-registry.json +70 -0
- package/src/meta/layout/control-registry.ts +92 -0
- package/src/meta/layout/elements.ts +203 -0
- package/src/meta/layout/index.ts +41 -0
- package/src/meta/layout/page-layout.ts +35 -0
- package/src/meta/layout/size-value.ts +27 -0
- package/src/meta/list-views.ts +109 -0
- package/src/meta/lists.ts +104 -0
- package/src/meta/menu-configurations.ts +128 -0
- package/src/meta/modules.ts +159 -0
- package/src/meta/pages.ts +106 -0
- package/src/meta/types.ts +1115 -0
- package/src/meta/variables.ts +98 -0
- package/src/storage/files.ts +183 -0
- package/src/storage/index.ts +33 -0
- package/src/storage/types.ts +70 -0
- package/src/types/common.ts +143 -0
- package/src/types/index.ts +28 -0
- package/src/types/options.ts +95 -0
- package/src/workflow/executions.ts +99 -0
- package/src/workflow/index.ts +109 -0
- package/src/workflow/node-types.ts +50 -0
- package/src/workflow/types.ts +658 -0
- package/src/workflow/workflows.ts +152 -0
|
@@ -0,0 +1,1185 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var zod = require('zod');
|
|
4
|
+
|
|
5
|
+
// src/iterator.ts
|
|
6
|
+
var DONE = /* @__PURE__ */ Symbol("DONE");
|
|
7
|
+
var DEFAULT_PAGE_SIZE = 100;
|
|
8
|
+
var PageIterator = class {
|
|
9
|
+
listFn;
|
|
10
|
+
options;
|
|
11
|
+
// Pages are 0-indexed across all Proteos services. First fetch is page 0,
|
|
12
|
+
// last is pagesTotal - 1.
|
|
13
|
+
page = 0;
|
|
14
|
+
buffer = [];
|
|
15
|
+
bufferIndex = 0;
|
|
16
|
+
pagesTotal;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a new PageIterator.
|
|
19
|
+
*
|
|
20
|
+
* @param listFn - Function to fetch a page of results
|
|
21
|
+
* @param options - Options for list requests (including pagination)
|
|
22
|
+
*/
|
|
23
|
+
constructor(listFn, options) {
|
|
24
|
+
this.listFn = listFn;
|
|
25
|
+
this.options = { ...options };
|
|
26
|
+
if (!this.options.page_size) {
|
|
27
|
+
this.options.page_size = DEFAULT_PAGE_SIZE;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Returns the next item in the iterator.
|
|
32
|
+
* Returns DONE symbol when iteration is complete.
|
|
33
|
+
*
|
|
34
|
+
* @returns The next item or DONE
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* const item = await iterator.next();
|
|
39
|
+
* if (item !== DONE) {
|
|
40
|
+
* console.log(item);
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
async next() {
|
|
45
|
+
if (this.bufferIndex < this.buffer.length) {
|
|
46
|
+
const item = this.buffer[this.bufferIndex];
|
|
47
|
+
this.bufferIndex++;
|
|
48
|
+
return item;
|
|
49
|
+
}
|
|
50
|
+
if (this.pagesTotal !== void 0 && this.page >= this.pagesTotal) {
|
|
51
|
+
return DONE;
|
|
52
|
+
}
|
|
53
|
+
const result = await this.listFn({
|
|
54
|
+
...this.options,
|
|
55
|
+
page: this.page
|
|
56
|
+
});
|
|
57
|
+
this.pagesTotal = result.meta.pages_total;
|
|
58
|
+
if (result.data.length === 0) {
|
|
59
|
+
return DONE;
|
|
60
|
+
}
|
|
61
|
+
this.buffer = result.data;
|
|
62
|
+
this.bufferIndex = 1;
|
|
63
|
+
this.page++;
|
|
64
|
+
return this.buffer[0];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Collects all remaining items into an array.
|
|
68
|
+
* Useful when you need all items at once.
|
|
69
|
+
*
|
|
70
|
+
* @returns Array of all remaining items
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const allEntities = await iterator.all();
|
|
75
|
+
* console.log(`Found ${allEntities.length} entities`);
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
async all() {
|
|
79
|
+
const items = [];
|
|
80
|
+
while (true) {
|
|
81
|
+
const item = await this.next();
|
|
82
|
+
if (item === DONE) {
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
items.push(item);
|
|
86
|
+
}
|
|
87
|
+
return items;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Implements AsyncIterable for use with for-await-of loops.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* for await (const entity of iterator) {
|
|
95
|
+
* console.log(entity.name);
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
async *[Symbol.asyncIterator]() {
|
|
100
|
+
while (true) {
|
|
101
|
+
const item = await this.next();
|
|
102
|
+
if (item === DONE) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
yield item;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
function createIterator(listFn, options) {
|
|
110
|
+
return new PageIterator(listFn, options);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// src/meta/apps.ts
|
|
114
|
+
var APPS_BASE_PATH = "/meta/v1/apps";
|
|
115
|
+
var AppServiceImpl = class {
|
|
116
|
+
constructor(client) {
|
|
117
|
+
this.client = client;
|
|
118
|
+
}
|
|
119
|
+
client;
|
|
120
|
+
list(options = {}) {
|
|
121
|
+
return new PageIterator((opts) => this.listPage(opts), options);
|
|
122
|
+
}
|
|
123
|
+
async listPage(options = {}) {
|
|
124
|
+
return this.client.requestWithQuery("GET", APPS_BASE_PATH, options);
|
|
125
|
+
}
|
|
126
|
+
async get(slug) {
|
|
127
|
+
return this.client.request("GET", `${APPS_BASE_PATH}/${slug}`);
|
|
128
|
+
}
|
|
129
|
+
async create(request) {
|
|
130
|
+
return this.client.request("POST", APPS_BASE_PATH, request);
|
|
131
|
+
}
|
|
132
|
+
async upsert(slug, request) {
|
|
133
|
+
return this.client.request("PUT", `${APPS_BASE_PATH}/${slug}`, { ...request, slug });
|
|
134
|
+
}
|
|
135
|
+
async update(slug, request) {
|
|
136
|
+
return this.client.request("PATCH", `${APPS_BASE_PATH}/${slug}`, request);
|
|
137
|
+
}
|
|
138
|
+
async delete(slug) {
|
|
139
|
+
await this.client.request("DELETE", `${APPS_BASE_PATH}/${slug}`);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// src/meta/components.ts
|
|
144
|
+
var COMPONENTS_BASE_PATH = "/meta/v1/components";
|
|
145
|
+
var ComponentServiceImpl = class {
|
|
146
|
+
constructor(client) {
|
|
147
|
+
this.client = client;
|
|
148
|
+
}
|
|
149
|
+
client;
|
|
150
|
+
list(options = {}) {
|
|
151
|
+
return new PageIterator((opts) => this.listPage(opts), options);
|
|
152
|
+
}
|
|
153
|
+
async listPage(options = {}) {
|
|
154
|
+
return this.client.requestWithQuery("GET", COMPONENTS_BASE_PATH, options);
|
|
155
|
+
}
|
|
156
|
+
async get(id) {
|
|
157
|
+
return this.client.request("GET", `${COMPONENTS_BASE_PATH}/${id}`);
|
|
158
|
+
}
|
|
159
|
+
async create(request) {
|
|
160
|
+
return this.client.request("POST", COMPONENTS_BASE_PATH, request);
|
|
161
|
+
}
|
|
162
|
+
async upsert(request) {
|
|
163
|
+
return this.client.request("POST", `${COMPONENTS_BASE_PATH}/upsert`, request);
|
|
164
|
+
}
|
|
165
|
+
async update(id, request) {
|
|
166
|
+
return this.client.request("PATCH", `${COMPONENTS_BASE_PATH}/${id}`, request);
|
|
167
|
+
}
|
|
168
|
+
async delete(id) {
|
|
169
|
+
await this.client.request("DELETE", `${COMPONENTS_BASE_PATH}/${id}`);
|
|
170
|
+
}
|
|
171
|
+
bundleUrl(slug) {
|
|
172
|
+
return `${COMPONENTS_BASE_PATH}/${slug}/bundle`;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// src/meta/entities.ts
|
|
177
|
+
var ENTITIES_BASE_PATH = "/meta/v1/entities";
|
|
178
|
+
var EntityServiceImpl = class {
|
|
179
|
+
constructor(client) {
|
|
180
|
+
this.client = client;
|
|
181
|
+
}
|
|
182
|
+
client;
|
|
183
|
+
list(options = {}) {
|
|
184
|
+
return new PageIterator((opts) => this.listPage(opts), options);
|
|
185
|
+
}
|
|
186
|
+
async listPage(options = {}) {
|
|
187
|
+
return this.client.requestWithQuery("GET", ENTITIES_BASE_PATH, options);
|
|
188
|
+
}
|
|
189
|
+
listWithSchema(options = {}) {
|
|
190
|
+
return new PageIterator((opts) => this.listPageWithSchema(opts), options);
|
|
191
|
+
}
|
|
192
|
+
async listPageWithSchema(options = {}) {
|
|
193
|
+
return this.client.requestWithQuery("GET", ENTITIES_BASE_PATH, {
|
|
194
|
+
...options,
|
|
195
|
+
with_schema: true
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
async get(slug) {
|
|
199
|
+
return this.client.request("GET", `${ENTITIES_BASE_PATH}/${slug}`);
|
|
200
|
+
}
|
|
201
|
+
async getWithSchema(slug) {
|
|
202
|
+
return this.client.requestWithQuery("GET", `${ENTITIES_BASE_PATH}/${slug}`, {
|
|
203
|
+
with_schema: true
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
async create(request) {
|
|
207
|
+
return this.client.request("POST", ENTITIES_BASE_PATH, request);
|
|
208
|
+
}
|
|
209
|
+
async upsert(slug, request) {
|
|
210
|
+
return this.client.request("PUT", `${ENTITIES_BASE_PATH}/${slug}`, { ...request, slug });
|
|
211
|
+
}
|
|
212
|
+
async update(slug, request) {
|
|
213
|
+
return this.client.request("PATCH", `${ENTITIES_BASE_PATH}/${slug}`, request);
|
|
214
|
+
}
|
|
215
|
+
async delete(slug) {
|
|
216
|
+
await this.client.request("DELETE", `${ENTITIES_BASE_PATH}/${slug}`);
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
// src/meta/list-views.ts
|
|
221
|
+
var LIST_VIEWS_BASE_PATH = "/meta/v1/list-views";
|
|
222
|
+
var ListViewServiceImpl = class {
|
|
223
|
+
constructor(client) {
|
|
224
|
+
this.client = client;
|
|
225
|
+
}
|
|
226
|
+
client;
|
|
227
|
+
list(options = {}) {
|
|
228
|
+
return new PageIterator((opts) => this.listPage(opts), options);
|
|
229
|
+
}
|
|
230
|
+
async listPage(options = {}) {
|
|
231
|
+
return this.client.requestWithQuery("GET", LIST_VIEWS_BASE_PATH, options);
|
|
232
|
+
}
|
|
233
|
+
async get(slug) {
|
|
234
|
+
return this.client.request("GET", `${LIST_VIEWS_BASE_PATH}/${slug}`);
|
|
235
|
+
}
|
|
236
|
+
async create(request) {
|
|
237
|
+
return this.client.request("POST", LIST_VIEWS_BASE_PATH, request);
|
|
238
|
+
}
|
|
239
|
+
async upsert(request) {
|
|
240
|
+
return this.client.request("POST", `${LIST_VIEWS_BASE_PATH}/upsert`, request);
|
|
241
|
+
}
|
|
242
|
+
async update(slug, request) {
|
|
243
|
+
return this.client.request("PATCH", `${LIST_VIEWS_BASE_PATH}/${slug}`, request);
|
|
244
|
+
}
|
|
245
|
+
async delete(slug) {
|
|
246
|
+
await this.client.request("DELETE", `${LIST_VIEWS_BASE_PATH}/${slug}`);
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
// src/meta/lists.ts
|
|
251
|
+
var LISTS_BASE_PATH = "/meta/v1/lists";
|
|
252
|
+
var ListServiceImpl = class {
|
|
253
|
+
constructor(client) {
|
|
254
|
+
this.client = client;
|
|
255
|
+
}
|
|
256
|
+
client;
|
|
257
|
+
list(options = {}) {
|
|
258
|
+
return new PageIterator((opts) => this.listPage(opts), options);
|
|
259
|
+
}
|
|
260
|
+
async listPage(options = {}) {
|
|
261
|
+
return this.client.requestWithQuery("GET", LISTS_BASE_PATH, options);
|
|
262
|
+
}
|
|
263
|
+
async get(slug) {
|
|
264
|
+
return this.client.request("GET", `${LISTS_BASE_PATH}/${slug}`);
|
|
265
|
+
}
|
|
266
|
+
async create(request) {
|
|
267
|
+
return this.client.request("POST", LISTS_BASE_PATH, request);
|
|
268
|
+
}
|
|
269
|
+
async upsert(request) {
|
|
270
|
+
return this.client.request("POST", `${LISTS_BASE_PATH}/upsert`, request);
|
|
271
|
+
}
|
|
272
|
+
async update(slug, request) {
|
|
273
|
+
return this.client.request("PATCH", `${LISTS_BASE_PATH}/${slug}`, request);
|
|
274
|
+
}
|
|
275
|
+
async delete(slug) {
|
|
276
|
+
await this.client.request("DELETE", `${LISTS_BASE_PATH}/${slug}`);
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// src/meta/menu-configurations.ts
|
|
281
|
+
var MENU_CONFIGURATIONS_BASE_PATH = "/meta/v1/menu-configurations";
|
|
282
|
+
var MenuConfigurationServiceImpl = class {
|
|
283
|
+
constructor(client) {
|
|
284
|
+
this.client = client;
|
|
285
|
+
}
|
|
286
|
+
client;
|
|
287
|
+
list(options = {}) {
|
|
288
|
+
return new PageIterator((opts) => this.listPage(opts), options);
|
|
289
|
+
}
|
|
290
|
+
async listPage(options = {}) {
|
|
291
|
+
return this.client.requestWithQuery(
|
|
292
|
+
"GET",
|
|
293
|
+
MENU_CONFIGURATIONS_BASE_PATH,
|
|
294
|
+
options
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
async get(slug) {
|
|
298
|
+
return this.client.request("GET", `${MENU_CONFIGURATIONS_BASE_PATH}/${slug}`);
|
|
299
|
+
}
|
|
300
|
+
async create(request) {
|
|
301
|
+
return this.client.request("POST", MENU_CONFIGURATIONS_BASE_PATH, request);
|
|
302
|
+
}
|
|
303
|
+
async upsert(slug, request) {
|
|
304
|
+
return this.client.request(
|
|
305
|
+
"PUT",
|
|
306
|
+
`${MENU_CONFIGURATIONS_BASE_PATH}/${slug}`,
|
|
307
|
+
{ ...request, slug }
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
async update(slug, request) {
|
|
311
|
+
return this.client.request(
|
|
312
|
+
"PATCH",
|
|
313
|
+
`${MENU_CONFIGURATIONS_BASE_PATH}/${slug}`,
|
|
314
|
+
request
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
async delete(slug) {
|
|
318
|
+
await this.client.request("DELETE", `${MENU_CONFIGURATIONS_BASE_PATH}/${slug}`);
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// src/meta/modules.ts
|
|
323
|
+
var MODULES_BASE_PATH = "/meta/v1/modules";
|
|
324
|
+
var ModuleServiceImpl = class {
|
|
325
|
+
constructor(client) {
|
|
326
|
+
this.client = client;
|
|
327
|
+
}
|
|
328
|
+
client;
|
|
329
|
+
list(options = {}) {
|
|
330
|
+
return new PageIterator((opts) => this.listPage(opts), options);
|
|
331
|
+
}
|
|
332
|
+
async listPage(options = {}) {
|
|
333
|
+
return this.client.requestWithQuery("GET", MODULES_BASE_PATH, options);
|
|
334
|
+
}
|
|
335
|
+
async get(slug) {
|
|
336
|
+
return this.client.request("GET", `${MODULES_BASE_PATH}/${slug}`);
|
|
337
|
+
}
|
|
338
|
+
async deploy(request, file) {
|
|
339
|
+
const formData = new FormData();
|
|
340
|
+
formData.append("metadata", JSON.stringify(request));
|
|
341
|
+
let blob;
|
|
342
|
+
if (file instanceof ArrayBuffer) {
|
|
343
|
+
blob = new Blob([file], { type: "application/wasm" });
|
|
344
|
+
} else {
|
|
345
|
+
blob = file;
|
|
346
|
+
}
|
|
347
|
+
formData.append("file", blob, "module.wasm");
|
|
348
|
+
return this.client.requestMultipart("POST", `${MODULES_BASE_PATH}/deploy`, formData);
|
|
349
|
+
}
|
|
350
|
+
async delete(slug) {
|
|
351
|
+
await this.client.request("DELETE", `${MODULES_BASE_PATH}/${slug}`);
|
|
352
|
+
}
|
|
353
|
+
async activate(slug) {
|
|
354
|
+
await this.client.request("PATCH", `${MODULES_BASE_PATH}/${slug}/activate`);
|
|
355
|
+
}
|
|
356
|
+
async deactivate(slug) {
|
|
357
|
+
await this.client.request("PATCH", `${MODULES_BASE_PATH}/${slug}/deactivate`);
|
|
358
|
+
}
|
|
359
|
+
async download(slug) {
|
|
360
|
+
const [{ body }, module] = await Promise.all([
|
|
361
|
+
this.client.requestRaw("GET", `${MODULES_BASE_PATH}/${slug}/download`),
|
|
362
|
+
this.get(slug)
|
|
363
|
+
]);
|
|
364
|
+
return { body, module };
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
// src/meta/pages.ts
|
|
369
|
+
var PAGES_BASE_PATH = "/meta/v1/pages";
|
|
370
|
+
var PageServiceImpl = class {
|
|
371
|
+
constructor(client) {
|
|
372
|
+
this.client = client;
|
|
373
|
+
}
|
|
374
|
+
client;
|
|
375
|
+
list(options = {}) {
|
|
376
|
+
return new PageIterator((opts) => this.listPage(opts), options);
|
|
377
|
+
}
|
|
378
|
+
async listPage(options = {}) {
|
|
379
|
+
return this.client.requestWithQuery("GET", PAGES_BASE_PATH, options);
|
|
380
|
+
}
|
|
381
|
+
async get(slug) {
|
|
382
|
+
return this.client.request("GET", `${PAGES_BASE_PATH}/${slug}`);
|
|
383
|
+
}
|
|
384
|
+
async create(request) {
|
|
385
|
+
return this.client.request("POST", PAGES_BASE_PATH, request);
|
|
386
|
+
}
|
|
387
|
+
async upsert(slug, request) {
|
|
388
|
+
return this.client.request("PUT", `${PAGES_BASE_PATH}/${slug}`, { ...request, slug });
|
|
389
|
+
}
|
|
390
|
+
async update(slug, request) {
|
|
391
|
+
return this.client.request("PATCH", `${PAGES_BASE_PATH}/${slug}`, request);
|
|
392
|
+
}
|
|
393
|
+
async delete(slug) {
|
|
394
|
+
await this.client.request("DELETE", `${PAGES_BASE_PATH}/${slug}`);
|
|
395
|
+
}
|
|
396
|
+
};
|
|
397
|
+
|
|
398
|
+
// src/meta/variables.ts
|
|
399
|
+
var VARIABLES_BASE_PATH = "/meta/v1/variables";
|
|
400
|
+
var VariableServiceImpl = class {
|
|
401
|
+
constructor(client) {
|
|
402
|
+
this.client = client;
|
|
403
|
+
}
|
|
404
|
+
client;
|
|
405
|
+
list(options = {}) {
|
|
406
|
+
return new PageIterator((opts) => this.listPage(opts), options);
|
|
407
|
+
}
|
|
408
|
+
async listPage(options = {}) {
|
|
409
|
+
return this.client.requestWithQuery("GET", VARIABLES_BASE_PATH, options);
|
|
410
|
+
}
|
|
411
|
+
async get(id) {
|
|
412
|
+
return this.client.request("GET", `${VARIABLES_BASE_PATH}/${id}`);
|
|
413
|
+
}
|
|
414
|
+
async create(request) {
|
|
415
|
+
return this.client.request("POST", VARIABLES_BASE_PATH, request);
|
|
416
|
+
}
|
|
417
|
+
async update(id, request) {
|
|
418
|
+
return this.client.request("PATCH", `${VARIABLES_BASE_PATH}/${id}`, request);
|
|
419
|
+
}
|
|
420
|
+
async delete(id) {
|
|
421
|
+
await this.client.request("DELETE", `${VARIABLES_BASE_PATH}/${id}`);
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
|
|
425
|
+
// src/meta/currency/index.ts
|
|
426
|
+
var cachedCodes = null;
|
|
427
|
+
function allCurrencyCodes() {
|
|
428
|
+
if (cachedCodes) return cachedCodes;
|
|
429
|
+
const supported = typeof Intl !== "undefined" && "supportedValuesOf" in Intl ? Intl.supportedValuesOf(
|
|
430
|
+
"currency"
|
|
431
|
+
) : [];
|
|
432
|
+
cachedCodes = [...supported].sort();
|
|
433
|
+
return cachedCodes;
|
|
434
|
+
}
|
|
435
|
+
function currencyLabel(code, locale) {
|
|
436
|
+
try {
|
|
437
|
+
const names = new Intl.DisplayNames(locale ? [locale] : void 0, { type: "currency" });
|
|
438
|
+
return names.of(code) ?? code;
|
|
439
|
+
} catch {
|
|
440
|
+
return code;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
function currencySymbol(code, locale) {
|
|
444
|
+
try {
|
|
445
|
+
const parts = new Intl.NumberFormat(locale, {
|
|
446
|
+
style: "currency",
|
|
447
|
+
currency: code,
|
|
448
|
+
currencyDisplay: "narrowSymbol"
|
|
449
|
+
}).formatToParts(0);
|
|
450
|
+
return parts.find((part) => part.type === "currency")?.value ?? code;
|
|
451
|
+
} catch {
|
|
452
|
+
return code;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
var SUFFIX_SYMBOL_CURRENCIES = /* @__PURE__ */ new Set([
|
|
456
|
+
"EUR",
|
|
457
|
+
"PLN",
|
|
458
|
+
"CZK",
|
|
459
|
+
"HUF",
|
|
460
|
+
"RON",
|
|
461
|
+
"BGN",
|
|
462
|
+
"HRK",
|
|
463
|
+
"SEK",
|
|
464
|
+
"NOK",
|
|
465
|
+
"DKK",
|
|
466
|
+
"ISK",
|
|
467
|
+
"RSD",
|
|
468
|
+
"RUB",
|
|
469
|
+
"UAH",
|
|
470
|
+
"GEL",
|
|
471
|
+
"MKD",
|
|
472
|
+
"ALL",
|
|
473
|
+
"AMD",
|
|
474
|
+
"AZN",
|
|
475
|
+
"VND"
|
|
476
|
+
]);
|
|
477
|
+
function currencySymbolSide(code) {
|
|
478
|
+
return SUFFIX_SYMBOL_CURRENCIES.has(code) ? "suffix" : "prefix";
|
|
479
|
+
}
|
|
480
|
+
var separatorCache = /* @__PURE__ */ new Map();
|
|
481
|
+
function localeNumberSeparators(locale) {
|
|
482
|
+
const key = locale ?? "__default__";
|
|
483
|
+
const cached = separatorCache.get(key);
|
|
484
|
+
if (cached) return cached;
|
|
485
|
+
let group = ",";
|
|
486
|
+
let decimal = ".";
|
|
487
|
+
try {
|
|
488
|
+
const parts = new Intl.NumberFormat(locale).formatToParts(11111.1);
|
|
489
|
+
group = parts.find((part) => part.type === "group")?.value ?? group;
|
|
490
|
+
decimal = parts.find((part) => part.type === "decimal")?.value ?? decimal;
|
|
491
|
+
} catch {
|
|
492
|
+
}
|
|
493
|
+
const result = { group, decimal };
|
|
494
|
+
separatorCache.set(key, result);
|
|
495
|
+
return result;
|
|
496
|
+
}
|
|
497
|
+
var DECIMAL_RE = /^-?\d+(\.\d+)?$/;
|
|
498
|
+
function groupDigits(intDigits, groupSeparator) {
|
|
499
|
+
return intDigits.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
|
|
500
|
+
}
|
|
501
|
+
function formatAmount(canonical, locale, options) {
|
|
502
|
+
if (canonical === "") return "";
|
|
503
|
+
if (!DECIMAL_RE.test(canonical)) return canonical;
|
|
504
|
+
const grouped = options?.grouped !== false;
|
|
505
|
+
const { group, decimal } = localeNumberSeparators(locale);
|
|
506
|
+
const negative = canonical.startsWith("-");
|
|
507
|
+
const body = negative ? canonical.slice(1) : canonical;
|
|
508
|
+
const dotIndex = body.indexOf(".");
|
|
509
|
+
const intPart = dotIndex === -1 ? body : body.slice(0, dotIndex);
|
|
510
|
+
const fracPart = dotIndex === -1 ? void 0 : body.slice(dotIndex + 1);
|
|
511
|
+
const intOut = grouped ? groupDigits(intPart, group) : intPart;
|
|
512
|
+
const out = fracPart !== void 0 ? `${intOut}${decimal}${fracPart}` : intOut;
|
|
513
|
+
return negative ? `-${out}` : out;
|
|
514
|
+
}
|
|
515
|
+
function parseAmount(input, locale) {
|
|
516
|
+
const trimmed = input.trim();
|
|
517
|
+
if (trimmed === "") return "";
|
|
518
|
+
const { group, decimal } = localeNumberSeparators(locale);
|
|
519
|
+
const negative = trimmed.startsWith("-");
|
|
520
|
+
let normalized = trimmed.split(group).join("");
|
|
521
|
+
normalized = normalized.split(decimal).join(".");
|
|
522
|
+
normalized = normalized.replace(/[^\d.]/g, "");
|
|
523
|
+
const firstDot = normalized.indexOf(".");
|
|
524
|
+
if (firstDot !== -1) {
|
|
525
|
+
normalized = normalized.slice(0, firstDot + 1) + normalized.slice(firstDot + 1).replace(/\./g, "");
|
|
526
|
+
}
|
|
527
|
+
if (normalized === "" || normalized === ".") return "";
|
|
528
|
+
return negative ? `-${normalized}` : normalized;
|
|
529
|
+
}
|
|
530
|
+
function formatMoney(value, locale) {
|
|
531
|
+
const { amount, currency_code: code } = value;
|
|
532
|
+
if (!amount || !code) return [amount, code].filter(Boolean).join(" ");
|
|
533
|
+
if (!DECIMAL_RE.test(amount)) return `${amount} ${code}`;
|
|
534
|
+
const number = formatAmount(amount, locale, { grouped: true });
|
|
535
|
+
const symbol = currencySymbol(code, locale);
|
|
536
|
+
return currencySymbolSide(code) === "suffix" ? `${number} ${symbol}` : `${symbol}${number}`;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// src/meta/layout/control-registry.json
|
|
540
|
+
var control_registry_default = {
|
|
541
|
+
builtInControls: [
|
|
542
|
+
"text",
|
|
543
|
+
"textarea",
|
|
544
|
+
"email",
|
|
545
|
+
"url",
|
|
546
|
+
"password",
|
|
547
|
+
"number",
|
|
548
|
+
"switch",
|
|
549
|
+
"checkbox",
|
|
550
|
+
"select",
|
|
551
|
+
"radio-group",
|
|
552
|
+
"chip-group",
|
|
553
|
+
"multi-select",
|
|
554
|
+
"date-picker",
|
|
555
|
+
"datetime-picker",
|
|
556
|
+
"time-picker",
|
|
557
|
+
"tag-input",
|
|
558
|
+
"entity-picker",
|
|
559
|
+
"user-picker",
|
|
560
|
+
"currency",
|
|
561
|
+
"knowledge-text",
|
|
562
|
+
"file"
|
|
563
|
+
],
|
|
564
|
+
controls: {
|
|
565
|
+
string: {
|
|
566
|
+
primary: "text",
|
|
567
|
+
compatible: ["text", "textarea", "password"],
|
|
568
|
+
byFormat: {
|
|
569
|
+
email: { primary: "email", compatible: ["email", "text"] },
|
|
570
|
+
uri: { primary: "url", compatible: ["url", "text"] },
|
|
571
|
+
uuid: { primary: "text", compatible: ["text"] },
|
|
572
|
+
hostname: { primary: "text", compatible: ["text"] },
|
|
573
|
+
ipv4: { primary: "text", compatible: ["text"] },
|
|
574
|
+
ipv6: { primary: "text", compatible: ["text"] }
|
|
575
|
+
}
|
|
576
|
+
},
|
|
577
|
+
number: { primary: "number", compatible: ["number"] },
|
|
578
|
+
integer: { primary: "number", compatible: ["number"] },
|
|
579
|
+
boolean: { primary: "switch", compatible: ["switch", "checkbox"] },
|
|
580
|
+
enum: { primary: "select", compatible: ["select", "radio-group", "chip-group"] },
|
|
581
|
+
array: {
|
|
582
|
+
primary: "tag-input",
|
|
583
|
+
compatible: ["tag-input"],
|
|
584
|
+
byItemsType: {
|
|
585
|
+
string: { primary: "tag-input", compatible: ["tag-input"] },
|
|
586
|
+
enum: { primary: "multi-select", compatible: ["multi-select"] }
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
datetime: {
|
|
590
|
+
primary: null,
|
|
591
|
+
compatible: [],
|
|
592
|
+
byFormat: {
|
|
593
|
+
date: { primary: "date-picker", compatible: ["date-picker"] },
|
|
594
|
+
"date-time": { primary: "datetime-picker", compatible: ["datetime-picker"] },
|
|
595
|
+
time: { primary: "time-picker", compatible: ["time-picker"] },
|
|
596
|
+
duration: { primary: null, compatible: [] }
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
object: { primary: null, compatible: [] },
|
|
600
|
+
relation: { primary: "entity-picker", compatible: ["entity-picker"] },
|
|
601
|
+
user: { primary: "user-picker", compatible: ["user-picker"] },
|
|
602
|
+
currency: { primary: "currency", compatible: ["currency"] },
|
|
603
|
+
"knowledge-text": { primary: "knowledge-text", compatible: ["knowledge-text"] },
|
|
604
|
+
file: { primary: "file", compatible: ["file"] }
|
|
605
|
+
}
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
// src/meta/layout/control-registry.ts
|
|
609
|
+
var BUILT_IN_CONTROLS = control_registry_default.builtInControls;
|
|
610
|
+
var CONTROLS = control_registry_default.controls;
|
|
611
|
+
function isBuiltInControl(slug) {
|
|
612
|
+
return BUILT_IN_CONTROLS.includes(slug);
|
|
613
|
+
}
|
|
614
|
+
function lookupControls(attr) {
|
|
615
|
+
const typeBucket = CONTROLS[attr.type];
|
|
616
|
+
if (!typeBucket) return EMPTY;
|
|
617
|
+
const meta = attr.meta ?? void 0;
|
|
618
|
+
const format = meta?.format;
|
|
619
|
+
if (format && typeBucket.byFormat?.[format]) {
|
|
620
|
+
return typeBucket.byFormat[format];
|
|
621
|
+
}
|
|
622
|
+
const itemsType = meta?.items?.type;
|
|
623
|
+
if (itemsType && typeBucket.byItemsType?.[itemsType]) {
|
|
624
|
+
return typeBucket.byItemsType[itemsType];
|
|
625
|
+
}
|
|
626
|
+
return typeBucket;
|
|
627
|
+
}
|
|
628
|
+
function lookupPrimaryControl(attr) {
|
|
629
|
+
return lookupControls(attr).primary;
|
|
630
|
+
}
|
|
631
|
+
function lookupCompatibleControls(attr) {
|
|
632
|
+
return lookupControls(attr).compatible;
|
|
633
|
+
}
|
|
634
|
+
var EMPTY = { primary: null, compatible: [] };
|
|
635
|
+
var FilterElementSchema = zod.z.object({
|
|
636
|
+
field: zod.z.string(),
|
|
637
|
+
value: zod.z.string(),
|
|
638
|
+
operator: zod.z.enum([
|
|
639
|
+
"eq",
|
|
640
|
+
"gt",
|
|
641
|
+
"lt",
|
|
642
|
+
"gte",
|
|
643
|
+
"lte",
|
|
644
|
+
"ne",
|
|
645
|
+
"in",
|
|
646
|
+
"not_in",
|
|
647
|
+
"contains",
|
|
648
|
+
"starts_with",
|
|
649
|
+
"ends_with",
|
|
650
|
+
"empty",
|
|
651
|
+
"not_empty"
|
|
652
|
+
])
|
|
653
|
+
});
|
|
654
|
+
var FilterGroupSchema = zod.z.lazy(
|
|
655
|
+
() => zod.z.object({
|
|
656
|
+
logical_operator: zod.z.enum(["and", "or"]),
|
|
657
|
+
elements: zod.z.array(FilterElementSchema).optional(),
|
|
658
|
+
groups: zod.z.array(FilterGroupSchema).optional()
|
|
659
|
+
})
|
|
660
|
+
);
|
|
661
|
+
var SIZE_VALUE_STRING_RE = /^(\d+\/\d+|\d+px|\d+%|auto|fill)$/;
|
|
662
|
+
var SizeValueSchema = zod.z.union([
|
|
663
|
+
zod.z.number().min(0).max(1).describe("Fraction in [0, 1]"),
|
|
664
|
+
zod.z.string().regex(SIZE_VALUE_STRING_RE, 'must match n/m, Npx, N%, "auto", or "fill"')
|
|
665
|
+
]);
|
|
666
|
+
|
|
667
|
+
// src/meta/layout/common-props.ts
|
|
668
|
+
var AlignSchema = zod.z.enum(["start", "center", "end", "stretch"]);
|
|
669
|
+
var JustifySchema = zod.z.enum(["start", "center", "end", "between", "around"]);
|
|
670
|
+
var GapSchema = zod.z.enum(["xs", "sm", "md", "lg"]);
|
|
671
|
+
var SizingPropsSchema = zod.z.object({
|
|
672
|
+
width: SizeValueSchema.optional(),
|
|
673
|
+
height: SizeValueSchema.optional(),
|
|
674
|
+
grow: zod.z.number().optional(),
|
|
675
|
+
shrink: zod.z.number().optional(),
|
|
676
|
+
align: AlignSchema.optional()
|
|
677
|
+
});
|
|
678
|
+
var ResponsiveSizingSchema = zod.z.object({
|
|
679
|
+
sm: SizingPropsSchema.optional(),
|
|
680
|
+
md: SizingPropsSchema.optional(),
|
|
681
|
+
lg: SizingPropsSchema.optional()
|
|
682
|
+
});
|
|
683
|
+
var commonPropsShape = {
|
|
684
|
+
id: zod.z.string().optional(),
|
|
685
|
+
visible_when: FilterGroupSchema.optional(),
|
|
686
|
+
read_only_when: FilterGroupSchema.optional(),
|
|
687
|
+
width: SizeValueSchema.optional(),
|
|
688
|
+
height: SizeValueSchema.optional(),
|
|
689
|
+
grow: zod.z.number().optional(),
|
|
690
|
+
shrink: zod.z.number().optional(),
|
|
691
|
+
align: AlignSchema.optional(),
|
|
692
|
+
responsive: ResponsiveSizingSchema.optional()
|
|
693
|
+
};
|
|
694
|
+
var layoutAlignShape = AlignSchema;
|
|
695
|
+
var layoutJustifyShape = JustifySchema;
|
|
696
|
+
var layoutGapShape = GapSchema;
|
|
697
|
+
|
|
698
|
+
// src/meta/layout/elements.ts
|
|
699
|
+
var LayoutElementType = {
|
|
700
|
+
Row: "row",
|
|
701
|
+
Column: "column",
|
|
702
|
+
Section: "section",
|
|
703
|
+
Tabs: "tabs",
|
|
704
|
+
Field: "field",
|
|
705
|
+
RelatedList: "related_list",
|
|
706
|
+
Component: "component",
|
|
707
|
+
Divider: "divider",
|
|
708
|
+
Text: "text"
|
|
709
|
+
};
|
|
710
|
+
var LayoutElementSchema = zod.z.lazy(
|
|
711
|
+
() => zod.z.discriminatedUnion("type", [
|
|
712
|
+
zod.z.object({
|
|
713
|
+
type: zod.z.literal("row"),
|
|
714
|
+
...commonPropsShape,
|
|
715
|
+
gap: layoutGapShape.optional(),
|
|
716
|
+
allows_wrap: zod.z.boolean().optional(),
|
|
717
|
+
align: layoutAlignShape.optional(),
|
|
718
|
+
justify: layoutJustifyShape.optional(),
|
|
719
|
+
children: zod.z.array(LayoutElementSchema)
|
|
720
|
+
}),
|
|
721
|
+
zod.z.object({
|
|
722
|
+
type: zod.z.literal("column"),
|
|
723
|
+
...commonPropsShape,
|
|
724
|
+
gap: layoutGapShape.optional(),
|
|
725
|
+
align: layoutAlignShape.optional(),
|
|
726
|
+
justify: layoutJustifyShape.optional(),
|
|
727
|
+
children: zod.z.array(LayoutElementSchema)
|
|
728
|
+
}),
|
|
729
|
+
zod.z.object({
|
|
730
|
+
type: zod.z.literal("section"),
|
|
731
|
+
...commonPropsShape,
|
|
732
|
+
title: zod.z.string().optional(),
|
|
733
|
+
description: zod.z.string().optional(),
|
|
734
|
+
is_collapsible: zod.z.boolean().optional(),
|
|
735
|
+
default_collapsed: zod.z.boolean().optional(),
|
|
736
|
+
content: LayoutElementSchema
|
|
737
|
+
}),
|
|
738
|
+
zod.z.object({
|
|
739
|
+
type: zod.z.literal("tabs"),
|
|
740
|
+
...commonPropsShape,
|
|
741
|
+
tabs: zod.z.array(
|
|
742
|
+
zod.z.object({
|
|
743
|
+
id: zod.z.string().min(1),
|
|
744
|
+
label: zod.z.string().min(1),
|
|
745
|
+
icon: zod.z.string().optional(),
|
|
746
|
+
visible_when: FilterGroupSchema.optional(),
|
|
747
|
+
content: LayoutElementSchema
|
|
748
|
+
})
|
|
749
|
+
),
|
|
750
|
+
default_tab_id: zod.z.string().optional()
|
|
751
|
+
}),
|
|
752
|
+
zod.z.object({
|
|
753
|
+
type: zod.z.literal("field"),
|
|
754
|
+
...commonPropsShape,
|
|
755
|
+
attribute: zod.z.string().min(1),
|
|
756
|
+
label: zod.z.string().nullable().optional(),
|
|
757
|
+
description: zod.z.string().optional(),
|
|
758
|
+
placeholder: zod.z.string().optional(),
|
|
759
|
+
is_read_only: zod.z.boolean().optional(),
|
|
760
|
+
is_required: zod.z.boolean().optional(),
|
|
761
|
+
empty_display: zod.z.string().optional(),
|
|
762
|
+
control: zod.z.string().optional(),
|
|
763
|
+
control_props: zod.z.record(zod.z.unknown()).optional()
|
|
764
|
+
}),
|
|
765
|
+
zod.z.object({
|
|
766
|
+
type: zod.z.literal("related_list"),
|
|
767
|
+
...commonPropsShape,
|
|
768
|
+
related_entity_slug: zod.z.string().min(1),
|
|
769
|
+
via_attribute: zod.z.string().min(1),
|
|
770
|
+
list_slug: zod.z.string().min(1).optional()
|
|
771
|
+
}),
|
|
772
|
+
zod.z.object({
|
|
773
|
+
type: zod.z.literal("component"),
|
|
774
|
+
...commonPropsShape,
|
|
775
|
+
component_slug: zod.z.string().min(1),
|
|
776
|
+
props: zod.z.record(zod.z.unknown()).optional()
|
|
777
|
+
}),
|
|
778
|
+
zod.z.object({
|
|
779
|
+
type: zod.z.literal("divider"),
|
|
780
|
+
...commonPropsShape
|
|
781
|
+
}),
|
|
782
|
+
zod.z.object({
|
|
783
|
+
type: zod.z.literal("text"),
|
|
784
|
+
...commonPropsShape,
|
|
785
|
+
variant: zod.z.enum(["heading", "subheading", "body", "caption", "callout"]),
|
|
786
|
+
content: zod.z.string().min(1)
|
|
787
|
+
})
|
|
788
|
+
])
|
|
789
|
+
);
|
|
790
|
+
var PageLayoutSidePanelSchema = zod.z.object({
|
|
791
|
+
width: SizeValueSchema.optional(),
|
|
792
|
+
is_sticky: zod.z.boolean().optional(),
|
|
793
|
+
content: LayoutElementSchema
|
|
794
|
+
});
|
|
795
|
+
var PageLayoutSchema = zod.z.object({
|
|
796
|
+
version: zod.z.literal(1),
|
|
797
|
+
main: LayoutElementSchema,
|
|
798
|
+
side_panel: PageLayoutSidePanelSchema.optional()
|
|
799
|
+
});
|
|
800
|
+
var ResponseMetaSchema = zod.z.object({
|
|
801
|
+
page: zod.z.number(),
|
|
802
|
+
page_size: zod.z.number(),
|
|
803
|
+
items_total: zod.z.number(),
|
|
804
|
+
pages_total: zod.z.number()
|
|
805
|
+
});
|
|
806
|
+
function createListResultSchema(itemSchema) {
|
|
807
|
+
return zod.z.object({
|
|
808
|
+
meta: ResponseMetaSchema,
|
|
809
|
+
data: zod.z.array(itemSchema)
|
|
810
|
+
});
|
|
811
|
+
}
|
|
812
|
+
var UserRefSchema = zod.z.object({
|
|
813
|
+
type: zod.z.enum(["person", "agent", "api"]),
|
|
814
|
+
id: zod.z.string()
|
|
815
|
+
});
|
|
816
|
+
var PLATFORM_USER_ID = "platform";
|
|
817
|
+
var FileRefSchema = zod.z.object({
|
|
818
|
+
id: zod.z.string(),
|
|
819
|
+
name: zod.z.string()
|
|
820
|
+
});
|
|
821
|
+
var AuditFieldsSchema = zod.z.object({
|
|
822
|
+
created_at: zod.z.string(),
|
|
823
|
+
updated_at: zod.z.string(),
|
|
824
|
+
created_by: UserRefSchema,
|
|
825
|
+
updated_by: UserRefSchema
|
|
826
|
+
});
|
|
827
|
+
|
|
828
|
+
// src/meta/types.ts
|
|
829
|
+
var OnDeleteActionSchema = zod.z.enum(["cascade", "restrict", "set-null"]);
|
|
830
|
+
var RelationAttributeMetaSchema = zod.z.object({
|
|
831
|
+
related_entity_slug: zod.z.string(),
|
|
832
|
+
related_attribute: zod.z.string(),
|
|
833
|
+
predicate: zod.z.string(),
|
|
834
|
+
description: zod.z.string().optional(),
|
|
835
|
+
on_delete: OnDeleteActionSchema
|
|
836
|
+
});
|
|
837
|
+
var UserAttributeMetaSchema = zod.z.object({
|
|
838
|
+
description: zod.z.string().optional()
|
|
839
|
+
});
|
|
840
|
+
var CurrencyAttributeMetaSchema = zod.z.object({
|
|
841
|
+
default_currency_code: zod.z.string().optional(),
|
|
842
|
+
allowed_currency_codes: zod.z.array(zod.z.string()).optional()
|
|
843
|
+
});
|
|
844
|
+
zod.z.object({
|
|
845
|
+
description: zod.z.string().optional()
|
|
846
|
+
});
|
|
847
|
+
var FileAttributeMetaSchema = zod.z.object({
|
|
848
|
+
description: zod.z.string().optional()
|
|
849
|
+
});
|
|
850
|
+
var PLATFORM_ATTRIBUTE_NAMES = [
|
|
851
|
+
"id",
|
|
852
|
+
"created_at",
|
|
853
|
+
"updated_at",
|
|
854
|
+
"created_by",
|
|
855
|
+
"updated_by"
|
|
856
|
+
];
|
|
857
|
+
function isPlatformAttributeName(name) {
|
|
858
|
+
return PLATFORM_ATTRIBUTE_NAMES.includes(name);
|
|
859
|
+
}
|
|
860
|
+
function platformAttributes() {
|
|
861
|
+
return [
|
|
862
|
+
{
|
|
863
|
+
name: "id",
|
|
864
|
+
type: "string",
|
|
865
|
+
label: "Id",
|
|
866
|
+
description: "Unique identifier of the record.",
|
|
867
|
+
is_required: false,
|
|
868
|
+
is_unique: true,
|
|
869
|
+
is_read_only: true,
|
|
870
|
+
is_platform_managed: true
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
name: "created_at",
|
|
874
|
+
type: "datetime",
|
|
875
|
+
label: "Created At",
|
|
876
|
+
description: "Timestamp when the record was created.",
|
|
877
|
+
is_required: false,
|
|
878
|
+
is_unique: false,
|
|
879
|
+
is_read_only: true,
|
|
880
|
+
is_platform_managed: true,
|
|
881
|
+
meta: { format: "date-time" }
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
name: "updated_at",
|
|
885
|
+
type: "datetime",
|
|
886
|
+
label: "Updated At",
|
|
887
|
+
description: "Timestamp when the record was last updated.",
|
|
888
|
+
is_required: false,
|
|
889
|
+
is_unique: false,
|
|
890
|
+
is_read_only: true,
|
|
891
|
+
is_platform_managed: true,
|
|
892
|
+
meta: { format: "date-time" }
|
|
893
|
+
},
|
|
894
|
+
{
|
|
895
|
+
name: "created_by",
|
|
896
|
+
type: "user",
|
|
897
|
+
label: "Created By",
|
|
898
|
+
description: 'User who created the record ("platform" for system writes).',
|
|
899
|
+
is_required: false,
|
|
900
|
+
is_unique: false,
|
|
901
|
+
is_read_only: true,
|
|
902
|
+
is_platform_managed: true
|
|
903
|
+
},
|
|
904
|
+
{
|
|
905
|
+
name: "updated_by",
|
|
906
|
+
type: "user",
|
|
907
|
+
label: "Updated By",
|
|
908
|
+
description: 'User who last updated the record ("platform" for system writes).',
|
|
909
|
+
is_required: false,
|
|
910
|
+
is_unique: false,
|
|
911
|
+
is_read_only: true,
|
|
912
|
+
is_platform_managed: true
|
|
913
|
+
}
|
|
914
|
+
];
|
|
915
|
+
}
|
|
916
|
+
var AttributeSchema = zod.z.object({
|
|
917
|
+
name: zod.z.string(),
|
|
918
|
+
type: zod.z.string(),
|
|
919
|
+
label: zod.z.string(),
|
|
920
|
+
description: zod.z.string().optional(),
|
|
921
|
+
is_required: zod.z.boolean(),
|
|
922
|
+
is_nullable: zod.z.boolean().optional(),
|
|
923
|
+
is_unique: zod.z.boolean(),
|
|
924
|
+
is_read_only: zod.z.boolean().optional(),
|
|
925
|
+
default_value: zod.z.unknown().optional(),
|
|
926
|
+
meta: zod.z.unknown().optional(),
|
|
927
|
+
options: zod.z.record(zod.z.unknown()).optional()
|
|
928
|
+
});
|
|
929
|
+
function parseRelationMeta(attr) {
|
|
930
|
+
if (attr.type !== "relation") return null;
|
|
931
|
+
const parsed = RelationAttributeMetaSchema.safeParse(attr.meta);
|
|
932
|
+
return parsed.success ? parsed.data : null;
|
|
933
|
+
}
|
|
934
|
+
function parseCurrencyMeta(attr) {
|
|
935
|
+
if (attr.type !== "currency") return null;
|
|
936
|
+
const parsed = CurrencyAttributeMetaSchema.safeParse(attr.meta ?? {});
|
|
937
|
+
return parsed.success ? parsed.data : null;
|
|
938
|
+
}
|
|
939
|
+
function parseUserMeta(attr) {
|
|
940
|
+
if (attr.type !== "user") return null;
|
|
941
|
+
if (attr.meta == null) return {};
|
|
942
|
+
const parsed = UserAttributeMetaSchema.safeParse(attr.meta);
|
|
943
|
+
return parsed.success ? parsed.data : {};
|
|
944
|
+
}
|
|
945
|
+
function parseFileMeta(attr) {
|
|
946
|
+
if (attr.type !== "file") return null;
|
|
947
|
+
if (attr.meta == null) return {};
|
|
948
|
+
const parsed = FileAttributeMetaSchema.safeParse(attr.meta);
|
|
949
|
+
return parsed.success ? parsed.data : {};
|
|
950
|
+
}
|
|
951
|
+
var EntitySchema = AuditFieldsSchema.extend({
|
|
952
|
+
slug: zod.z.string(),
|
|
953
|
+
name: zod.z.string(),
|
|
954
|
+
description: zod.z.string(),
|
|
955
|
+
is_remote: zod.z.boolean(),
|
|
956
|
+
module_slug: zod.z.string(),
|
|
957
|
+
// Default keeps older API responses (pre-`title_template` rollout) parsing
|
|
958
|
+
// cleanly — the field is non-optional in the TS surface but tolerant on
|
|
959
|
+
// the wire.
|
|
960
|
+
title_template: zod.z.string().default(""),
|
|
961
|
+
attributes: zod.z.array(AttributeSchema)
|
|
962
|
+
});
|
|
963
|
+
var EntityWithSchemaSchema = EntitySchema.extend({
|
|
964
|
+
schema: zod.z.record(zod.z.unknown())
|
|
965
|
+
});
|
|
966
|
+
var ModuleSchema = AuditFieldsSchema.extend({
|
|
967
|
+
slug: zod.z.string(),
|
|
968
|
+
name: zod.z.string(),
|
|
969
|
+
description: zod.z.string(),
|
|
970
|
+
version: zod.z.string(),
|
|
971
|
+
file_id: zod.z.string(),
|
|
972
|
+
status: zod.z.enum(["pending", "deploying", "active", "failed", "deactivating", "inactive"]),
|
|
973
|
+
status_details: zod.z.string(),
|
|
974
|
+
is_deactivated: zod.z.boolean()
|
|
975
|
+
});
|
|
976
|
+
var VariableSchema = AuditFieldsSchema.extend({
|
|
977
|
+
id: zod.z.string(),
|
|
978
|
+
key: zod.z.string(),
|
|
979
|
+
value: zod.z.string(),
|
|
980
|
+
is_secret: zod.z.boolean(),
|
|
981
|
+
module: zod.z.string()
|
|
982
|
+
});
|
|
983
|
+
var ComponentSchema = AuditFieldsSchema.extend({
|
|
984
|
+
slug: zod.z.string(),
|
|
985
|
+
name: zod.z.string(),
|
|
986
|
+
description: zod.z.string(),
|
|
987
|
+
module_slug: zod.z.string(),
|
|
988
|
+
bundle_file_id: zod.z.string(),
|
|
989
|
+
source_file_id: zod.z.string(),
|
|
990
|
+
props_schema: zod.z.record(zod.z.unknown()).nullable()
|
|
991
|
+
});
|
|
992
|
+
var ColumnSchema = zod.z.object({
|
|
993
|
+
attribute: zod.z.string(),
|
|
994
|
+
label: zod.z.string(),
|
|
995
|
+
width: zod.z.number()
|
|
996
|
+
});
|
|
997
|
+
var SortConfigSchema = zod.z.object({
|
|
998
|
+
attribute: zod.z.string(),
|
|
999
|
+
direction: zod.z.enum(["asc", "desc"])
|
|
1000
|
+
});
|
|
1001
|
+
var ListSchema = AuditFieldsSchema.extend({
|
|
1002
|
+
slug: zod.z.string(),
|
|
1003
|
+
module_slug: zod.z.string(),
|
|
1004
|
+
name: zod.z.string(),
|
|
1005
|
+
entity_slug: zod.z.string(),
|
|
1006
|
+
columns: zod.z.array(ColumnSchema),
|
|
1007
|
+
sorting: zod.z.array(SortConfigSchema),
|
|
1008
|
+
filters: zod.z.array(FilterGroupSchema)
|
|
1009
|
+
});
|
|
1010
|
+
var ListViewSchema = AuditFieldsSchema.extend({
|
|
1011
|
+
slug: zod.z.string(),
|
|
1012
|
+
module_slug: zod.z.string(),
|
|
1013
|
+
list_slug: zod.z.string(),
|
|
1014
|
+
name: zod.z.string(),
|
|
1015
|
+
columns: zod.z.array(ColumnSchema),
|
|
1016
|
+
sorting: zod.z.array(SortConfigSchema),
|
|
1017
|
+
filters: zod.z.array(FilterGroupSchema)
|
|
1018
|
+
});
|
|
1019
|
+
var PageActionSchema = zod.z.object({
|
|
1020
|
+
label: zod.z.string(),
|
|
1021
|
+
icon: zod.z.string(),
|
|
1022
|
+
action: zod.z.string()
|
|
1023
|
+
});
|
|
1024
|
+
var PageTypeSchema = zod.z.enum(["record", "platform"]);
|
|
1025
|
+
var PageSchema = AuditFieldsSchema.extend({
|
|
1026
|
+
slug: zod.z.string(),
|
|
1027
|
+
name: zod.z.string(),
|
|
1028
|
+
module_slug: zod.z.string(),
|
|
1029
|
+
type: PageTypeSchema,
|
|
1030
|
+
entity_slug: zod.z.string().optional(),
|
|
1031
|
+
actions: zod.z.array(PageActionSchema),
|
|
1032
|
+
layout: PageLayoutSchema
|
|
1033
|
+
});
|
|
1034
|
+
var MenuItemType = {
|
|
1035
|
+
Link: "link",
|
|
1036
|
+
Group: "group",
|
|
1037
|
+
Entity: "entity",
|
|
1038
|
+
Page: "page",
|
|
1039
|
+
List: "list"
|
|
1040
|
+
};
|
|
1041
|
+
var MenuItemSchema = zod.z.lazy(
|
|
1042
|
+
() => zod.z.object({
|
|
1043
|
+
id: zod.z.string(),
|
|
1044
|
+
order: zod.z.number(),
|
|
1045
|
+
label: zod.z.string(),
|
|
1046
|
+
type: zod.z.enum(["link", "group", "entity", "page", "list"]),
|
|
1047
|
+
icon: zod.z.string(),
|
|
1048
|
+
reference: zod.z.string().optional(),
|
|
1049
|
+
children: zod.z.array(MenuItemSchema).nullable()
|
|
1050
|
+
})
|
|
1051
|
+
);
|
|
1052
|
+
var MenuConfigurationSchema = AuditFieldsSchema.extend({
|
|
1053
|
+
slug: zod.z.string(),
|
|
1054
|
+
name: zod.z.string(),
|
|
1055
|
+
module_slug: zod.z.string(),
|
|
1056
|
+
app_slug: zod.z.string(),
|
|
1057
|
+
items: zod.z.array(MenuItemSchema),
|
|
1058
|
+
is_default: zod.z.boolean()
|
|
1059
|
+
});
|
|
1060
|
+
var AppSchema = AuditFieldsSchema.extend({
|
|
1061
|
+
slug: zod.z.string(),
|
|
1062
|
+
org_id: zod.z.string(),
|
|
1063
|
+
module_slug: zod.z.string(),
|
|
1064
|
+
name: zod.z.string(),
|
|
1065
|
+
description: zod.z.string(),
|
|
1066
|
+
icon_slug: zod.z.string()
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
// src/meta/index.ts
|
|
1070
|
+
var MetaClient = class {
|
|
1071
|
+
/**
|
|
1072
|
+
* Service for managing entity definitions.
|
|
1073
|
+
*/
|
|
1074
|
+
entities;
|
|
1075
|
+
/**
|
|
1076
|
+
* Service for managing WebAssembly modules.
|
|
1077
|
+
*/
|
|
1078
|
+
modules;
|
|
1079
|
+
/**
|
|
1080
|
+
* Service for managing configuration and secret variables.
|
|
1081
|
+
*/
|
|
1082
|
+
variables;
|
|
1083
|
+
/**
|
|
1084
|
+
* Service for managing UI component definitions.
|
|
1085
|
+
*/
|
|
1086
|
+
components;
|
|
1087
|
+
/**
|
|
1088
|
+
* Service for managing list configurations.
|
|
1089
|
+
*/
|
|
1090
|
+
lists;
|
|
1091
|
+
/**
|
|
1092
|
+
* Service for managing list view configurations.
|
|
1093
|
+
*/
|
|
1094
|
+
listViews;
|
|
1095
|
+
/**
|
|
1096
|
+
* Service for managing page configurations.
|
|
1097
|
+
*/
|
|
1098
|
+
pages;
|
|
1099
|
+
/**
|
|
1100
|
+
* Service for managing menu configurations.
|
|
1101
|
+
*/
|
|
1102
|
+
menuConfigurations;
|
|
1103
|
+
/**
|
|
1104
|
+
* Service for managing apps.
|
|
1105
|
+
*/
|
|
1106
|
+
apps;
|
|
1107
|
+
/**
|
|
1108
|
+
* Creates a new MetaClient instance.
|
|
1109
|
+
*
|
|
1110
|
+
* @param client - The base ProteosClient to use for API requests
|
|
1111
|
+
*/
|
|
1112
|
+
constructor(client) {
|
|
1113
|
+
this.entities = new EntityServiceImpl(client);
|
|
1114
|
+
this.modules = new ModuleServiceImpl(client);
|
|
1115
|
+
this.variables = new VariableServiceImpl(client);
|
|
1116
|
+
this.components = new ComponentServiceImpl(client);
|
|
1117
|
+
this.lists = new ListServiceImpl(client);
|
|
1118
|
+
this.listViews = new ListViewServiceImpl(client);
|
|
1119
|
+
this.pages = new PageServiceImpl(client);
|
|
1120
|
+
this.menuConfigurations = new MenuConfigurationServiceImpl(client);
|
|
1121
|
+
this.apps = new AppServiceImpl(client);
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
exports.AppSchema = AppSchema;
|
|
1126
|
+
exports.AttributeSchema = AttributeSchema;
|
|
1127
|
+
exports.AuditFieldsSchema = AuditFieldsSchema;
|
|
1128
|
+
exports.BUILT_IN_CONTROLS = BUILT_IN_CONTROLS;
|
|
1129
|
+
exports.ColumnSchema = ColumnSchema;
|
|
1130
|
+
exports.ComponentSchema = ComponentSchema;
|
|
1131
|
+
exports.CurrencyAttributeMetaSchema = CurrencyAttributeMetaSchema;
|
|
1132
|
+
exports.DEFAULT_PAGE_SIZE = DEFAULT_PAGE_SIZE;
|
|
1133
|
+
exports.DONE = DONE;
|
|
1134
|
+
exports.EntitySchema = EntitySchema;
|
|
1135
|
+
exports.EntityWithSchemaSchema = EntityWithSchemaSchema;
|
|
1136
|
+
exports.FileAttributeMetaSchema = FileAttributeMetaSchema;
|
|
1137
|
+
exports.FileRefSchema = FileRefSchema;
|
|
1138
|
+
exports.FilterElementSchema = FilterElementSchema;
|
|
1139
|
+
exports.FilterGroupSchema = FilterGroupSchema;
|
|
1140
|
+
exports.LayoutElementSchema = LayoutElementSchema;
|
|
1141
|
+
exports.LayoutElementType = LayoutElementType;
|
|
1142
|
+
exports.ListSchema = ListSchema;
|
|
1143
|
+
exports.ListViewSchema = ListViewSchema;
|
|
1144
|
+
exports.MenuConfigurationSchema = MenuConfigurationSchema;
|
|
1145
|
+
exports.MenuItemSchema = MenuItemSchema;
|
|
1146
|
+
exports.MenuItemType = MenuItemType;
|
|
1147
|
+
exports.MetaClient = MetaClient;
|
|
1148
|
+
exports.ModuleSchema = ModuleSchema;
|
|
1149
|
+
exports.OnDeleteActionSchema = OnDeleteActionSchema;
|
|
1150
|
+
exports.PLATFORM_ATTRIBUTE_NAMES = PLATFORM_ATTRIBUTE_NAMES;
|
|
1151
|
+
exports.PLATFORM_USER_ID = PLATFORM_USER_ID;
|
|
1152
|
+
exports.PageActionSchema = PageActionSchema;
|
|
1153
|
+
exports.PageIterator = PageIterator;
|
|
1154
|
+
exports.PageLayoutSchema = PageLayoutSchema;
|
|
1155
|
+
exports.PageLayoutSidePanelSchema = PageLayoutSidePanelSchema;
|
|
1156
|
+
exports.PageSchema = PageSchema;
|
|
1157
|
+
exports.RelationAttributeMetaSchema = RelationAttributeMetaSchema;
|
|
1158
|
+
exports.ResponseMetaSchema = ResponseMetaSchema;
|
|
1159
|
+
exports.SizeValueSchema = SizeValueSchema;
|
|
1160
|
+
exports.SortConfigSchema = SortConfigSchema;
|
|
1161
|
+
exports.UserAttributeMetaSchema = UserAttributeMetaSchema;
|
|
1162
|
+
exports.UserRefSchema = UserRefSchema;
|
|
1163
|
+
exports.VariableSchema = VariableSchema;
|
|
1164
|
+
exports.allCurrencyCodes = allCurrencyCodes;
|
|
1165
|
+
exports.createIterator = createIterator;
|
|
1166
|
+
exports.createListResultSchema = createListResultSchema;
|
|
1167
|
+
exports.currencyLabel = currencyLabel;
|
|
1168
|
+
exports.currencySymbol = currencySymbol;
|
|
1169
|
+
exports.currencySymbolSide = currencySymbolSide;
|
|
1170
|
+
exports.formatAmount = formatAmount;
|
|
1171
|
+
exports.formatMoney = formatMoney;
|
|
1172
|
+
exports.isBuiltInControl = isBuiltInControl;
|
|
1173
|
+
exports.isPlatformAttributeName = isPlatformAttributeName;
|
|
1174
|
+
exports.localeNumberSeparators = localeNumberSeparators;
|
|
1175
|
+
exports.lookupCompatibleControls = lookupCompatibleControls;
|
|
1176
|
+
exports.lookupControls = lookupControls;
|
|
1177
|
+
exports.lookupPrimaryControl = lookupPrimaryControl;
|
|
1178
|
+
exports.parseAmount = parseAmount;
|
|
1179
|
+
exports.parseCurrencyMeta = parseCurrencyMeta;
|
|
1180
|
+
exports.parseFileMeta = parseFileMeta;
|
|
1181
|
+
exports.parseRelationMeta = parseRelationMeta;
|
|
1182
|
+
exports.parseUserMeta = parseUserMeta;
|
|
1183
|
+
exports.platformAttributes = platformAttributes;
|
|
1184
|
+
//# sourceMappingURL=chunk-7RGN4E22.cjs.map
|
|
1185
|
+
//# sourceMappingURL=chunk-7RGN4E22.cjs.map
|