@bitbitpress/client 1.0.4 → 1.1.0-alpha.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/react/index.d.ts +41 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +68 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/primitives.d.ts +54 -0
- package/dist/react/primitives.d.ts.map +1 -0
- package/dist/react/primitives.js +223 -0
- package/dist/react/primitives.js.map +1 -0
- package/dist/react-native-expo/index.d.ts +42 -0
- package/dist/react-native-expo/index.d.ts.map +1 -0
- package/dist/react-native-expo/index.js +78 -0
- package/dist/react-native-expo/index.js.map +1 -0
- package/dist/react-native-expo/primitives.d.ts +58 -0
- package/dist/react-native-expo/primitives.d.ts.map +1 -0
- package/dist/react-native-expo/primitives.js +218 -0
- package/dist/react-native-expo/primitives.js.map +1 -0
- package/dist/synthesisView/context.d.ts +18 -0
- package/dist/synthesisView/context.d.ts.map +1 -0
- package/dist/synthesisView/context.js +15 -0
- package/dist/synthesisView/context.js.map +1 -0
- package/dist/synthesisView/createComponentMap.d.ts +18 -0
- package/dist/synthesisView/createComponentMap.d.ts.map +1 -0
- package/dist/synthesisView/createComponentMap.js +40 -0
- package/dist/synthesisView/createComponentMap.js.map +1 -0
- package/dist/synthesisView/engine.d.ts +35 -0
- package/dist/synthesisView/engine.d.ts.map +1 -0
- package/dist/synthesisView/engine.js +113 -0
- package/dist/synthesisView/engine.js.map +1 -0
- package/dist/synthesisView/primitives.d.ts +180 -0
- package/dist/synthesisView/primitives.d.ts.map +1 -0
- package/dist/synthesisView/primitives.js +29 -0
- package/dist/synthesisView/primitives.js.map +1 -0
- package/dist/synthesisView/resolve.d.ts +17 -0
- package/dist/synthesisView/resolve.d.ts.map +1 -0
- package/dist/synthesisView/resolve.js +42 -0
- package/dist/synthesisView/resolve.js.map +1 -0
- package/dist/synthesisView/types.d.ts +72 -0
- package/dist/synthesisView/types.d.ts.map +1 -0
- package/dist/synthesisView/types.js +2 -0
- package/dist/synthesisView/types.js.map +1 -0
- package/dist/synthesisView/useSynthesisView.d.ts +13 -0
- package/dist/synthesisView/useSynthesisView.d.ts.map +1 -0
- package/dist/synthesisView/useSynthesisView.js +49 -0
- package/dist/synthesisView/useSynthesisView.js.map +1 -0
- package/dist/user/index.d.ts +14 -1
- package/dist/user/index.d.ts.map +1 -1
- package/dist/user/index.js +6 -1
- package/dist/user/index.js.map +1 -1
- package/dist/user/synthesize-view-batch-manager.d.ts +17 -0
- package/dist/user/synthesize-view-batch-manager.d.ts.map +1 -0
- package/dist/user/synthesize-view-batch-manager.js +52 -0
- package/dist/user/synthesize-view-batch-manager.js.map +1 -0
- package/dist/user/synthesizeView.d.ts +41 -0
- package/dist/user/synthesizeView.d.ts.map +1 -0
- package/dist/user/synthesizeView.js +26 -0
- package/dist/user/synthesizeView.js.map +1 -0
- package/package.json +29 -5
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { RequestConfig } from '../request.js';
|
|
2
|
+
/** Optional input forwarded to a view's content synthesis (e.g. an article
|
|
3
|
+
* id the view should personalize against). */
|
|
4
|
+
export interface ContentInput {
|
|
5
|
+
type: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
/** Render-time view parameters. Independent from `contentInputs` — these
|
|
9
|
+
* affect flattening only and never reach the synthesis agent. */
|
|
10
|
+
export interface ViewInputs {
|
|
11
|
+
/** Provide the dark mode setting of the current UI to the agent. */
|
|
12
|
+
darkMode?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** One view to resolve in a `synthesizeViews` request. */
|
|
15
|
+
export interface SynthesizeViewRequestItem {
|
|
16
|
+
/** Stable identifier of the view to load. Configured in the BitBitPress
|
|
17
|
+
* CMS; same value you pass as `<BitBitView keyName="…">`. */
|
|
18
|
+
keyName: string;
|
|
19
|
+
/** Optional inputs the view's content synthesis should consider. */
|
|
20
|
+
contentInputs?: ContentInput[];
|
|
21
|
+
/** Render-time view parameters (theme variant, etc.). */
|
|
22
|
+
viewInputs?: ViewInputs;
|
|
23
|
+
}
|
|
24
|
+
export interface SynthesizeViewResponse {
|
|
25
|
+
/** Render-ready array a BB SDK renderer can display directly. Pass it
|
|
26
|
+
* to `<BitBitView>` / `<BitBitViewRenderer>` and you're done. Empty
|
|
27
|
+
* array when the view resolved but had no UI to render. */
|
|
28
|
+
uiData: unknown[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Resolve one or more synthesis views in a single request. Returns the
|
|
32
|
+
* responses in the same order as `items`; an item that doesn't match any
|
|
33
|
+
* view resolves to `{ uiData: [] }`.
|
|
34
|
+
*
|
|
35
|
+
* Most apps reach this through `<BitBitView keyName="…">` rather than
|
|
36
|
+
* calling it directly — that path also coalesces multiple `<BitBitView>`
|
|
37
|
+
* mounts within a short window into a single request via the SDK's batch
|
|
38
|
+
* manager.
|
|
39
|
+
*/
|
|
40
|
+
export declare function synthesizeViews(config: RequestConfig, items: SynthesizeViewRequestItem[]): Promise<SynthesizeViewResponse[]>;
|
|
41
|
+
//# sourceMappingURL=synthesizeView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesizeView.d.ts","sourceRoot":"","sources":["../../src/user/synthesizeView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAGnD;+CAC+C;AAC/C,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED;kEACkE;AAClE,MAAM,WAAW,UAAU;IACzB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,0DAA0D;AAC1D,MAAM,WAAW,yBAAyB;IACxC;kEAC8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;IAC/B,yDAAyD;IACzD,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC;;gEAE4D;IAC5D,MAAM,EAAE,OAAO,EAAE,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,KAAK,EAAE,yBAAyB,EAAE,GACjC,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAYnC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.synthesizeViews = synthesizeViews;
|
|
4
|
+
const request_js_1 = require("../request.js");
|
|
5
|
+
/**
|
|
6
|
+
* Resolve one or more synthesis views in a single request. Returns the
|
|
7
|
+
* responses in the same order as `items`; an item that doesn't match any
|
|
8
|
+
* view resolves to `{ uiData: [] }`.
|
|
9
|
+
*
|
|
10
|
+
* Most apps reach this through `<BitBitView keyName="…">` rather than
|
|
11
|
+
* calling it directly — that path also coalesces multiple `<BitBitView>`
|
|
12
|
+
* mounts within a short window into a single request via the SDK's batch
|
|
13
|
+
* manager.
|
|
14
|
+
*/
|
|
15
|
+
async function synthesizeViews(config, items) {
|
|
16
|
+
const response = await (0, request_js_1.makeRequest)(config, {
|
|
17
|
+
method: 'POST',
|
|
18
|
+
path: '/v1/user/synthesize-views',
|
|
19
|
+
body: { items },
|
|
20
|
+
});
|
|
21
|
+
if (!response?.items) {
|
|
22
|
+
throw new Error('Failed to synthesize views: no items in response');
|
|
23
|
+
}
|
|
24
|
+
return response.items;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=synthesizeView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"synthesizeView.js","sourceRoot":"","sources":["../../src/user/synthesizeView.ts"],"names":[],"mappings":";;AA6CA,0CAeC;AA3DD,8CAA4C;AAkC5C;;;;;;;;;GASG;AACI,KAAK,UAAU,eAAe,CACnC,MAAqB,EACrB,KAAkC;IAElC,MAAM,QAAQ,GAAG,MAAM,IAAA,wBAAW,EAAsC,MAAM,EAAE;QAC9E,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE,EAAE,KAAK,EAAE;KAChB,CAAC,CAAC;IAEH,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,QAAQ,CAAC,KAAK,CAAC;AACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitbitpress/client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-alpha.0",
|
|
4
4
|
"description": "BitBitPress TypeScript client library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js",
|
|
12
12
|
"require": "./dist/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./react": {
|
|
15
|
+
"types": "./dist/react/index.d.ts",
|
|
16
|
+
"import": "./dist/react/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./react-native-expo": {
|
|
19
|
+
"types": "./dist/react-native-expo/index.d.ts",
|
|
20
|
+
"import": "./dist/react-native-expo/index.js"
|
|
13
21
|
}
|
|
14
22
|
},
|
|
15
23
|
"files": [
|
|
@@ -18,7 +26,7 @@
|
|
|
18
26
|
],
|
|
19
27
|
"scripts": {
|
|
20
28
|
"prebuild": "rimraf dist",
|
|
21
|
-
"build": "tsc && npm run build:cjs && npm run copy:types",
|
|
29
|
+
"build": "tsc && tsc --project tsconfig.ui.json && npm run build:cjs && npm run copy:types",
|
|
22
30
|
"copy:types": "mkdir -p dist/generated && cp src/generated/openapi.d.ts dist/generated/openapi.d.ts && cp src/generated/openapi.ts dist/generated/openapi.ts",
|
|
23
31
|
"build:with-types": "npm run generate:types && npm run build",
|
|
24
32
|
"build:cjs": "tsc --project tsconfig.cjs.json",
|
|
@@ -29,8 +37,8 @@
|
|
|
29
37
|
"ts:watch": "tsc -w",
|
|
30
38
|
"lint": "biome check .",
|
|
31
39
|
"lint:fix": "biome check . --write",
|
|
32
|
-
"test": "tsx --test src/**/*.test.ts",
|
|
33
|
-
"test:watch": "tsx --test --watch src/**/*.test.ts",
|
|
40
|
+
"test": "TSX_TSCONFIG_PATH=./tsconfig.ui.json tsx --test src/**/*.test.ts",
|
|
41
|
+
"test:watch": "TSX_TSCONFIG_PATH=./tsconfig.ui.json tsx --test --watch src/**/*.test.ts",
|
|
34
42
|
"prepublishOnly": "npm run build"
|
|
35
43
|
},
|
|
36
44
|
"keywords": [
|
|
@@ -56,19 +64,35 @@
|
|
|
56
64
|
"devDependencies": {
|
|
57
65
|
"@biomejs/biome": "^2.3.11",
|
|
58
66
|
"@types/node": "^24.10.8",
|
|
67
|
+
"@types/react": "^18.3.12",
|
|
68
|
+
"@types/react-dom": "^18.3.1",
|
|
59
69
|
"chokidar-cli": "^3.0.0",
|
|
60
70
|
"npm-run-all": "^4.1.5",
|
|
61
71
|
"openapi-typescript": "^7.4.2",
|
|
72
|
+
"react": "^18.3.1",
|
|
73
|
+
"react-dom": "^18.3.1",
|
|
62
74
|
"rimraf": "^6.1.2",
|
|
63
75
|
"tsx": "^4.21.0",
|
|
64
76
|
"typescript": "^5.9.3"
|
|
65
77
|
},
|
|
66
78
|
"peerDependencies": {
|
|
67
|
-
"@types/react-native": "*"
|
|
79
|
+
"@types/react-native": "*",
|
|
80
|
+
"expo-linear-gradient": ">=12",
|
|
81
|
+
"react": ">=18",
|
|
82
|
+
"react-native": ">=0.76"
|
|
68
83
|
},
|
|
69
84
|
"peerDependenciesMeta": {
|
|
70
85
|
"@types/react-native": {
|
|
71
86
|
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"expo-linear-gradient": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"react": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"react-native": {
|
|
95
|
+
"optional": true
|
|
72
96
|
}
|
|
73
97
|
}
|
|
74
98
|
}
|