@proteos/sdk 0.51.1 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-IRFFXJMB.js → chunk-HEUXXELG.js} +311 -17
- package/dist/chunk-HEUXXELG.js.map +1 -0
- package/dist/{chunk-RKFXHDVU.cjs → chunk-SWCPI6SL.cjs} +326 -16
- package/dist/chunk-SWCPI6SL.cjs.map +1 -0
- package/dist/index.cjs +209 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +213 -12
- package/dist/index.d.ts +213 -12
- package/dist/index.js +49 -2
- package/dist/index.js.map +1 -1
- package/dist/meta/index.cjs +123 -59
- package/dist/meta/index.d.cts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/meta/index.js +1 -1
- package/dist/{types-C9flkAj-.d.cts → types-D5P6yk1L.d.cts} +1288 -69
- package/dist/{types-C9flkAj-.d.ts → types-D5P6yk1L.d.ts} +1288 -69
- package/package.json +3 -3
- package/src/conversation/index.ts +39 -0
- package/src/conversation/types.ts +108 -4
- package/src/data/index.ts +15 -2
- package/src/data/records.ts +63 -0
- package/src/data/types.ts +52 -0
- package/src/index.ts +60 -1
- package/src/meta/entity-extensions.ts +98 -0
- package/src/meta/index.ts +84 -1
- package/src/meta/layout/common-props.ts +8 -0
- package/src/meta/layout/control-registry.json +10 -2
- package/src/meta/layout/elements.ts +15 -10
- package/src/meta/layout/index.ts +1 -0
- package/src/meta/list-extensions.ts +98 -0
- package/src/meta/menu-configuration-extensions.ts +132 -0
- package/src/meta/page-extensions.ts +98 -0
- package/src/meta/types.ts +470 -0
- package/dist/chunk-IRFFXJMB.js.map +0 -1
- package/dist/chunk-RKFXHDVU.cjs.map +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { ProteosClient } from '../client.js'
|
|
2
|
+
import { PageIterator } from '../iterator.js'
|
|
3
|
+
import type { ListResult } from '../types/common.js'
|
|
4
|
+
import type {
|
|
5
|
+
CreateListExtensionRequest,
|
|
6
|
+
ListExtension,
|
|
7
|
+
ListListExtensionsOptions,
|
|
8
|
+
UpdateListExtensionRequest,
|
|
9
|
+
} from './types.js'
|
|
10
|
+
|
|
11
|
+
const LIST_EXTENSIONS_BASE_PATH = '/meta/v1/list-extensions'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Service for entity extensions — attributes contributed to an EXISTING host
|
|
15
|
+
* entity by a resource that does not own it (typically a second module). The
|
|
16
|
+
* host's `attributes` are the materialized merge: its own attributes plus every
|
|
17
|
+
* extension's, each stamped with `extension_key`. Every write here
|
|
18
|
+
* re-materializes the host; an attribute name shared with the host or another
|
|
19
|
+
* extension is refused (`entity_extension_attribute_collision`).
|
|
20
|
+
*/
|
|
21
|
+
export interface ListExtensionService {
|
|
22
|
+
/** Lists entity extensions (auto-paginating iterator). */
|
|
23
|
+
list(
|
|
24
|
+
options?: ListListExtensionsOptions,
|
|
25
|
+
): PageIterator<ListExtension, ListListExtensionsOptions>
|
|
26
|
+
|
|
27
|
+
/** Fetches a single page of entity extensions. */
|
|
28
|
+
listPage(options?: ListListExtensionsOptions): Promise<ListResult<ListExtension>>
|
|
29
|
+
|
|
30
|
+
/** Gets an entity extension by key (404 when unknown). */
|
|
31
|
+
get(key: string): Promise<ListExtension>
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates an entity extension and merges its attributes into the host.
|
|
35
|
+
* @throws {ProteosError} 409 `entity_extension_already_exists` when the key
|
|
36
|
+
* is taken; 400 `entity_extension_entity_not_found` when the host does
|
|
37
|
+
* not exist; 400 `entity_extension_attribute_collision` on a name clash.
|
|
38
|
+
*/
|
|
39
|
+
create(request: CreateListExtensionRequest): Promise<ListExtension>
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creates or replaces an entity extension idempotently by key
|
|
43
|
+
* (`PUT /meta/v1/list-extensions/:key`). Replaces the whole definition;
|
|
44
|
+
* the host binding (`list_slug`) of an existing key is immutable.
|
|
45
|
+
*/
|
|
46
|
+
upsert(key: string, request: CreateListExtensionRequest): Promise<ListExtension>
|
|
47
|
+
|
|
48
|
+
/** Partially updates an entity extension (`attributes` replaces the whole list). */
|
|
49
|
+
update(key: string, request: UpdateListExtensionRequest): Promise<ListExtension>
|
|
50
|
+
|
|
51
|
+
/** Deletes an entity extension and removes its attributes from the host. */
|
|
52
|
+
delete(key: string): Promise<void>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export class ListExtensionServiceImpl implements ListExtensionService {
|
|
56
|
+
constructor(private readonly client: ProteosClient) {}
|
|
57
|
+
|
|
58
|
+
list(
|
|
59
|
+
options: ListListExtensionsOptions = {},
|
|
60
|
+
): PageIterator<ListExtension, ListListExtensionsOptions> {
|
|
61
|
+
return new PageIterator((opts) => this.listPage(opts), options)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async listPage(options: ListListExtensionsOptions = {}): Promise<ListResult<ListExtension>> {
|
|
65
|
+
return this.client.requestWithQuery<ListResult<ListExtension>>(
|
|
66
|
+
'GET',
|
|
67
|
+
LIST_EXTENSIONS_BASE_PATH,
|
|
68
|
+
options,
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async get(key: string): Promise<ListExtension> {
|
|
73
|
+
return this.client.request<ListExtension>('GET', `${LIST_EXTENSIONS_BASE_PATH}/${key}`)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async create(request: CreateListExtensionRequest): Promise<ListExtension> {
|
|
77
|
+
return this.client.request<ListExtension>('POST', LIST_EXTENSIONS_BASE_PATH, request)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async upsert(key: string, request: CreateListExtensionRequest): Promise<ListExtension> {
|
|
81
|
+
return this.client.request<ListExtension>('PUT', `${LIST_EXTENSIONS_BASE_PATH}/${key}`, {
|
|
82
|
+
...request,
|
|
83
|
+
key,
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async update(key: string, request: UpdateListExtensionRequest): Promise<ListExtension> {
|
|
88
|
+
return this.client.request<ListExtension>(
|
|
89
|
+
'PATCH',
|
|
90
|
+
`${LIST_EXTENSIONS_BASE_PATH}/${key}`,
|
|
91
|
+
request,
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async delete(key: string): Promise<void> {
|
|
96
|
+
await this.client.request<void>('DELETE', `${LIST_EXTENSIONS_BASE_PATH}/${key}`)
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import type { ProteosClient } from '../client.js'
|
|
2
|
+
import { PageIterator } from '../iterator.js'
|
|
3
|
+
import type { ListResult } from '../types/common.js'
|
|
4
|
+
import type {
|
|
5
|
+
CreateMenuConfigurationExtensionRequest,
|
|
6
|
+
ListMenuConfigurationExtensionsOptions,
|
|
7
|
+
MenuConfigurationExtension,
|
|
8
|
+
UpdateMenuConfigurationExtensionRequest,
|
|
9
|
+
} from './types.js'
|
|
10
|
+
|
|
11
|
+
const MENU_CONFIGURATION_EXTENSIONS_BASE_PATH = '/meta/v1/menu-configuration-extensions'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Service for menu-configuration extensions — items contributed to an EXISTING
|
|
15
|
+
* host menu configuration by a resource that does not own it (typically a
|
|
16
|
+
* second module). The host's `items` are the materialized merge: its own tree
|
|
17
|
+
* plus every extension's placements, each contributed item stamped with
|
|
18
|
+
* `extension_key` (a replaced / removed host item kept under `replaced_item`).
|
|
19
|
+
* Every write here re-materializes the host; an item id shared with the host
|
|
20
|
+
* or another extension is refused
|
|
21
|
+
* (`menu_configuration_extension_item_id_collision`), an anchor the host does
|
|
22
|
+
* not have too (`menu_configuration_extension_anchor_not_found`).
|
|
23
|
+
*/
|
|
24
|
+
export interface MenuConfigurationExtensionService {
|
|
25
|
+
/** Lists menu-configuration extensions (auto-paginating iterator). */
|
|
26
|
+
list(
|
|
27
|
+
options?: ListMenuConfigurationExtensionsOptions,
|
|
28
|
+
): PageIterator<MenuConfigurationExtension, ListMenuConfigurationExtensionsOptions>
|
|
29
|
+
|
|
30
|
+
/** Fetches a single page of menu-configuration extensions. */
|
|
31
|
+
listPage(
|
|
32
|
+
options?: ListMenuConfigurationExtensionsOptions,
|
|
33
|
+
): Promise<ListResult<MenuConfigurationExtension>>
|
|
34
|
+
|
|
35
|
+
/** Gets a menu-configuration extension by key (404 when unknown). */
|
|
36
|
+
get(key: string): Promise<MenuConfigurationExtension>
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Creates a menu-configuration extension and merges its items into the host.
|
|
40
|
+
* @throws {ProteosError} 409 `menu_configuration_extension_already_exists`
|
|
41
|
+
* when the key is taken; 400 `menu_configuration_extension_menu_not_found`
|
|
42
|
+
* when the host does not exist; 400
|
|
43
|
+
* `menu_configuration_extension_anchor_not_found` /
|
|
44
|
+
* `menu_configuration_extension_item_id_collision` on a bad placement.
|
|
45
|
+
*/
|
|
46
|
+
create(request: CreateMenuConfigurationExtensionRequest): Promise<MenuConfigurationExtension>
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Creates or replaces a menu-configuration extension idempotently by key
|
|
50
|
+
* (`PUT /meta/v1/menu-configuration-extensions/:key`). Replaces the whole definition;
|
|
51
|
+
* the host binding (`menu_slug`) of an existing key is immutable.
|
|
52
|
+
*/
|
|
53
|
+
upsert(
|
|
54
|
+
key: string,
|
|
55
|
+
request: CreateMenuConfigurationExtensionRequest,
|
|
56
|
+
): Promise<MenuConfigurationExtension>
|
|
57
|
+
|
|
58
|
+
/** Partially updates a menu-configuration extension (`placements` replaces the whole list). */
|
|
59
|
+
update(
|
|
60
|
+
key: string,
|
|
61
|
+
request: UpdateMenuConfigurationExtensionRequest,
|
|
62
|
+
): Promise<MenuConfigurationExtension>
|
|
63
|
+
|
|
64
|
+
/** Deletes a menu-configuration extension and removes its items from the host. */
|
|
65
|
+
delete(key: string): Promise<void>
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export class MenuConfigurationExtensionServiceImpl implements MenuConfigurationExtensionService {
|
|
69
|
+
constructor(private readonly client: ProteosClient) {}
|
|
70
|
+
|
|
71
|
+
list(
|
|
72
|
+
options: ListMenuConfigurationExtensionsOptions = {},
|
|
73
|
+
): PageIterator<MenuConfigurationExtension, ListMenuConfigurationExtensionsOptions> {
|
|
74
|
+
return new PageIterator((opts) => this.listPage(opts), options)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async listPage(
|
|
78
|
+
options: ListMenuConfigurationExtensionsOptions = {},
|
|
79
|
+
): Promise<ListResult<MenuConfigurationExtension>> {
|
|
80
|
+
return this.client.requestWithQuery<ListResult<MenuConfigurationExtension>>(
|
|
81
|
+
'GET',
|
|
82
|
+
MENU_CONFIGURATION_EXTENSIONS_BASE_PATH,
|
|
83
|
+
options,
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async get(key: string): Promise<MenuConfigurationExtension> {
|
|
88
|
+
return this.client.request<MenuConfigurationExtension>(
|
|
89
|
+
'GET',
|
|
90
|
+
`${MENU_CONFIGURATION_EXTENSIONS_BASE_PATH}/${key}`,
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async create(
|
|
95
|
+
request: CreateMenuConfigurationExtensionRequest,
|
|
96
|
+
): Promise<MenuConfigurationExtension> {
|
|
97
|
+
return this.client.request<MenuConfigurationExtension>(
|
|
98
|
+
'POST',
|
|
99
|
+
MENU_CONFIGURATION_EXTENSIONS_BASE_PATH,
|
|
100
|
+
request,
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
async upsert(
|
|
105
|
+
key: string,
|
|
106
|
+
request: CreateMenuConfigurationExtensionRequest,
|
|
107
|
+
): Promise<MenuConfigurationExtension> {
|
|
108
|
+
return this.client.request<MenuConfigurationExtension>(
|
|
109
|
+
'PUT',
|
|
110
|
+
`${MENU_CONFIGURATION_EXTENSIONS_BASE_PATH}/${key}`,
|
|
111
|
+
{
|
|
112
|
+
...request,
|
|
113
|
+
key,
|
|
114
|
+
},
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async update(
|
|
119
|
+
key: string,
|
|
120
|
+
request: UpdateMenuConfigurationExtensionRequest,
|
|
121
|
+
): Promise<MenuConfigurationExtension> {
|
|
122
|
+
return this.client.request<MenuConfigurationExtension>(
|
|
123
|
+
'PATCH',
|
|
124
|
+
`${MENU_CONFIGURATION_EXTENSIONS_BASE_PATH}/${key}`,
|
|
125
|
+
request,
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async delete(key: string): Promise<void> {
|
|
130
|
+
await this.client.request<void>('DELETE', `${MENU_CONFIGURATION_EXTENSIONS_BASE_PATH}/${key}`)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { ProteosClient } from '../client.js'
|
|
2
|
+
import { PageIterator } from '../iterator.js'
|
|
3
|
+
import type { ListResult } from '../types/common.js'
|
|
4
|
+
import type {
|
|
5
|
+
CreatePageExtensionRequest,
|
|
6
|
+
PageExtension,
|
|
7
|
+
ListPageExtensionsOptions,
|
|
8
|
+
UpdatePageExtensionRequest,
|
|
9
|
+
} from './types.js'
|
|
10
|
+
|
|
11
|
+
const PAGE_EXTENSIONS_BASE_PATH = '/meta/v1/page-extensions'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Service for entity extensions — attributes contributed to an EXISTING host
|
|
15
|
+
* entity by a resource that does not own it (typically a second module). The
|
|
16
|
+
* host's `attributes` are the materialized merge: its own attributes plus every
|
|
17
|
+
* extension's, each stamped with `extension_key`. Every write here
|
|
18
|
+
* re-materializes the host; an attribute name shared with the host or another
|
|
19
|
+
* extension is refused (`entity_extension_attribute_collision`).
|
|
20
|
+
*/
|
|
21
|
+
export interface PageExtensionService {
|
|
22
|
+
/** Lists entity extensions (auto-paginating iterator). */
|
|
23
|
+
list(
|
|
24
|
+
options?: ListPageExtensionsOptions,
|
|
25
|
+
): PageIterator<PageExtension, ListPageExtensionsOptions>
|
|
26
|
+
|
|
27
|
+
/** Fetches a single page of entity extensions. */
|
|
28
|
+
listPage(options?: ListPageExtensionsOptions): Promise<ListResult<PageExtension>>
|
|
29
|
+
|
|
30
|
+
/** Gets an entity extension by key (404 when unknown). */
|
|
31
|
+
get(key: string): Promise<PageExtension>
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Creates an entity extension and merges its attributes into the host.
|
|
35
|
+
* @throws {ProteosError} 409 `entity_extension_already_exists` when the key
|
|
36
|
+
* is taken; 400 `entity_extension_entity_not_found` when the host does
|
|
37
|
+
* not exist; 400 `entity_extension_attribute_collision` on a name clash.
|
|
38
|
+
*/
|
|
39
|
+
create(request: CreatePageExtensionRequest): Promise<PageExtension>
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creates or replaces an entity extension idempotently by key
|
|
43
|
+
* (`PUT /meta/v1/page-extensions/:key`). Replaces the whole definition;
|
|
44
|
+
* the host binding (`page_slug`) of an existing key is immutable.
|
|
45
|
+
*/
|
|
46
|
+
upsert(key: string, request: CreatePageExtensionRequest): Promise<PageExtension>
|
|
47
|
+
|
|
48
|
+
/** Partially updates an entity extension (`attributes` replaces the whole list). */
|
|
49
|
+
update(key: string, request: UpdatePageExtensionRequest): Promise<PageExtension>
|
|
50
|
+
|
|
51
|
+
/** Deletes an entity extension and removes its attributes from the host. */
|
|
52
|
+
delete(key: string): Promise<void>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export class PageExtensionServiceImpl implements PageExtensionService {
|
|
56
|
+
constructor(private readonly client: ProteosClient) {}
|
|
57
|
+
|
|
58
|
+
list(
|
|
59
|
+
options: ListPageExtensionsOptions = {},
|
|
60
|
+
): PageIterator<PageExtension, ListPageExtensionsOptions> {
|
|
61
|
+
return new PageIterator((opts) => this.listPage(opts), options)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
async listPage(options: ListPageExtensionsOptions = {}): Promise<ListResult<PageExtension>> {
|
|
65
|
+
return this.client.requestWithQuery<ListResult<PageExtension>>(
|
|
66
|
+
'GET',
|
|
67
|
+
PAGE_EXTENSIONS_BASE_PATH,
|
|
68
|
+
options,
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async get(key: string): Promise<PageExtension> {
|
|
73
|
+
return this.client.request<PageExtension>('GET', `${PAGE_EXTENSIONS_BASE_PATH}/${key}`)
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async create(request: CreatePageExtensionRequest): Promise<PageExtension> {
|
|
77
|
+
return this.client.request<PageExtension>('POST', PAGE_EXTENSIONS_BASE_PATH, request)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
async upsert(key: string, request: CreatePageExtensionRequest): Promise<PageExtension> {
|
|
81
|
+
return this.client.request<PageExtension>('PUT', `${PAGE_EXTENSIONS_BASE_PATH}/${key}`, {
|
|
82
|
+
...request,
|
|
83
|
+
key,
|
|
84
|
+
})
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async update(key: string, request: UpdatePageExtensionRequest): Promise<PageExtension> {
|
|
88
|
+
return this.client.request<PageExtension>(
|
|
89
|
+
'PATCH',
|
|
90
|
+
`${PAGE_EXTENSIONS_BASE_PATH}/${key}`,
|
|
91
|
+
request,
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async delete(key: string): Promise<void> {
|
|
96
|
+
await this.client.request<void>('DELETE', `${PAGE_EXTENSIONS_BASE_PATH}/${key}`)
|
|
97
|
+
}
|
|
98
|
+
}
|