@proteos/sdk 0.21.0 → 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-OUVD2XJX.js → chunk-OOAHNKPP.js} +92 -3
- package/dist/chunk-OOAHNKPP.js.map +1 -0
- package/dist/{chunk-DD6H5PIF.cjs → chunk-V5X4QWIO.cjs} +92 -2
- package/dist/chunk-V5X4QWIO.cjs.map +1 -0
- package/dist/index.cjs +188 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +246 -210
- package/dist/index.d.ts +246 -210
- package/dist/index.js +104 -64
- 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-PzImL4QI.d.cts → types-DT29DVEj.d.cts} +180 -1
- package/dist/{types-PzImL4QI.d.ts → types-DT29DVEj.d.ts} +180 -1
- package/package.json +1 -1
- package/src/auth/platform-entities.ts +4 -0
- package/src/data/records.ts +60 -0
- package/src/index.ts +29 -21
- package/src/meta/design-references.ts +127 -0
- package/src/meta/entities.ts +17 -0
- package/src/meta/index.ts +15 -0
- package/src/meta/types.ts +94 -0
- package/src/storage/files.ts +31 -0
- package/src/storage/types.ts +10 -0
- package/dist/chunk-DD6H5PIF.cjs.map +0 -1
- package/dist/chunk-OUVD2XJX.js.map +0 -1
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,
|
|
@@ -182,6 +195,7 @@ export type {
|
|
|
182
195
|
StringFormat,
|
|
183
196
|
UpdateAppRequest,
|
|
184
197
|
UpdateComponentRequest,
|
|
198
|
+
UpdateDesignReferenceRequest,
|
|
185
199
|
UpdateEntityRequest,
|
|
186
200
|
UpdateListRequest,
|
|
187
201
|
UpdateListViewRequest,
|
|
@@ -201,6 +215,7 @@ export {
|
|
|
201
215
|
ColumnSchema,
|
|
202
216
|
ComponentSchema,
|
|
203
217
|
CurrencyAttributeMetaSchema,
|
|
218
|
+
DesignReferenceSchema,
|
|
204
219
|
EntitySchema,
|
|
205
220
|
EntityWithSchemaSchema,
|
|
206
221
|
FileAttributeMetaSchema,
|
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
|
|
@@ -1152,3 +1179,70 @@ export interface UpdateAppRequest {
|
|
|
1152
1179
|
description?: string
|
|
1153
1180
|
icon_slug?: string
|
|
1154
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
|
}
|
package/src/storage/types.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { PublicAccessOperation } from '../meta/types.js'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* A version of a stored file. Each file has one or more versions; the file's
|
|
3
5
|
* `current_version` points at the latest. Size is carried here, not on the
|
|
@@ -27,6 +29,12 @@ export interface StorageFile {
|
|
|
27
29
|
is_deleted: boolean
|
|
28
30
|
is_persisted: boolean
|
|
29
31
|
is_locked: boolean
|
|
32
|
+
/**
|
|
33
|
+
* Operations the file is exposed for on the unauthenticated public surface.
|
|
34
|
+
* Only `["read"]` is honored (download via the public route). Empty =
|
|
35
|
+
* private (default).
|
|
36
|
+
*/
|
|
37
|
+
public_access: PublicAccessOperation[]
|
|
30
38
|
created_at: string
|
|
31
39
|
updated_at: string
|
|
32
40
|
}
|
|
@@ -38,6 +46,8 @@ export interface StorageFile {
|
|
|
38
46
|
export interface CreateFileMetadata {
|
|
39
47
|
name: string
|
|
40
48
|
content_type?: string
|
|
49
|
+
/** See {@link StorageFile.public_access}. Only `["read"]` accepted today. */
|
|
50
|
+
public_access?: PublicAccessOperation[]
|
|
41
51
|
}
|
|
42
52
|
|
|
43
53
|
/**
|