@proteos/sdk 0.20.5 → 0.22.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-XJP5WCRZ.js → chunk-OOAHNKPP.js} +104 -5
- package/dist/chunk-OOAHNKPP.js.map +1 -0
- package/dist/{chunk-7RGN4E22.cjs → chunk-V5X4QWIO.cjs} +104 -4
- package/dist/chunk-V5X4QWIO.cjs.map +1 -0
- package/dist/index.cjs +202 -147
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +256 -210
- package/dist/index.d.ts +256 -210
- package/dist/index.js +118 -67
- package/dist/index.js.map +1 -1
- package/dist/meta/index.cjs +54 -50
- 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-BNsjfU8N.d.cts → types-DT29DVEj.d.cts} +243 -9
- package/dist/{types-BNsjfU8N.d.ts → types-DT29DVEj.d.ts} +243 -9
- package/package.json +1 -1
- package/src/auth/platform-entities.ts +4 -0
- package/src/client.ts +5 -3
- package/src/data/records.ts +60 -0
- package/src/functions/actions.ts +25 -0
- package/src/index.ts +30 -19
- package/src/meta/design-references.ts +127 -0
- package/src/meta/entities.ts +17 -0
- package/src/meta/index.ts +18 -0
- package/src/meta/pages.ts +28 -1
- package/src/meta/types.ts +139 -6
- package/src/storage/files.ts +31 -0
- package/src/storage/types.ts +10 -0
- package/src/types/options.ts +6 -0
- package/dist/chunk-7RGN4E22.cjs.map +0 -1
- package/dist/chunk-XJP5WCRZ.js.map +0 -1
package/src/index.ts
CHANGED
|
@@ -161,6 +161,23 @@ export {
|
|
|
161
161
|
} from './auth/index.js'
|
|
162
162
|
// Main client
|
|
163
163
|
export { ProteosClient } from './client.js'
|
|
164
|
+
export type {
|
|
165
|
+
ConnectionScope as ConnectorConnectionScope,
|
|
166
|
+
ConnectionStatus as ConnectorConnectionStatus,
|
|
167
|
+
ConnectionTokenResponse as ConnectorConnectionTokenResponse,
|
|
168
|
+
Connector,
|
|
169
|
+
ConnectorConnection,
|
|
170
|
+
ConnectorMethod,
|
|
171
|
+
CreateConnectorConnectionRequest,
|
|
172
|
+
CredentialKind as ConnectorCredentialKind,
|
|
173
|
+
InstallConnectorConnectionResponse,
|
|
174
|
+
ListConnectorConnectionsQuery,
|
|
175
|
+
ListConnectorsQuery,
|
|
176
|
+
UpdateConnectorConnectionRequest,
|
|
177
|
+
WriteCredentialsRequest,
|
|
178
|
+
} from './connector/index.js'
|
|
179
|
+
// Connector client (connector-service)
|
|
180
|
+
export { ConnectorClient } from './connector/index.js'
|
|
164
181
|
// Conversation types (conversation-service: connections, conversations, messages, listeners)
|
|
165
182
|
export type {
|
|
166
183
|
AgentListener,
|
|
@@ -190,17 +207,17 @@ export type {
|
|
|
190
207
|
InstallConnectionResponse,
|
|
191
208
|
ListAgentListenersQuery,
|
|
192
209
|
ListConnectionsQuery,
|
|
193
|
-
ListGlossaryTermsQuery,
|
|
194
210
|
ListConversationsQuery,
|
|
211
|
+
ListGlossaryTermsQuery,
|
|
195
212
|
ListMessagesQuery,
|
|
196
213
|
ListParticipantsQuery,
|
|
197
214
|
// Conversation-local page envelope ({meta, data}) — distinct from the
|
|
198
215
|
// PageIterator-based ListResult used by the other modules.
|
|
199
216
|
ListResponse,
|
|
200
217
|
ListRoomsQuery,
|
|
218
|
+
MeetingService,
|
|
201
219
|
Message,
|
|
202
220
|
MessageDirection,
|
|
203
|
-
MeetingService,
|
|
204
221
|
MessagePreview,
|
|
205
222
|
MessageRecipient,
|
|
206
223
|
MessageService,
|
|
@@ -228,23 +245,6 @@ export type {
|
|
|
228
245
|
} from './conversation/index.js'
|
|
229
246
|
// Conversation client (conversation-service)
|
|
230
247
|
export { ConversationClient } from './conversation/index.js'
|
|
231
|
-
// Connector client (connector-service)
|
|
232
|
-
export { ConnectorClient } from './connector/index.js'
|
|
233
|
-
export type {
|
|
234
|
-
Connector,
|
|
235
|
-
ConnectorConnection,
|
|
236
|
-
ConnectorMethod,
|
|
237
|
-
ConnectionScope as ConnectorConnectionScope,
|
|
238
|
-
ConnectionStatus as ConnectorConnectionStatus,
|
|
239
|
-
ConnectionTokenResponse as ConnectorConnectionTokenResponse,
|
|
240
|
-
CreateConnectorConnectionRequest,
|
|
241
|
-
CredentialKind as ConnectorCredentialKind,
|
|
242
|
-
InstallConnectorConnectionResponse,
|
|
243
|
-
ListConnectorConnectionsQuery,
|
|
244
|
-
ListConnectorsQuery,
|
|
245
|
-
UpdateConnectorConnectionRequest,
|
|
246
|
-
WriteCredentialsRequest,
|
|
247
|
-
} from './connector/index.js'
|
|
248
248
|
export type {
|
|
249
249
|
BatchTransactionError,
|
|
250
250
|
BatchTransactionStatus,
|
|
@@ -390,6 +390,7 @@ export type {
|
|
|
390
390
|
ComponentService,
|
|
391
391
|
CreateAppRequest,
|
|
392
392
|
CreateComponentRequest,
|
|
393
|
+
CreateDesignReferenceRequest,
|
|
393
394
|
CreateEntityRequest,
|
|
394
395
|
CreateListRequest,
|
|
395
396
|
CreateListViewRequest,
|
|
@@ -401,6 +402,10 @@ export type {
|
|
|
401
402
|
CurrencySymbolSide,
|
|
402
403
|
CurrencyValue,
|
|
403
404
|
DeployModuleRequest,
|
|
405
|
+
// DesignReference types
|
|
406
|
+
DesignReference,
|
|
407
|
+
DesignReferenceContent,
|
|
408
|
+
DesignReferenceService,
|
|
404
409
|
// Entity types
|
|
405
410
|
Entity,
|
|
406
411
|
EntityService,
|
|
@@ -413,6 +418,7 @@ export type {
|
|
|
413
418
|
List,
|
|
414
419
|
ListAppsOptions,
|
|
415
420
|
ListComponentsOptions,
|
|
421
|
+
ListDesignReferencesOptions,
|
|
416
422
|
ListEntitiesOptions,
|
|
417
423
|
ListListsOptions,
|
|
418
424
|
ListListViewsOptions,
|
|
@@ -441,12 +447,16 @@ export type {
|
|
|
441
447
|
PageAction,
|
|
442
448
|
PageLayout,
|
|
443
449
|
PageService,
|
|
450
|
+
PageType,
|
|
451
|
+
PublicPageComponent,
|
|
452
|
+
PublicPageResponse,
|
|
444
453
|
// Relation attribute meta
|
|
445
454
|
RelationAttributeMeta,
|
|
446
455
|
SortConfig,
|
|
447
456
|
SortDirection,
|
|
448
457
|
UpdateAppRequest,
|
|
449
458
|
UpdateComponentRequest,
|
|
459
|
+
UpdateDesignReferenceRequest,
|
|
450
460
|
UpdateEntityRequest,
|
|
451
461
|
UpdateListRequest,
|
|
452
462
|
UpdateListViewRequest,
|
|
@@ -470,6 +480,7 @@ export {
|
|
|
470
480
|
currencyLabel,
|
|
471
481
|
currencySymbol,
|
|
472
482
|
currencySymbolSide,
|
|
483
|
+
DesignReferenceSchema,
|
|
473
484
|
EntitySchema,
|
|
474
485
|
EntityWithSchemaSchema,
|
|
475
486
|
FilterElementSchema,
|
|
@@ -0,0 +1,127 @@
|
|
|
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
|
+
CreateDesignReferenceRequest,
|
|
6
|
+
DesignReference,
|
|
7
|
+
DesignReferenceContent,
|
|
8
|
+
ListDesignReferencesOptions,
|
|
9
|
+
UpdateDesignReferenceRequest,
|
|
10
|
+
} from './types.js'
|
|
11
|
+
|
|
12
|
+
const DESIGN_REFERENCES_BASE_PATH = '/meta/v1/design-references'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Service for managing an org's stored DESIGN.md documents (design references).
|
|
16
|
+
*
|
|
17
|
+
* The markdown body is split from the metadata methods: list/get never carry
|
|
18
|
+
* `content` — read it with {@link getContent} and write it with
|
|
19
|
+
* {@link setContent} (create may seed it in one shot).
|
|
20
|
+
*/
|
|
21
|
+
export interface DesignReferenceService {
|
|
22
|
+
/** Lists design references (metadata only — no `content`). */
|
|
23
|
+
list(
|
|
24
|
+
options?: ListDesignReferencesOptions,
|
|
25
|
+
): PageIterator<DesignReference, ListDesignReferencesOptions>
|
|
26
|
+
|
|
27
|
+
/** Fetches a single page of design references (metadata only). */
|
|
28
|
+
listPage(options?: ListDesignReferencesOptions): Promise<ListResult<DesignReference>>
|
|
29
|
+
|
|
30
|
+
/** Gets a single design reference by id (metadata only — no `content`). */
|
|
31
|
+
get(id: string): Promise<DesignReference>
|
|
32
|
+
|
|
33
|
+
/** Resolves a design reference by its per-org slug (metadata only). */
|
|
34
|
+
getBySlug(slug: string): Promise<DesignReference>
|
|
35
|
+
|
|
36
|
+
/** Creates a design reference; `content` optionally seeds the body. */
|
|
37
|
+
create(request: CreateDesignReferenceRequest): Promise<DesignReference>
|
|
38
|
+
|
|
39
|
+
/** Creates or (by slug) replaces a design reference, including its body. */
|
|
40
|
+
upsert(request: CreateDesignReferenceRequest): Promise<DesignReference>
|
|
41
|
+
|
|
42
|
+
/** Updates a design reference's metadata (name/description/slug). */
|
|
43
|
+
update(id: string, request: UpdateDesignReferenceRequest): Promise<DesignReference>
|
|
44
|
+
|
|
45
|
+
/** Deletes a design reference. */
|
|
46
|
+
delete(id: string): Promise<void>
|
|
47
|
+
|
|
48
|
+
/** Reads the markdown body for a design reference. */
|
|
49
|
+
getContent(id: string): Promise<string>
|
|
50
|
+
|
|
51
|
+
/** Overwrites the markdown body for a design reference (metadata untouched). */
|
|
52
|
+
setContent(id: string, content: string): Promise<void>
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Implementation of DesignReferenceService.
|
|
57
|
+
*/
|
|
58
|
+
export class DesignReferenceServiceImpl implements DesignReferenceService {
|
|
59
|
+
constructor(private readonly client: ProteosClient) {}
|
|
60
|
+
|
|
61
|
+
list(
|
|
62
|
+
options: ListDesignReferencesOptions = {},
|
|
63
|
+
): PageIterator<DesignReference, ListDesignReferencesOptions> {
|
|
64
|
+
return new PageIterator((opts) => this.listPage(opts), options)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async listPage(options: ListDesignReferencesOptions = {}): Promise<ListResult<DesignReference>> {
|
|
68
|
+
return this.client.requestWithQuery<ListResult<DesignReference>>(
|
|
69
|
+
'GET',
|
|
70
|
+
DESIGN_REFERENCES_BASE_PATH,
|
|
71
|
+
options,
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
async get(id: string): Promise<DesignReference> {
|
|
76
|
+
return this.client.request<DesignReference>('GET', `${DESIGN_REFERENCES_BASE_PATH}/${id}`)
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async getBySlug(slug: string): Promise<DesignReference> {
|
|
80
|
+
const page = await this.listPage({ slug })
|
|
81
|
+
const match = page.data[0]
|
|
82
|
+
if (!match) {
|
|
83
|
+
throw new Error(`design reference with slug "${slug}" not found`)
|
|
84
|
+
}
|
|
85
|
+
return match
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
async create(request: CreateDesignReferenceRequest): Promise<DesignReference> {
|
|
89
|
+
return this.client.request<DesignReference>('POST', DESIGN_REFERENCES_BASE_PATH, request)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async upsert(request: CreateDesignReferenceRequest): Promise<DesignReference> {
|
|
93
|
+
return this.client.request<DesignReference>(
|
|
94
|
+
'POST',
|
|
95
|
+
`${DESIGN_REFERENCES_BASE_PATH}/upsert`,
|
|
96
|
+
request,
|
|
97
|
+
)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
async update(id: string, request: UpdateDesignReferenceRequest): Promise<DesignReference> {
|
|
101
|
+
return this.client.request<DesignReference>(
|
|
102
|
+
'PATCH',
|
|
103
|
+
`${DESIGN_REFERENCES_BASE_PATH}/${id}`,
|
|
104
|
+
request,
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async delete(id: string): Promise<void> {
|
|
109
|
+
await this.client.request<void>('DELETE', `${DESIGN_REFERENCES_BASE_PATH}/${id}`)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
async getContent(id: string): Promise<string> {
|
|
113
|
+
const response = await this.client.request<DesignReferenceContent>(
|
|
114
|
+
'GET',
|
|
115
|
+
`${DESIGN_REFERENCES_BASE_PATH}/${id}/content`,
|
|
116
|
+
)
|
|
117
|
+
return response.content
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async setContent(id: string, content: string): Promise<void> {
|
|
121
|
+
await this.client.request<DesignReferenceContent>(
|
|
122
|
+
'PUT',
|
|
123
|
+
`${DESIGN_REFERENCES_BASE_PATH}/${id}/content`,
|
|
124
|
+
{ content },
|
|
125
|
+
)
|
|
126
|
+
}
|
|
127
|
+
}
|
package/src/meta/entities.ts
CHANGED
|
@@ -82,6 +82,13 @@ export interface EntityService {
|
|
|
82
82
|
*/
|
|
83
83
|
getWithSchema(slug: string): Promise<EntityWithSchema>
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Gets a public-access (read) entity (with schema) through the UNAUTHENTICATED
|
|
87
|
+
* public endpoint — no Authorization header. A non-public or missing
|
|
88
|
+
* entity 404s identically.
|
|
89
|
+
*/
|
|
90
|
+
getPublic(orgId: string, slug: string): Promise<EntityWithSchema>
|
|
91
|
+
|
|
85
92
|
/**
|
|
86
93
|
* Creates a new entity.
|
|
87
94
|
*
|
|
@@ -175,6 +182,16 @@ export class EntityServiceImpl implements EntityService {
|
|
|
175
182
|
})
|
|
176
183
|
}
|
|
177
184
|
|
|
185
|
+
async getPublic(orgId: string, slug: string): Promise<EntityWithSchema> {
|
|
186
|
+
return this.client.requestWithQuery<EntityWithSchema>(
|
|
187
|
+
'GET',
|
|
188
|
+
`/meta/v1/public/orgs/${encodeURIComponent(orgId)}/entities/${encodeURIComponent(slug)}`,
|
|
189
|
+
{ with_schema: true },
|
|
190
|
+
undefined,
|
|
191
|
+
{ skipAuth: true },
|
|
192
|
+
)
|
|
193
|
+
}
|
|
194
|
+
|
|
178
195
|
async create(request: CreateEntityRequest): Promise<Entity> {
|
|
179
196
|
return this.client.request<Entity>('POST', ENTITIES_BASE_PATH, request)
|
|
180
197
|
}
|
package/src/meta/index.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ProteosClient } from '../client.js'
|
|
2
2
|
import { type AppService, AppServiceImpl } from './apps.js'
|
|
3
3
|
import { type ComponentService, ComponentServiceImpl } from './components.js'
|
|
4
|
+
import { type DesignReferenceService, DesignReferenceServiceImpl } from './design-references.js'
|
|
4
5
|
import { type EntityService, EntityServiceImpl } from './entities.js'
|
|
5
6
|
import { type ListViewService, ListViewServiceImpl } from './list-views.js'
|
|
6
7
|
import { type ListService, ListServiceImpl } from './lists.js'
|
|
@@ -78,6 +79,11 @@ export class MetaClient {
|
|
|
78
79
|
*/
|
|
79
80
|
readonly apps: AppService
|
|
80
81
|
|
|
82
|
+
/**
|
|
83
|
+
* Service for managing design references (stored DESIGN.md documents).
|
|
84
|
+
*/
|
|
85
|
+
readonly designReferences: DesignReferenceService
|
|
86
|
+
|
|
81
87
|
/**
|
|
82
88
|
* Creates a new MetaClient instance.
|
|
83
89
|
*
|
|
@@ -93,12 +99,14 @@ export class MetaClient {
|
|
|
93
99
|
this.pages = new PageServiceImpl(client)
|
|
94
100
|
this.menuConfigurations = new MenuConfigurationServiceImpl(client)
|
|
95
101
|
this.apps = new AppServiceImpl(client)
|
|
102
|
+
this.designReferences = new DesignReferenceServiceImpl(client)
|
|
96
103
|
}
|
|
97
104
|
}
|
|
98
105
|
|
|
99
106
|
export type { AppService } from './apps.js'
|
|
100
107
|
export type { ComponentService } from './components.js'
|
|
101
108
|
export * from './currency/index.js'
|
|
109
|
+
export type { DesignReferenceService } from './design-references.js'
|
|
102
110
|
// Re-export service interfaces
|
|
103
111
|
export type { EntityService } from './entities.js'
|
|
104
112
|
// Re-export the layout module (PageLayout types + Zod schemas + control registry)
|
|
@@ -122,6 +130,7 @@ export type {
|
|
|
122
130
|
Component,
|
|
123
131
|
CreateAppRequest,
|
|
124
132
|
CreateComponentRequest,
|
|
133
|
+
CreateDesignReferenceRequest,
|
|
125
134
|
CreateEntityRequest,
|
|
126
135
|
CreateListRequest,
|
|
127
136
|
CreateListViewRequest,
|
|
@@ -134,6 +143,9 @@ export type {
|
|
|
134
143
|
DatetimeAttributeMeta,
|
|
135
144
|
DatetimeFormat,
|
|
136
145
|
DeployModuleRequest,
|
|
146
|
+
// DesignReference types
|
|
147
|
+
DesignReference,
|
|
148
|
+
DesignReferenceContent,
|
|
137
149
|
// Entity types
|
|
138
150
|
Entity,
|
|
139
151
|
EntityWithSchema,
|
|
@@ -147,6 +159,7 @@ export type {
|
|
|
147
159
|
List,
|
|
148
160
|
ListAppsOptions,
|
|
149
161
|
ListComponentsOptions,
|
|
162
|
+
ListDesignReferencesOptions,
|
|
150
163
|
ListEntitiesOptions,
|
|
151
164
|
ListListsOptions,
|
|
152
165
|
ListListViewsOptions,
|
|
@@ -171,6 +184,9 @@ export type {
|
|
|
171
184
|
// Page types
|
|
172
185
|
Page,
|
|
173
186
|
PageAction,
|
|
187
|
+
PageType,
|
|
188
|
+
PublicPageComponent,
|
|
189
|
+
PublicPageResponse,
|
|
174
190
|
// Relation attribute meta
|
|
175
191
|
RelationAttributeMeta,
|
|
176
192
|
SortConfig,
|
|
@@ -179,6 +195,7 @@ export type {
|
|
|
179
195
|
StringFormat,
|
|
180
196
|
UpdateAppRequest,
|
|
181
197
|
UpdateComponentRequest,
|
|
198
|
+
UpdateDesignReferenceRequest,
|
|
182
199
|
UpdateEntityRequest,
|
|
183
200
|
UpdateListRequest,
|
|
184
201
|
UpdateListViewRequest,
|
|
@@ -198,6 +215,7 @@ export {
|
|
|
198
215
|
ColumnSchema,
|
|
199
216
|
ComponentSchema,
|
|
200
217
|
CurrencyAttributeMetaSchema,
|
|
218
|
+
DesignReferenceSchema,
|
|
201
219
|
EntitySchema,
|
|
202
220
|
EntityWithSchemaSchema,
|
|
203
221
|
FileAttributeMetaSchema,
|
package/src/meta/pages.ts
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import type { ProteosClient } from '../client.js'
|
|
2
2
|
import { PageIterator } from '../iterator.js'
|
|
3
3
|
import type { ListResult } from '../types/common.js'
|
|
4
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
CreatePageRequest,
|
|
6
|
+
ListPagesOptions,
|
|
7
|
+
Page,
|
|
8
|
+
PublicPageResponse,
|
|
9
|
+
UpdatePageRequest,
|
|
10
|
+
} from './types.js'
|
|
5
11
|
|
|
6
12
|
const PAGES_BASE_PATH = '/meta/v1/pages'
|
|
7
13
|
|
|
@@ -32,6 +38,18 @@ export interface PageService {
|
|
|
32
38
|
*/
|
|
33
39
|
get(slug: string): Promise<Page>
|
|
34
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Gets a PUBLIC page (type='public') without authentication — no
|
|
43
|
+
* Authorization header is sent. Returns the page plus the props_schema of
|
|
44
|
+
* every component its layout references. Non-public pages 404
|
|
45
|
+
* (indistinguishable from absent).
|
|
46
|
+
*
|
|
47
|
+
* @param orgId - Org id (public routes carry the org in the path — there is
|
|
48
|
+
* no token to scope from)
|
|
49
|
+
* @param slug - Page slug
|
|
50
|
+
*/
|
|
51
|
+
getPublic(orgId: string, slug: string): Promise<PublicPageResponse>
|
|
52
|
+
|
|
35
53
|
/**
|
|
36
54
|
* Creates a new page.
|
|
37
55
|
*
|
|
@@ -88,6 +106,15 @@ export class PageServiceImpl implements PageService {
|
|
|
88
106
|
return this.client.request<Page>('GET', `${PAGES_BASE_PATH}/${slug}`)
|
|
89
107
|
}
|
|
90
108
|
|
|
109
|
+
async getPublic(orgId: string, slug: string): Promise<PublicPageResponse> {
|
|
110
|
+
return this.client.request<PublicPageResponse>(
|
|
111
|
+
'GET',
|
|
112
|
+
`/meta/v1/public/orgs/${encodeURIComponent(orgId)}/pages/${encodeURIComponent(slug)}`,
|
|
113
|
+
undefined,
|
|
114
|
+
{ skipAuth: true },
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
91
118
|
async create(request: CreatePageRequest): Promise<Page> {
|
|
92
119
|
return this.client.request<Page>('POST', PAGES_BASE_PATH, request)
|
|
93
120
|
}
|
package/src/meta/types.ts
CHANGED
|
@@ -425,6 +425,15 @@ export function parseFileMeta(attr: Attribute): FileAttributeMeta | null {
|
|
|
425
425
|
return parsed.success ? parsed.data : {}
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
+
/**
|
|
429
|
+
* A single operation a resource may be publicly exposed for. Independent set
|
|
430
|
+
* (not a level): a resource can be public for `write` without `read`. Only
|
|
431
|
+
* `read` is honored on the platform today; `write`/`delete` are reserved.
|
|
432
|
+
*/
|
|
433
|
+
export type PublicAccessOperation = 'read' | 'write' | 'delete'
|
|
434
|
+
|
|
435
|
+
export const PublicAccessOperationSchema = z.enum(['read', 'write', 'delete'])
|
|
436
|
+
|
|
428
437
|
/**
|
|
429
438
|
* Entity definition.
|
|
430
439
|
* Note: Entity uses `slug` as its primary identifier, not `id`.
|
|
@@ -434,6 +443,14 @@ export interface Entity extends AuditFields {
|
|
|
434
443
|
name: string
|
|
435
444
|
description: string
|
|
436
445
|
is_remote: boolean
|
|
446
|
+
/**
|
|
447
|
+
* Operations ALL records of the entity are exposed for on the
|
|
448
|
+
* unauthenticated public surface. Only `["read"]` is honored today (records
|
|
449
|
+
* become world-readable; the entity definition is implicitly readable so
|
|
450
|
+
* they can be interpreted); `write`/`delete` are reserved. Empty = private
|
|
451
|
+
* (default).
|
|
452
|
+
*/
|
|
453
|
+
public_record_access: PublicAccessOperation[]
|
|
437
454
|
module_slug: string
|
|
438
455
|
/**
|
|
439
456
|
* Liquid template that renders a human-readable title for an instance
|
|
@@ -453,6 +470,9 @@ export const EntitySchema = AuditFieldsSchema.extend({
|
|
|
453
470
|
name: z.string(),
|
|
454
471
|
description: z.string(),
|
|
455
472
|
is_remote: z.boolean(),
|
|
473
|
+
// Default keeps older API responses (pre-`public_record_access` rollout)
|
|
474
|
+
// parsing cleanly.
|
|
475
|
+
public_record_access: z.array(PublicAccessOperationSchema).default([]),
|
|
456
476
|
module_slug: z.string(),
|
|
457
477
|
// Default keeps older API responses (pre-`title_template` rollout) parsing
|
|
458
478
|
// cleanly — the field is non-optional in the TS surface but tolerant on
|
|
@@ -489,6 +509,12 @@ export interface CreateEntityRequest {
|
|
|
489
509
|
slug: string
|
|
490
510
|
name: string
|
|
491
511
|
is_remote: boolean
|
|
512
|
+
/**
|
|
513
|
+
* Operations to expose all records of the entity for, unauthenticated (only
|
|
514
|
+
* `["read"]` accepted today). Full-replacement on upsert: an upsert without
|
|
515
|
+
* the field resets it to private.
|
|
516
|
+
*/
|
|
517
|
+
public_record_access?: PublicAccessOperation[]
|
|
492
518
|
module_slug: string
|
|
493
519
|
description: string
|
|
494
520
|
title_template?: string
|
|
@@ -501,6 +527,7 @@ export interface CreateEntityRequest {
|
|
|
501
527
|
export interface UpdateEntityRequest {
|
|
502
528
|
name?: string
|
|
503
529
|
is_remote?: boolean
|
|
530
|
+
public_record_access?: PublicAccessOperation[]
|
|
504
531
|
module_slug?: string
|
|
505
532
|
description?: string
|
|
506
533
|
title_template?: string
|
|
@@ -641,6 +668,13 @@ export interface Component extends AuditFields {
|
|
|
641
668
|
source_file_id: string
|
|
642
669
|
/** The component's JSON Schema, driving the page-designer props editor + runtime validation. `null` until set. */
|
|
643
670
|
props_schema: Record<string, unknown> | null
|
|
671
|
+
/**
|
|
672
|
+
* Opts the compiled bundle into UNAUTHENTICATED serving. Public
|
|
673
|
+
* (type='public') pages may only reference public components (enforced at
|
|
674
|
+
* page save), and a public component's only platform reach at runtime is
|
|
675
|
+
* `functions.actions.invokePublic`.
|
|
676
|
+
*/
|
|
677
|
+
is_public: boolean
|
|
644
678
|
}
|
|
645
679
|
|
|
646
680
|
export const ComponentSchema = AuditFieldsSchema.extend({
|
|
@@ -650,7 +684,9 @@ export const ComponentSchema = AuditFieldsSchema.extend({
|
|
|
650
684
|
module_slug: z.string(),
|
|
651
685
|
bundle_file_id: z.string(),
|
|
652
686
|
source_file_id: z.string(),
|
|
687
|
+
// default(false): rows serialized before the flag existed lack the field.
|
|
653
688
|
props_schema: z.record(z.unknown()).nullable(),
|
|
689
|
+
is_public: z.boolean().default(false),
|
|
654
690
|
})
|
|
655
691
|
|
|
656
692
|
/**
|
|
@@ -673,6 +709,8 @@ export interface CreateComponentRequest {
|
|
|
673
709
|
bundle_file_id?: string
|
|
674
710
|
source_file_id?: string
|
|
675
711
|
props_schema?: Record<string, unknown>
|
|
712
|
+
/** See {@link Component.is_public}. Manifest-driven: omitting it sets false. */
|
|
713
|
+
is_public?: boolean
|
|
676
714
|
}
|
|
677
715
|
|
|
678
716
|
/**
|
|
@@ -684,6 +722,7 @@ export interface UpdateComponentRequest {
|
|
|
684
722
|
bundle_file_id?: string
|
|
685
723
|
source_file_id?: string
|
|
686
724
|
props_schema?: Record<string, unknown>
|
|
725
|
+
is_public?: boolean
|
|
687
726
|
}
|
|
688
727
|
|
|
689
728
|
// ============================================================================
|
|
@@ -886,14 +925,21 @@ export const PageActionSchema = z.object({
|
|
|
886
925
|
})
|
|
887
926
|
|
|
888
927
|
/**
|
|
889
|
-
* Page type
|
|
890
|
-
*
|
|
891
|
-
*
|
|
892
|
-
*
|
|
928
|
+
* Page type — encodes what the page binds to and how it is served (chrome +
|
|
929
|
+
* auth posture both follow from it):
|
|
930
|
+
*
|
|
931
|
+
* - `record`: rendered against a single record of `entity_slug`; app chrome;
|
|
932
|
+
* authenticated.
|
|
933
|
+
* - `platform`: standalone, no record context (e.g. a dashboard launched from
|
|
934
|
+
* a menu item); app chrome; authenticated.
|
|
935
|
+
* - `kiosk`: standalone, NO app chrome (bare page at `/k/…`); authenticated.
|
|
936
|
+
* - `public`: standalone, NO app chrome (bare page at `/p/…`);
|
|
937
|
+
* UNAUTHENTICATED — the layout is world-readable and its components may only
|
|
938
|
+
* call `is_public` global actions.
|
|
893
939
|
*/
|
|
894
|
-
export type PageType = 'record' | 'platform'
|
|
940
|
+
export type PageType = 'record' | 'platform' | 'kiosk' | 'public'
|
|
895
941
|
|
|
896
|
-
export const PageTypeSchema = z.enum(['record', 'platform'])
|
|
942
|
+
export const PageTypeSchema = z.enum(['record', 'platform', 'kiosk', 'public'])
|
|
897
943
|
|
|
898
944
|
/**
|
|
899
945
|
* Page configuration. A `record` page is the detail-page shape for a single
|
|
@@ -924,6 +970,26 @@ export const PageSchema = AuditFieldsSchema.extend({
|
|
|
924
970
|
layout: PageLayoutSchema,
|
|
925
971
|
})
|
|
926
972
|
|
|
973
|
+
/**
|
|
974
|
+
* Component metadata slice riding on the public page payload — just the slug
|
|
975
|
+
* and props schema (deliberately not the full Component: this is served
|
|
976
|
+
* unauthenticated).
|
|
977
|
+
*/
|
|
978
|
+
export interface PublicPageComponent {
|
|
979
|
+
slug: string
|
|
980
|
+
props_schema?: Record<string, unknown>
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
/**
|
|
984
|
+
* Payload of the unauthenticated `GET /meta/v1/public/orgs/{orgId}/pages/{slug}`:
|
|
985
|
+
* the page plus the props_schema of every component its layout references, so
|
|
986
|
+
* a public renderer needs no follow-up authenticated calls.
|
|
987
|
+
*/
|
|
988
|
+
export interface PublicPageResponse {
|
|
989
|
+
page: Page
|
|
990
|
+
components: PublicPageComponent[]
|
|
991
|
+
}
|
|
992
|
+
|
|
927
993
|
/**
|
|
928
994
|
* Options for listing pages.
|
|
929
995
|
*/
|
|
@@ -1113,3 +1179,70 @@ export interface UpdateAppRequest {
|
|
|
1113
1179
|
description?: string
|
|
1114
1180
|
icon_slug?: string
|
|
1115
1181
|
}
|
|
1182
|
+
|
|
1183
|
+
// ============================================================================
|
|
1184
|
+
// DesignReference Types
|
|
1185
|
+
// ============================================================================
|
|
1186
|
+
|
|
1187
|
+
/**
|
|
1188
|
+
* A stored DESIGN.md document — a named design reference an org authors and that
|
|
1189
|
+
* design agents read as the source of truth for a surface. `name` + `description`
|
|
1190
|
+
* are the selector ("which reference, and when to use it").
|
|
1191
|
+
*
|
|
1192
|
+
* `content` (the markdown body) is NOT returned by list/get — fetch it via
|
|
1193
|
+
* {@link DesignReferenceService.getContent} and write it via `setContent`.
|
|
1194
|
+
*/
|
|
1195
|
+
export interface DesignReference extends AuditFields {
|
|
1196
|
+
id: string
|
|
1197
|
+
org_id: string
|
|
1198
|
+
slug: string
|
|
1199
|
+
name: string
|
|
1200
|
+
description: string
|
|
1201
|
+
/** The DESIGN.md body. Only present on the dedicated content endpoint; undefined on list/get. */
|
|
1202
|
+
content?: string
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
export const DesignReferenceSchema = AuditFieldsSchema.extend({
|
|
1206
|
+
id: z.string(),
|
|
1207
|
+
slug: z.string(),
|
|
1208
|
+
name: z.string(),
|
|
1209
|
+
description: z.string(),
|
|
1210
|
+
content: z.string().optional(),
|
|
1211
|
+
})
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* Options for listing design references.
|
|
1215
|
+
*/
|
|
1216
|
+
export interface ListDesignReferencesOptions extends MetaListOptions {
|
|
1217
|
+
id?: string
|
|
1218
|
+
slug?: string
|
|
1219
|
+
name?: string
|
|
1220
|
+
description?: string
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* Request to create a design reference. `content` optionally seeds the body.
|
|
1225
|
+
*/
|
|
1226
|
+
export interface CreateDesignReferenceRequest {
|
|
1227
|
+
slug: string
|
|
1228
|
+
name: string
|
|
1229
|
+
description?: string
|
|
1230
|
+
content?: string
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* Request to update a design reference's metadata. Content is edited via the
|
|
1235
|
+
* dedicated content endpoint, not here.
|
|
1236
|
+
*/
|
|
1237
|
+
export interface UpdateDesignReferenceRequest {
|
|
1238
|
+
slug?: string
|
|
1239
|
+
name?: string
|
|
1240
|
+
description?: string
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
/**
|
|
1244
|
+
* The markdown body, from GET/PUT /design-references/:id/content.
|
|
1245
|
+
*/
|
|
1246
|
+
export interface DesignReferenceContent {
|
|
1247
|
+
content: string
|
|
1248
|
+
}
|
package/src/storage/files.ts
CHANGED
|
@@ -70,6 +70,19 @@ export interface FileService {
|
|
|
70
70
|
* {@link FileService.createDownloadUrl} for browser click-to-download.
|
|
71
71
|
*/
|
|
72
72
|
download(id: string): Promise<Blob>
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Downloads the current version of a public-read file through the
|
|
76
|
+
* UNAUTHENTICATED public endpoint (no Authorization header). A non-public
|
|
77
|
+
* or missing file 404s identically.
|
|
78
|
+
*/
|
|
79
|
+
downloadPublic(orgId: string, id: string): Promise<Blob>
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Builds the unauthenticated public download URL for a public-read
|
|
83
|
+
* file — usable directly as an <img src> / <a href> on public pages.
|
|
84
|
+
*/
|
|
85
|
+
publicDownloadUrl(orgId: string, id: string): string
|
|
73
86
|
}
|
|
74
87
|
|
|
75
88
|
/**
|
|
@@ -180,4 +193,22 @@ export class FileServiceImpl implements FileService {
|
|
|
180
193
|
const { response } = await this.client.requestRaw('GET', `${FILES_BASE_PATH}/${id}/download`)
|
|
181
194
|
return await response.blob()
|
|
182
195
|
}
|
|
196
|
+
|
|
197
|
+
async downloadPublic(orgId: string, id: string): Promise<Blob> {
|
|
198
|
+
const { response } = await this.client.requestRaw(
|
|
199
|
+
'GET',
|
|
200
|
+
this.publicDownloadPath(orgId, id),
|
|
201
|
+
undefined,
|
|
202
|
+
{ skipAuth: true },
|
|
203
|
+
)
|
|
204
|
+
return await response.blob()
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
publicDownloadUrl(orgId: string, id: string): string {
|
|
208
|
+
return `${this.client.baseUrl}${this.publicDownloadPath(orgId, id)}`
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
private publicDownloadPath(orgId: string, id: string): string {
|
|
212
|
+
return `/storage/v1/public/orgs/${encodeURIComponent(orgId)}/files/${encodeURIComponent(id)}/download`
|
|
213
|
+
}
|
|
183
214
|
}
|