@voobase/cli 0.1.1-nonprod.2039 → 0.1.1-nonprod.2050

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.
Files changed (109) hide show
  1. package/dist-bundle/index.mjs +69 -61
  2. package/package.json +9 -6
  3. package/runtime-sdk/dist/auth/client.d.ts +14 -0
  4. package/runtime-sdk/dist/auth/client.js +28 -0
  5. package/runtime-sdk/dist/blob/client.d.ts +39 -0
  6. package/runtime-sdk/dist/blob/client.js +148 -0
  7. package/runtime-sdk/dist/blob/client.test.d.ts +1 -0
  8. package/runtime-sdk/dist/blob/client.test.js +494 -0
  9. package/runtime-sdk/dist/browser/app.d.ts +142 -0
  10. package/runtime-sdk/dist/browser/app.js +256 -0
  11. package/runtime-sdk/dist/browser/app.test.d.ts +1 -0
  12. package/runtime-sdk/dist/browser/app.test.js +81 -0
  13. package/runtime-sdk/dist/browser/errors.d.ts +39 -0
  14. package/runtime-sdk/dist/browser/errors.js +265 -0
  15. package/runtime-sdk/dist/browser/errors.test.d.ts +1 -0
  16. package/runtime-sdk/dist/browser/errors.test.js +41 -0
  17. package/runtime-sdk/dist/browser.d.ts +5 -0
  18. package/runtime-sdk/dist/browser.js +5 -0
  19. package/runtime-sdk/dist/client.d.ts +16 -0
  20. package/runtime-sdk/dist/client.js +22 -0
  21. package/runtime-sdk/dist/cms/client.d.ts +39 -0
  22. package/runtime-sdk/dist/cms/client.js +56 -0
  23. package/runtime-sdk/dist/cms/client.test.d.ts +1 -0
  24. package/runtime-sdk/dist/cms/client.test.js +56 -0
  25. package/runtime-sdk/dist/cms/media.d.ts +10 -0
  26. package/runtime-sdk/dist/cms/media.js +113 -0
  27. package/runtime-sdk/dist/cms/media.test.d.ts +1 -0
  28. package/runtime-sdk/dist/cms/media.test.js +76 -0
  29. package/runtime-sdk/dist/cms/taxonomy.d.ts +8 -0
  30. package/runtime-sdk/dist/cms/taxonomy.js +77 -0
  31. package/runtime-sdk/dist/cms/taxonomy.test.d.ts +1 -0
  32. package/runtime-sdk/dist/cms/taxonomy.test.js +65 -0
  33. package/runtime-sdk/dist/data-form/client.d.ts +19 -0
  34. package/runtime-sdk/dist/data-form/client.js +118 -0
  35. package/runtime-sdk/dist/data-form/client.test.d.ts +1 -0
  36. package/runtime-sdk/dist/data-form/client.test.js +210 -0
  37. package/runtime-sdk/dist/data-form/contracts.d.ts +10 -0
  38. package/runtime-sdk/dist/data-form/contracts.js +33 -0
  39. package/runtime-sdk/dist/data-form/index.d.ts +3 -0
  40. package/runtime-sdk/dist/data-form/index.js +2 -0
  41. package/runtime-sdk/dist/data-form/types.d.ts +110 -0
  42. package/runtime-sdk/dist/data-form/types.js +1 -0
  43. package/runtime-sdk/dist/http.d.ts +27 -0
  44. package/runtime-sdk/dist/http.js +126 -0
  45. package/runtime-sdk/dist/index.d.ts +19 -0
  46. package/runtime-sdk/dist/index.js +14 -0
  47. package/runtime-sdk/dist/notification/client.d.ts +16 -0
  48. package/runtime-sdk/dist/notification/client.js +39 -0
  49. package/runtime-sdk/dist/notification/index.d.ts +1 -0
  50. package/runtime-sdk/dist/notification/index.js +1 -0
  51. package/runtime-sdk/dist/react/context.d.ts +18 -0
  52. package/runtime-sdk/dist/react/context.js +28 -0
  53. package/runtime-sdk/dist/react/hooks.d.ts +90 -0
  54. package/runtime-sdk/dist/react/hooks.js +172 -0
  55. package/runtime-sdk/dist/react.d.ts +2 -0
  56. package/runtime-sdk/dist/react.js +2 -0
  57. package/runtime-sdk/dist/session/browser.d.ts +25 -0
  58. package/runtime-sdk/dist/session/browser.js +60 -0
  59. package/runtime-sdk/dist/types/auth.d.ts +38 -0
  60. package/runtime-sdk/dist/types/auth.js +1 -0
  61. package/runtime-sdk/dist/types/cms.d.ts +93 -0
  62. package/runtime-sdk/dist/types/cms.js +1 -0
  63. package/runtime-sdk/dist/types/notification.d.ts +37 -0
  64. package/runtime-sdk/dist/types/notification.js +1 -0
  65. package/runtime-sdk/dist/types/object-storage.d.ts +58 -0
  66. package/runtime-sdk/dist/types/object-storage.js +1 -0
  67. package/runtime-sdk/dist/types/workflow.d.ts +52 -0
  68. package/runtime-sdk/dist/types/workflow.js +1 -0
  69. package/runtime-sdk/dist/workflow/client.d.ts +30 -0
  70. package/runtime-sdk/dist/workflow/client.js +45 -0
  71. package/scaffold-assets-manifest.json +429 -0
  72. package/template-blocks/assets.ts +95 -0
  73. package/template-blocks/contract/capabilities.ts +33 -0
  74. package/template-blocks/contract/facade-contract.ts +59 -0
  75. package/template-blocks/contract/index.ts +4 -0
  76. package/template-blocks/contract/path-builders.ts +76 -0
  77. package/template-blocks/contract/route-path-patterns-source.ts +222 -0
  78. package/template-blocks/contract/route-path-patterns.ts +210 -0
  79. package/template-blocks/contract/runtime-config.ts +256 -0
  80. package/template-blocks/dev-support/index.ts +2 -0
  81. package/template-blocks/dev-support/node/auth-shell.ts +31 -0
  82. package/template-blocks/dev-support/node/index.ts +3 -0
  83. package/template-blocks/dev-support/node/proxy.ts +133 -0
  84. package/template-blocks/dev-support/node/runtime-config.ts +163 -0
  85. package/template-blocks/dev-support/vite/auth-shell.ts +23 -0
  86. package/template-blocks/dev-support/vite/index.ts +3 -0
  87. package/template-blocks/dev-support/vite/proxy.ts +451 -0
  88. package/template-blocks/dev-support/vite/runtime-config.ts +107 -0
  89. package/template-blocks/legacy/app-core.ts +153 -0
  90. package/template-blocks/legacy/index.ts +10 -0
  91. package/template-blocks/legacy/lifecycle.ts +38 -0
  92. package/template-blocks/legacy/metadata.ts +59 -0
  93. package/template-blocks/legacy/pages.ts +156 -0
  94. package/template-blocks/legacy/react-lock.ts +1599 -0
  95. package/template-blocks/legacy/react.ts +823 -0
  96. package/template-blocks/legacy/tailwind.ts +1138 -0
  97. package/template-blocks/legacy/wrappers/auth.ts +105 -0
  98. package/template-blocks/legacy/wrappers/proxy.ts +250 -0
  99. package/template-blocks/legacy/wrappers/runtime.ts +535 -0
  100. package/template-blocks/protocol/auth-routes.ts +82 -0
  101. package/template-blocks/protocol/cms-routes.ts +81 -0
  102. package/template-blocks/protocol/index.ts +4 -0
  103. package/template-blocks/protocol/public-app-routes.ts +48 -0
  104. package/template-blocks/protocol/route-map.ts +75 -0
  105. package/template-blocks/routing.ts +62 -0
  106. package/template-blocks/server/html-injection.ts +45 -0
  107. package/template-blocks/server/proxy-routing.ts +65 -0
  108. package/template-blocks/server/request-context.ts +103 -0
  109. package/template-blocks/server/route-strip.ts +47 -0
@@ -0,0 +1,14 @@
1
+ export { PlatformRuntimeSdk } from "./client.js";
2
+ export { RuntimeApiError } from "./http.js";
3
+ export { createBrowserRuntimeApp } from "./browser/app.js";
4
+ export { normalizeCmsMediaUrl, resolveCmsCoverImageSet, resolveCmsCoverImageUrl, resolveCmsImageSet, resolveCmsImageUrl } from "./cms/media.js";
5
+ export { buildCmsCategoryNameMap, resolveCmsCategoryName, resolveCmsItemCategoryName, resolveCmsItemTagLabels, resolveCmsTagLabels } from "./cms/taxonomy.js";
6
+ export { RuntimeBlobClient } from "./blob/client.js";
7
+ export { classifyBrowserRuntimeError, classifyBrowserWorkflowError, getBrowserRuntimeErrorMessage, getBrowserWorkflowErrorMessage, resolveEndUserAccess, } from "./browser/errors.js";
8
+ export { buildEndUserSessionStorageKey, createBrowserRuntimeSdk, createBrowserSessionStore } from "./session/browser.js";
9
+ export { RuntimeAuthClient } from "./auth/client.js";
10
+ export { RuntimeCmsClient } from "./cms/client.js";
11
+ export * from "./data-form/index.js";
12
+ export * from "./notification/index.js";
13
+ export { RuntimeNotificationClient } from "./notification/client.js";
14
+ export { RuntimeWorkflowClient } from "./workflow/client.js";
@@ -0,0 +1,16 @@
1
+ import { BaseRuntimeSdk, type RuntimeSdkOptions } from "../http.js";
2
+ import type { RuntimeNotificationAnnouncements, RuntimeNotificationCommandResult, RuntimeNotificationInboxItemStatus, RuntimeNotificationInboxList, RuntimeNotificationUnreadCount } from "../types/notification.js";
3
+ export declare class RuntimeNotificationClient extends BaseRuntimeSdk {
4
+ constructor(options: RuntimeSdkOptions);
5
+ listMyInbox(args?: {
6
+ status?: RuntimeNotificationInboxItemStatus;
7
+ inboxType?: "task_projection" | "notification" | "alert" | "announcement";
8
+ limit?: number;
9
+ }): Promise<RuntimeNotificationInboxList>;
10
+ getMyUnreadCount(): Promise<RuntimeNotificationUnreadCount>;
11
+ listMyAnnouncements(args?: {
12
+ limit?: number;
13
+ }): Promise<RuntimeNotificationAnnouncements>;
14
+ markRead(itemId: string): Promise<RuntimeNotificationCommandResult>;
15
+ dismiss(itemId: string): Promise<RuntimeNotificationCommandResult>;
16
+ }
@@ -0,0 +1,39 @@
1
+ import { BaseRuntimeSdk } from "../http.js";
2
+ export class RuntimeNotificationClient extends BaseRuntimeSdk {
3
+ constructor(options) {
4
+ super(options);
5
+ }
6
+ async listMyInbox(args = {}) {
7
+ const url = this.buildRequestUrl(this.buildAppPath("/notification/inbox"));
8
+ if (args.status) {
9
+ url.searchParams.set("status", args.status);
10
+ }
11
+ if (args.inboxType) {
12
+ url.searchParams.set("inbox_type", args.inboxType);
13
+ }
14
+ if (args.limit !== undefined) {
15
+ url.searchParams.set("limit", String(args.limit));
16
+ }
17
+ return this.request(url.pathname + url.search);
18
+ }
19
+ async getMyUnreadCount() {
20
+ return this.requestApp("/notification/unread-count");
21
+ }
22
+ async listMyAnnouncements(args = {}) {
23
+ const url = this.buildRequestUrl(this.buildAppPath("/notification/announcements"));
24
+ if (args.limit !== undefined) {
25
+ url.searchParams.set("limit", String(args.limit));
26
+ }
27
+ return this.request(url.pathname + url.search);
28
+ }
29
+ async markRead(itemId) {
30
+ return this.requestApp(`/notification/inbox/${encodeURIComponent(itemId)}/read`, {
31
+ method: "PATCH"
32
+ });
33
+ }
34
+ async dismiss(itemId) {
35
+ return this.requestApp(`/notification/inbox/${encodeURIComponent(itemId)}/dismiss`, {
36
+ method: "PATCH"
37
+ });
38
+ }
39
+ }
@@ -0,0 +1 @@
1
+ export { RuntimeNotificationClient } from "./client.js";
@@ -0,0 +1 @@
1
+ export { RuntimeNotificationClient } from "./client.js";
@@ -0,0 +1,18 @@
1
+ import * as React from "react";
2
+ import type { PlatformRuntimeSdk } from "../client.js";
3
+ import { type BrowserSessionStore, type BrowserSessionStoreOptions } from "../session/browser.js";
4
+ export declare function RuntimeSdkProvider(props: {
5
+ sdk: PlatformRuntimeSdk;
6
+ children: React.ReactNode;
7
+ }): React.ReactElement;
8
+ export declare function useRuntimeSdk(): PlatformRuntimeSdk;
9
+ export declare function useOptionalRuntimeSdk(): PlatformRuntimeSdk | null;
10
+ export declare function BrowserRuntimeSdkProvider(props: {
11
+ baseUrl: string;
12
+ appId: string;
13
+ env?: "preview" | "prod";
14
+ fetchImpl?: typeof fetch;
15
+ session?: BrowserSessionStore;
16
+ sessionOptions?: BrowserSessionStoreOptions;
17
+ children: React.ReactNode;
18
+ }): React.ReactElement;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { createBrowserRuntimeSdk, createBrowserSessionStore } from "../session/browser.js";
4
+ const RuntimeSdkContext = React.createContext(null);
5
+ export function RuntimeSdkProvider(props) {
6
+ return _jsx(RuntimeSdkContext.Provider, { value: props.sdk, children: props.children });
7
+ }
8
+ export function useRuntimeSdk() {
9
+ const sdk = React.useContext(RuntimeSdkContext);
10
+ if (!sdk) {
11
+ throw new Error("RuntimeSdkProvider is missing");
12
+ }
13
+ return sdk;
14
+ }
15
+ export function useOptionalRuntimeSdk() {
16
+ return React.useContext(RuntimeSdkContext);
17
+ }
18
+ export function BrowserRuntimeSdkProvider(props) {
19
+ const session = React.useMemo(() => props.session ?? createBrowserSessionStore(props.sessionOptions), [props.session, props.sessionOptions]);
20
+ const sdk = React.useMemo(() => createBrowserRuntimeSdk({
21
+ baseUrl: props.baseUrl,
22
+ appId: props.appId,
23
+ env: props.env,
24
+ fetchImpl: props.fetchImpl,
25
+ session,
26
+ }), [props.appId, props.baseUrl, props.env, props.fetchImpl, session]);
27
+ return _jsx(RuntimeSdkProvider, { sdk: sdk, children: props.children });
28
+ }
@@ -0,0 +1,90 @@
1
+ import { PlatformRuntimeSdk } from "../client.js";
2
+ import type { RuntimeApiError } from "../http.js";
3
+ import type { RuntimeEndUserAuthMe, RuntimeEndUserRoleRecord } from "../types/auth.js";
4
+ import type { RuntimeCmsCategoryNode, RuntimeCmsCategoryTreeResponse, RuntimeCmsCollectionListResponse, RuntimeCmsCollectionMetaResponse, RuntimeCmsDeliveryListResponse, RuntimeCmsItemDeliveryPayload } from "../types/cms.js";
5
+ import type { RuntimeWorkflowActionResult, RuntimeWorkflowObjectState, RuntimeWorkflowTaskList, RuntimeWorkflowTimelineItem } from "../types/workflow.js";
6
+ type AsyncState<T> = {
7
+ loading: boolean;
8
+ error: RuntimeApiError | Error | null;
9
+ data: T | null;
10
+ reload: () => Promise<void>;
11
+ };
12
+ export declare function useCurrentEndUser(sdk?: PlatformRuntimeSdk | null): AsyncState<RuntimeEndUserAuthMe>;
13
+ export declare function useCurrentEndUserRoles(sdk?: PlatformRuntimeSdk | null): AsyncState<RuntimeEndUserRoleRecord[]>;
14
+ type WorkflowTaskArgs = {
15
+ status?: string;
16
+ limit?: number;
17
+ cursor?: string;
18
+ };
19
+ type WorkflowObjectArgs = {
20
+ objectType: string;
21
+ objectId: string;
22
+ };
23
+ type CmsListArgs = {
24
+ tenantId: string;
25
+ collection: string;
26
+ page?: number;
27
+ pageSize?: number;
28
+ categoryId?: string;
29
+ tags?: string[];
30
+ featured?: boolean;
31
+ sortField?: string;
32
+ sortDirection?: "asc" | "desc";
33
+ q?: string;
34
+ };
35
+ type CmsCollectionArgs = {
36
+ tenantId: string;
37
+ collection: string;
38
+ };
39
+ type CmsCollectionsArgs = {
40
+ tenantId: string;
41
+ };
42
+ type CmsSlugArgs = CmsCollectionArgs & {
43
+ slug: string;
44
+ };
45
+ type CmsIdArgs = CmsCollectionArgs & {
46
+ itemId: string;
47
+ };
48
+ export declare function useMyWorkflowTasks(args?: WorkflowTaskArgs, options?: {
49
+ sdk?: PlatformRuntimeSdk | null;
50
+ }): AsyncState<RuntimeWorkflowTaskList>;
51
+ export declare function useWorkflowObjectState(args: WorkflowObjectArgs | null, options?: {
52
+ sdk?: PlatformRuntimeSdk | null;
53
+ }): AsyncState<RuntimeWorkflowObjectState>;
54
+ export declare function useWorkflowTimeline(args: WorkflowObjectArgs | null, options?: {
55
+ sdk?: PlatformRuntimeSdk | null;
56
+ }): AsyncState<RuntimeWorkflowTimelineItem[]>;
57
+ export declare function useCmsItems(args: CmsListArgs | null, options?: {
58
+ sdk?: PlatformRuntimeSdk | null;
59
+ }): AsyncState<RuntimeCmsDeliveryListResponse>;
60
+ export declare function useCmsCollections(args: CmsCollectionsArgs | null, options?: {
61
+ sdk?: PlatformRuntimeSdk | null;
62
+ }): AsyncState<RuntimeCmsCollectionListResponse>;
63
+ export declare function useCmsCollectionMeta(args: CmsCollectionArgs | null, options?: {
64
+ sdk?: PlatformRuntimeSdk | null;
65
+ }): AsyncState<RuntimeCmsCollectionMetaResponse>;
66
+ export declare function useCmsCategories(args: CmsCollectionArgs | null, options?: {
67
+ sdk?: PlatformRuntimeSdk | null;
68
+ }): AsyncState<RuntimeCmsCategoryTreeResponse>;
69
+ export declare function useCmsCategoryNodes(args: CmsCollectionArgs | null, options?: {
70
+ sdk?: PlatformRuntimeSdk | null;
71
+ }): AsyncState<RuntimeCmsCategoryNode[]>;
72
+ export declare function useCmsItemBySlug(args: CmsSlugArgs | null, options?: {
73
+ sdk?: PlatformRuntimeSdk | null;
74
+ }): AsyncState<RuntimeCmsItemDeliveryPayload>;
75
+ export declare function useCmsItemById(args: CmsIdArgs | null, options?: {
76
+ sdk?: PlatformRuntimeSdk | null;
77
+ }): AsyncState<RuntimeCmsItemDeliveryPayload>;
78
+ export declare function useWorkflowActionRunner(sdk?: PlatformRuntimeSdk | null): {
79
+ loading: boolean;
80
+ error: RuntimeApiError | Error | null;
81
+ data: RuntimeWorkflowActionResult | null;
82
+ run: (args: {
83
+ instanceId: string;
84
+ actionKey: string;
85
+ comment?: string;
86
+ payload?: Record<string, unknown>;
87
+ }) => Promise<RuntimeWorkflowActionResult | null>;
88
+ reset: () => void;
89
+ };
90
+ export {};
@@ -0,0 +1,172 @@
1
+ import * as React from "react";
2
+ import { useOptionalRuntimeSdk } from "./context.js";
3
+ export function useCurrentEndUser(sdk = null) {
4
+ const runtimeSdk = useResolvedRuntimeSdk(sdk);
5
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => runtimeSdk?.auth.getCurrentEndUser() ?? null, [runtimeSdk]));
6
+ }
7
+ export function useCurrentEndUserRoles(sdk = null) {
8
+ const runtimeSdk = useResolvedRuntimeSdk(sdk);
9
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => runtimeSdk?.auth.getCurrentEndUserRoles() ?? null, [runtimeSdk]));
10
+ }
11
+ export function useMyWorkflowTasks(args = {}, options = {}) {
12
+ const runtimeSdk = useResolvedRuntimeSdk(options.sdk ?? null);
13
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => runtimeSdk?.workflow.listMyTasks(args) ?? null, [runtimeSdk, args.cursor, args.limit, args.status]));
14
+ }
15
+ export function useWorkflowObjectState(args, options = {}) {
16
+ const runtimeSdk = useResolvedRuntimeSdk(options.sdk ?? null);
17
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => {
18
+ if (!runtimeSdk || !args) {
19
+ return null;
20
+ }
21
+ return runtimeSdk.workflow.getObjectState(args);
22
+ }, [runtimeSdk, args?.objectId, args?.objectType]));
23
+ }
24
+ export function useWorkflowTimeline(args, options = {}) {
25
+ const runtimeSdk = useResolvedRuntimeSdk(options.sdk ?? null);
26
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => {
27
+ if (!runtimeSdk || !args) {
28
+ return null;
29
+ }
30
+ return runtimeSdk.workflow.listTimeline(args);
31
+ }, [runtimeSdk, args?.objectId, args?.objectType]));
32
+ }
33
+ export function useCmsItems(args, options = {}) {
34
+ const runtimeSdk = useResolvedRuntimeSdk(options.sdk ?? null);
35
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => {
36
+ if (!runtimeSdk || !args) {
37
+ return null;
38
+ }
39
+ return runtimeSdk.cms.listItems(args);
40
+ }, [
41
+ runtimeSdk,
42
+ args?.tenantId,
43
+ args?.collection,
44
+ args?.page,
45
+ args?.pageSize,
46
+ args?.categoryId,
47
+ args?.q,
48
+ args?.featured,
49
+ args?.sortField,
50
+ args?.sortDirection,
51
+ JSON.stringify(args?.tags ?? [])
52
+ ]));
53
+ }
54
+ export function useCmsCollections(args, options = {}) {
55
+ const runtimeSdk = useResolvedRuntimeSdk(options.sdk ?? null);
56
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => {
57
+ if (!runtimeSdk || !args) {
58
+ return null;
59
+ }
60
+ return runtimeSdk.cms.listCollections(args);
61
+ }, [runtimeSdk, args?.tenantId]));
62
+ }
63
+ export function useCmsCollectionMeta(args, options = {}) {
64
+ const runtimeSdk = useResolvedRuntimeSdk(options.sdk ?? null);
65
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => {
66
+ if (!runtimeSdk || !args) {
67
+ return null;
68
+ }
69
+ return runtimeSdk.cms.getCollectionMeta(args);
70
+ }, [runtimeSdk, args?.tenantId, args?.collection]));
71
+ }
72
+ export function useCmsCategories(args, options = {}) {
73
+ const runtimeSdk = useResolvedRuntimeSdk(options.sdk ?? null);
74
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => {
75
+ if (!runtimeSdk || !args) {
76
+ return null;
77
+ }
78
+ return runtimeSdk.cms.listCategories(args);
79
+ }, [runtimeSdk, args?.tenantId, args?.collection]));
80
+ }
81
+ export function useCmsCategoryNodes(args, options = {}) {
82
+ const runtimeSdk = useResolvedRuntimeSdk(options.sdk ?? null);
83
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => {
84
+ if (!runtimeSdk || !args) {
85
+ return null;
86
+ }
87
+ const result = await runtimeSdk.cms.listCategories(args);
88
+ return Array.isArray(result?.nodes) ? result.nodes : [];
89
+ }, [runtimeSdk, args?.tenantId, args?.collection]));
90
+ }
91
+ export function useCmsItemBySlug(args, options = {}) {
92
+ const runtimeSdk = useResolvedRuntimeSdk(options.sdk ?? null);
93
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => {
94
+ if (!runtimeSdk || !args) {
95
+ return null;
96
+ }
97
+ return runtimeSdk.cms.getItemBySlug(args);
98
+ }, [runtimeSdk, args?.tenantId, args?.collection, args?.slug]));
99
+ }
100
+ export function useCmsItemById(args, options = {}) {
101
+ const runtimeSdk = useResolvedRuntimeSdk(options.sdk ?? null);
102
+ return useAsyncResource(runtimeSdk, React.useCallback(async () => {
103
+ if (!runtimeSdk || !args) {
104
+ return null;
105
+ }
106
+ return runtimeSdk.cms.getItemById(args);
107
+ }, [runtimeSdk, args?.tenantId, args?.collection, args?.itemId]));
108
+ }
109
+ export function useWorkflowActionRunner(sdk = null) {
110
+ const runtimeSdk = useResolvedRuntimeSdk(sdk);
111
+ const [loading, setLoading] = React.useState(false);
112
+ const [error, setError] = React.useState(null);
113
+ const [data, setData] = React.useState(null);
114
+ const run = React.useCallback(async (args) => {
115
+ if (!runtimeSdk) {
116
+ return null;
117
+ }
118
+ setLoading(true);
119
+ setError(null);
120
+ try {
121
+ const result = await runtimeSdk.workflow.performAction(args);
122
+ setData(result);
123
+ return result;
124
+ }
125
+ catch (nextError) {
126
+ setError(nextError instanceof Error ? nextError : new Error("workflow action failed"));
127
+ return null;
128
+ }
129
+ finally {
130
+ setLoading(false);
131
+ }
132
+ }, [runtimeSdk]);
133
+ const reset = React.useCallback(() => {
134
+ setError(null);
135
+ setData(null);
136
+ setLoading(false);
137
+ }, []);
138
+ return { loading, error, data, run, reset };
139
+ }
140
+ function useResolvedRuntimeSdk(sdk) {
141
+ const contextSdk = useOptionalRuntimeSdk();
142
+ return sdk ?? contextSdk;
143
+ }
144
+ function useAsyncResource(sdk, loader) {
145
+ const [loading, setLoading] = React.useState(false);
146
+ const [error, setError] = React.useState(null);
147
+ const [data, setData] = React.useState(null);
148
+ const reload = React.useCallback(async () => {
149
+ if (!sdk) {
150
+ setData(null);
151
+ setError(null);
152
+ setLoading(false);
153
+ return;
154
+ }
155
+ setLoading(true);
156
+ setError(null);
157
+ try {
158
+ const result = await loader();
159
+ setData(result);
160
+ }
161
+ catch (nextError) {
162
+ setError(nextError instanceof Error ? nextError : new Error("runtime sdk request failed"));
163
+ }
164
+ finally {
165
+ setLoading(false);
166
+ }
167
+ }, [loader, sdk]);
168
+ React.useEffect(() => {
169
+ void reload();
170
+ }, [reload]);
171
+ return { loading, error, data, reload };
172
+ }
@@ -0,0 +1,2 @@
1
+ export { BrowserRuntimeSdkProvider, RuntimeSdkProvider, useOptionalRuntimeSdk, useRuntimeSdk } from "./react/context.js";
2
+ export { useCmsCategories, useCmsCategoryNodes, useCmsCollectionMeta, useCmsCollections, useCmsItemById, useCmsItemBySlug, useCmsItems, useCurrentEndUser, useCurrentEndUserRoles, useMyWorkflowTasks, useWorkflowActionRunner, useWorkflowObjectState, useWorkflowTimeline } from "./react/hooks.js";
@@ -0,0 +1,2 @@
1
+ export { BrowserRuntimeSdkProvider, RuntimeSdkProvider, useOptionalRuntimeSdk, useRuntimeSdk } from "./react/context.js";
2
+ export { useCmsCategories, useCmsCategoryNodes, useCmsCollectionMeta, useCmsCollections, useCmsItemById, useCmsItemBySlug, useCmsItems, useCurrentEndUser, useCurrentEndUserRoles, useMyWorkflowTasks, useWorkflowActionRunner, useWorkflowObjectState, useWorkflowTimeline } from "./react/hooks.js";
@@ -0,0 +1,25 @@
1
+ import { PlatformRuntimeSdk } from "../client.js";
2
+ import type { RuntimeSdkOptions } from "../http.js";
3
+ export type BrowserSessionStoreOptions = {
4
+ storage?: Storage;
5
+ storageKey?: string;
6
+ origin?: string;
7
+ authPath?: string;
8
+ headerValueBuilder?: (token: string) => string;
9
+ };
10
+ export type BrowserSessionStore = {
11
+ storageKey: string;
12
+ readToken: () => string;
13
+ writeToken: (token: string) => void;
14
+ clearToken: () => void;
15
+ getHeaders: () => HeadersInit;
16
+ };
17
+ export declare function buildEndUserSessionStorageKey(args?: {
18
+ origin?: string;
19
+ authPath?: string;
20
+ }): string;
21
+ export declare function createBrowserSessionStore(options?: BrowserSessionStoreOptions): BrowserSessionStore;
22
+ export declare function createBrowserRuntimeSdk(options: Omit<RuntimeSdkOptions, "getHeaders"> & {
23
+ session?: BrowserSessionStore;
24
+ sessionOptions?: BrowserSessionStoreOptions;
25
+ }): PlatformRuntimeSdk;
@@ -0,0 +1,60 @@
1
+ import { PlatformRuntimeSdk } from "../client.js";
2
+ export function buildEndUserSessionStorageKey(args = {}) {
3
+ const origin = args.origin ?? inferWindowOrigin();
4
+ const authPath = args.authPath ?? "/auth";
5
+ return `platform:end-user-auth:${origin}:${authPath}`;
6
+ }
7
+ export function createBrowserSessionStore(options = {}) {
8
+ const storageKey = options.storageKey ?? buildEndUserSessionStorageKey({
9
+ origin: options.origin,
10
+ authPath: options.authPath,
11
+ });
12
+ const headerValueBuilder = options.headerValueBuilder ?? ((token) => `Bearer ${token}`);
13
+ const getStorage = () => {
14
+ if (options.storage) {
15
+ return options.storage;
16
+ }
17
+ if (typeof window === "undefined" || !window.sessionStorage) {
18
+ throw new Error("Browser session storage is unavailable");
19
+ }
20
+ return window.sessionStorage;
21
+ };
22
+ const readToken = () => {
23
+ try {
24
+ return getStorage().getItem(storageKey) ?? "";
25
+ }
26
+ catch {
27
+ return "";
28
+ }
29
+ };
30
+ return {
31
+ storageKey,
32
+ readToken,
33
+ writeToken: (token) => {
34
+ getStorage().setItem(storageKey, token);
35
+ },
36
+ clearToken: () => {
37
+ getStorage().removeItem(storageKey);
38
+ },
39
+ getHeaders: () => {
40
+ const token = readToken();
41
+ return token ? { Authorization: headerValueBuilder(token) } : {};
42
+ },
43
+ };
44
+ }
45
+ export function createBrowserRuntimeSdk(options) {
46
+ const session = options.session ?? createBrowserSessionStore(options.sessionOptions);
47
+ return new PlatformRuntimeSdk({
48
+ baseUrl: options.baseUrl,
49
+ appId: options.appId,
50
+ env: options.env,
51
+ fetchImpl: options.fetchImpl,
52
+ getHeaders: session.getHeaders,
53
+ });
54
+ }
55
+ function inferWindowOrigin() {
56
+ if (typeof window !== "undefined" && window.location?.origin) {
57
+ return window.location.origin;
58
+ }
59
+ return "";
60
+ }
@@ -0,0 +1,38 @@
1
+ export type RuntimeEndUserAccessState = "auth_not_enabled" | "not_authenticated" | "authenticated_and_ready" | "authenticated_but_not_provisioned" | "authenticated_but_blocked" | "binding_unavailable";
2
+ export type RuntimeEndUserIdentityProvider = "email_magic_link" | "admin_provisioned_password" | "wechat_oauth";
3
+ export type RuntimeEndUserStatus = "active" | "blocked" | "pending";
4
+ export type RuntimeEndUserAuthMe = {
5
+ tenant_id: string;
6
+ app_id: string;
7
+ auth_enabled: boolean;
8
+ access_state: RuntimeEndUserAccessState;
9
+ identity: {
10
+ identity_id: string;
11
+ user_store_id: string;
12
+ provider: RuntimeEndUserIdentityProvider;
13
+ provider_subject_id: string;
14
+ email: string | null;
15
+ phone: string | null;
16
+ is_verified: boolean;
17
+ } | null;
18
+ app_user: {
19
+ app_user_id: string;
20
+ app_id: string;
21
+ status: RuntimeEndUserStatus;
22
+ display_name: string | null;
23
+ profile_summary: Record<string, unknown> | null;
24
+ } | null;
25
+ };
26
+ export type RuntimeEndUserRoleRecord = {
27
+ tenant_id: string;
28
+ app_id: string;
29
+ user_store_id: string;
30
+ role_key: string;
31
+ display_name: string;
32
+ description: string | null;
33
+ status: "active" | "disabled";
34
+ role_source: "system_reserved" | "custom";
35
+ assignable: boolean;
36
+ created_at: string | null;
37
+ updated_at: string | null;
38
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,93 @@
1
+ export type RuntimeCmsCategoryNode = {
2
+ id: string;
3
+ collection: string;
4
+ name: string;
5
+ slug: string;
6
+ parent_id: string | null;
7
+ order: number;
8
+ created_at?: string;
9
+ updated_at?: string;
10
+ };
11
+ export type RuntimeCmsCollectionSpec = {
12
+ schema_version: string;
13
+ kind: "collection";
14
+ name: string;
15
+ label: string;
16
+ description: string;
17
+ template: "generic" | "article";
18
+ capabilities: Record<string, boolean>;
19
+ fields: Array<Record<string, unknown>>;
20
+ system_fields?: Record<string, unknown>;
21
+ };
22
+ export type RuntimeCmsCollectionListEntry = {
23
+ collection: string;
24
+ label: string;
25
+ template: "generic" | "article";
26
+ published_item_count: number;
27
+ };
28
+ export type RuntimeCmsRelationSummary = {
29
+ id: string;
30
+ label: string;
31
+ slug?: string;
32
+ };
33
+ export type RuntimeCmsImageSet = {
34
+ original?: string | null;
35
+ thumbnail?: string | null;
36
+ sm?: string | null;
37
+ md?: string | null;
38
+ lg?: string | null;
39
+ };
40
+ export type RuntimeCmsPresentation = {
41
+ title?: string | null;
42
+ summary?: string | null;
43
+ cover_urls?: RuntimeCmsImageSet | null;
44
+ cover_url?: string | null;
45
+ };
46
+ export type RuntimeCmsItemDeliveryPayload = {
47
+ collection: string;
48
+ system: {
49
+ id?: string;
50
+ publish_status?: "draft" | "published" | "archived";
51
+ slug?: string;
52
+ featured?: boolean;
53
+ tags?: string[];
54
+ category_id?: string | null;
55
+ content_format?: "markdown" | "html";
56
+ rendered_html?: string;
57
+ created_at?: string;
58
+ updated_at?: string;
59
+ published_at?: string | null;
60
+ source?: {
61
+ source_type?: string;
62
+ source_url?: string | null;
63
+ source_path?: string | null;
64
+ source_raw?: string | null;
65
+ checksum?: string | null;
66
+ imported_by?: string | null;
67
+ parser_version?: string | null;
68
+ };
69
+ };
70
+ content: Record<string, unknown | RuntimeCmsRelationSummary | RuntimeCmsRelationSummary[] | null>;
71
+ presentation?: RuntimeCmsPresentation;
72
+ };
73
+ export type RuntimeCmsDeliveryListResponse = {
74
+ items: RuntimeCmsItemDeliveryPayload[];
75
+ page: number;
76
+ page_size: number;
77
+ total: number;
78
+ };
79
+ export type RuntimeCmsCollectionListResponse = {
80
+ items: RuntimeCmsCollectionListEntry[];
81
+ };
82
+ export type RuntimeCmsCategoryTreeResponse = {
83
+ collection: string;
84
+ nodes: RuntimeCmsCategoryNode[];
85
+ };
86
+ export type RuntimeCmsCollectionMetaResponse = {
87
+ collection: string;
88
+ label: string;
89
+ template: "generic" | "article";
90
+ published_item_count: number;
91
+ schema: RuntimeCmsCollectionSpec;
92
+ categories: RuntimeCmsCategoryNode[];
93
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,37 @@
1
+ export type RuntimeNotificationInboxItemStatus = "unread" | "read" | "dismissed" | "archived";
2
+ export type RuntimeNotificationInboxItemType = "task_projection" | "notification" | "alert" | "announcement";
3
+ export type RuntimeNotificationInboxItem = {
4
+ id: string;
5
+ tenant_id: string;
6
+ app_id: string;
7
+ inbox_type: RuntimeNotificationInboxItemType;
8
+ status: RuntimeNotificationInboxItemStatus;
9
+ source_event_id: string | null;
10
+ source_task_ref: {
11
+ task_id: string;
12
+ instance_id: string;
13
+ } | null;
14
+ object_ref: {
15
+ resource_type: string;
16
+ resource_id: string;
17
+ app_id?: string | null;
18
+ } | null;
19
+ title: string;
20
+ summary: string | null;
21
+ created_at: string;
22
+ updated_at: string;
23
+ };
24
+ export type RuntimeNotificationInboxList = {
25
+ items: RuntimeNotificationInboxItem[];
26
+ unread_count: number;
27
+ };
28
+ export type RuntimeNotificationUnreadCount = {
29
+ unread_count: number;
30
+ };
31
+ export type RuntimeNotificationAnnouncements = {
32
+ items: RuntimeNotificationInboxItem[];
33
+ };
34
+ export type RuntimeNotificationCommandResult = {
35
+ command_status: "succeeded";
36
+ item: RuntimeNotificationInboxItem;
37
+ };
@@ -0,0 +1 @@
1
+ export {};