@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
|
@@ -71,6 +71,12 @@ declare function resolveOptions(options: ClientOptions): ResolvedClientOptions;
|
|
|
71
71
|
interface RequestOptions {
|
|
72
72
|
/** Request timeout in milliseconds (overrides client default) */
|
|
73
73
|
timeout?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Skip attaching the Authorization header. Only meaningful for the public,
|
|
76
|
+
* unauthenticated endpoints (`/meta/v1/public/*`, `/functions/v1/public/*`)
|
|
77
|
+
* — every other endpoint 401s without a bearer.
|
|
78
|
+
*/
|
|
79
|
+
skipAuth?: boolean;
|
|
74
80
|
/** Additional headers for this request */
|
|
75
81
|
headers?: Record<string, string>;
|
|
76
82
|
/** AbortSignal for request cancellation */
|
|
@@ -669,6 +675,36 @@ interface ComponentService {
|
|
|
669
675
|
bundleUrl(slug: string): string;
|
|
670
676
|
}
|
|
671
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
|
+
|
|
672
708
|
/**
|
|
673
709
|
* Service for managing entity definitions.
|
|
674
710
|
* Entities define the structure of business objects in the system.
|
|
@@ -734,6 +770,12 @@ interface EntityService {
|
|
|
734
770
|
* @throws {ProteosError} If entity not found (404)
|
|
735
771
|
*/
|
|
736
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>;
|
|
737
779
|
/**
|
|
738
780
|
* Creates a new entity.
|
|
739
781
|
*
|
|
@@ -1070,6 +1112,17 @@ interface PageService {
|
|
|
1070
1112
|
* @throws {ProteosError} If page not found (404)
|
|
1071
1113
|
*/
|
|
1072
1114
|
get(slug: string): Promise<Page>;
|
|
1115
|
+
/**
|
|
1116
|
+
* Gets a PUBLIC page (type='public') without authentication — no
|
|
1117
|
+
* Authorization header is sent. Returns the page plus the props_schema of
|
|
1118
|
+
* every component its layout references. Non-public pages 404
|
|
1119
|
+
* (indistinguishable from absent).
|
|
1120
|
+
*
|
|
1121
|
+
* @param orgId - Org id (public routes carry the org in the path — there is
|
|
1122
|
+
* no token to scope from)
|
|
1123
|
+
* @param slug - Page slug
|
|
1124
|
+
*/
|
|
1125
|
+
getPublic(orgId: string, slug: string): Promise<PublicPageResponse>;
|
|
1073
1126
|
/**
|
|
1074
1127
|
* Creates a new page.
|
|
1075
1128
|
*
|
|
@@ -1570,6 +1623,10 @@ declare class MetaClient {
|
|
|
1570
1623
|
* Service for managing apps.
|
|
1571
1624
|
*/
|
|
1572
1625
|
readonly apps: AppService;
|
|
1626
|
+
/**
|
|
1627
|
+
* Service for managing design references (stored DESIGN.md documents).
|
|
1628
|
+
*/
|
|
1629
|
+
readonly designReferences: DesignReferenceService;
|
|
1573
1630
|
/**
|
|
1574
1631
|
* Creates a new MetaClient instance.
|
|
1575
1632
|
*
|
|
@@ -1862,6 +1919,12 @@ declare function parseUserMeta(attr: Attribute): UserAttributeMeta | null;
|
|
|
1862
1919
|
* with no meta still resolves to an empty `{}` rather than null.
|
|
1863
1920
|
*/
|
|
1864
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';
|
|
1865
1928
|
/**
|
|
1866
1929
|
* Entity definition.
|
|
1867
1930
|
* Note: Entity uses `slug` as its primary identifier, not `id`.
|
|
@@ -1871,6 +1934,14 @@ interface Entity extends AuditFields {
|
|
|
1871
1934
|
name: string;
|
|
1872
1935
|
description: string;
|
|
1873
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[];
|
|
1874
1945
|
module_slug: string;
|
|
1875
1946
|
/**
|
|
1876
1947
|
* Liquid template that renders a human-readable title for an instance
|
|
@@ -1912,6 +1983,7 @@ declare const EntitySchema: z.ZodObject<{
|
|
|
1912
1983
|
name: z.ZodString;
|
|
1913
1984
|
description: z.ZodString;
|
|
1914
1985
|
is_remote: z.ZodBoolean;
|
|
1986
|
+
public_record_access: z.ZodDefault<z.ZodArray<z.ZodEnum<["read", "write", "delete"]>, "many">>;
|
|
1915
1987
|
module_slug: z.ZodString;
|
|
1916
1988
|
title_template: z.ZodDefault<z.ZodString>;
|
|
1917
1989
|
attributes: z.ZodArray<z.ZodObject<{
|
|
@@ -1979,6 +2051,7 @@ declare const EntitySchema: z.ZodObject<{
|
|
|
1979
2051
|
}[];
|
|
1980
2052
|
slug: string;
|
|
1981
2053
|
is_remote: boolean;
|
|
2054
|
+
public_record_access: ("read" | "write" | "delete")[];
|
|
1982
2055
|
module_slug: string;
|
|
1983
2056
|
title_template: string;
|
|
1984
2057
|
}, {
|
|
@@ -2010,6 +2083,7 @@ declare const EntitySchema: z.ZodObject<{
|
|
|
2010
2083
|
slug: string;
|
|
2011
2084
|
is_remote: boolean;
|
|
2012
2085
|
module_slug: string;
|
|
2086
|
+
public_record_access?: ("read" | "write" | "delete")[] | undefined;
|
|
2013
2087
|
title_template?: string | undefined;
|
|
2014
2088
|
}>;
|
|
2015
2089
|
/**
|
|
@@ -2046,6 +2120,7 @@ declare const EntityWithSchemaSchema: z.ZodObject<{
|
|
|
2046
2120
|
name: z.ZodString;
|
|
2047
2121
|
description: z.ZodString;
|
|
2048
2122
|
is_remote: z.ZodBoolean;
|
|
2123
|
+
public_record_access: z.ZodDefault<z.ZodArray<z.ZodEnum<["read", "write", "delete"]>, "many">>;
|
|
2049
2124
|
module_slug: z.ZodString;
|
|
2050
2125
|
title_template: z.ZodDefault<z.ZodString>;
|
|
2051
2126
|
attributes: z.ZodArray<z.ZodObject<{
|
|
@@ -2115,6 +2190,7 @@ declare const EntityWithSchemaSchema: z.ZodObject<{
|
|
|
2115
2190
|
}[];
|
|
2116
2191
|
slug: string;
|
|
2117
2192
|
is_remote: boolean;
|
|
2193
|
+
public_record_access: ("read" | "write" | "delete")[];
|
|
2118
2194
|
module_slug: string;
|
|
2119
2195
|
title_template: string;
|
|
2120
2196
|
schema: Record<string, unknown>;
|
|
@@ -2148,6 +2224,7 @@ declare const EntityWithSchemaSchema: z.ZodObject<{
|
|
|
2148
2224
|
is_remote: boolean;
|
|
2149
2225
|
module_slug: string;
|
|
2150
2226
|
schema: Record<string, unknown>;
|
|
2227
|
+
public_record_access?: ("read" | "write" | "delete")[] | undefined;
|
|
2151
2228
|
title_template?: string | undefined;
|
|
2152
2229
|
}>;
|
|
2153
2230
|
/**
|
|
@@ -2166,6 +2243,12 @@ interface CreateEntityRequest {
|
|
|
2166
2243
|
slug: string;
|
|
2167
2244
|
name: string;
|
|
2168
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[];
|
|
2169
2252
|
module_slug: string;
|
|
2170
2253
|
description: string;
|
|
2171
2254
|
title_template?: string;
|
|
@@ -2177,6 +2260,7 @@ interface CreateEntityRequest {
|
|
|
2177
2260
|
interface UpdateEntityRequest {
|
|
2178
2261
|
name?: string;
|
|
2179
2262
|
is_remote?: boolean;
|
|
2263
|
+
public_record_access?: PublicAccessOperation[];
|
|
2180
2264
|
module_slug?: string;
|
|
2181
2265
|
description?: string;
|
|
2182
2266
|
title_template?: string;
|
|
@@ -2404,6 +2488,13 @@ interface Component extends AuditFields {
|
|
|
2404
2488
|
source_file_id: string;
|
|
2405
2489
|
/** The component's JSON Schema, driving the page-designer props editor + runtime validation. `null` until set. */
|
|
2406
2490
|
props_schema: Record<string, unknown> | null;
|
|
2491
|
+
/**
|
|
2492
|
+
* Opts the compiled bundle into UNAUTHENTICATED serving. Public
|
|
2493
|
+
* (type='public') pages may only reference public components (enforced at
|
|
2494
|
+
* page save), and a public component's only platform reach at runtime is
|
|
2495
|
+
* `functions.actions.invokePublic`.
|
|
2496
|
+
*/
|
|
2497
|
+
is_public: boolean;
|
|
2407
2498
|
}
|
|
2408
2499
|
declare const ComponentSchema: z.ZodObject<{
|
|
2409
2500
|
created_at: z.ZodString;
|
|
@@ -2436,6 +2527,7 @@ declare const ComponentSchema: z.ZodObject<{
|
|
|
2436
2527
|
bundle_file_id: z.ZodString;
|
|
2437
2528
|
source_file_id: z.ZodString;
|
|
2438
2529
|
props_schema: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
2530
|
+
is_public: z.ZodDefault<z.ZodBoolean>;
|
|
2439
2531
|
}, "strip", z.ZodTypeAny, {
|
|
2440
2532
|
name: string;
|
|
2441
2533
|
created_at: string;
|
|
@@ -2454,6 +2546,7 @@ declare const ComponentSchema: z.ZodObject<{
|
|
|
2454
2546
|
bundle_file_id: string;
|
|
2455
2547
|
source_file_id: string;
|
|
2456
2548
|
props_schema: Record<string, unknown> | null;
|
|
2549
|
+
is_public: boolean;
|
|
2457
2550
|
}, {
|
|
2458
2551
|
name: string;
|
|
2459
2552
|
created_at: string;
|
|
@@ -2472,6 +2565,7 @@ declare const ComponentSchema: z.ZodObject<{
|
|
|
2472
2565
|
bundle_file_id: string;
|
|
2473
2566
|
source_file_id: string;
|
|
2474
2567
|
props_schema: Record<string, unknown> | null;
|
|
2568
|
+
is_public?: boolean | undefined;
|
|
2475
2569
|
}>;
|
|
2476
2570
|
/**
|
|
2477
2571
|
* Options for listing components.
|
|
@@ -2492,6 +2586,8 @@ interface CreateComponentRequest {
|
|
|
2492
2586
|
bundle_file_id?: string;
|
|
2493
2587
|
source_file_id?: string;
|
|
2494
2588
|
props_schema?: Record<string, unknown>;
|
|
2589
|
+
/** See {@link Component.is_public}. Manifest-driven: omitting it sets false. */
|
|
2590
|
+
is_public?: boolean;
|
|
2495
2591
|
}
|
|
2496
2592
|
/**
|
|
2497
2593
|
* Request to update a component.
|
|
@@ -2502,6 +2598,7 @@ interface UpdateComponentRequest {
|
|
|
2502
2598
|
bundle_file_id?: string;
|
|
2503
2599
|
source_file_id?: string;
|
|
2504
2600
|
props_schema?: Record<string, unknown>;
|
|
2601
|
+
is_public?: boolean;
|
|
2505
2602
|
}
|
|
2506
2603
|
/**
|
|
2507
2604
|
* List column definition.
|
|
@@ -2865,12 +2962,19 @@ declare const PageActionSchema: z.ZodObject<{
|
|
|
2865
2962
|
action: string;
|
|
2866
2963
|
}>;
|
|
2867
2964
|
/**
|
|
2868
|
-
* Page type
|
|
2869
|
-
*
|
|
2870
|
-
*
|
|
2871
|
-
*
|
|
2965
|
+
* Page type — encodes what the page binds to and how it is served (chrome +
|
|
2966
|
+
* auth posture both follow from it):
|
|
2967
|
+
*
|
|
2968
|
+
* - `record`: rendered against a single record of `entity_slug`; app chrome;
|
|
2969
|
+
* authenticated.
|
|
2970
|
+
* - `platform`: standalone, no record context (e.g. a dashboard launched from
|
|
2971
|
+
* a menu item); app chrome; authenticated.
|
|
2972
|
+
* - `kiosk`: standalone, NO app chrome (bare page at `/k/…`); authenticated.
|
|
2973
|
+
* - `public`: standalone, NO app chrome (bare page at `/p/…`);
|
|
2974
|
+
* UNAUTHENTICATED — the layout is world-readable and its components may only
|
|
2975
|
+
* call `is_public` global actions.
|
|
2872
2976
|
*/
|
|
2873
|
-
type PageType = 'record' | 'platform';
|
|
2977
|
+
type PageType = 'record' | 'platform' | 'kiosk' | 'public';
|
|
2874
2978
|
/**
|
|
2875
2979
|
* Page configuration. A `record` page is the detail-page shape for a single
|
|
2876
2980
|
* entity; a `platform` page is standalone (no entity, no record).
|
|
@@ -2916,7 +3020,7 @@ declare const PageSchema: z.ZodObject<{
|
|
|
2916
3020
|
slug: z.ZodString;
|
|
2917
3021
|
name: z.ZodString;
|
|
2918
3022
|
module_slug: z.ZodString;
|
|
2919
|
-
type: z.ZodEnum<["record", "platform"]>;
|
|
3023
|
+
type: z.ZodEnum<["record", "platform", "kiosk", "public"]>;
|
|
2920
3024
|
entity_slug: z.ZodOptional<z.ZodString>;
|
|
2921
3025
|
actions: z.ZodArray<z.ZodObject<{
|
|
2922
3026
|
label: z.ZodString;
|
|
@@ -2965,7 +3069,7 @@ declare const PageSchema: z.ZodObject<{
|
|
|
2965
3069
|
} | undefined;
|
|
2966
3070
|
}>;
|
|
2967
3071
|
}, "strip", z.ZodTypeAny, {
|
|
2968
|
-
type: "platform" | "record";
|
|
3072
|
+
type: "platform" | "record" | "kiosk" | "public";
|
|
2969
3073
|
name: string;
|
|
2970
3074
|
created_at: string;
|
|
2971
3075
|
updated_at: string;
|
|
@@ -2995,7 +3099,7 @@ declare const PageSchema: z.ZodObject<{
|
|
|
2995
3099
|
};
|
|
2996
3100
|
entity_slug?: string | undefined;
|
|
2997
3101
|
}, {
|
|
2998
|
-
type: "platform" | "record";
|
|
3102
|
+
type: "platform" | "record" | "kiosk" | "public";
|
|
2999
3103
|
name: string;
|
|
3000
3104
|
created_at: string;
|
|
3001
3105
|
updated_at: string;
|
|
@@ -3025,6 +3129,24 @@ declare const PageSchema: z.ZodObject<{
|
|
|
3025
3129
|
};
|
|
3026
3130
|
entity_slug?: string | undefined;
|
|
3027
3131
|
}>;
|
|
3132
|
+
/**
|
|
3133
|
+
* Component metadata slice riding on the public page payload — just the slug
|
|
3134
|
+
* and props schema (deliberately not the full Component: this is served
|
|
3135
|
+
* unauthenticated).
|
|
3136
|
+
*/
|
|
3137
|
+
interface PublicPageComponent {
|
|
3138
|
+
slug: string;
|
|
3139
|
+
props_schema?: Record<string, unknown>;
|
|
3140
|
+
}
|
|
3141
|
+
/**
|
|
3142
|
+
* Payload of the unauthenticated `GET /meta/v1/public/orgs/{orgId}/pages/{slug}`:
|
|
3143
|
+
* the page plus the props_schema of every component its layout references, so
|
|
3144
|
+
* a public renderer needs no follow-up authenticated calls.
|
|
3145
|
+
*/
|
|
3146
|
+
interface PublicPageResponse {
|
|
3147
|
+
page: Page;
|
|
3148
|
+
components: PublicPageComponent[];
|
|
3149
|
+
}
|
|
3028
3150
|
/**
|
|
3029
3151
|
* Options for listing pages.
|
|
3030
3152
|
*/
|
|
@@ -3295,5 +3417,117 @@ interface UpdateAppRequest {
|
|
|
3295
3417
|
description?: string;
|
|
3296
3418
|
icon_slug?: string;
|
|
3297
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
|
+
}
|
|
3298
3532
|
|
|
3299
|
-
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/client.ts
CHANGED
|
@@ -91,9 +91,11 @@ export class ProteosClient {
|
|
|
91
91
|
...requestOptions?.headers,
|
|
92
92
|
})
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
if (!requestOptions?.skipAuth) {
|
|
95
|
+
const token = await this.getToken()
|
|
96
|
+
if (token) {
|
|
97
|
+
headers.set('Authorization', `Bearer ${token}`)
|
|
98
|
+
}
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
return headers
|
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/functions/actions.ts
CHANGED
|
@@ -40,6 +40,17 @@ export interface ActionService {
|
|
|
40
40
|
*/
|
|
41
41
|
invokeGlobal(slug: string, params: Record<string, unknown>): Promise<unknown>
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Invokes a PUBLIC (`is_public`) global action without authentication — no
|
|
45
|
+
* Authorization header is sent. This is the only data path available to
|
|
46
|
+
* components on a public page. The action runs server-side as its creator
|
|
47
|
+
* (org + user injected via a machine token); non-public actions 404.
|
|
48
|
+
*
|
|
49
|
+
* @param orgId - Org id (public routes carry the org in the path — there is
|
|
50
|
+
* no token to scope from)
|
|
51
|
+
*/
|
|
52
|
+
invokePublic(orgId: string, slug: string, params: Record<string, unknown>): Promise<unknown>
|
|
53
|
+
|
|
43
54
|
/**
|
|
44
55
|
* Invokes an entity-scoped action against a specific record. Returns the
|
|
45
56
|
* unwrapped `result` payload.
|
|
@@ -79,6 +90,20 @@ export class ActionServiceImpl implements ActionService {
|
|
|
79
90
|
return response.result
|
|
80
91
|
}
|
|
81
92
|
|
|
93
|
+
async invokePublic(
|
|
94
|
+
orgId: string,
|
|
95
|
+
slug: string,
|
|
96
|
+
params: Record<string, unknown>,
|
|
97
|
+
): Promise<unknown> {
|
|
98
|
+
const response = await this.client.request<InvokeActionResponse>(
|
|
99
|
+
'POST',
|
|
100
|
+
`/functions/v1/public/orgs/${encodeURIComponent(orgId)}/actions/${encodeURIComponent(slug)}/invoke`,
|
|
101
|
+
params,
|
|
102
|
+
{ skipAuth: true },
|
|
103
|
+
)
|
|
104
|
+
return response.result
|
|
105
|
+
}
|
|
106
|
+
|
|
82
107
|
async invokeEntity(
|
|
83
108
|
entitySlug: string,
|
|
84
109
|
recordId: string,
|