@alliumcloud/configurator-service 1.5.12 → 1.5.14
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/README.md +73 -67
- package/dist/index.d.mts +23 -13
- package/dist/index.d.ts +23 -13
- package/dist/index.js +14 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -448,21 +448,18 @@ await sdk.sketchfab.updateObject("item-id", {
|
|
|
448
448
|
|
|
449
449
|
### Bounding Box
|
|
450
450
|
|
|
451
|
-
There are two distinct Unreal item types under this endpoint family:
|
|
452
|
-
|
|
453
|
-
- **`BoundingBoxRuntimeModel`** — one model, `gltfUrl`.
|
|
454
|
-
- **`MultiModelBoundingBox`** — several models, `gltfUrls`, and there is no singular `gltfUrl` for this type. Unreal shows every model in `gltfUrls` side by side. To page, replace `gltfUrls` with the next page's models via `updateObject`.
|
|
451
|
+
There are two distinct Unreal item types under this endpoint family: single bounding boxes (`BoundingBoxRuntimeModel`) and multi bounding boxes (`MultiModelBoundingBox`).
|
|
455
452
|
|
|
456
453
|
The wireframe collider is fitted to the loaded mesh(es) by Unreal — you never send an extent.
|
|
457
454
|
|
|
458
455
|
`disableClick` controls whether the box can be clicked in-world. Unreal's default is `false`, so an **omitted value means clickable**.
|
|
459
456
|
|
|
460
|
-
#### `sdk.boundingBox.
|
|
457
|
+
#### `sdk.boundingBox.addSingle(data)`
|
|
461
458
|
|
|
462
|
-
Add a bounding box 3D model to a space.
|
|
459
|
+
Add a single bounding box 3D model to a space.
|
|
463
460
|
|
|
464
461
|
```typescript
|
|
465
|
-
await sdk.boundingBox.
|
|
462
|
+
await sdk.boundingBox.addSingle({
|
|
466
463
|
orgId: "org-id",
|
|
467
464
|
spaceId: "space-id",
|
|
468
465
|
spaceItemId: "item-id",
|
|
@@ -479,44 +476,49 @@ await sdk.boundingBox.addObject({
|
|
|
479
476
|
rotation: { x: 0, y: 0, z: 0 },
|
|
480
477
|
offsetUpRotation: 0,
|
|
481
478
|
disableClick: false,
|
|
482
|
-
gltfUrls: [],
|
|
483
479
|
});
|
|
484
480
|
```
|
|
485
481
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
482
|
+
**Returns:** `Promise<void>`
|
|
483
|
+
|
|
484
|
+
---
|
|
485
|
+
|
|
486
|
+
#### `sdk.boundingBox.addMulti(data)`
|
|
487
|
+
|
|
488
|
+
Add a multi bounding box 3D model to a space.
|
|
489
|
+
|
|
490
|
+
```typescript
|
|
491
|
+
await sdk.boundingBox.addMulti({
|
|
492
|
+
orgId: "org-id",
|
|
493
|
+
spaceId: "space-id",
|
|
494
|
+
spaceItemId: "item-id",
|
|
495
|
+
name: "Multi Bounding Box",
|
|
496
|
+
type: "MultiModelBoundingBox",
|
|
497
|
+
gltfUrls: ["https://.../chair1.glb", "https://.../chair2.glb"],
|
|
498
|
+
highlightedGltfUrl: "https://.../chair1.glb",
|
|
499
|
+
materialOverrideId: "None",
|
|
500
|
+
scale: { x: 1, y: 1, z: 1 },
|
|
501
|
+
autoScale: false,
|
|
502
|
+
offsetUpPosition: 0,
|
|
503
|
+
offsetUniformScale: 1,
|
|
504
|
+
collisionsEnabled: true,
|
|
505
|
+
position: { x: 0, y: 300, z: 90 },
|
|
506
|
+
rotation: { x: 0, y: 0, z: 0 },
|
|
507
|
+
offsetUpRotation: 0,
|
|
508
|
+
disableClick: false,
|
|
509
|
+
});
|
|
510
|
+
```
|
|
509
511
|
|
|
510
512
|
**Returns:** `Promise<void>`
|
|
511
513
|
|
|
512
514
|
---
|
|
513
515
|
|
|
514
|
-
#### `sdk.boundingBox.
|
|
516
|
+
#### `sdk.boundingBox.updateSingle(spaceItemId, data)`
|
|
515
517
|
|
|
516
|
-
Update an existing bounding box. Changing `gltfUrl` swaps the mesh in place and refits the collider.
|
|
518
|
+
Update an existing single bounding box. Changing `gltfUrl` swaps the mesh in place and refits the collider.
|
|
517
519
|
|
|
518
520
|
```typescript
|
|
519
|
-
await sdk.boundingBox.
|
|
521
|
+
await sdk.boundingBox.updateSingle("item-id", {
|
|
520
522
|
orgId: "org-id",
|
|
521
523
|
spaceId: "space-id",
|
|
522
524
|
spaceItemId: "item-id",
|
|
@@ -524,20 +526,22 @@ await sdk.boundingBox.updateObject("item-id", {
|
|
|
524
526
|
});
|
|
525
527
|
```
|
|
526
528
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
529
|
+
**Returns:** `Promise<void>`
|
|
530
|
+
|
|
531
|
+
---
|
|
532
|
+
|
|
533
|
+
#### `sdk.boundingBox.updateMulti(spaceItemId, data)`
|
|
534
|
+
|
|
535
|
+
Update an existing multi bounding box.
|
|
536
|
+
|
|
537
|
+
```typescript
|
|
538
|
+
await sdk.boundingBox.updateMulti("item-id", {
|
|
539
|
+
orgId: "org-id",
|
|
540
|
+
spaceId: "space-id",
|
|
541
|
+
spaceItemId: "item-id",
|
|
542
|
+
gltfUrls: ["https://.../chair3.glb"],
|
|
543
|
+
});
|
|
544
|
+
```
|
|
541
545
|
|
|
542
546
|
Only the fields you send are changed — the backend merges them into the stored item before pushing the full payload to Unreal.
|
|
543
547
|
|
|
@@ -1056,14 +1060,8 @@ type UpdateSketchfabObjectInput = {
|
|
|
1056
1060
|
```typescript
|
|
1057
1061
|
type BoundingBoxType = "BoundingBoxRuntimeModel" | "MultiModelBoundingBox";
|
|
1058
1062
|
|
|
1059
|
-
type
|
|
1060
|
-
orgId: string;
|
|
1061
|
-
spaceId: string;
|
|
1063
|
+
type BaseCreateBoundingBoxInput = Omit<SpaceContext, "type"> & {
|
|
1062
1064
|
spaceItemId: string;
|
|
1063
|
-
name: string;
|
|
1064
|
-
type: BoundingBoxType;
|
|
1065
|
-
// Required for BoundingBoxRuntimeModel; unused by MultiModelBoundingBox.
|
|
1066
|
-
gltfUrl?: string;
|
|
1067
1065
|
materialOverrideId: string;
|
|
1068
1066
|
scale: Vector3;
|
|
1069
1067
|
autoScale: boolean;
|
|
@@ -1071,32 +1069,40 @@ type CreateBoundingBoxObjectInput = {
|
|
|
1071
1069
|
offsetUniformScale: number;
|
|
1072
1070
|
collisionsEnabled: boolean;
|
|
1073
1071
|
disableClick: boolean;
|
|
1074
|
-
// Not on the multi-model struct — Unreal never reads or writes these for it.
|
|
1075
|
-
currentAnimation?: string;
|
|
1076
|
-
availableAnimations?: string[];
|
|
1077
1072
|
thumb?: string;
|
|
1078
|
-
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
export type CreateSingleBoundingBoxInput = BaseCreateBoundingBoxInput & {
|
|
1076
|
+
type: "BoundingBoxRuntimeModel";
|
|
1077
|
+
gltfUrl?: string;
|
|
1078
|
+
};
|
|
1079
|
+
|
|
1080
|
+
export type CreateMultiBoundingBoxInput = BaseCreateBoundingBoxInput & {
|
|
1081
|
+
type: "MultiModelBoundingBox";
|
|
1079
1082
|
gltfUrls: string[];
|
|
1080
|
-
|
|
1081
|
-
rotation: Vector3;
|
|
1082
|
-
offsetUpRotation: number;
|
|
1083
|
-
isLocked?: boolean;
|
|
1084
|
-
user?: string;
|
|
1083
|
+
highlightedGltfUrl: string;
|
|
1085
1084
|
};
|
|
1086
1085
|
|
|
1087
|
-
type
|
|
1086
|
+
type BaseUpdateBoundingBoxInput = {
|
|
1088
1087
|
orgId: string;
|
|
1089
1088
|
spaceId: string;
|
|
1090
1089
|
spaceItemId: string;
|
|
1091
|
-
gltfUrl?: string;
|
|
1092
1090
|
materialOverrideId?: string;
|
|
1093
1091
|
scale?: Vector3;
|
|
1094
1092
|
autoScale?: boolean;
|
|
1095
1093
|
offsetUniformScale?: number;
|
|
1096
1094
|
collisionsEnabled?: boolean;
|
|
1097
|
-
currentAnimation?: string;
|
|
1098
1095
|
disableClick?: boolean;
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
export type UpdateSingleBoundingBoxInput = BaseUpdateBoundingBoxInput & {
|
|
1099
|
+
gltfUrl?: string;
|
|
1100
|
+
highlightedNodeNames?: string[];
|
|
1101
|
+
};
|
|
1102
|
+
|
|
1103
|
+
export type UpdateMultiBoundingBoxInput = BaseUpdateBoundingBoxInput & {
|
|
1099
1104
|
gltfUrls?: string[];
|
|
1105
|
+
highlightedGltfUrl?: string;
|
|
1100
1106
|
};
|
|
1101
1107
|
```
|
|
1102
1108
|
|
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
type ConfiguratorServiceSDKConfig = {
|
|
5
5
|
apiKey: string;
|
|
6
|
-
jwksUri: string;
|
|
7
6
|
accessTokenProvider: () => string | Promise<string>;
|
|
8
7
|
timeout?: number;
|
|
9
8
|
/** @internal - dev only, not for production use */
|
|
@@ -30,10 +29,8 @@ type SpaceContext = {
|
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
type BoundingBoxType = "BoundingBoxRuntimeModel" | "MultiModelBoundingBox";
|
|
33
|
-
type
|
|
32
|
+
type BaseCreateBoundingBoxInput = Omit<SpaceContext, "type"> & {
|
|
34
33
|
spaceItemId: string;
|
|
35
|
-
type: BoundingBoxType;
|
|
36
|
-
gltfUrl?: string;
|
|
37
34
|
materialOverrideId: string;
|
|
38
35
|
scale: Vector3;
|
|
39
36
|
autoScale: boolean;
|
|
@@ -41,24 +38,35 @@ type CreateBoundingBoxObjectInput = Omit<SpaceContext, "type"> & {
|
|
|
41
38
|
offsetUniformScale: number;
|
|
42
39
|
collisionsEnabled: boolean;
|
|
43
40
|
disableClick: boolean;
|
|
44
|
-
currentAnimation?: string;
|
|
45
|
-
availableAnimations?: string[];
|
|
46
41
|
thumb?: string;
|
|
42
|
+
};
|
|
43
|
+
type CreateSingleBoundingBoxInput = BaseCreateBoundingBoxInput & {
|
|
44
|
+
type: "BoundingBoxRuntimeModel";
|
|
45
|
+
gltfUrl?: string;
|
|
46
|
+
highlightedNodeNames?: string[];
|
|
47
|
+
};
|
|
48
|
+
type CreateMultiBoundingBoxInput = BaseCreateBoundingBoxInput & {
|
|
49
|
+
type: "MultiModelBoundingBox";
|
|
47
50
|
gltfUrls: string[];
|
|
51
|
+
highlightedGltfUrl?: string;
|
|
48
52
|
};
|
|
49
|
-
type
|
|
53
|
+
type BaseUpdateBoundingBoxInput = {
|
|
50
54
|
orgId: string;
|
|
51
55
|
spaceId: string;
|
|
52
|
-
spaceItemId: string;
|
|
53
|
-
gltfUrl?: string;
|
|
54
56
|
materialOverrideId?: string;
|
|
55
57
|
scale?: Vector3;
|
|
56
58
|
autoScale?: boolean;
|
|
57
59
|
offsetUniformScale?: number;
|
|
58
60
|
collisionsEnabled?: boolean;
|
|
59
|
-
currentAnimation?: string;
|
|
60
61
|
disableClick?: boolean;
|
|
62
|
+
};
|
|
63
|
+
type UpdateSingleBoundingBoxInput = BaseUpdateBoundingBoxInput & {
|
|
64
|
+
gltfUrl?: string;
|
|
65
|
+
highlightedNodeNames?: string[];
|
|
66
|
+
};
|
|
67
|
+
type UpdateMultiBoundingBoxInput = BaseUpdateBoundingBoxInput & {
|
|
61
68
|
gltfUrls?: string[];
|
|
69
|
+
highlightedGltfUrl?: string;
|
|
62
70
|
};
|
|
63
71
|
|
|
64
72
|
/**
|
|
@@ -66,8 +74,10 @@ type UpdateBoundingBoxObjectInput = {
|
|
|
66
74
|
*/
|
|
67
75
|
|
|
68
76
|
interface BoundingBoxHandle {
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
addSingle(data: CreateSingleBoundingBoxInput): Promise<void>;
|
|
78
|
+
addMulti(data: CreateMultiBoundingBoxInput): Promise<void>;
|
|
79
|
+
updateSingle(spaceItemId: string, data: UpdateSingleBoundingBoxInput): Promise<void>;
|
|
80
|
+
updateMulti(spaceItemId: string, data: UpdateMultiBoundingBoxInput): Promise<void>;
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
type SpatialMediaTypes = "video" | "link";
|
|
@@ -391,4 +401,4 @@ declare const ConfiguratorSDK: {
|
|
|
391
401
|
readonly create: (config: ConfiguratorServiceSDKConfig) => ConfiguratorSDKHandle;
|
|
392
402
|
};
|
|
393
403
|
|
|
394
|
-
export { type AlliumError, type BoundingBoxType, type ConfiguratorSDKHandle, type ConfiguratorServiceSDKConfig, type
|
|
404
|
+
export { type AlliumError, type BoundingBoxType, type ConfiguratorSDKHandle, type ConfiguratorServiceSDKConfig, type CreateConfiguratorItemInput, type CreateConfiguratorObjectInput, type CreateLinkInput, type CreateMultiBoundingBoxInput, type CreateSingleBoundingBoxInput, type CreateSketchfabObjectInput, type CreateStreamInput, type CreateVideoInput, type DeleteAllLayerItemsInput, type DeleteLayerItemInput, type LockLayerItemInput, type RenameLayerItemInput, type SnapToGroundInput, type UpdateConfiguratorItemStateInput, type UpdateConfiguratorObjectConfigInput, type UpdateLinkInput, type UpdateMultiBoundingBoxInput, type UpdatePositionInput, type UpdateRotationInput, type UpdateScaleInput, type UpdateSingleBoundingBoxInput, type UpdateSketchfabObjectInput, type UpdateStreamInput, type UpdateVideoInput, createConfiguratorSDK, ConfiguratorSDK as default, isAlliumError };
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
type ConfiguratorServiceSDKConfig = {
|
|
5
5
|
apiKey: string;
|
|
6
|
-
jwksUri: string;
|
|
7
6
|
accessTokenProvider: () => string | Promise<string>;
|
|
8
7
|
timeout?: number;
|
|
9
8
|
/** @internal - dev only, not for production use */
|
|
@@ -30,10 +29,8 @@ type SpaceContext = {
|
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
type BoundingBoxType = "BoundingBoxRuntimeModel" | "MultiModelBoundingBox";
|
|
33
|
-
type
|
|
32
|
+
type BaseCreateBoundingBoxInput = Omit<SpaceContext, "type"> & {
|
|
34
33
|
spaceItemId: string;
|
|
35
|
-
type: BoundingBoxType;
|
|
36
|
-
gltfUrl?: string;
|
|
37
34
|
materialOverrideId: string;
|
|
38
35
|
scale: Vector3;
|
|
39
36
|
autoScale: boolean;
|
|
@@ -41,24 +38,35 @@ type CreateBoundingBoxObjectInput = Omit<SpaceContext, "type"> & {
|
|
|
41
38
|
offsetUniformScale: number;
|
|
42
39
|
collisionsEnabled: boolean;
|
|
43
40
|
disableClick: boolean;
|
|
44
|
-
currentAnimation?: string;
|
|
45
|
-
availableAnimations?: string[];
|
|
46
41
|
thumb?: string;
|
|
42
|
+
};
|
|
43
|
+
type CreateSingleBoundingBoxInput = BaseCreateBoundingBoxInput & {
|
|
44
|
+
type: "BoundingBoxRuntimeModel";
|
|
45
|
+
gltfUrl?: string;
|
|
46
|
+
highlightedNodeNames?: string[];
|
|
47
|
+
};
|
|
48
|
+
type CreateMultiBoundingBoxInput = BaseCreateBoundingBoxInput & {
|
|
49
|
+
type: "MultiModelBoundingBox";
|
|
47
50
|
gltfUrls: string[];
|
|
51
|
+
highlightedGltfUrl?: string;
|
|
48
52
|
};
|
|
49
|
-
type
|
|
53
|
+
type BaseUpdateBoundingBoxInput = {
|
|
50
54
|
orgId: string;
|
|
51
55
|
spaceId: string;
|
|
52
|
-
spaceItemId: string;
|
|
53
|
-
gltfUrl?: string;
|
|
54
56
|
materialOverrideId?: string;
|
|
55
57
|
scale?: Vector3;
|
|
56
58
|
autoScale?: boolean;
|
|
57
59
|
offsetUniformScale?: number;
|
|
58
60
|
collisionsEnabled?: boolean;
|
|
59
|
-
currentAnimation?: string;
|
|
60
61
|
disableClick?: boolean;
|
|
62
|
+
};
|
|
63
|
+
type UpdateSingleBoundingBoxInput = BaseUpdateBoundingBoxInput & {
|
|
64
|
+
gltfUrl?: string;
|
|
65
|
+
highlightedNodeNames?: string[];
|
|
66
|
+
};
|
|
67
|
+
type UpdateMultiBoundingBoxInput = BaseUpdateBoundingBoxInput & {
|
|
61
68
|
gltfUrls?: string[];
|
|
69
|
+
highlightedGltfUrl?: string;
|
|
62
70
|
};
|
|
63
71
|
|
|
64
72
|
/**
|
|
@@ -66,8 +74,10 @@ type UpdateBoundingBoxObjectInput = {
|
|
|
66
74
|
*/
|
|
67
75
|
|
|
68
76
|
interface BoundingBoxHandle {
|
|
69
|
-
|
|
70
|
-
|
|
77
|
+
addSingle(data: CreateSingleBoundingBoxInput): Promise<void>;
|
|
78
|
+
addMulti(data: CreateMultiBoundingBoxInput): Promise<void>;
|
|
79
|
+
updateSingle(spaceItemId: string, data: UpdateSingleBoundingBoxInput): Promise<void>;
|
|
80
|
+
updateMulti(spaceItemId: string, data: UpdateMultiBoundingBoxInput): Promise<void>;
|
|
71
81
|
}
|
|
72
82
|
|
|
73
83
|
type SpatialMediaTypes = "video" | "link";
|
|
@@ -391,4 +401,4 @@ declare const ConfiguratorSDK: {
|
|
|
391
401
|
readonly create: (config: ConfiguratorServiceSDKConfig) => ConfiguratorSDKHandle;
|
|
392
402
|
};
|
|
393
403
|
|
|
394
|
-
export { type AlliumError, type BoundingBoxType, type ConfiguratorSDKHandle, type ConfiguratorServiceSDKConfig, type
|
|
404
|
+
export { type AlliumError, type BoundingBoxType, type ConfiguratorSDKHandle, type ConfiguratorServiceSDKConfig, type CreateConfiguratorItemInput, type CreateConfiguratorObjectInput, type CreateLinkInput, type CreateMultiBoundingBoxInput, type CreateSingleBoundingBoxInput, type CreateSketchfabObjectInput, type CreateStreamInput, type CreateVideoInput, type DeleteAllLayerItemsInput, type DeleteLayerItemInput, type LockLayerItemInput, type RenameLayerItemInput, type SnapToGroundInput, type UpdateConfiguratorItemStateInput, type UpdateConfiguratorObjectConfigInput, type UpdateLinkInput, type UpdateMultiBoundingBoxInput, type UpdatePositionInput, type UpdateRotationInput, type UpdateScaleInput, type UpdateSingleBoundingBoxInput, type UpdateSketchfabObjectInput, type UpdateStreamInput, type UpdateVideoInput, createConfiguratorSDK, ConfiguratorSDK as default, isAlliumError };
|
package/dist/index.js
CHANGED
|
@@ -71,8 +71,7 @@ function createHttpClient(config) {
|
|
|
71
71
|
timeout: config.timeout ?? 3e4,
|
|
72
72
|
headers: {
|
|
73
73
|
"Content-Type": "application/json",
|
|
74
|
-
"x-
|
|
75
|
-
...config.jwksUri?.trim() && { "x-jwks-uri": config.jwksUri.trim() }
|
|
74
|
+
"x-allium-key": config.apiKey.trim()
|
|
76
75
|
}
|
|
77
76
|
});
|
|
78
77
|
client.interceptors.request.use(async (req) => {
|
|
@@ -132,15 +131,23 @@ function createHttpClient(config) {
|
|
|
132
131
|
|
|
133
132
|
// src/modules/boundingBox.ts
|
|
134
133
|
function createBoundingBoxModule(http) {
|
|
135
|
-
async function
|
|
136
|
-
await http.post("/boundingbox/
|
|
134
|
+
async function addSingle(data) {
|
|
135
|
+
await http.post("/boundingbox/single", data);
|
|
137
136
|
debugLog();
|
|
138
137
|
}
|
|
139
|
-
async function
|
|
140
|
-
await http.
|
|
138
|
+
async function addMulti(data) {
|
|
139
|
+
await http.post("/boundingbox/multi", data);
|
|
141
140
|
debugLog();
|
|
142
141
|
}
|
|
143
|
-
|
|
142
|
+
async function updateSingle(spaceItemId, data) {
|
|
143
|
+
await http.patch(`/boundingbox/single/${spaceItemId}`, data);
|
|
144
|
+
debugLog();
|
|
145
|
+
}
|
|
146
|
+
async function updateMulti(spaceItemId, data) {
|
|
147
|
+
await http.patch(`/boundingbox/multi/${spaceItemId}`, data);
|
|
148
|
+
debugLog();
|
|
149
|
+
}
|
|
150
|
+
return { addSingle, addMulti, updateSingle, updateMulti };
|
|
144
151
|
}
|
|
145
152
|
|
|
146
153
|
// src/modules/media.ts
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/utils/debug.ts","../src/core/http.ts","../src/modules/boundingBox.ts","../src/modules/media.ts","../src/modules/sketchfab.ts","../src/modules/transform.ts","../src/modules/layer.ts","../src/modules/configuratorItems.ts","../src/modules/configuratorObjects.ts","../src/index.ts"],"names":["axios"],"mappings":";;;;;;;;;;;;;AAQA,SAAS,SAAA,CACP,IAAA,EACA,IAAA,EACA,OAAA,EACA,KAAA,EACa;AACb,EAAA,MAAM,GAAA,GAAM,IAAI,KAAA,CAAM,OAAO,CAAA;AAC7B,EAAA,GAAA,CAAI,IAAA,GAAO,IAAA;AACX,EAAC,IAAY,IAAA,GAAO,IAAA;AACpB,EAAA,IAAI,KAAA,KAAU,MAAA,EAAY,GAAA,CAAY,KAAA,GAAQ,KAAA;AAC9C,EAAA,OAAO,GAAA;AACT;AAYO,SAAS,eAAA,CAAgB,SAAiB,KAAA,EAA8B;AAC7E,EAAA,OAAO,SAAA,CAAU,iBAAA,EAAmB,YAAA,EAAc,OAAA,EAAS,KAAK,CAAA;AAClE;AAGO,SAAS,kBAAA,CACd,SACA,KAAA,EACa;AACb,EAAA,OAAO,SAAA,CAAU,oBAAA,EAAsB,eAAA,EAAiB,OAAA,EAAS,KAAK,CAAA;AACxE;AAGO,SAAS,qBAAA,CACd,SACA,KAAA,EACa;AACb,EAAA,OAAO,SAAA,CAAU,uBAAA,EAAyB,kBAAA,EAAoB,OAAA,EAAS,KAAK,CAAA;AAC9E;AAGO,SAAS,iBAAA,CACd,SACA,KAAA,EACa;AACb,EAAA,OAAO,SAAA,CAAU,mBAAA,EAAqB,cAAA,EAAgB,OAAA,EAAS,KAAK,CAAA;AACtE;AAGO,SAAS,iBAAA,CACd,SACA,KAAA,EACa;AACb,EAAA,OAAO,SAAA,CAAU,mBAAA,EAAqB,gBAAA,EAAkB,OAAA,EAAS,KAAK,CAAA;AACxE;AAGO,SAAS,cAAc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error factories.\n */\n\nexport interface AlliumError extends Error {\n readonly code: string;\n}\n\nfunction makeError(\n name: string,\n code: string,\n message: string,\n cause?: unknown,\n): AlliumError {\n const err = new Error(message) as AlliumError;\n err.name = name;\n (err as any).code = code;\n if (cause !== undefined) (err as any).cause = cause;\n return err;\n}\n\n/** Generic SDK error — use when no specific category fits */\nexport function createSDKError(\n message: string,\n code = \"SDK_ERROR\",\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumSDKError\", code, message, cause);\n}\n\n/** Thrown when the API key is missing, invalid, or rejected by the server */\nexport function createAuthError(message: string, cause?: unknown): AlliumError {\n return makeError(\"AlliumAuthError\", \"AUTH_ERROR\", message, cause);\n}\n\n/** Thrown when the HTTP request itself fails (network, timeout, 5xx) */\nexport function createRequestError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumRequestError\", \"REQUEST_ERROR\", message, cause);\n}\n\n/** Thrown when the server returns a 4xx for bad input data */\nexport function createValidationError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumValidationError\", \"VALIDATION_ERROR\", message, cause);\n}\n\n/** Thrown for upload-specific failures (initiate, complete, abort) */\nexport function createUploadError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumUploadError\", \"UPLOAD_ERROR\", message, cause);\n}\n\n/** Thrown when SDK_BASE_URL or apiKey is not configured correctly */\nexport function createConfigError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumConfigError\", \"INVALID_CONFIG\", message, cause);\n}\n\n/** Type guard — works for all Allium error factories */\nexport function isAlliumError(err: unknown): err is AlliumError {\n return err instanceof Error && \"code\" in err;\n}\n","/**\n * Centralised debug logging utility.\n */\n\ndeclare global {\n interface Window {\n ALLIUM_DEBUG?: boolean;\n }\n}\n\nexport const isDebugEnabled = (): boolean => {\n // Node.js environment\n if (typeof process !== \"undefined\" && process.env?.ALLIUM_DEBUG === \"true\") {\n return true;\n }\n // Browser environment\n if (typeof window !== \"undefined\" && window.ALLIUM_DEBUG === true) {\n return true;\n }\n return false;\n};\n\nexport const debugLog = (\n category: string,\n message: string,\n data?: unknown,\n): void => {\n if (!isDebugEnabled()) return;\n const timestamp = new Date().toISOString().slice(11, 23);\n if (data !== undefined) {\n } else {\n }\n};\n","/**\n * HTTP client factory.\n *\n * Creates and configures the axios instance used by all modules.\n * Handles:\n * - Base URL (baked in at build time)\n * - API key injection on every request via header\n * - Timeout\n * - Response unwrapping (your backend wraps all responses in { data: ... })\n * - Error normalization into AlliumError types\n */\n\nimport axios, { AxiosInstance, AxiosError } from \"axios\";\nimport { ConfiguratorServiceSDKConfig } from \"../types/common\";\nimport {\n createAuthError,\n createConfigError,\n createRequestError,\n createValidationError,\n createUploadError,\n} from \"../errors\";\nimport { debugLog } from \"../utils\";\n\n// ─── Build-time URL ───────────────────────────────────────────────────────────\n\ndeclare const process: { env: { CONFIGURATOR_SERVICE_BASE_URL: string } };\nconst PROD_BASE_URL: string = process.env.CONFIGURATOR_SERVICE_BASE_URL;\n\n// ─── Factory ──────────────────────────────────────────────────────────────────\n\nexport function createHttpClient(\n config: ConfiguratorServiceSDKConfig,\n): AxiosInstance {\n const BASE_URL = config._devBaseUrl ?? PROD_BASE_URL;\n if (!BASE_URL) {\n throw createConfigError(\n \"[SDK] Base URL not configured. This SDK build is missing CONFIGURATOR_SERVICE_BASE_URL.\",\n );\n }\n\n if (\n !config.apiKey ||\n typeof config.apiKey !== \"string\" ||\n !config.apiKey.trim()\n ) {\n throw createConfigError(\"[SDK] A valid apiKey is required.\");\n }\n\n if (typeof config.accessTokenProvider !== \"function\")\n throw createConfigError(\"[SDK] accessTokenProvider must be a function.\");\n\n const client = axios.create({\n baseURL: BASE_URL,\n timeout: config.timeout ?? 30_000,\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-sdk-key\": config.apiKey.trim(),\n ...(config.jwksUri?.trim() && { \"x-jwks-uri\": config.jwksUri.trim() }),\n },\n });\n\n // ── Request interceptor — debug logging ───────────────────────────────────\n client.interceptors.request.use(async (req) => {\n const token = await config.accessTokenProvider();\n if (token) {\n req.headers[\"Authorization\"] = `Bearer ${token}`;\n }\n debugLog(\n \"HTTP\",\n `→ ${req.method?.toUpperCase()} ${req.url}`,\n req.params ?? req.data,\n );\n return req;\n });\n\n // ── Response interceptor — unwrap + normalize errors ──────────────────────\n client.interceptors.response.use(\n (res) => {\n debugLog(\"HTTP\", `← ${res.status} ${res.config.url}`);\n return res;\n },\n (err: AxiosError) => {\n const status = err.response?.status;\n const message =\n (err.response?.data as any)?.message ?? err.message ?? \"Unknown error\";\n const url = err.config?.url ?? \"\";\n\n debugLog(\"HTTP\", `← ERROR ${status ?? \"network\"} ${url}`, message);\n\n if (!status) {\n // Network error — no response received at all\n throw createRequestError(\n `[SDK] Network error reaching ${url}: ${message}`,\n err,\n );\n }\n\n if (status === 401 || status === 403) {\n throw createAuthError(\n `[SDK] Authentication failed (${status}): ${message}`,\n err,\n );\n }\n\n if (status === 422 || status === 400) {\n throw createValidationError(\n `[SDK] Validation error (${status}): ${message}`,\n err,\n );\n }\n\n if (url.includes(\"/uploader\")) {\n throw createUploadError(\n `[SDK] Upload operation failed (${status}): ${message}`,\n err,\n );\n }\n\n throw createRequestError(\n `[SDK] Request failed (${status}): ${message}`,\n err,\n );\n },\n );\n\n return client;\n}\n","/**\n * Bounding Box Module - Bounding Box 3D Object Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateBoundingBoxObjectInput,\n UpdateBoundingBoxObjectInput,\n} from \"../types/boundingBox\";\nimport { debugLog } from \"../utils\";\n\nexport interface BoundingBoxHandle {\n addObject(data: CreateBoundingBoxObjectInput): Promise<void>;\n updateObject(\n spaceItemId: string,\n data: UpdateBoundingBoxObjectInput,\n ): Promise<void>;\n}\n\nexport function createBoundingBoxModule(\n http: AxiosInstance,\n): BoundingBoxHandle {\n async function addObject(data: CreateBoundingBoxObjectInput): Promise<void> {\n await http.post(\"/boundingbox/object\", data);\n debugLog(\"BoundingBox\", \"addObject\", data);\n }\n\n async function updateObject(\n spaceItemId: string,\n data: UpdateBoundingBoxObjectInput,\n ): Promise<void> {\n await http.patch(`/boundingbox/${spaceItemId}`, data);\n debugLog(\"BoundingBox\", \"updateObject\", data);\n }\n\n return { addObject, updateObject };\n}\n","/**\n * Media Module - Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateLinkInput,\n CreateStreamInput,\n CreateVideoInput,\n UpdateLinkInput,\n UpdateStreamInput,\n UpdateVideoInput,\n} from \"../types/media\";\nimport { debugLog } from \"../utils\";\n\nexport interface MediaHandle {\n addVideo(data: CreateVideoInput): Promise<void>;\n updateVideo(spaceItemId: string, data: UpdateVideoInput): Promise<void>;\n addStream(data: CreateStreamInput): Promise<void>;\n updateStream(spaceItemId: string, data: UpdateStreamInput): Promise<void>;\n addLink(data: CreateLinkInput): Promise<void>;\n updateLink(spaceItemId: string, data: UpdateLinkInput): Promise<void>;\n}\n\nexport function createMediaModule(http: AxiosInstance): MediaHandle {\n async function addVideo(data: CreateVideoInput): Promise<void> {\n await http.post(\"/media/video\", data);\n debugLog(\"Media\", \"addVideo\", data);\n }\n\n async function updateVideo(\n spaceItemId: string,\n data: UpdateVideoInput,\n ): Promise<void> {\n await http.patch(`/media/video/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateVideo\", data);\n }\n\n async function addStream(data: CreateStreamInput): Promise<void> {\n await http.post(\"/media/stream\", data);\n debugLog(\"Media\", \"addStream\", data);\n }\n\n async function updateStream(\n spaceItemId: string,\n data: UpdateStreamInput,\n ): Promise<void> {\n await http.patch(`/media/stream/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateStream\", data);\n }\n\n async function addLink(data: CreateLinkInput): Promise<void> {\n await http.post(\"/media/link\", data);\n debugLog(\"Media\", \"addLink\", data);\n }\n\n async function updateLink(\n spaceItemId: string,\n data: UpdateLinkInput,\n ): Promise<void> {\n await http.patch(`/media/link/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateLink\", data);\n }\n\n return {\n addVideo,\n updateVideo,\n addStream,\n updateStream,\n addLink,\n updateLink,\n };\n}\n","/**\n * Sketchfab Module - 3D Object Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateSketchfabObjectInput,\n UpdateSketchfabObjectInput,\n} from \"../types/sketchfab\";\nimport { debugLog } from \"../utils\";\n\nexport interface SketchfabHandle {\n addObject(data: CreateSketchfabObjectInput): Promise<void>;\n updateObject(\n spaceItemId: string,\n data: UpdateSketchfabObjectInput,\n ): Promise<void>;\n}\n\nexport function createSketchfabModule(http: AxiosInstance): SketchfabHandle {\n async function addObject(data: CreateSketchfabObjectInput): Promise<void> {\n await http.post(\"/sketchfab/object\", data);\n debugLog(\"Sketchfab\", \"addObject\", data);\n }\n\n async function updateObject(\n spaceItemId: string,\n data: UpdateSketchfabObjectInput,\n ): Promise<void> {\n await http.patch(`/sketchfab/${spaceItemId}`, data);\n debugLog(\"Sketchfab\", \"updateObject\", data);\n }\n\n return { addObject, updateObject };\n}\n","/**\n * Transform Module - Position, Rotation, Scale Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n UpdatePositionInput,\n UpdateRotationInput,\n UpdateScaleInput,\n SnapToGroundInput,\n} from \"../types/transform\";\nimport { debugLog } from \"../utils\";\n\nexport interface TransformHandle {\n updatePosition(spaceItemId: string, data: UpdatePositionInput): Promise<void>;\n updateRotation(spaceItemId: string, data: UpdateRotationInput): Promise<void>;\n updateScale(spaceItemId: string, data: UpdateScaleInput): Promise<void>;\n snapToGround(spaceItemId: string, data: SnapToGroundInput): Promise<void>;\n}\n\nexport function createTransformModule(http: AxiosInstance): TransformHandle {\n async function updatePosition(\n spaceItemId: string,\n data: UpdatePositionInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/position`, data);\n debugLog(\"Transform\", \"updatePosition\", data);\n }\n\n async function updateRotation(\n spaceItemId: string,\n data: UpdateRotationInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/rotation`, data);\n debugLog(\"Transform\", \"updateRotation\", data);\n }\n\n async function updateScale(\n spaceItemId: string,\n data: UpdateScaleInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/scale`, data);\n debugLog(\"Transform\", \"updateScale\", data);\n }\n\n async function snapToGround(\n spaceItemId: string,\n data: SnapToGroundInput,\n ): Promise<void> {\n await http.post(`/transform/${spaceItemId}/snap`, data);\n debugLog(\"Transform\", \"snapToGround\", data);\n }\n\n return { updatePosition, updateRotation, updateScale, snapToGround };\n}\n","/**\n * Layer Module - Lock, Rename, Delete Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n LockLayerItemInput,\n RenameLayerItemInput,\n DeleteLayerItemInput,\n DeleteAllLayerItemsInput,\n} from \"../types/layer\";\nimport { debugLog } from \"../utils\";\n\nexport interface LayerHandle {\n lockItem(spaceItemId: string, data: LockLayerItemInput): Promise<void>;\n renameItem(spaceItemId: string, data: RenameLayerItemInput): Promise<void>;\n deleteItem(spaceItemId: string, data: DeleteLayerItemInput): Promise<void>;\n deleteAll(data: DeleteAllLayerItemsInput): Promise<void>;\n}\n\nexport function createLayerModule(http: AxiosInstance): LayerHandle {\n async function lockItem(\n spaceItemId: string,\n data: LockLayerItemInput,\n ): Promise<void> {\n await http.patch(`/layer/${spaceItemId}/lock`, data);\n debugLog(\"Layer\", \"lockItem\", data);\n }\n\n async function renameItem(\n spaceItemId: string,\n data: RenameLayerItemInput,\n ): Promise<void> {\n await http.patch(`/layer/${spaceItemId}/rename`, data);\n debugLog(\"Layer\", \"renameItem\", data);\n }\n\n async function deleteItem(\n spaceItemId: string,\n data: DeleteLayerItemInput,\n ): Promise<void> {\n await http.delete(`/layer/${spaceItemId}`, { data });\n debugLog(\"Layer\", \"deleteItem\", data);\n }\n\n async function deleteAll(data: DeleteAllLayerItemsInput): Promise<void> {\n await http.delete(\"/layer\", { data });\n debugLog(\"Layer\", \"deleteAll\", data);\n }\n\n return { lockItem, renameItem, deleteItem, deleteAll };\n}\n","/**\n * Configurator Items Module - Level-wide property operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateConfiguratorItemInput,\n UpdateConfiguratorItemStateInput,\n} from \"../types/configuratorItems\";\nimport { debugLog } from \"../utils\";\n\nexport interface ConfiguratorItemsHandle {\n create(data: CreateConfiguratorItemInput): Promise<void>;\n updateState(\n spaceItemId: string,\n data: UpdateConfiguratorItemStateInput,\n ): Promise<void>;\n}\n\nexport function createConfiguratorItemsModule(\n http: AxiosInstance,\n): ConfiguratorItemsHandle {\n async function create(data: CreateConfiguratorItemInput): Promise<void> {\n await http.post(\"/configurator_items\", data);\n debugLog(\"ConfiguratorItems\", \"create\", data);\n }\n\n async function updateState(\n spaceItemId: string,\n data: UpdateConfiguratorItemStateInput,\n ): Promise<void> {\n await http.patch(`/configurator_items/${spaceItemId}/state`, data);\n debugLog(\"ConfiguratorItems\", \"updateState\", data);\n }\n\n return { create, updateState };\n}\n","/**\n * Configurator Objects Module - UE Actor placement and configuration\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateConfiguratorObjectInput,\n UpdateConfiguratorObjectConfigInput,\n} from \"../types/configuratorObjects\";\nimport { debugLog } from \"../utils\";\n\nexport interface ConfiguratorObjectsHandle {\n create(data: CreateConfiguratorObjectInput): Promise<void>;\n updateConfiguration(\n spaceItemId: string,\n data: UpdateConfiguratorObjectConfigInput,\n ): Promise<void>;\n}\n\nexport function createConfiguratorObjectsModule(\n http: AxiosInstance,\n): ConfiguratorObjectsHandle {\n async function create(data: CreateConfiguratorObjectInput): Promise<void> {\n await http.post(\"/configurator_objects\", data);\n debugLog(\"ConfiguratorObjects\", \"create\", data);\n }\n\n async function updateConfiguration(\n spaceItemId: string,\n data: UpdateConfiguratorObjectConfigInput,\n ): Promise<void> {\n await http.patch(\n `/configurator_objects/${spaceItemId}/configuration`,\n data,\n );\n debugLog(\"ConfiguratorObjects\", \"updateConfiguration\", data);\n }\n\n return { create, updateConfiguration };\n}\n","import { createHttpClient } from \"./core/http\";\nimport {\n createBoundingBoxModule,\n BoundingBoxHandle,\n} from \"./modules/boundingBox\";\nimport { createMediaModule, MediaHandle } from \"./modules/media\";\nimport { createSketchfabModule, SketchfabHandle } from \"./modules/sketchfab\";\nimport { createTransformModule, TransformHandle } from \"./modules/transform\";\nimport { createLayerModule, LayerHandle } from \"./modules/layer\";\nimport {\n createConfiguratorItemsModule,\n ConfiguratorItemsHandle,\n} from \"./modules/configuratorItems\";\nimport {\n createConfiguratorObjectsModule,\n ConfiguratorObjectsHandle,\n} from \"./modules/configuratorObjects\";\nimport { ConfiguratorServiceSDKConfig } from \"./types/common\";\nimport { debugLog } from \"./utils\";\n\n// ─── Public handle interface ──────────────────────────────────────────────────\n\nexport interface ConfiguratorSDKHandle {\n readonly sdkKey: string;\n readonly serviceType: \"CONFIGURATOR_SERVICE\";\n media: MediaHandle;\n sketchfab: SketchfabHandle;\n boundingBox: BoundingBoxHandle;\n transform: TransformHandle;\n layer: LayerHandle;\n configuratorItems: ConfiguratorItemsHandle;\n configuratorObjects: ConfiguratorObjectsHandle;\n}\n\n// ─── Factory function ─────────────────────────────────────────────────────────\n\nexport function createConfiguratorSDK(\n config: ConfiguratorServiceSDKConfig,\n): ConfiguratorSDKHandle {\n const http = createHttpClient(config);\n\n debugLog(\"ConfiguratorSDK\", \"Initialized\", {\n timeout: config.timeout ?? 30_000,\n });\n\n return {\n sdkKey: config.apiKey.trim(),\n serviceType: \"CONFIGURATOR_SERVICE\" as const,\n media: createMediaModule(http),\n sketchfab: createSketchfabModule(http),\n boundingBox: createBoundingBoxModule(http),\n transform: createTransformModule(http),\n layer: createLayerModule(http),\n configuratorItems: createConfiguratorItemsModule(http),\n configuratorObjects: createConfiguratorObjectsModule(http),\n };\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n\nconst ConfiguratorSDK = {\n /**\n * Create a new SDK client instance.\n * @param config SDK configuration — apiKey is required, timeout is optional.\n */\n create(config: ConfiguratorServiceSDKConfig): ConfiguratorSDKHandle {\n return createConfiguratorSDK(config);\n },\n} as const;\n\nexport default ConfiguratorSDK;\n\n// ─── Type exports ─────────────────────────────────────────────────────────────\n\nexport type { ConfiguratorServiceSDKConfig } from \"./types/common\";\n\n// Media\nexport type {\n CreateVideoInput,\n UpdateVideoInput,\n CreateLinkInput,\n UpdateLinkInput,\n CreateStreamInput,\n UpdateStreamInput,\n} from \"./types/media\";\n\n// Sketchfab\nexport type {\n CreateSketchfabObjectInput,\n UpdateSketchfabObjectInput,\n} from \"./types/sketchfab\";\n\n// Bounding Box\nexport type {\n BoundingBoxType,\n CreateBoundingBoxObjectInput,\n UpdateBoundingBoxObjectInput,\n} from \"./types/boundingBox\";\n\n// Transform\nexport type {\n UpdatePositionInput,\n UpdateRotationInput,\n UpdateScaleInput,\n SnapToGroundInput,\n} from \"./types/transform\";\n\n// Layer\nexport type {\n LockLayerItemInput,\n RenameLayerItemInput,\n DeleteLayerItemInput,\n DeleteAllLayerItemsInput,\n} from \"./types/layer\";\n\n// Configurator\nexport type {\n CreateConfiguratorItemInput,\n UpdateConfiguratorItemStateInput,\n} from \"./types/configuratorItems\";\n\nexport type {\n CreateConfiguratorObjectInput,\n UpdateConfiguratorObjectConfigInput,\n} from \"./types/configuratorObjects\";\n\nexport { isAlliumError } from \"./errors\";\nexport type { AlliumError } from \"./errors\";\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/utils/debug.ts","../src/core/http.ts","../src/modules/boundingBox.ts","../src/modules/media.ts","../src/modules/sketchfab.ts","../src/modules/transform.ts","../src/modules/layer.ts","../src/modules/configuratorItems.ts","../src/modules/configuratorObjects.ts","../src/index.ts"],"names":["axios"],"mappings":";;;;;;;;;;;;;AAQA,SAAS,SAAA,CACP,IAAA,EACA,IAAA,EACA,OAAA,EACA,KAAA,EACa;AACb,EAAA,MAAM,GAAA,GAAM,IAAI,KAAA,CAAM,OAAO,CAAA;AAC7B,EAAA,GAAA,CAAI,IAAA,GAAO,IAAA;AACX,EA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AA,EACe;AACf,IAAA,MAAM,IAAA,CAAK,KAAA;AAAA,MACT,yBAAyB,WAAW,CAAA,cAAA,CAAA;AAAA,MACpC;AAAA,KACF;AACA,IAAA,QAAA,CAA2D,CAAA;AAAA,EAC7D;AAEA,EAAA,OAAO,EAAE,QAAQ,mBAAA,EAAoB;AACvC;;;ACHO,SAAS,sBACd,MAAA,EACuB;AACvB,EAAA,MAAM,IAAA,GAAO,iBAAiB,MAAM,CAAA;AAEpC,EAAA,QAAA,CAAS,mBAAmB,aAAA,EAAe;AAAA,IACzC,OAAA,EAAS,OAAO,OAAA,IAAW;AAAA,GAC5B,CAAA;AAED,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,MAAA,CAAO,MAAA,CAAO,IAAA,EAAK;AAAA,IAC3B,WAAA,EAAa,sBAAA;AAAA,IACb,KAAA,EAAO,kBAAkB,IAAI,CAAA;AAAA,IAC7B,SAAA,EAAW,sBAAsB,IAAI,CAAA;AAAA,IACrC,WAAA,EAAa,wBAAwB,IAAI,CAAA;AAAA,IACzC,SAAA,EAAW,sBAAsB,IAAI,CAAA;AAAA,IACrC,KAAA,EAAO,kBAAkB,IAAI,CAAA;AAAA,IAC7B,iBAAA,EAAmB,8BAA8B,IAAI,CAAA;AAAA,IACrD,mBAAA,EAAqB,gCAAgC,IAAI;AAAA,GAC3D;AACF;AAIA,IAAM,eAAA,GAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtB,OAAO,MAAA,EAA6D;AAClE,IAAA,OAAO,sBAAsB,MAAM,CAAA;AAAA,EACrC;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.js","sourcesContent":["/**\n * SDK Error factories.\n */\n\nexport interface AlliumError extends Error {\n readonly code: string;\n}\n\nfunction makeError(\n name: string,\n code: string,\n message: string,\n cause?: unknown,\n): AlliumError {\n const err = new Error(message) as AlliumError;\n err.name = name;\n (err as any).code = code;\n if (cause !== undefined) (err as any).cause = cause;\n return err;\n}\n\n/** Generic SDK error — use when no specific category fits */\nexport function createSDKError(\n message: string,\n code = \"SDK_ERROR\",\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumSDKError\", code, message, cause);\n}\n\n/** Thrown when the API key is missing, invalid, or rejected by the server */\nexport function createAuthError(message: string, cause?: unknown): AlliumError {\n return makeError(\"AlliumAuthError\", \"AUTH_ERROR\", message, cause);\n}\n\n/** Thrown when the HTTP request itself fails (network, timeout, 5xx) */\nexport function createRequestError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumRequestError\", \"REQUEST_ERROR\", message, cause);\n}\n\n/** Thrown when the server returns a 4xx for bad input data */\nexport function createValidationError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumValidationError\", \"VALIDATION_ERROR\", message, cause);\n}\n\n/** Thrown for upload-specific failures (initiate, complete, abort) */\nexport function createUploadError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumUploadError\", \"UPLOAD_ERROR\", message, cause);\n}\n\n/** Thrown when SDK_BASE_URL or apiKey is not configured correctly */\nexport function createConfigError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumConfigError\", \"INVALID_CONFIG\", message, cause);\n}\n\n/** Type guard — works for all Allium error factories */\nexport function isAlliumError(err: unknown): err is AlliumError {\n return err instanceof Error && \"code\" in err;\n}\n","/**\n * Centralised debug logging utility.\n */\n\ndeclare global {\n interface Window {\n ALLIUM_DEBUG?: boolean;\n }\n}\n\nexport const isDebugEnabled = (): boolean => {\n // Node.js environment\n if (typeof process !== \"undefined\" && process.env?.ALLIUM_DEBUG === \"true\") {\n return true;\n }\n // Browser environment\n if (typeof window !== \"undefined\" && window.ALLIUM_DEBUG === true) {\n return true;\n }\n return false;\n};\n\nexport const debugLog = (\n category: string,\n message: string,\n data?: unknown,\n): void => {\n if (!isDebugEnabled()) return;\n const timestamp = new Date().toISOString().slice(11, 23);\n if (data !== undefined) {\n } else {\n }\n};\n","/**\n * HTTP client factory.\n *\n * Creates and configures the axios instance used by all modules.\n * Handles:\n * - Base URL (baked in at build time)\n * - API key injection on every request via header\n * - Timeout\n * - Response unwrapping (your backend wraps all responses in { data: ... })\n * - Error normalization into AlliumError types\n */\n\nimport axios, { AxiosInstance, AxiosError } from \"axios\";\nimport { ConfiguratorServiceSDKConfig } from \"../types/common\";\nimport {\n createAuthError,\n createConfigError,\n createRequestError,\n createValidationError,\n createUploadError,\n} from \"../errors\";\nimport { debugLog } from \"../utils\";\n\n// ─── Build-time URL ───────────────────────────────────────────────────────────\n\ndeclare const process: { env: { CONFIGURATOR_SERVICE_BASE_URL: string } };\nconst PROD_BASE_URL: string = process.env.CONFIGURATOR_SERVICE_BASE_URL;\n\n// ─── Factory ──────────────────────────────────────────────────────────────────\n\nexport function createHttpClient(\n config: ConfiguratorServiceSDKConfig,\n): AxiosInstance {\n const BASE_URL = config._devBaseUrl ?? PROD_BASE_URL;\n if (!BASE_URL) {\n throw createConfigError(\n \"[SDK] Base URL not configured. This SDK build is missing CONFIGURATOR_SERVICE_BASE_URL.\",\n );\n }\n\n if (\n !config.apiKey ||\n typeof config.apiKey !== \"string\" ||\n !config.apiKey.trim()\n ) {\n throw createConfigError(\"[SDK] A valid apiKey is required.\");\n }\n\n if (typeof config.accessTokenProvider !== \"function\")\n throw createConfigError(\"[SDK] accessTokenProvider must be a function.\");\n\n const client = axios.create({\n baseURL: BASE_URL,\n timeout: config.timeout ?? 30_000,\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-allium-key\": config.apiKey.trim(),\n },\n });\n\n // ── Request interceptor — debug logging ───────────────────────────────────\n client.interceptors.request.use(async (req) => {\n const token = await config.accessTokenProvider();\n if (token) {\n req.headers[\"Authorization\"] = `Bearer ${token}`;\n }\n debugLog(\n \"HTTP\",\n `→ ${req.method?.toUpperCase()} ${req.url}`,\n req.params ?? req.data,\n );\n return req;\n });\n\n // ── Response interceptor — unwrap + normalize errors ──────────────────────\n client.interceptors.response.use(\n (res) => {\n debugLog(\"HTTP\", `← ${res.status} ${res.config.url}`);\n return res;\n },\n (err: AxiosError) => {\n const status = err.response?.status;\n const message =\n (err.response?.data as any)?.message ?? err.message ?? \"Unknown error\";\n const url = err.config?.url ?? \"\";\n\n debugLog(\"HTTP\", `← ERROR ${status ?? \"network\"} ${url}`, message);\n\n if (!status) {\n // Network error — no response received at all\n throw createRequestError(\n `[SDK] Network error reaching ${url}: ${message}`,\n err,\n );\n }\n\n if (status === 401 || status === 403) {\n throw createAuthError(\n `[SDK] Authentication failed (${status}): ${message}`,\n err,\n );\n }\n\n if (status === 422 || status === 400) {\n throw createValidationError(\n `[SDK] Validation error (${status}): ${message}`,\n err,\n );\n }\n\n if (url.includes(\"/uploader\")) {\n throw createUploadError(\n `[SDK] Upload operation failed (${status}): ${message}`,\n err,\n );\n }\n\n throw createRequestError(\n `[SDK] Request failed (${status}): ${message}`,\n err,\n );\n },\n );\n\n return client;\n}\n","/**\n * Bounding Box Module - Bounding Box 3D Object Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateSingleBoundingBoxInput,\n CreateMultiBoundingBoxInput,\n UpdateSingleBoundingBoxInput,\n UpdateMultiBoundingBoxInput,\n} from \"../types/boundingBox\";\nimport { debugLog } from \"../utils\";\n\nexport interface BoundingBoxHandle {\n addSingle(data: CreateSingleBoundingBoxInput): Promise<void>;\n addMulti(data: CreateMultiBoundingBoxInput): Promise<void>;\n updateSingle(\n spaceItemId: string,\n data: UpdateSingleBoundingBoxInput,\n ): Promise<void>;\n updateMulti(\n spaceItemId: string,\n data: UpdateMultiBoundingBoxInput,\n ): Promise<void>;\n}\n\nexport function createBoundingBoxModule(\n http: AxiosInstance,\n): BoundingBoxHandle {\n async function addSingle(data: CreateSingleBoundingBoxInput): Promise<void> {\n await http.post(\"/boundingbox/single\", data);\n debugLog(\"BoundingBox\", \"addSingle\", data);\n }\n\n async function addMulti(data: CreateMultiBoundingBoxInput): Promise<void> {\n await http.post(\"/boundingbox/multi\", data);\n debugLog(\"BoundingBox\", \"addMulti\", data);\n }\n\n async function updateSingle(\n spaceItemId: string,\n data: UpdateSingleBoundingBoxInput,\n ): Promise<void> {\n await http.patch(`/boundingbox/single/${spaceItemId}`, data);\n debugLog(\"BoundingBox\", \"updateSingle\", data);\n }\n\n async function updateMulti(\n spaceItemId: string,\n data: UpdateMultiBoundingBoxInput,\n ): Promise<void> {\n await http.patch(`/boundingbox/multi/${spaceItemId}`, data);\n debugLog(\"BoundingBox\", \"updateMulti\", data);\n }\n\n return { addSingle, addMulti, updateSingle, updateMulti };\n}\n","/**\n * Media Module - Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateLinkInput,\n CreateStreamInput,\n CreateVideoInput,\n UpdateLinkInput,\n UpdateStreamInput,\n UpdateVideoInput,\n} from \"../types/media\";\nimport { debugLog } from \"../utils\";\n\nexport interface MediaHandle {\n addVideo(data: CreateVideoInput): Promise<void>;\n updateVideo(spaceItemId: string, data: UpdateVideoInput): Promise<void>;\n addStream(data: CreateStreamInput): Promise<void>;\n updateStream(spaceItemId: string, data: UpdateStreamInput): Promise<void>;\n addLink(data: CreateLinkInput): Promise<void>;\n updateLink(spaceItemId: string, data: UpdateLinkInput): Promise<void>;\n}\n\nexport function createMediaModule(http: AxiosInstance): MediaHandle {\n async function addVideo(data: CreateVideoInput): Promise<void> {\n await http.post(\"/media/video\", data);\n debugLog(\"Media\", \"addVideo\", data);\n }\n\n async function updateVideo(\n spaceItemId: string,\n data: UpdateVideoInput,\n ): Promise<void> {\n await http.patch(`/media/video/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateVideo\", data);\n }\n\n async function addStream(data: CreateStreamInput): Promise<void> {\n await http.post(\"/media/stream\", data);\n debugLog(\"Media\", \"addStream\", data);\n }\n\n async function updateStream(\n spaceItemId: string,\n data: UpdateStreamInput,\n ): Promise<void> {\n await http.patch(`/media/stream/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateStream\", data);\n }\n\n async function addLink(data: CreateLinkInput): Promise<void> {\n await http.post(\"/media/link\", data);\n debugLog(\"Media\", \"addLink\", data);\n }\n\n async function updateLink(\n spaceItemId: string,\n data: UpdateLinkInput,\n ): Promise<void> {\n await http.patch(`/media/link/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateLink\", data);\n }\n\n return {\n addVideo,\n updateVideo,\n addStream,\n updateStream,\n addLink,\n updateLink,\n };\n}\n","/**\n * Sketchfab Module - 3D Object Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateSketchfabObjectInput,\n UpdateSketchfabObjectInput,\n} from \"../types/sketchfab\";\nimport { debugLog } from \"../utils\";\n\nexport interface SketchfabHandle {\n addObject(data: CreateSketchfabObjectInput): Promise<void>;\n updateObject(\n spaceItemId: string,\n data: UpdateSketchfabObjectInput,\n ): Promise<void>;\n}\n\nexport function createSketchfabModule(http: AxiosInstance): SketchfabHandle {\n async function addObject(data: CreateSketchfabObjectInput): Promise<void> {\n await http.post(\"/sketchfab/object\", data);\n debugLog(\"Sketchfab\", \"addObject\", data);\n }\n\n async function updateObject(\n spaceItemId: string,\n data: UpdateSketchfabObjectInput,\n ): Promise<void> {\n await http.patch(`/sketchfab/${spaceItemId}`, data);\n debugLog(\"Sketchfab\", \"updateObject\", data);\n }\n\n return { addObject, updateObject };\n}\n","/**\n * Transform Module - Position, Rotation, Scale Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n UpdatePositionInput,\n UpdateRotationInput,\n UpdateScaleInput,\n SnapToGroundInput,\n} from \"../types/transform\";\nimport { debugLog } from \"../utils\";\n\nexport interface TransformHandle {\n updatePosition(spaceItemId: string, data: UpdatePositionInput): Promise<void>;\n updateRotation(spaceItemId: string, data: UpdateRotationInput): Promise<void>;\n updateScale(spaceItemId: string, data: UpdateScaleInput): Promise<void>;\n snapToGround(spaceItemId: string, data: SnapToGroundInput): Promise<void>;\n}\n\nexport function createTransformModule(http: AxiosInstance): TransformHandle {\n async function updatePosition(\n spaceItemId: string,\n data: UpdatePositionInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/position`, data);\n debugLog(\"Transform\", \"updatePosition\", data);\n }\n\n async function updateRotation(\n spaceItemId: string,\n data: UpdateRotationInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/rotation`, data);\n debugLog(\"Transform\", \"updateRotation\", data);\n }\n\n async function updateScale(\n spaceItemId: string,\n data: UpdateScaleInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/scale`, data);\n debugLog(\"Transform\", \"updateScale\", data);\n }\n\n async function snapToGround(\n spaceItemId: string,\n data: SnapToGroundInput,\n ): Promise<void> {\n await http.post(`/transform/${spaceItemId}/snap`, data);\n debugLog(\"Transform\", \"snapToGround\", data);\n }\n\n return { updatePosition, updateRotation, updateScale, snapToGround };\n}\n","/**\n * Layer Module - Lock, Rename, Delete Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n LockLayerItemInput,\n RenameLayerItemInput,\n DeleteLayerItemInput,\n DeleteAllLayerItemsInput,\n} from \"../types/layer\";\nimport { debugLog } from \"../utils\";\n\nexport interface LayerHandle {\n lockItem(spaceItemId: string, data: LockLayerItemInput): Promise<void>;\n renameItem(spaceItemId: string, data: RenameLayerItemInput): Promise<void>;\n deleteItem(spaceItemId: string, data: DeleteLayerItemInput): Promise<void>;\n deleteAll(data: DeleteAllLayerItemsInput): Promise<void>;\n}\n\nexport function createLayerModule(http: AxiosInstance): LayerHandle {\n async function lockItem(\n spaceItemId: string,\n data: LockLayerItemInput,\n ): Promise<void> {\n await http.patch(`/layer/${spaceItemId}/lock`, data);\n debugLog(\"Layer\", \"lockItem\", data);\n }\n\n async function renameItem(\n spaceItemId: string,\n data: RenameLayerItemInput,\n ): Promise<void> {\n await http.patch(`/layer/${spaceItemId}/rename`, data);\n debugLog(\"Layer\", \"renameItem\", data);\n }\n\n async function deleteItem(\n spaceItemId: string,\n data: DeleteLayerItemInput,\n ): Promise<void> {\n await http.delete(`/layer/${spaceItemId}`, { data });\n debugLog(\"Layer\", \"deleteItem\", data);\n }\n\n async function deleteAll(data: DeleteAllLayerItemsInput): Promise<void> {\n await http.delete(\"/layer\", { data });\n debugLog(\"Layer\", \"deleteAll\", data);\n }\n\n return { lockItem, renameItem, deleteItem, deleteAll };\n}\n","/**\n * Configurator Items Module - Level-wide property operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateConfiguratorItemInput,\n UpdateConfiguratorItemStateInput,\n} from \"../types/configuratorItems\";\nimport { debugLog } from \"../utils\";\n\nexport interface ConfiguratorItemsHandle {\n create(data: CreateConfiguratorItemInput): Promise<void>;\n updateState(\n spaceItemId: string,\n data: UpdateConfiguratorItemStateInput,\n ): Promise<void>;\n}\n\nexport function createConfiguratorItemsModule(\n http: AxiosInstance,\n): ConfiguratorItemsHandle {\n async function create(data: CreateConfiguratorItemInput): Promise<void> {\n await http.post(\"/configurator_items\", data);\n debugLog(\"ConfiguratorItems\", \"create\", data);\n }\n\n async function updateState(\n spaceItemId: string,\n data: UpdateConfiguratorItemStateInput,\n ): Promise<void> {\n await http.patch(`/configurator_items/${spaceItemId}/state`, data);\n debugLog(\"ConfiguratorItems\", \"updateState\", data);\n }\n\n return { create, updateState };\n}\n","/**\n * Configurator Objects Module - UE Actor placement and configuration\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateConfiguratorObjectInput,\n UpdateConfiguratorObjectConfigInput,\n} from \"../types/configuratorObjects\";\nimport { debugLog } from \"../utils\";\n\nexport interface ConfiguratorObjectsHandle {\n create(data: CreateConfiguratorObjectInput): Promise<void>;\n updateConfiguration(\n spaceItemId: string,\n data: UpdateConfiguratorObjectConfigInput,\n ): Promise<void>;\n}\n\nexport function createConfiguratorObjectsModule(\n http: AxiosInstance,\n): ConfiguratorObjectsHandle {\n async function create(data: CreateConfiguratorObjectInput): Promise<void> {\n await http.post(\"/configurator_objects\", data);\n debugLog(\"ConfiguratorObjects\", \"create\", data);\n }\n\n async function updateConfiguration(\n spaceItemId: string,\n data: UpdateConfiguratorObjectConfigInput,\n ): Promise<void> {\n await http.patch(\n `/configurator_objects/${spaceItemId}/configuration`,\n data,\n );\n debugLog(\"ConfiguratorObjects\", \"updateConfiguration\", data);\n }\n\n return { create, updateConfiguration };\n}\n","import { createHttpClient } from \"./core/http\";\nimport {\n createBoundingBoxModule,\n BoundingBoxHandle,\n} from \"./modules/boundingBox\";\nimport { createMediaModule, MediaHandle } from \"./modules/media\";\nimport { createSketchfabModule, SketchfabHandle } from \"./modules/sketchfab\";\nimport { createTransformModule, TransformHandle } from \"./modules/transform\";\nimport { createLayerModule, LayerHandle } from \"./modules/layer\";\nimport {\n createConfiguratorItemsModule,\n ConfiguratorItemsHandle,\n} from \"./modules/configuratorItems\";\nimport {\n createConfiguratorObjectsModule,\n ConfiguratorObjectsHandle,\n} from \"./modules/configuratorObjects\";\nimport { ConfiguratorServiceSDKConfig } from \"./types/common\";\nimport { debugLog } from \"./utils\";\n\n// ─── Public handle interface ──────────────────────────────────────────────────\n\nexport interface ConfiguratorSDKHandle {\n readonly sdkKey: string;\n readonly serviceType: \"CONFIGURATOR_SERVICE\";\n media: MediaHandle;\n sketchfab: SketchfabHandle;\n boundingBox: BoundingBoxHandle;\n transform: TransformHandle;\n layer: LayerHandle;\n configuratorItems: ConfiguratorItemsHandle;\n configuratorObjects: ConfiguratorObjectsHandle;\n}\n\n// ─── Factory function ─────────────────────────────────────────────────────────\n\nexport function createConfiguratorSDK(\n config: ConfiguratorServiceSDKConfig,\n): ConfiguratorSDKHandle {\n const http = createHttpClient(config);\n\n debugLog(\"ConfiguratorSDK\", \"Initialized\", {\n timeout: config.timeout ?? 30_000,\n });\n\n return {\n sdkKey: config.apiKey.trim(),\n serviceType: \"CONFIGURATOR_SERVICE\" as const,\n media: createMediaModule(http),\n sketchfab: createSketchfabModule(http),\n boundingBox: createBoundingBoxModule(http),\n transform: createTransformModule(http),\n layer: createLayerModule(http),\n configuratorItems: createConfiguratorItemsModule(http),\n configuratorObjects: createConfiguratorObjectsModule(http),\n };\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n\nconst ConfiguratorSDK = {\n /**\n * Create a new SDK client instance.\n * @param config SDK configuration — apiKey is required, timeout is optional.\n */\n create(config: ConfiguratorServiceSDKConfig): ConfiguratorSDKHandle {\n return createConfiguratorSDK(config);\n },\n} as const;\n\nexport default ConfiguratorSDK;\n\n// ─── Type exports ─────────────────────────────────────────────────────────────\n\nexport type { ConfiguratorServiceSDKConfig } from \"./types/common\";\n\n// Media\nexport type {\n CreateVideoInput,\n UpdateVideoInput,\n CreateLinkInput,\n UpdateLinkInput,\n CreateStreamInput,\n UpdateStreamInput,\n} from \"./types/media\";\n\n// Sketchfab\nexport type {\n CreateSketchfabObjectInput,\n UpdateSketchfabObjectInput,\n} from \"./types/sketchfab\";\n\n// Bounding Box\nexport type {\n BoundingBoxType,\n CreateSingleBoundingBoxInput,\n CreateMultiBoundingBoxInput,\n UpdateSingleBoundingBoxInput,\n UpdateMultiBoundingBoxInput,\n} from \"./types/boundingBox\";\n\n// Transform\nexport type {\n UpdatePositionInput,\n UpdateRotationInput,\n UpdateScaleInput,\n SnapToGroundInput,\n} from \"./types/transform\";\n\n// Layer\nexport type {\n LockLayerItemInput,\n RenameLayerItemInput,\n DeleteLayerItemInput,\n DeleteAllLayerItemsInput,\n} from \"./types/layer\";\n\n// Configurator\nexport type {\n CreateConfiguratorItemInput,\n UpdateConfiguratorItemStateInput,\n} from \"./types/configuratorItems\";\n\nexport type {\n CreateConfiguratorObjectInput,\n UpdateConfiguratorObjectConfigInput,\n} from \"./types/configuratorObjects\";\n\nexport { isAlliumError } from \"./errors\";\nexport type { AlliumError } from \"./errors\";\n"]}
|
package/dist/index.mjs
CHANGED
|
@@ -63,8 +63,7 @@ function createHttpClient(config) {
|
|
|
63
63
|
timeout: config.timeout ?? 3e4,
|
|
64
64
|
headers: {
|
|
65
65
|
"Content-Type": "application/json",
|
|
66
|
-
"x-
|
|
67
|
-
...config.jwksUri?.trim() && { "x-jwks-uri": config.jwksUri.trim() }
|
|
66
|
+
"x-allium-key": config.apiKey.trim()
|
|
68
67
|
}
|
|
69
68
|
});
|
|
70
69
|
client.interceptors.request.use(async (req) => {
|
|
@@ -124,15 +123,23 @@ function createHttpClient(config) {
|
|
|
124
123
|
|
|
125
124
|
// src/modules/boundingBox.ts
|
|
126
125
|
function createBoundingBoxModule(http) {
|
|
127
|
-
async function
|
|
128
|
-
await http.post("/boundingbox/
|
|
126
|
+
async function addSingle(data) {
|
|
127
|
+
await http.post("/boundingbox/single", data);
|
|
129
128
|
debugLog();
|
|
130
129
|
}
|
|
131
|
-
async function
|
|
132
|
-
await http.
|
|
130
|
+
async function addMulti(data) {
|
|
131
|
+
await http.post("/boundingbox/multi", data);
|
|
133
132
|
debugLog();
|
|
134
133
|
}
|
|
135
|
-
|
|
134
|
+
async function updateSingle(spaceItemId, data) {
|
|
135
|
+
await http.patch(`/boundingbox/single/${spaceItemId}`, data);
|
|
136
|
+
debugLog();
|
|
137
|
+
}
|
|
138
|
+
async function updateMulti(spaceItemId, data) {
|
|
139
|
+
await http.patch(`/boundingbox/multi/${spaceItemId}`, data);
|
|
140
|
+
debugLog();
|
|
141
|
+
}
|
|
142
|
+
return { addSingle, addMulti, updateSingle, updateMulti };
|
|
136
143
|
}
|
|
137
144
|
|
|
138
145
|
// src/modules/media.ts
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/errors.ts","../src/utils/debug.ts","../src/core/http.ts","../src/modules/boundingBox.ts","../src/modules/media.ts","../src/modules/sketchfab.ts","../src/modules/transform.ts","../src/modules/layer.ts","../src/modules/configuratorItems.ts","../src/modules/configuratorObjects.ts","../src/index.ts"],"names":[],"mappings":";;;;;AAQA,SAAS,SAAA,CACP,IAAA,EACA,IAAA,EACA,OAAA,EACA,KAAA,EACa;AACb,EAAA,MAAM,GAAA,GAAM,IAAI,KAAA,CAAM,OAAO,CAAA;AAC7B,EAAA,GAAA,C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,SAAS,sBACd,MAAA,EACuB;AACvB,EAAA,MAAM,IAAA,GAAO,iBAAiB,MAAM,CAAA;AAEpC,EAAA,QAAA,CAAS,mBAAmB,aAAA,EAAe;AAAA,IACzC,OAAA,EAAS,OAAO,OAAA,IAAW;AAAA,GAC5B,CAAA;AAED,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,MAAA,CAAO,MAAA,CAAO,IAAA,EAAK;AAAA,IAC3B,WAAA,EAAa,sBAAA;AAAA,IACb,KAAA,EAAO,kBAAkB,IAAI,CAAA;AAAA,IAC7B,SAAA,EAAW,sBAAsB,IAAI,CAAA;AAAA,IACrC,WAAA,EAAa,wBAAwB,IAAI,CAAA;AAAA,IACzC,SAAA,EAAW,sBAAsB,IAAI,CAAA;AAAA,IACrC,KAAA,EAAO,kBAAkB,IAAI,CAAA;AAAA,IAC7B,iBAAA,EAAmB,8BAA8B,IAAI,CAAA;AAAA,IACrD,mBAAA,EAAqB,gCAAgC,IAAI;AAAA,GAC3D;AACF;AAIA,IAAM,eAAA,GAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtB,OAAO,MAAA,EAA6D;AAClE,IAAA,OAAO,sBAAsB,MAAM,CAAA;AAAA,EACrC;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.mjs","sourcesContent":["/**\n * SDK Error factories.\n */\n\nexport interface AlliumError extends Error {\n readonly code: string;\n}\n\nfunction makeError(\n name: string,\n code: string,\n message: string,\n cause?: unknown,\n): AlliumError {\n const err = new Error(message) as AlliumError;\n err.name = name;\n (err as any).code = code;\n if (cause !== undefined) (err as any).cause = cause;\n return err;\n}\n\n/** Generic SDK error — use when no specific category fits */\nexport function createSDKError(\n message: string,\n code = \"SDK_ERROR\",\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumSDKError\", code, message, cause);\n}\n\n/** Thrown when the API key is missing, invalid, or rejected by the server */\nexport function createAuthError(message: string, cause?: unknown): AlliumError {\n return makeError(\"AlliumAuthError\", \"AUTH_ERROR\", message, cause);\n}\n\n/** Thrown when the HTTP request itself fails (network, timeout, 5xx) */\nexport function createRequestError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumRequestError\", \"REQUEST_ERROR\", message, cause);\n}\n\n/** Thrown when the server returns a 4xx for bad input data */\nexport function createValidationError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumValidationError\", \"VALIDATION_ERROR\", message, cause);\n}\n\n/** Thrown for upload-specific failures (initiate, complete, abort) */\nexport function createUploadError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumUploadError\", \"UPLOAD_ERROR\", message, cause);\n}\n\n/** Thrown when SDK_BASE_URL or apiKey is not configured correctly */\nexport function createConfigError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumConfigError\", \"INVALID_CONFIG\", message, cause);\n}\n\n/** Type guard — works for all Allium error factories */\nexport function isAlliumError(err: unknown): err is AlliumError {\n return err instanceof Error && \"code\" in err;\n}\n","/**\n * Centralised debug logging utility.\n */\n\ndeclare global {\n interface Window {\n ALLIUM_DEBUG?: boolean;\n }\n}\n\nexport const isDebugEnabled = (): boolean => {\n // Node.js environment\n if (typeof process !== \"undefined\" && process.env?.ALLIUM_DEBUG === \"true\") {\n return true;\n }\n // Browser environment\n if (typeof window !== \"undefined\" && window.ALLIUM_DEBUG === true) {\n return true;\n }\n return false;\n};\n\nexport const debugLog = (\n category: string,\n message: string,\n data?: unknown,\n): void => {\n if (!isDebugEnabled()) return;\n const timestamp = new Date().toISOString().slice(11, 23);\n if (data !== undefined) {\n } else {\n }\n};\n","/**\n * HTTP client factory.\n *\n * Creates and configures the axios instance used by all modules.\n * Handles:\n * - Base URL (baked in at build time)\n * - API key injection on every request via header\n * - Timeout\n * - Response unwrapping (your backend wraps all responses in { data: ... })\n * - Error normalization into AlliumError types\n */\n\nimport axios, { AxiosInstance, AxiosError } from \"axios\";\nimport { ConfiguratorServiceSDKConfig } from \"../types/common\";\nimport {\n createAuthError,\n createConfigError,\n createRequestError,\n createValidationError,\n createUploadError,\n} from \"../errors\";\nimport { debugLog } from \"../utils\";\n\n// ─── Build-time URL ───────────────────────────────────────────────────────────\n\ndeclare const process: { env: { CONFIGURATOR_SERVICE_BASE_URL: string } };\nconst PROD_BASE_URL: string = process.env.CONFIGURATOR_SERVICE_BASE_URL;\n\n// ─── Factory ──────────────────────────────────────────────────────────────────\n\nexport function createHttpClient(\n config: ConfiguratorServiceSDKConfig,\n): AxiosInstance {\n const BASE_URL = config._devBaseUrl ?? PROD_BASE_URL;\n if (!BASE_URL) {\n throw createConfigError(\n \"[SDK] Base URL not configured. This SDK build is missing CONFIGURATOR_SERVICE_BASE_URL.\",\n );\n }\n\n if (\n !config.apiKey ||\n typeof config.apiKey !== \"string\" ||\n !config.apiKey.trim()\n ) {\n throw createConfigError(\"[SDK] A valid apiKey is required.\");\n }\n\n if (typeof config.accessTokenProvider !== \"function\")\n throw createConfigError(\"[SDK] accessTokenProvider must be a function.\");\n\n const client = axios.create({\n baseURL: BASE_URL,\n timeout: config.timeout ?? 30_000,\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-sdk-key\": config.apiKey.trim(),\n ...(config.jwksUri?.trim() && { \"x-jwks-uri\": config.jwksUri.trim() }),\n },\n });\n\n // ── Request interceptor — debug logging ───────────────────────────────────\n client.interceptors.request.use(async (req) => {\n const token = await config.accessTokenProvider();\n if (token) {\n req.headers[\"Authorization\"] = `Bearer ${token}`;\n }\n debugLog(\n \"HTTP\",\n `→ ${req.method?.toUpperCase()} ${req.url}`,\n req.params ?? req.data,\n );\n return req;\n });\n\n // ── Response interceptor — unwrap + normalize errors ──────────────────────\n client.interceptors.response.use(\n (res) => {\n debugLog(\"HTTP\", `← ${res.status} ${res.config.url}`);\n return res;\n },\n (err: AxiosError) => {\n const status = err.response?.status;\n const message =\n (err.response?.data as any)?.message ?? err.message ?? \"Unknown error\";\n const url = err.config?.url ?? \"\";\n\n debugLog(\"HTTP\", `← ERROR ${status ?? \"network\"} ${url}`, message);\n\n if (!status) {\n // Network error — no response received at all\n throw createRequestError(\n `[SDK] Network error reaching ${url}: ${message}`,\n err,\n );\n }\n\n if (status === 401 || status === 403) {\n throw createAuthError(\n `[SDK] Authentication failed (${status}): ${message}`,\n err,\n );\n }\n\n if (status === 422 || status === 400) {\n throw createValidationError(\n `[SDK] Validation error (${status}): ${message}`,\n err,\n );\n }\n\n if (url.includes(\"/uploader\")) {\n throw createUploadError(\n `[SDK] Upload operation failed (${status}): ${message}`,\n err,\n );\n }\n\n throw createRequestError(\n `[SDK] Request failed (${status}): ${message}`,\n err,\n );\n },\n );\n\n return client;\n}\n","/**\n * Bounding Box Module - Bounding Box 3D Object Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateBoundingBoxObjectInput,\n UpdateBoundingBoxObjectInput,\n} from \"../types/boundingBox\";\nimport { debugLog } from \"../utils\";\n\nexport interface BoundingBoxHandle {\n addObject(data: CreateBoundingBoxObjectInput): Promise<void>;\n updateObject(\n spaceItemId: string,\n data: UpdateBoundingBoxObjectInput,\n ): Promise<void>;\n}\n\nexport function createBoundingBoxModule(\n http: AxiosInstance,\n): BoundingBoxHandle {\n async function addObject(data: CreateBoundingBoxObjectInput): Promise<void> {\n await http.post(\"/boundingbox/object\", data);\n debugLog(\"BoundingBox\", \"addObject\", data);\n }\n\n async function updateObject(\n spaceItemId: string,\n data: UpdateBoundingBoxObjectInput,\n ): Promise<void> {\n await http.patch(`/boundingbox/${spaceItemId}`, data);\n debugLog(\"BoundingBox\", \"updateObject\", data);\n }\n\n return { addObject, updateObject };\n}\n","/**\n * Media Module - Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateLinkInput,\n CreateStreamInput,\n CreateVideoInput,\n UpdateLinkInput,\n UpdateStreamInput,\n UpdateVideoInput,\n} from \"../types/media\";\nimport { debugLog } from \"../utils\";\n\nexport interface MediaHandle {\n addVideo(data: CreateVideoInput): Promise<void>;\n updateVideo(spaceItemId: string, data: UpdateVideoInput): Promise<void>;\n addStream(data: CreateStreamInput): Promise<void>;\n updateStream(spaceItemId: string, data: UpdateStreamInput): Promise<void>;\n addLink(data: CreateLinkInput): Promise<void>;\n updateLink(spaceItemId: string, data: UpdateLinkInput): Promise<void>;\n}\n\nexport function createMediaModule(http: AxiosInstance): MediaHandle {\n async function addVideo(data: CreateVideoInput): Promise<void> {\n await http.post(\"/media/video\", data);\n debugLog(\"Media\", \"addVideo\", data);\n }\n\n async function updateVideo(\n spaceItemId: string,\n data: UpdateVideoInput,\n ): Promise<void> {\n await http.patch(`/media/video/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateVideo\", data);\n }\n\n async function addStream(data: CreateStreamInput): Promise<void> {\n await http.post(\"/media/stream\", data);\n debugLog(\"Media\", \"addStream\", data);\n }\n\n async function updateStream(\n spaceItemId: string,\n data: UpdateStreamInput,\n ): Promise<void> {\n await http.patch(`/media/stream/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateStream\", data);\n }\n\n async function addLink(data: CreateLinkInput): Promise<void> {\n await http.post(\"/media/link\", data);\n debugLog(\"Media\", \"addLink\", data);\n }\n\n async function updateLink(\n spaceItemId: string,\n data: UpdateLinkInput,\n ): Promise<void> {\n await http.patch(`/media/link/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateLink\", data);\n }\n\n return {\n addVideo,\n updateVideo,\n addStream,\n updateStream,\n addLink,\n updateLink,\n };\n}\n","/**\n * Sketchfab Module - 3D Object Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateSketchfabObjectInput,\n UpdateSketchfabObjectInput,\n} from \"../types/sketchfab\";\nimport { debugLog } from \"../utils\";\n\nexport interface SketchfabHandle {\n addObject(data: CreateSketchfabObjectInput): Promise<void>;\n updateObject(\n spaceItemId: string,\n data: UpdateSketchfabObjectInput,\n ): Promise<void>;\n}\n\nexport function createSketchfabModule(http: AxiosInstance): SketchfabHandle {\n async function addObject(data: CreateSketchfabObjectInput): Promise<void> {\n await http.post(\"/sketchfab/object\", data);\n debugLog(\"Sketchfab\", \"addObject\", data);\n }\n\n async function updateObject(\n spaceItemId: string,\n data: UpdateSketchfabObjectInput,\n ): Promise<void> {\n await http.patch(`/sketchfab/${spaceItemId}`, data);\n debugLog(\"Sketchfab\", \"updateObject\", data);\n }\n\n return { addObject, updateObject };\n}\n","/**\n * Transform Module - Position, Rotation, Scale Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n UpdatePositionInput,\n UpdateRotationInput,\n UpdateScaleInput,\n SnapToGroundInput,\n} from \"../types/transform\";\nimport { debugLog } from \"../utils\";\n\nexport interface TransformHandle {\n updatePosition(spaceItemId: string, data: UpdatePositionInput): Promise<void>;\n updateRotation(spaceItemId: string, data: UpdateRotationInput): Promise<void>;\n updateScale(spaceItemId: string, data: UpdateScaleInput): Promise<void>;\n snapToGround(spaceItemId: string, data: SnapToGroundInput): Promise<void>;\n}\n\nexport function createTransformModule(http: AxiosInstance): TransformHandle {\n async function updatePosition(\n spaceItemId: string,\n data: UpdatePositionInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/position`, data);\n debugLog(\"Transform\", \"updatePosition\", data);\n }\n\n async function updateRotation(\n spaceItemId: string,\n data: UpdateRotationInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/rotation`, data);\n debugLog(\"Transform\", \"updateRotation\", data);\n }\n\n async function updateScale(\n spaceItemId: string,\n data: UpdateScaleInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/scale`, data);\n debugLog(\"Transform\", \"updateScale\", data);\n }\n\n async function snapToGround(\n spaceItemId: string,\n data: SnapToGroundInput,\n ): Promise<void> {\n await http.post(`/transform/${spaceItemId}/snap`, data);\n debugLog(\"Transform\", \"snapToGround\", data);\n }\n\n return { updatePosition, updateRotation, updateScale, snapToGround };\n}\n","/**\n * Layer Module - Lock, Rename, Delete Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n LockLayerItemInput,\n RenameLayerItemInput,\n DeleteLayerItemInput,\n DeleteAllLayerItemsInput,\n} from \"../types/layer\";\nimport { debugLog } from \"../utils\";\n\nexport interface LayerHandle {\n lockItem(spaceItemId: string, data: LockLayerItemInput): Promise<void>;\n renameItem(spaceItemId: string, data: RenameLayerItemInput): Promise<void>;\n deleteItem(spaceItemId: string, data: DeleteLayerItemInput): Promise<void>;\n deleteAll(data: DeleteAllLayerItemsInput): Promise<void>;\n}\n\nexport function createLayerModule(http: AxiosInstance): LayerHandle {\n async function lockItem(\n spaceItemId: string,\n data: LockLayerItemInput,\n ): Promise<void> {\n await http.patch(`/layer/${spaceItemId}/lock`, data);\n debugLog(\"Layer\", \"lockItem\", data);\n }\n\n async function renameItem(\n spaceItemId: string,\n data: RenameLayerItemInput,\n ): Promise<void> {\n await http.patch(`/layer/${spaceItemId}/rename`, data);\n debugLog(\"Layer\", \"renameItem\", data);\n }\n\n async function deleteItem(\n spaceItemId: string,\n data: DeleteLayerItemInput,\n ): Promise<void> {\n await http.delete(`/layer/${spaceItemId}`, { data });\n debugLog(\"Layer\", \"deleteItem\", data);\n }\n\n async function deleteAll(data: DeleteAllLayerItemsInput): Promise<void> {\n await http.delete(\"/layer\", { data });\n debugLog(\"Layer\", \"deleteAll\", data);\n }\n\n return { lockItem, renameItem, deleteItem, deleteAll };\n}\n","/**\n * Configurator Items Module - Level-wide property operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateConfiguratorItemInput,\n UpdateConfiguratorItemStateInput,\n} from \"../types/configuratorItems\";\nimport { debugLog } from \"../utils\";\n\nexport interface ConfiguratorItemsHandle {\n create(data: CreateConfiguratorItemInput): Promise<void>;\n updateState(\n spaceItemId: string,\n data: UpdateConfiguratorItemStateInput,\n ): Promise<void>;\n}\n\nexport function createConfiguratorItemsModule(\n http: AxiosInstance,\n): ConfiguratorItemsHandle {\n async function create(data: CreateConfiguratorItemInput): Promise<void> {\n await http.post(\"/configurator_items\", data);\n debugLog(\"ConfiguratorItems\", \"create\", data);\n }\n\n async function updateState(\n spaceItemId: string,\n data: UpdateConfiguratorItemStateInput,\n ): Promise<void> {\n await http.patch(`/configurator_items/${spaceItemId}/state`, data);\n debugLog(\"ConfiguratorItems\", \"updateState\", data);\n }\n\n return { create, updateState };\n}\n","/**\n * Configurator Objects Module - UE Actor placement and configuration\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateConfiguratorObjectInput,\n UpdateConfiguratorObjectConfigInput,\n} from \"../types/configuratorObjects\";\nimport { debugLog } from \"../utils\";\n\nexport interface ConfiguratorObjectsHandle {\n create(data: CreateConfiguratorObjectInput): Promise<void>;\n updateConfiguration(\n spaceItemId: string,\n data: UpdateConfiguratorObjectConfigInput,\n ): Promise<void>;\n}\n\nexport function createConfiguratorObjectsModule(\n http: AxiosInstance,\n): ConfiguratorObjectsHandle {\n async function create(data: CreateConfiguratorObjectInput): Promise<void> {\n await http.post(\"/configurator_objects\", data);\n debugLog(\"ConfiguratorObjects\", \"create\", data);\n }\n\n async function updateConfiguration(\n spaceItemId: string,\n data: UpdateConfiguratorObjectConfigInput,\n ): Promise<void> {\n await http.patch(\n `/configurator_objects/${spaceItemId}/configuration`,\n data,\n );\n debugLog(\"ConfiguratorObjects\", \"updateConfiguration\", data);\n }\n\n return { create, updateConfiguration };\n}\n","import { createHttpClient } from \"./core/http\";\nimport {\n createBoundingBoxModule,\n BoundingBoxHandle,\n} from \"./modules/boundingBox\";\nimport { createMediaModule, MediaHandle } from \"./modules/media\";\nimport { createSketchfabModule, SketchfabHandle } from \"./modules/sketchfab\";\nimport { createTransformModule, TransformHandle } from \"./modules/transform\";\nimport { createLayerModule, LayerHandle } from \"./modules/layer\";\nimport {\n createConfiguratorItemsModule,\n ConfiguratorItemsHandle,\n} from \"./modules/configuratorItems\";\nimport {\n createConfiguratorObjectsModule,\n ConfiguratorObjectsHandle,\n} from \"./modules/configuratorObjects\";\nimport { ConfiguratorServiceSDKConfig } from \"./types/common\";\nimport { debugLog } from \"./utils\";\n\n// ─── Public handle interface ──────────────────────────────────────────────────\n\nexport interface ConfiguratorSDKHandle {\n readonly sdkKey: string;\n readonly serviceType: \"CONFIGURATOR_SERVICE\";\n media: MediaHandle;\n sketchfab: SketchfabHandle;\n boundingBox: BoundingBoxHandle;\n transform: TransformHandle;\n layer: LayerHandle;\n configuratorItems: ConfiguratorItemsHandle;\n configuratorObjects: ConfiguratorObjectsHandle;\n}\n\n// ─── Factory function ─────────────────────────────────────────────────────────\n\nexport function createConfiguratorSDK(\n config: ConfiguratorServiceSDKConfig,\n): ConfiguratorSDKHandle {\n const http = createHttpClient(config);\n\n debugLog(\"ConfiguratorSDK\", \"Initialized\", {\n timeout: config.timeout ?? 30_000,\n });\n\n return {\n sdkKey: config.apiKey.trim(),\n serviceType: \"CONFIGURATOR_SERVICE\" as const,\n media: createMediaModule(http),\n sketchfab: createSketchfabModule(http),\n boundingBox: createBoundingBoxModule(http),\n transform: createTransformModule(http),\n layer: createLayerModule(http),\n configuratorItems: createConfiguratorItemsModule(http),\n configuratorObjects: createConfiguratorObjectsModule(http),\n };\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n\nconst ConfiguratorSDK = {\n /**\n * Create a new SDK client instance.\n * @param config SDK configuration — apiKey is required, timeout is optional.\n */\n create(config: ConfiguratorServiceSDKConfig): ConfiguratorSDKHandle {\n return createConfiguratorSDK(config);\n },\n} as const;\n\nexport default ConfiguratorSDK;\n\n// ─── Type exports ─────────────────────────────────────────────────────────────\n\nexport type { ConfiguratorServiceSDKConfig } from \"./types/common\";\n\n// Media\nexport type {\n CreateVideoInput,\n UpdateVideoInput,\n CreateLinkInput,\n UpdateLinkInput,\n CreateStreamInput,\n UpdateStreamInput,\n} from \"./types/media\";\n\n// Sketchfab\nexport type {\n CreateSketchfabObjectInput,\n UpdateSketchfabObjectInput,\n} from \"./types/sketchfab\";\n\n// Bounding Box\nexport type {\n BoundingBoxType,\n CreateBoundingBoxObjectInput,\n UpdateBoundingBoxObjectInput,\n} from \"./types/boundingBox\";\n\n// Transform\nexport type {\n UpdatePositionInput,\n UpdateRotationInput,\n UpdateScaleInput,\n SnapToGroundInput,\n} from \"./types/transform\";\n\n// Layer\nexport type {\n LockLayerItemInput,\n RenameLayerItemInput,\n DeleteLayerItemInput,\n DeleteAllLayerItemsInput,\n} from \"./types/layer\";\n\n// Configurator\nexport type {\n CreateConfiguratorItemInput,\n UpdateConfiguratorItemStateInput,\n} from \"./types/configuratorItems\";\n\nexport type {\n CreateConfiguratorObjectInput,\n UpdateConfiguratorObjectConfigInput,\n} from \"./types/configuratorObjects\";\n\nexport { isAlliumError } from \"./errors\";\nexport type { AlliumError } from \"./errors\";\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/errors.ts","../src/utils/debug.ts","../src/core/http.ts","../src/modules/boundingBox.ts","../src/modules/media.ts","../src/modules/sketchfab.ts","../src/modules/transform.ts","../src/modules/layer.ts","../src/modules/configuratorItems.ts","../src/modules/configuratorObjects.ts","../src/index.ts"],"names":[],"mappings":";;;;;AAQA,SAAS,SAAA,CACP,IAAA,EACA,IAAA,EACA,OAAA,EACA,KAAA,EACa;AACb,EAAA,MAAM,GAAA,GAAM,IAAI,KAAA,CAAM,OAAO,CAAA;AAC7B,EAAA,GAAA,CAAI,IAAA,GAAO,IAAA;AACX,EAAC,IAAY,IAAA,GAAO,IAAA;AACpB,EAAA,IAAI,KAAA,KAAU,MAAA,EAAY,GAAA,CAAY,KAAA,GAAQ,KAAA;AAC9C,EAAA,OAAO,GAAA;AACT;AAYO,SAAS,eAAA,CAAgB,SAAiB,KAAA,EAA8B;AAC7E,EAAA,OAAO,SAAA,CAAU,iBAAA,EAAmB,YAAA,EAAc,OAAA,EAAS,KAAK,CAAA;AAClE;AAGO,SAAS,kBAAA,CACd,SACA,KAAA,EACa;AACb,EAAA,OAAO,SAAA,CAAU,oBAAA,EAAsB,eAAA,EAAiB,OAAA,EAAS,KAAK,CAAA;AACxE;AAGO,SAAS,qBAAA,CACd,SACA,KAA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AA,EAAQ,MAAA,CAAO,MAAA,CAAO,IAAA,EAAK;AAAA,IAC3B,WAAA,EAAa,sBAAA;AAAA,IACb,KAAA,EAAO,kBAAkB,IAAI,CAAA;AAAA,IAC7B,SAAA,EAAW,sBAAsB,IAAI,CAAA;AAAA,IACrC,WAAA,EAAa,wBAAwB,IAAI,CAAA;AAAA,IACzC,SAAA,EAAW,sBAAsB,IAAI,CAAA;AAAA,IACrC,KAAA,EAAO,kBAAkB,IAAI,CAAA;AAAA,IAC7B,iBAAA,EAAmB,8BAA8B,IAAI,CAAA;AAAA,IACrD,mBAAA,EAAqB,gCAAgC,IAAI;AAAA,GAC3D;AACF;AAIA,IAAM,eAAA,GAAkB;AAAA;AAAA;AAAA;AAAA;AAAA,EAKtB,OAAO,MAAA,EAA6D;AAClE,IAAA,OAAO,sBAAsB,MAAM,CAAA;AAAA,EACrC;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.mjs","sourcesContent":["/**\n * SDK Error factories.\n */\n\nexport interface AlliumError extends Error {\n readonly code: string;\n}\n\nfunction makeError(\n name: string,\n code: string,\n message: string,\n cause?: unknown,\n): AlliumError {\n const err = new Error(message) as AlliumError;\n err.name = name;\n (err as any).code = code;\n if (cause !== undefined) (err as any).cause = cause;\n return err;\n}\n\n/** Generic SDK error — use when no specific category fits */\nexport function createSDKError(\n message: string,\n code = \"SDK_ERROR\",\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumSDKError\", code, message, cause);\n}\n\n/** Thrown when the API key is missing, invalid, or rejected by the server */\nexport function createAuthError(message: string, cause?: unknown): AlliumError {\n return makeError(\"AlliumAuthError\", \"AUTH_ERROR\", message, cause);\n}\n\n/** Thrown when the HTTP request itself fails (network, timeout, 5xx) */\nexport function createRequestError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumRequestError\", \"REQUEST_ERROR\", message, cause);\n}\n\n/** Thrown when the server returns a 4xx for bad input data */\nexport function createValidationError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumValidationError\", \"VALIDATION_ERROR\", message, cause);\n}\n\n/** Thrown for upload-specific failures (initiate, complete, abort) */\nexport function createUploadError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumUploadError\", \"UPLOAD_ERROR\", message, cause);\n}\n\n/** Thrown when SDK_BASE_URL or apiKey is not configured correctly */\nexport function createConfigError(\n message: string,\n cause?: unknown,\n): AlliumError {\n return makeError(\"AlliumConfigError\", \"INVALID_CONFIG\", message, cause);\n}\n\n/** Type guard — works for all Allium error factories */\nexport function isAlliumError(err: unknown): err is AlliumError {\n return err instanceof Error && \"code\" in err;\n}\n","/**\n * Centralised debug logging utility.\n */\n\ndeclare global {\n interface Window {\n ALLIUM_DEBUG?: boolean;\n }\n}\n\nexport const isDebugEnabled = (): boolean => {\n // Node.js environment\n if (typeof process !== \"undefined\" && process.env?.ALLIUM_DEBUG === \"true\") {\n return true;\n }\n // Browser environment\n if (typeof window !== \"undefined\" && window.ALLIUM_DEBUG === true) {\n return true;\n }\n return false;\n};\n\nexport const debugLog = (\n category: string,\n message: string,\n data?: unknown,\n): void => {\n if (!isDebugEnabled()) return;\n const timestamp = new Date().toISOString().slice(11, 23);\n if (data !== undefined) {\n } else {\n }\n};\n","/**\n * HTTP client factory.\n *\n * Creates and configures the axios instance used by all modules.\n * Handles:\n * - Base URL (baked in at build time)\n * - API key injection on every request via header\n * - Timeout\n * - Response unwrapping (your backend wraps all responses in { data: ... })\n * - Error normalization into AlliumError types\n */\n\nimport axios, { AxiosInstance, AxiosError } from \"axios\";\nimport { ConfiguratorServiceSDKConfig } from \"../types/common\";\nimport {\n createAuthError,\n createConfigError,\n createRequestError,\n createValidationError,\n createUploadError,\n} from \"../errors\";\nimport { debugLog } from \"../utils\";\n\n// ─── Build-time URL ───────────────────────────────────────────────────────────\n\ndeclare const process: { env: { CONFIGURATOR_SERVICE_BASE_URL: string } };\nconst PROD_BASE_URL: string = process.env.CONFIGURATOR_SERVICE_BASE_URL;\n\n// ─── Factory ──────────────────────────────────────────────────────────────────\n\nexport function createHttpClient(\n config: ConfiguratorServiceSDKConfig,\n): AxiosInstance {\n const BASE_URL = config._devBaseUrl ?? PROD_BASE_URL;\n if (!BASE_URL) {\n throw createConfigError(\n \"[SDK] Base URL not configured. This SDK build is missing CONFIGURATOR_SERVICE_BASE_URL.\",\n );\n }\n\n if (\n !config.apiKey ||\n typeof config.apiKey !== \"string\" ||\n !config.apiKey.trim()\n ) {\n throw createConfigError(\"[SDK] A valid apiKey is required.\");\n }\n\n if (typeof config.accessTokenProvider !== \"function\")\n throw createConfigError(\"[SDK] accessTokenProvider must be a function.\");\n\n const client = axios.create({\n baseURL: BASE_URL,\n timeout: config.timeout ?? 30_000,\n headers: {\n \"Content-Type\": \"application/json\",\n \"x-allium-key\": config.apiKey.trim(),\n },\n });\n\n // ── Request interceptor — debug logging ───────────────────────────────────\n client.interceptors.request.use(async (req) => {\n const token = await config.accessTokenProvider();\n if (token) {\n req.headers[\"Authorization\"] = `Bearer ${token}`;\n }\n debugLog(\n \"HTTP\",\n `→ ${req.method?.toUpperCase()} ${req.url}`,\n req.params ?? req.data,\n );\n return req;\n });\n\n // ── Response interceptor — unwrap + normalize errors ──────────────────────\n client.interceptors.response.use(\n (res) => {\n debugLog(\"HTTP\", `← ${res.status} ${res.config.url}`);\n return res;\n },\n (err: AxiosError) => {\n const status = err.response?.status;\n const message =\n (err.response?.data as any)?.message ?? err.message ?? \"Unknown error\";\n const url = err.config?.url ?? \"\";\n\n debugLog(\"HTTP\", `← ERROR ${status ?? \"network\"} ${url}`, message);\n\n if (!status) {\n // Network error — no response received at all\n throw createRequestError(\n `[SDK] Network error reaching ${url}: ${message}`,\n err,\n );\n }\n\n if (status === 401 || status === 403) {\n throw createAuthError(\n `[SDK] Authentication failed (${status}): ${message}`,\n err,\n );\n }\n\n if (status === 422 || status === 400) {\n throw createValidationError(\n `[SDK] Validation error (${status}): ${message}`,\n err,\n );\n }\n\n if (url.includes(\"/uploader\")) {\n throw createUploadError(\n `[SDK] Upload operation failed (${status}): ${message}`,\n err,\n );\n }\n\n throw createRequestError(\n `[SDK] Request failed (${status}): ${message}`,\n err,\n );\n },\n );\n\n return client;\n}\n","/**\n * Bounding Box Module - Bounding Box 3D Object Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateSingleBoundingBoxInput,\n CreateMultiBoundingBoxInput,\n UpdateSingleBoundingBoxInput,\n UpdateMultiBoundingBoxInput,\n} from \"../types/boundingBox\";\nimport { debugLog } from \"../utils\";\n\nexport interface BoundingBoxHandle {\n addSingle(data: CreateSingleBoundingBoxInput): Promise<void>;\n addMulti(data: CreateMultiBoundingBoxInput): Promise<void>;\n updateSingle(\n spaceItemId: string,\n data: UpdateSingleBoundingBoxInput,\n ): Promise<void>;\n updateMulti(\n spaceItemId: string,\n data: UpdateMultiBoundingBoxInput,\n ): Promise<void>;\n}\n\nexport function createBoundingBoxModule(\n http: AxiosInstance,\n): BoundingBoxHandle {\n async function addSingle(data: CreateSingleBoundingBoxInput): Promise<void> {\n await http.post(\"/boundingbox/single\", data);\n debugLog(\"BoundingBox\", \"addSingle\", data);\n }\n\n async function addMulti(data: CreateMultiBoundingBoxInput): Promise<void> {\n await http.post(\"/boundingbox/multi\", data);\n debugLog(\"BoundingBox\", \"addMulti\", data);\n }\n\n async function updateSingle(\n spaceItemId: string,\n data: UpdateSingleBoundingBoxInput,\n ): Promise<void> {\n await http.patch(`/boundingbox/single/${spaceItemId}`, data);\n debugLog(\"BoundingBox\", \"updateSingle\", data);\n }\n\n async function updateMulti(\n spaceItemId: string,\n data: UpdateMultiBoundingBoxInput,\n ): Promise<void> {\n await http.patch(`/boundingbox/multi/${spaceItemId}`, data);\n debugLog(\"BoundingBox\", \"updateMulti\", data);\n }\n\n return { addSingle, addMulti, updateSingle, updateMulti };\n}\n","/**\n * Media Module - Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateLinkInput,\n CreateStreamInput,\n CreateVideoInput,\n UpdateLinkInput,\n UpdateStreamInput,\n UpdateVideoInput,\n} from \"../types/media\";\nimport { debugLog } from \"../utils\";\n\nexport interface MediaHandle {\n addVideo(data: CreateVideoInput): Promise<void>;\n updateVideo(spaceItemId: string, data: UpdateVideoInput): Promise<void>;\n addStream(data: CreateStreamInput): Promise<void>;\n updateStream(spaceItemId: string, data: UpdateStreamInput): Promise<void>;\n addLink(data: CreateLinkInput): Promise<void>;\n updateLink(spaceItemId: string, data: UpdateLinkInput): Promise<void>;\n}\n\nexport function createMediaModule(http: AxiosInstance): MediaHandle {\n async function addVideo(data: CreateVideoInput): Promise<void> {\n await http.post(\"/media/video\", data);\n debugLog(\"Media\", \"addVideo\", data);\n }\n\n async function updateVideo(\n spaceItemId: string,\n data: UpdateVideoInput,\n ): Promise<void> {\n await http.patch(`/media/video/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateVideo\", data);\n }\n\n async function addStream(data: CreateStreamInput): Promise<void> {\n await http.post(\"/media/stream\", data);\n debugLog(\"Media\", \"addStream\", data);\n }\n\n async function updateStream(\n spaceItemId: string,\n data: UpdateStreamInput,\n ): Promise<void> {\n await http.patch(`/media/stream/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateStream\", data);\n }\n\n async function addLink(data: CreateLinkInput): Promise<void> {\n await http.post(\"/media/link\", data);\n debugLog(\"Media\", \"addLink\", data);\n }\n\n async function updateLink(\n spaceItemId: string,\n data: UpdateLinkInput,\n ): Promise<void> {\n await http.patch(`/media/link/${spaceItemId}`, data);\n debugLog(\"Media\", \"updateLink\", data);\n }\n\n return {\n addVideo,\n updateVideo,\n addStream,\n updateStream,\n addLink,\n updateLink,\n };\n}\n","/**\n * Sketchfab Module - 3D Object Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateSketchfabObjectInput,\n UpdateSketchfabObjectInput,\n} from \"../types/sketchfab\";\nimport { debugLog } from \"../utils\";\n\nexport interface SketchfabHandle {\n addObject(data: CreateSketchfabObjectInput): Promise<void>;\n updateObject(\n spaceItemId: string,\n data: UpdateSketchfabObjectInput,\n ): Promise<void>;\n}\n\nexport function createSketchfabModule(http: AxiosInstance): SketchfabHandle {\n async function addObject(data: CreateSketchfabObjectInput): Promise<void> {\n await http.post(\"/sketchfab/object\", data);\n debugLog(\"Sketchfab\", \"addObject\", data);\n }\n\n async function updateObject(\n spaceItemId: string,\n data: UpdateSketchfabObjectInput,\n ): Promise<void> {\n await http.patch(`/sketchfab/${spaceItemId}`, data);\n debugLog(\"Sketchfab\", \"updateObject\", data);\n }\n\n return { addObject, updateObject };\n}\n","/**\n * Transform Module - Position, Rotation, Scale Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n UpdatePositionInput,\n UpdateRotationInput,\n UpdateScaleInput,\n SnapToGroundInput,\n} from \"../types/transform\";\nimport { debugLog } from \"../utils\";\n\nexport interface TransformHandle {\n updatePosition(spaceItemId: string, data: UpdatePositionInput): Promise<void>;\n updateRotation(spaceItemId: string, data: UpdateRotationInput): Promise<void>;\n updateScale(spaceItemId: string, data: UpdateScaleInput): Promise<void>;\n snapToGround(spaceItemId: string, data: SnapToGroundInput): Promise<void>;\n}\n\nexport function createTransformModule(http: AxiosInstance): TransformHandle {\n async function updatePosition(\n spaceItemId: string,\n data: UpdatePositionInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/position`, data);\n debugLog(\"Transform\", \"updatePosition\", data);\n }\n\n async function updateRotation(\n spaceItemId: string,\n data: UpdateRotationInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/rotation`, data);\n debugLog(\"Transform\", \"updateRotation\", data);\n }\n\n async function updateScale(\n spaceItemId: string,\n data: UpdateScaleInput,\n ): Promise<void> {\n await http.patch(`/transform/${spaceItemId}/scale`, data);\n debugLog(\"Transform\", \"updateScale\", data);\n }\n\n async function snapToGround(\n spaceItemId: string,\n data: SnapToGroundInput,\n ): Promise<void> {\n await http.post(`/transform/${spaceItemId}/snap`, data);\n debugLog(\"Transform\", \"snapToGround\", data);\n }\n\n return { updatePosition, updateRotation, updateScale, snapToGround };\n}\n","/**\n * Layer Module - Lock, Rename, Delete Operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n LockLayerItemInput,\n RenameLayerItemInput,\n DeleteLayerItemInput,\n DeleteAllLayerItemsInput,\n} from \"../types/layer\";\nimport { debugLog } from \"../utils\";\n\nexport interface LayerHandle {\n lockItem(spaceItemId: string, data: LockLayerItemInput): Promise<void>;\n renameItem(spaceItemId: string, data: RenameLayerItemInput): Promise<void>;\n deleteItem(spaceItemId: string, data: DeleteLayerItemInput): Promise<void>;\n deleteAll(data: DeleteAllLayerItemsInput): Promise<void>;\n}\n\nexport function createLayerModule(http: AxiosInstance): LayerHandle {\n async function lockItem(\n spaceItemId: string,\n data: LockLayerItemInput,\n ): Promise<void> {\n await http.patch(`/layer/${spaceItemId}/lock`, data);\n debugLog(\"Layer\", \"lockItem\", data);\n }\n\n async function renameItem(\n spaceItemId: string,\n data: RenameLayerItemInput,\n ): Promise<void> {\n await http.patch(`/layer/${spaceItemId}/rename`, data);\n debugLog(\"Layer\", \"renameItem\", data);\n }\n\n async function deleteItem(\n spaceItemId: string,\n data: DeleteLayerItemInput,\n ): Promise<void> {\n await http.delete(`/layer/${spaceItemId}`, { data });\n debugLog(\"Layer\", \"deleteItem\", data);\n }\n\n async function deleteAll(data: DeleteAllLayerItemsInput): Promise<void> {\n await http.delete(\"/layer\", { data });\n debugLog(\"Layer\", \"deleteAll\", data);\n }\n\n return { lockItem, renameItem, deleteItem, deleteAll };\n}\n","/**\n * Configurator Items Module - Level-wide property operations\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateConfiguratorItemInput,\n UpdateConfiguratorItemStateInput,\n} from \"../types/configuratorItems\";\nimport { debugLog } from \"../utils\";\n\nexport interface ConfiguratorItemsHandle {\n create(data: CreateConfiguratorItemInput): Promise<void>;\n updateState(\n spaceItemId: string,\n data: UpdateConfiguratorItemStateInput,\n ): Promise<void>;\n}\n\nexport function createConfiguratorItemsModule(\n http: AxiosInstance,\n): ConfiguratorItemsHandle {\n async function create(data: CreateConfiguratorItemInput): Promise<void> {\n await http.post(\"/configurator_items\", data);\n debugLog(\"ConfiguratorItems\", \"create\", data);\n }\n\n async function updateState(\n spaceItemId: string,\n data: UpdateConfiguratorItemStateInput,\n ): Promise<void> {\n await http.patch(`/configurator_items/${spaceItemId}/state`, data);\n debugLog(\"ConfiguratorItems\", \"updateState\", data);\n }\n\n return { create, updateState };\n}\n","/**\n * Configurator Objects Module - UE Actor placement and configuration\n */\n\nimport { AxiosInstance } from \"axios\";\nimport {\n CreateConfiguratorObjectInput,\n UpdateConfiguratorObjectConfigInput,\n} from \"../types/configuratorObjects\";\nimport { debugLog } from \"../utils\";\n\nexport interface ConfiguratorObjectsHandle {\n create(data: CreateConfiguratorObjectInput): Promise<void>;\n updateConfiguration(\n spaceItemId: string,\n data: UpdateConfiguratorObjectConfigInput,\n ): Promise<void>;\n}\n\nexport function createConfiguratorObjectsModule(\n http: AxiosInstance,\n): ConfiguratorObjectsHandle {\n async function create(data: CreateConfiguratorObjectInput): Promise<void> {\n await http.post(\"/configurator_objects\", data);\n debugLog(\"ConfiguratorObjects\", \"create\", data);\n }\n\n async function updateConfiguration(\n spaceItemId: string,\n data: UpdateConfiguratorObjectConfigInput,\n ): Promise<void> {\n await http.patch(\n `/configurator_objects/${spaceItemId}/configuration`,\n data,\n );\n debugLog(\"ConfiguratorObjects\", \"updateConfiguration\", data);\n }\n\n return { create, updateConfiguration };\n}\n","import { createHttpClient } from \"./core/http\";\nimport {\n createBoundingBoxModule,\n BoundingBoxHandle,\n} from \"./modules/boundingBox\";\nimport { createMediaModule, MediaHandle } from \"./modules/media\";\nimport { createSketchfabModule, SketchfabHandle } from \"./modules/sketchfab\";\nimport { createTransformModule, TransformHandle } from \"./modules/transform\";\nimport { createLayerModule, LayerHandle } from \"./modules/layer\";\nimport {\n createConfiguratorItemsModule,\n ConfiguratorItemsHandle,\n} from \"./modules/configuratorItems\";\nimport {\n createConfiguratorObjectsModule,\n ConfiguratorObjectsHandle,\n} from \"./modules/configuratorObjects\";\nimport { ConfiguratorServiceSDKConfig } from \"./types/common\";\nimport { debugLog } from \"./utils\";\n\n// ─── Public handle interface ──────────────────────────────────────────────────\n\nexport interface ConfiguratorSDKHandle {\n readonly sdkKey: string;\n readonly serviceType: \"CONFIGURATOR_SERVICE\";\n media: MediaHandle;\n sketchfab: SketchfabHandle;\n boundingBox: BoundingBoxHandle;\n transform: TransformHandle;\n layer: LayerHandle;\n configuratorItems: ConfiguratorItemsHandle;\n configuratorObjects: ConfiguratorObjectsHandle;\n}\n\n// ─── Factory function ─────────────────────────────────────────────────────────\n\nexport function createConfiguratorSDK(\n config: ConfiguratorServiceSDKConfig,\n): ConfiguratorSDKHandle {\n const http = createHttpClient(config);\n\n debugLog(\"ConfiguratorSDK\", \"Initialized\", {\n timeout: config.timeout ?? 30_000,\n });\n\n return {\n sdkKey: config.apiKey.trim(),\n serviceType: \"CONFIGURATOR_SERVICE\" as const,\n media: createMediaModule(http),\n sketchfab: createSketchfabModule(http),\n boundingBox: createBoundingBoxModule(http),\n transform: createTransformModule(http),\n layer: createLayerModule(http),\n configuratorItems: createConfiguratorItemsModule(http),\n configuratorObjects: createConfiguratorObjectsModule(http),\n };\n}\n\n// ─────────────────────────────────────────────────────────────────────────────\n\nconst ConfiguratorSDK = {\n /**\n * Create a new SDK client instance.\n * @param config SDK configuration — apiKey is required, timeout is optional.\n */\n create(config: ConfiguratorServiceSDKConfig): ConfiguratorSDKHandle {\n return createConfiguratorSDK(config);\n },\n} as const;\n\nexport default ConfiguratorSDK;\n\n// ─── Type exports ─────────────────────────────────────────────────────────────\n\nexport type { ConfiguratorServiceSDKConfig } from \"./types/common\";\n\n// Media\nexport type {\n CreateVideoInput,\n UpdateVideoInput,\n CreateLinkInput,\n UpdateLinkInput,\n CreateStreamInput,\n UpdateStreamInput,\n} from \"./types/media\";\n\n// Sketchfab\nexport type {\n CreateSketchfabObjectInput,\n UpdateSketchfabObjectInput,\n} from \"./types/sketchfab\";\n\n// Bounding Box\nexport type {\n BoundingBoxType,\n CreateSingleBoundingBoxInput,\n CreateMultiBoundingBoxInput,\n UpdateSingleBoundingBoxInput,\n UpdateMultiBoundingBoxInput,\n} from \"./types/boundingBox\";\n\n// Transform\nexport type {\n UpdatePositionInput,\n UpdateRotationInput,\n UpdateScaleInput,\n SnapToGroundInput,\n} from \"./types/transform\";\n\n// Layer\nexport type {\n LockLayerItemInput,\n RenameLayerItemInput,\n DeleteLayerItemInput,\n DeleteAllLayerItemsInput,\n} from \"./types/layer\";\n\n// Configurator\nexport type {\n CreateConfiguratorItemInput,\n UpdateConfiguratorItemStateInput,\n} from \"./types/configuratorItems\";\n\nexport type {\n CreateConfiguratorObjectInput,\n UpdateConfiguratorObjectConfigInput,\n} from \"./types/configuratorObjects\";\n\nexport { isAlliumError } from \"./errors\";\nexport type { AlliumError } from \"./errors\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alliumcloud/configurator-service",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.14",
|
|
4
4
|
"description": "Allium Configurator SDK - manages sketchfab 3D object , manages live stream, video and links and manages position,scale,rotation of all objects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|