@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
|
@@ -675,6 +675,36 @@ interface ComponentService {
|
|
|
675
675
|
bundleUrl(slug: string): string;
|
|
676
676
|
}
|
|
677
677
|
|
|
678
|
+
/**
|
|
679
|
+
* Service for managing an org's stored DESIGN.md documents (design references).
|
|
680
|
+
*
|
|
681
|
+
* The markdown body is split from the metadata methods: list/get never carry
|
|
682
|
+
* `content` — read it with {@link getContent} and write it with
|
|
683
|
+
* {@link setContent} (create may seed it in one shot).
|
|
684
|
+
*/
|
|
685
|
+
interface DesignReferenceService {
|
|
686
|
+
/** Lists design references (metadata only — no `content`). */
|
|
687
|
+
list(options?: ListDesignReferencesOptions): PageIterator<DesignReference, ListDesignReferencesOptions>;
|
|
688
|
+
/** Fetches a single page of design references (metadata only). */
|
|
689
|
+
listPage(options?: ListDesignReferencesOptions): Promise<ListResult<DesignReference>>;
|
|
690
|
+
/** Gets a single design reference by id (metadata only — no `content`). */
|
|
691
|
+
get(id: string): Promise<DesignReference>;
|
|
692
|
+
/** Resolves a design reference by its per-org slug (metadata only). */
|
|
693
|
+
getBySlug(slug: string): Promise<DesignReference>;
|
|
694
|
+
/** Creates a design reference; `content` optionally seeds the body. */
|
|
695
|
+
create(request: CreateDesignReferenceRequest): Promise<DesignReference>;
|
|
696
|
+
/** Creates or (by slug) replaces a design reference, including its body. */
|
|
697
|
+
upsert(request: CreateDesignReferenceRequest): Promise<DesignReference>;
|
|
698
|
+
/** Updates a design reference's metadata (name/description/slug). */
|
|
699
|
+
update(id: string, request: UpdateDesignReferenceRequest): Promise<DesignReference>;
|
|
700
|
+
/** Deletes a design reference. */
|
|
701
|
+
delete(id: string): Promise<void>;
|
|
702
|
+
/** Reads the markdown body for a design reference. */
|
|
703
|
+
getContent(id: string): Promise<string>;
|
|
704
|
+
/** Overwrites the markdown body for a design reference (metadata untouched). */
|
|
705
|
+
setContent(id: string, content: string): Promise<void>;
|
|
706
|
+
}
|
|
707
|
+
|
|
678
708
|
/**
|
|
679
709
|
* Service for managing entity definitions.
|
|
680
710
|
* Entities define the structure of business objects in the system.
|
|
@@ -740,6 +770,12 @@ interface EntityService {
|
|
|
740
770
|
* @throws {ProteosError} If entity not found (404)
|
|
741
771
|
*/
|
|
742
772
|
getWithSchema(slug: string): Promise<EntityWithSchema>;
|
|
773
|
+
/**
|
|
774
|
+
* Gets a public-access (read) entity (with schema) through the UNAUTHENTICATED
|
|
775
|
+
* public endpoint — no Authorization header. A non-public or missing
|
|
776
|
+
* entity 404s identically.
|
|
777
|
+
*/
|
|
778
|
+
getPublic(orgId: string, slug: string): Promise<EntityWithSchema>;
|
|
743
779
|
/**
|
|
744
780
|
* Creates a new entity.
|
|
745
781
|
*
|
|
@@ -1587,6 +1623,10 @@ declare class MetaClient {
|
|
|
1587
1623
|
* Service for managing apps.
|
|
1588
1624
|
*/
|
|
1589
1625
|
readonly apps: AppService;
|
|
1626
|
+
/**
|
|
1627
|
+
* Service for managing design references (stored DESIGN.md documents).
|
|
1628
|
+
*/
|
|
1629
|
+
readonly designReferences: DesignReferenceService;
|
|
1590
1630
|
/**
|
|
1591
1631
|
* Creates a new MetaClient instance.
|
|
1592
1632
|
*
|
|
@@ -1879,6 +1919,12 @@ declare function parseUserMeta(attr: Attribute): UserAttributeMeta | null;
|
|
|
1879
1919
|
* with no meta still resolves to an empty `{}` rather than null.
|
|
1880
1920
|
*/
|
|
1881
1921
|
declare function parseFileMeta(attr: Attribute): FileAttributeMeta | null;
|
|
1922
|
+
/**
|
|
1923
|
+
* A single operation a resource may be publicly exposed for. Independent set
|
|
1924
|
+
* (not a level): a resource can be public for `write` without `read`. Only
|
|
1925
|
+
* `read` is honored on the platform today; `write`/`delete` are reserved.
|
|
1926
|
+
*/
|
|
1927
|
+
type PublicAccessOperation = 'read' | 'write' | 'delete';
|
|
1882
1928
|
/**
|
|
1883
1929
|
* Entity definition.
|
|
1884
1930
|
* Note: Entity uses `slug` as its primary identifier, not `id`.
|
|
@@ -1888,6 +1934,14 @@ interface Entity extends AuditFields {
|
|
|
1888
1934
|
name: string;
|
|
1889
1935
|
description: string;
|
|
1890
1936
|
is_remote: boolean;
|
|
1937
|
+
/**
|
|
1938
|
+
* Operations ALL records of the entity are exposed for on the
|
|
1939
|
+
* unauthenticated public surface. Only `["read"]` is honored today (records
|
|
1940
|
+
* become world-readable; the entity definition is implicitly readable so
|
|
1941
|
+
* they can be interpreted); `write`/`delete` are reserved. Empty = private
|
|
1942
|
+
* (default).
|
|
1943
|
+
*/
|
|
1944
|
+
public_record_access: PublicAccessOperation[];
|
|
1891
1945
|
module_slug: string;
|
|
1892
1946
|
/**
|
|
1893
1947
|
* Liquid template that renders a human-readable title for an instance
|
|
@@ -1929,6 +1983,7 @@ declare const EntitySchema: z.ZodObject<{
|
|
|
1929
1983
|
name: z.ZodString;
|
|
1930
1984
|
description: z.ZodString;
|
|
1931
1985
|
is_remote: z.ZodBoolean;
|
|
1986
|
+
public_record_access: z.ZodDefault<z.ZodArray<z.ZodEnum<["read", "write", "delete"]>, "many">>;
|
|
1932
1987
|
module_slug: z.ZodString;
|
|
1933
1988
|
title_template: z.ZodDefault<z.ZodString>;
|
|
1934
1989
|
attributes: z.ZodArray<z.ZodObject<{
|
|
@@ -1996,6 +2051,7 @@ declare const EntitySchema: z.ZodObject<{
|
|
|
1996
2051
|
}[];
|
|
1997
2052
|
slug: string;
|
|
1998
2053
|
is_remote: boolean;
|
|
2054
|
+
public_record_access: ("read" | "write" | "delete")[];
|
|
1999
2055
|
module_slug: string;
|
|
2000
2056
|
title_template: string;
|
|
2001
2057
|
}, {
|
|
@@ -2027,6 +2083,7 @@ declare const EntitySchema: z.ZodObject<{
|
|
|
2027
2083
|
slug: string;
|
|
2028
2084
|
is_remote: boolean;
|
|
2029
2085
|
module_slug: string;
|
|
2086
|
+
public_record_access?: ("read" | "write" | "delete")[] | undefined;
|
|
2030
2087
|
title_template?: string | undefined;
|
|
2031
2088
|
}>;
|
|
2032
2089
|
/**
|
|
@@ -2063,6 +2120,7 @@ declare const EntityWithSchemaSchema: z.ZodObject<{
|
|
|
2063
2120
|
name: z.ZodString;
|
|
2064
2121
|
description: z.ZodString;
|
|
2065
2122
|
is_remote: z.ZodBoolean;
|
|
2123
|
+
public_record_access: z.ZodDefault<z.ZodArray<z.ZodEnum<["read", "write", "delete"]>, "many">>;
|
|
2066
2124
|
module_slug: z.ZodString;
|
|
2067
2125
|
title_template: z.ZodDefault<z.ZodString>;
|
|
2068
2126
|
attributes: z.ZodArray<z.ZodObject<{
|
|
@@ -2132,6 +2190,7 @@ declare const EntityWithSchemaSchema: z.ZodObject<{
|
|
|
2132
2190
|
}[];
|
|
2133
2191
|
slug: string;
|
|
2134
2192
|
is_remote: boolean;
|
|
2193
|
+
public_record_access: ("read" | "write" | "delete")[];
|
|
2135
2194
|
module_slug: string;
|
|
2136
2195
|
title_template: string;
|
|
2137
2196
|
schema: Record<string, unknown>;
|
|
@@ -2165,6 +2224,7 @@ declare const EntityWithSchemaSchema: z.ZodObject<{
|
|
|
2165
2224
|
is_remote: boolean;
|
|
2166
2225
|
module_slug: string;
|
|
2167
2226
|
schema: Record<string, unknown>;
|
|
2227
|
+
public_record_access?: ("read" | "write" | "delete")[] | undefined;
|
|
2168
2228
|
title_template?: string | undefined;
|
|
2169
2229
|
}>;
|
|
2170
2230
|
/**
|
|
@@ -2183,6 +2243,12 @@ interface CreateEntityRequest {
|
|
|
2183
2243
|
slug: string;
|
|
2184
2244
|
name: string;
|
|
2185
2245
|
is_remote: boolean;
|
|
2246
|
+
/**
|
|
2247
|
+
* Operations to expose all records of the entity for, unauthenticated (only
|
|
2248
|
+
* `["read"]` accepted today). Full-replacement on upsert: an upsert without
|
|
2249
|
+
* the field resets it to private.
|
|
2250
|
+
*/
|
|
2251
|
+
public_record_access?: PublicAccessOperation[];
|
|
2186
2252
|
module_slug: string;
|
|
2187
2253
|
description: string;
|
|
2188
2254
|
title_template?: string;
|
|
@@ -2194,6 +2260,7 @@ interface CreateEntityRequest {
|
|
|
2194
2260
|
interface UpdateEntityRequest {
|
|
2195
2261
|
name?: string;
|
|
2196
2262
|
is_remote?: boolean;
|
|
2263
|
+
public_record_access?: PublicAccessOperation[];
|
|
2197
2264
|
module_slug?: string;
|
|
2198
2265
|
description?: string;
|
|
2199
2266
|
title_template?: string;
|
|
@@ -3350,5 +3417,117 @@ interface UpdateAppRequest {
|
|
|
3350
3417
|
description?: string;
|
|
3351
3418
|
icon_slug?: string;
|
|
3352
3419
|
}
|
|
3420
|
+
/**
|
|
3421
|
+
* A stored DESIGN.md document — a named design reference an org authors and that
|
|
3422
|
+
* design agents read as the source of truth for a surface. `name` + `description`
|
|
3423
|
+
* are the selector ("which reference, and when to use it").
|
|
3424
|
+
*
|
|
3425
|
+
* `content` (the markdown body) is NOT returned by list/get — fetch it via
|
|
3426
|
+
* {@link DesignReferenceService.getContent} and write it via `setContent`.
|
|
3427
|
+
*/
|
|
3428
|
+
interface DesignReference extends AuditFields {
|
|
3429
|
+
id: string;
|
|
3430
|
+
org_id: string;
|
|
3431
|
+
slug: string;
|
|
3432
|
+
name: string;
|
|
3433
|
+
description: string;
|
|
3434
|
+
/** The DESIGN.md body. Only present on the dedicated content endpoint; undefined on list/get. */
|
|
3435
|
+
content?: string;
|
|
3436
|
+
}
|
|
3437
|
+
declare const DesignReferenceSchema: z.ZodObject<{
|
|
3438
|
+
created_at: z.ZodString;
|
|
3439
|
+
updated_at: z.ZodString;
|
|
3440
|
+
created_by: z.ZodObject<{
|
|
3441
|
+
type: z.ZodEnum<["person", "agent", "api"]>;
|
|
3442
|
+
id: z.ZodString;
|
|
3443
|
+
}, "strip", z.ZodTypeAny, {
|
|
3444
|
+
type: "person" | "agent" | "api";
|
|
3445
|
+
id: string;
|
|
3446
|
+
}, {
|
|
3447
|
+
type: "person" | "agent" | "api";
|
|
3448
|
+
id: string;
|
|
3449
|
+
}>;
|
|
3450
|
+
updated_by: z.ZodObject<{
|
|
3451
|
+
type: z.ZodEnum<["person", "agent", "api"]>;
|
|
3452
|
+
id: z.ZodString;
|
|
3453
|
+
}, "strip", z.ZodTypeAny, {
|
|
3454
|
+
type: "person" | "agent" | "api";
|
|
3455
|
+
id: string;
|
|
3456
|
+
}, {
|
|
3457
|
+
type: "person" | "agent" | "api";
|
|
3458
|
+
id: string;
|
|
3459
|
+
}>;
|
|
3460
|
+
} & {
|
|
3461
|
+
id: z.ZodString;
|
|
3462
|
+
slug: z.ZodString;
|
|
3463
|
+
name: z.ZodString;
|
|
3464
|
+
description: z.ZodString;
|
|
3465
|
+
content: z.ZodOptional<z.ZodString>;
|
|
3466
|
+
}, "strip", z.ZodTypeAny, {
|
|
3467
|
+
id: string;
|
|
3468
|
+
name: string;
|
|
3469
|
+
created_at: string;
|
|
3470
|
+
updated_at: string;
|
|
3471
|
+
created_by: {
|
|
3472
|
+
type: "person" | "agent" | "api";
|
|
3473
|
+
id: string;
|
|
3474
|
+
};
|
|
3475
|
+
updated_by: {
|
|
3476
|
+
type: "person" | "agent" | "api";
|
|
3477
|
+
id: string;
|
|
3478
|
+
};
|
|
3479
|
+
description: string;
|
|
3480
|
+
slug: string;
|
|
3481
|
+
content?: string | undefined;
|
|
3482
|
+
}, {
|
|
3483
|
+
id: string;
|
|
3484
|
+
name: string;
|
|
3485
|
+
created_at: string;
|
|
3486
|
+
updated_at: string;
|
|
3487
|
+
created_by: {
|
|
3488
|
+
type: "person" | "agent" | "api";
|
|
3489
|
+
id: string;
|
|
3490
|
+
};
|
|
3491
|
+
updated_by: {
|
|
3492
|
+
type: "person" | "agent" | "api";
|
|
3493
|
+
id: string;
|
|
3494
|
+
};
|
|
3495
|
+
description: string;
|
|
3496
|
+
slug: string;
|
|
3497
|
+
content?: string | undefined;
|
|
3498
|
+
}>;
|
|
3499
|
+
/**
|
|
3500
|
+
* Options for listing design references.
|
|
3501
|
+
*/
|
|
3502
|
+
interface ListDesignReferencesOptions extends MetaListOptions {
|
|
3503
|
+
id?: string;
|
|
3504
|
+
slug?: string;
|
|
3505
|
+
name?: string;
|
|
3506
|
+
description?: string;
|
|
3507
|
+
}
|
|
3508
|
+
/**
|
|
3509
|
+
* Request to create a design reference. `content` optionally seeds the body.
|
|
3510
|
+
*/
|
|
3511
|
+
interface CreateDesignReferenceRequest {
|
|
3512
|
+
slug: string;
|
|
3513
|
+
name: string;
|
|
3514
|
+
description?: string;
|
|
3515
|
+
content?: string;
|
|
3516
|
+
}
|
|
3517
|
+
/**
|
|
3518
|
+
* Request to update a design reference's metadata. Content is edited via the
|
|
3519
|
+
* dedicated content endpoint, not here.
|
|
3520
|
+
*/
|
|
3521
|
+
interface UpdateDesignReferenceRequest {
|
|
3522
|
+
slug?: string;
|
|
3523
|
+
name?: string;
|
|
3524
|
+
description?: string;
|
|
3525
|
+
}
|
|
3526
|
+
/**
|
|
3527
|
+
* The markdown body, from GET/PUT /design-references/:id/content.
|
|
3528
|
+
*/
|
|
3529
|
+
interface DesignReferenceContent {
|
|
3530
|
+
content: string;
|
|
3531
|
+
}
|
|
3353
3532
|
|
|
3354
|
-
export { type
|
|
3533
|
+
export { type FilterGroup as $, type AuditFields as A, CurrencyAttributeMetaSchema as B, type ClientOptions as C, type CurrencySymbolSide as D, type CurrencyValue as E, type FileRef as F, DEFAULT_OPTIONS as G, DEFAULT_PAGE_SIZE as H, DONE as I, type DeployModuleRequest as J, type DesignReference as K, type ListOptions as L, type DesignReferenceContent as M, DesignReferenceSchema as N, type DesignReferenceService as O, PageIterator as P, type Done as Q, type Entity as R, EntitySchema as S, type EntityService as T, type UserRef as U, type EntityWithSchema as V, EntityWithSchemaSchema as W, type FileAttributeMeta as X, FileRefSchema as Y, type FilterElement as Z, FilterElementSchema as _, type Attribute as a, type UpdatePageRequest as a$, FilterGroupSchema as a0, type List as a1, type ListAppsOptions as a2, type ListComponentsOptions as a3, type ListDesignReferencesOptions as a4, type ListEntitiesOptions as a5, type ListFn as a6, type ListListViewsOptions as a7, type ListListsOptions as a8, type ListMenuConfigurationsOptions as a9, type PageAction as aA, PageActionSchema as aB, type PageLayout as aC, PageLayoutSchema as aD, PageSchema as aE, type PageService as aF, type PageType as aG, type PublicPageComponent as aH, type PublicPageResponse as aI, type RelationAttributeMeta as aJ, RelationAttributeMetaSchema as aK, type RequestOptions as aL, type ResolvedClientOptions as aM, type ResponseMeta as aN, ResponseMetaSchema as aO, type SortConfig as aP, SortConfigSchema as aQ, type SortDirection as aR, type Timestamps as aS, type TokenProvider as aT, type UpdateAppRequest as aU, type UpdateComponentRequest as aV, type UpdateDesignReferenceRequest as aW, type UpdateEntityRequest as aX, type UpdateListRequest as aY, type UpdateListViewRequest as aZ, type UpdateMenuConfigurationRequest as a_, type ListModulesOptions as aa, type ListPagesOptions as ab, ListSchema as ac, type ListService as ad, type ListVariablesOptions as ae, type ListView as af, ListViewSchema as ag, type ListViewService as ah, type LogicalOperator as ai, type MenuConfiguration as aj, MenuConfigurationSchema as ak, type MenuConfigurationService as al, type MenuItem as am, MenuItemSchema as an, MenuItemType as ao, MetaClient as ap, type MetaListOptions as aq, type Module as ar, ModuleSchema as as, type ModuleService as at, type ModuleStatus as au, type OnDeleteAction as av, OnDeleteActionSchema as aw, PLATFORM_ATTRIBUTE_NAMES as ax, PLATFORM_USER_ID as ay, type Page as az, type ListResult as b, isBuiltInControl as b$, type UpdateVariableRequest as b0, UserRefSchema as b1, type UserType as b2, type Variable as b3, VariableSchema as b4, type VariableService as b5, allCurrencyCodes as b6, createIterator as b7, createListResultSchema as b8, currencyLabel as b9, type FieldElement as bA, FileAttributeMetaSchema as bB, type LayoutAlign as bC, type LayoutElement as bD, LayoutElementSchema as bE, LayoutElementType as bF, type LayoutGap as bG, type LayoutJustify as bH, type LayoutTab as bI, type NumberAttributeMeta as bJ, type ObjectAttributeMeta as bK, type PageLayoutSidePanel as bL, PageLayoutSidePanelSchema as bM, type RelatedListElement as bN, type ResponsiveSizing as bO, type RowElement as bP, type SectionElement as bQ, type SizeValue as bR, SizeValueSchema as bS, type SizingProps as bT, type StringAttributeMeta as bU, type StringFormat as bV, type TabsElement as bW, type TextElement as bX, type TextVariant as bY, type UserAttributeMeta as bZ, UserAttributeMetaSchema as b_, currencySymbol as ba, currencySymbolSide as bb, formatAmount as bc, formatMoney as bd, isPlatformAttributeName as be, localeNumberSeparators as bf, parseAmount as bg, parseCurrencyMeta as bh, parseFileMeta as bi, parseRelationMeta as bj, platformAttributes as bk, resolveOptions as bl, type ArrayAttributeMeta as bm, type AttributeForLookup as bn, type AttributeMeta as bo, BUILT_IN_CONTROLS as bp, type BuiltInControlSlug as bq, type ColumnElement as br, type CommonProps as bs, type ComponentElement as bt, type ControlBucket as bu, type DatetimeAttributeMeta as bv, type DatetimeFormat as bw, type DividerElement as bx, type EnumAttributeMeta as by, type EnumValue as bz, ProteosClient as c, lookupCompatibleControls as c0, lookupControls as c1, lookupPrimaryControl as c2, parseUserMeta as c3, type PublicAccessOperation as d, type App as e, AppSchema as f, type AppService as g, AttributeSchema as h, type AttributeType as i, AuditFieldsSchema as j, type Column as k, ColumnSchema as l, type ComparisonOperator as m, type Component as n, ComponentSchema as o, type ComponentService as p, type CreateAppRequest as q, type CreateComponentRequest as r, type CreateDesignReferenceRequest as s, type CreateEntityRequest as t, type CreateListRequest as u, type CreateListViewRequest as v, type CreateMenuConfigurationRequest as w, type CreatePageRequest as x, type CreateVariableRequest as y, type CurrencyAttributeMeta as z };
|
package/package.json
CHANGED
|
@@ -30,6 +30,7 @@ export const PLATFORM_ENTITIES: readonly PlatformEntity[] = [
|
|
|
30
30
|
{ slug: 'components', name: 'Components' },
|
|
31
31
|
{ slug: 'lists', name: 'Lists' },
|
|
32
32
|
{ slug: 'list-views', name: 'List Views' },
|
|
33
|
+
{ slug: 'design-references', name: 'Design References' },
|
|
33
34
|
// System (metadata-service)
|
|
34
35
|
{ slug: 'modules', name: 'Modules' },
|
|
35
36
|
{ slug: 'variables', name: 'Variables' },
|
|
@@ -39,6 +40,9 @@ export const PLATFORM_ENTITIES: readonly PlatformEntity[] = [
|
|
|
39
40
|
// Automation (function-service)
|
|
40
41
|
{ slug: 'hooks', name: 'Hooks' },
|
|
41
42
|
{ slug: 'actions', name: 'Actions' },
|
|
43
|
+
// Workflows (workflow-service)
|
|
44
|
+
{ slug: 'workflows', name: 'Workflows' },
|
|
45
|
+
{ slug: 'workflow-executions', name: 'Workflow Executions' },
|
|
42
46
|
// Knowledge (knowledge-service)
|
|
43
47
|
{ slug: 'knowledge-nodes', name: 'Knowledge Nodes' },
|
|
44
48
|
{ slug: 'knowledge-links', name: 'Knowledge Links' },
|
package/src/data/records.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
|
|
11
11
|
const RECORDS_BASE_PATH = '/data/v1/records'
|
|
12
12
|
const BATCH_RECORDS_BASE_PATH = '/data/v1/batch/records'
|
|
13
|
+
const PUBLIC_RECORDS_BASE_PATH = '/data/v1/public/orgs'
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Service for managing records (per-entity data rows) via the data-service.
|
|
@@ -63,6 +64,34 @@ export interface RecordService {
|
|
|
63
64
|
entitySlug: string,
|
|
64
65
|
transactions: BatchUpsertTransaction[],
|
|
65
66
|
): Promise<BatchUpsertRecordsResponse>
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Lists records of a public-read entity through the UNAUTHENTICATED
|
|
70
|
+
* public endpoint (no Authorization header) as an async iterator. A
|
|
71
|
+
* non-public or missing entity 404s identically.
|
|
72
|
+
*/
|
|
73
|
+
listPublic(
|
|
74
|
+
orgId: string,
|
|
75
|
+
entitySlug: string,
|
|
76
|
+
options?: ListRecordsOptions,
|
|
77
|
+
): PageIterator<RecordData, ListRecordsOptions>
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Fetches a single page of records through the unauthenticated public
|
|
81
|
+
* endpoint. Same filter grammar and pagination as `listPage`.
|
|
82
|
+
*/
|
|
83
|
+
listPublicPage(
|
|
84
|
+
orgId: string,
|
|
85
|
+
entitySlug: string,
|
|
86
|
+
options?: ListRecordsOptions,
|
|
87
|
+
): Promise<ListResult<RecordData>>
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Gets a single record of a public-read entity through the
|
|
91
|
+
* unauthenticated public endpoint. Knowledge-text values stay unenriched
|
|
92
|
+
* (bare refs) on this path.
|
|
93
|
+
*/
|
|
94
|
+
getPublic(orgId: string, entitySlug: string, id: string): Promise<RecordData>
|
|
66
95
|
}
|
|
67
96
|
|
|
68
97
|
/**
|
|
@@ -119,4 +148,35 @@ export class RecordServiceImpl implements RecordService {
|
|
|
119
148
|
transactions,
|
|
120
149
|
)
|
|
121
150
|
}
|
|
151
|
+
|
|
152
|
+
listPublic(
|
|
153
|
+
orgId: string,
|
|
154
|
+
entitySlug: string,
|
|
155
|
+
options: ListRecordsOptions = {},
|
|
156
|
+
): PageIterator<RecordData, ListRecordsOptions> {
|
|
157
|
+
return new PageIterator((opts) => this.listPublicPage(orgId, entitySlug, opts), options)
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async listPublicPage(
|
|
161
|
+
orgId: string,
|
|
162
|
+
entitySlug: string,
|
|
163
|
+
options: ListRecordsOptions = {},
|
|
164
|
+
): Promise<ListResult<RecordData>> {
|
|
165
|
+
return this.client.requestWithQuery<ListResult<RecordData>>(
|
|
166
|
+
'GET',
|
|
167
|
+
`${PUBLIC_RECORDS_BASE_PATH}/${encodeURIComponent(orgId)}/records/${encodeURIComponent(entitySlug)}`,
|
|
168
|
+
options,
|
|
169
|
+
undefined,
|
|
170
|
+
{ skipAuth: true },
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async getPublic(orgId: string, entitySlug: string, id: string): Promise<RecordData> {
|
|
175
|
+
return this.client.request<RecordData>(
|
|
176
|
+
'GET',
|
|
177
|
+
`${PUBLIC_RECORDS_BASE_PATH}/${encodeURIComponent(orgId)}/records/${encodeURIComponent(entitySlug)}/${encodeURIComponent(id)}`,
|
|
178
|
+
undefined,
|
|
179
|
+
{ skipAuth: true },
|
|
180
|
+
)
|
|
181
|
+
}
|
|
122
182
|
}
|
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,
|
|
@@ -439,17 +445,18 @@ export type {
|
|
|
439
445
|
// Page types
|
|
440
446
|
Page,
|
|
441
447
|
PageAction,
|
|
448
|
+
PageLayout,
|
|
449
|
+
PageService,
|
|
442
450
|
PageType,
|
|
443
451
|
PublicPageComponent,
|
|
444
452
|
PublicPageResponse,
|
|
445
|
-
PageLayout,
|
|
446
|
-
PageService,
|
|
447
453
|
// Relation attribute meta
|
|
448
454
|
RelationAttributeMeta,
|
|
449
455
|
SortConfig,
|
|
450
456
|
SortDirection,
|
|
451
457
|
UpdateAppRequest,
|
|
452
458
|
UpdateComponentRequest,
|
|
459
|
+
UpdateDesignReferenceRequest,
|
|
453
460
|
UpdateEntityRequest,
|
|
454
461
|
UpdateListRequest,
|
|
455
462
|
UpdateListViewRequest,
|
|
@@ -473,6 +480,7 @@ export {
|
|
|
473
480
|
currencyLabel,
|
|
474
481
|
currencySymbol,
|
|
475
482
|
currencySymbolSide,
|
|
483
|
+
DesignReferenceSchema,
|
|
476
484
|
EntitySchema,
|
|
477
485
|
EntityWithSchemaSchema,
|
|
478
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
|
}
|