@bitbybit-dev/cad-cloud-sdk 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  // ---------------------------------------------------------------------------
2
2
  // AUTO-GENERATED by generate-pipeline-types.ts — do not edit manually.
3
- // Generated from operation-catalog.json v1.3.2
3
+ // Generated from operation-catalog.json v1.4.0
4
4
  // ---------------------------------------------------------------------------
5
5
  /**
6
6
  * Create a type-safe pipeline step with autocomplete for operation paths and params.
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline-operations.js","sourceRoot":"","sources":["../../src/types/pipeline-operations.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,uEAAuE;AACvE,+CAA+C;AAC/C,8EAA8E;AAk3c9E;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAChB,SAAY,EACZ,MAA0B,EAC1B,IAA2B;IAE3B,MAAM,CAAC,GAA4B,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IACzD,IAAI,IAAI,EAAE,MAAM;QAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IACrC,OAAO,CAAiB,CAAC;AAC7B,CAAC"}
1
+ {"version":3,"file":"pipeline-operations.js","sourceRoot":"","sources":["../../src/types/pipeline-operations.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,uEAAuE;AACvE,+CAA+C;AAC/C,8EAA8E;AA+oiB9E;;;;;;GAMG;AACH,MAAM,UAAU,IAAI,CAChB,SAAY,EACZ,MAA0B,EAC1B,IAA2B;IAE3B,MAAM,CAAC,GAA4B,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IACzD,IAAI,IAAI,EAAE,MAAM;QAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IACrC,OAAO,CAAiB,CAAC;AAC7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/validation/validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,uBAAuB,CAAC;AAGhE,mEAAmE;AACnE,qBAAa,uBAAwB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC;gBAElB,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE;CAQvD;AAsBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAS3E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEzE"}
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/validation/validator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAU,MAAM,uBAAuB,CAAC;AAGhE,mEAAmE;AACnE,qBAAa,uBAAwB,SAAQ,KAAK;IAC9C,QAAQ,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC;gBAElB,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE;CAQvD;AAuBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAS3E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEzE"}
@@ -17,7 +17,8 @@ function getValidator(schemaName) {
17
17
  const cached = validators.get(schemaName);
18
18
  if (cached)
19
19
  return cached;
20
- const def = schemaBundle.$defs[schemaName];
20
+ const defs = schemaBundle.$defs;
21
+ const def = defs[schemaName];
21
22
  if (!def)
22
23
  return undefined;
23
24
  const rootSchema = {
@@ -1 +1 @@
1
- {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/validation/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,S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AE,OAAO,MAAM,CAAC;IAE1B,MAAM,IAAI,GAAsC,YAAY,CAAC,KAAK,CAAC;IACnE,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,CAAC,CAAC;IAC7B,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAE3B,MAAM,UAAU,GAAW;QACvB,OAAO,EAAE,8CAA8C;QACvD,IAAI,EAAE,WAAW,UAAU,EAAE;QAC7B,KAAK,EAAE,YAAY,CAAC,KAAK;KAC5B,CAAC;IAEF,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC9D,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;IACtC,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAkB,EAAE,IAAa;IACjE,MAAM,SAAS,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;IAC3C,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,OAAO;IACX,CAAC;IACD,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,uBAAuB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACjD,OAAQ,YAAY,CAAC,SAAoC,CAAC,WAAW,CAAC,CAAC;AAC3E,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitbybit-dev/cad-cloud-sdk",
3
- "version": "1.3.2",
3
+ "version": "1.4.0",
4
4
  "description": "Type-safe SDK for the Bitbybit CAD Cloud API \u2014 parametric models, CAD operations, file conversion, and task management",
5
5
  "author": "Bit By Bit Developers",
6
6
  "license": "MIT",
@@ -31,10 +31,10 @@ export function mockFetcher(
31
31
  ...responses: Response[]
32
32
  ): (method: string, path: string, body?: unknown) => Promise<Response> {
33
33
  const queue = [...responses];
34
- return async (_method: string, _path: string, _body?: unknown) => {
34
+ return (_method: string, _path: string, _body?: unknown) => {
35
35
  const res = queue.shift();
36
- if (!res) throw new Error("mockFetcher: no more responses");
37
- return res;
36
+ if (!res) return Promise.reject(new Error("mockFetcher: no more responses"));
37
+ return Promise.resolve(res);
38
38
  };
39
39
  }
40
40
 
@@ -44,11 +44,11 @@ export function mockFetcher(
44
44
  export function spyFetcher(...responses: Response[]) {
45
45
  const calls: { method: string; path: string; body?: unknown }[] = [];
46
46
  const queue = [...responses];
47
- const fn = async (method: string, path: string, body?: unknown) => {
47
+ const fn = (method: string, path: string, body?: unknown) => {
48
48
  calls.push({ method, path, body });
49
49
  const res = queue.shift();
50
- if (!res) throw new Error("spyFetcher: no more responses");
51
- return res;
50
+ if (!res) return Promise.reject(new Error("spyFetcher: no more responses"));
51
+ return Promise.resolve(res);
52
52
  };
53
53
  return { fn, calls };
54
54
  }
@@ -16,8 +16,8 @@ describe("fetchDownloads", () => {
16
16
  { format: "glb", downloadUrl: "https://r2.example.com/result.glb", filename: "result.glb" },
17
17
  { format: "step", downloadUrl: "https://r2.example.com/result.step", filename: "result.step" },
18
18
  ];
19
- const fetcher = async (_m: string, _p: string) =>
20
- jsonResponse({ ok: true, data: { downloads } });
19
+ const fetcher = (_m: string, _p: string) =>
20
+ Promise.resolve(jsonResponse({ ok: true, data: { downloads } }));
21
21
 
22
22
  // Act
23
23
  const result = await fetchDownloads(fetcher, "task-123");
@@ -29,9 +29,9 @@ describe("fetchDownloads", () => {
29
29
  it("calls the correct API path with encoded taskId", async () => {
30
30
  // Arrange
31
31
  let calledPath = "";
32
- const fetcher = async (_m: string, path: string) => {
32
+ const fetcher = (_m: string, path: string) => {
33
33
  calledPath = path;
34
- return jsonResponse({ ok: true, data: { downloads: [] } });
34
+ return Promise.resolve(jsonResponse({ ok: true, data: { downloads: [] } }));
35
35
  };
36
36
 
37
37
  // Act
@@ -44,9 +44,9 @@ describe("fetchDownloads", () => {
44
44
  it("uses GET method", async () => {
45
45
  // Arrange
46
46
  let calledMethod = "";
47
- const fetcher = async (method: string, _p: string) => {
47
+ const fetcher = (method: string, _p: string) => {
48
48
  calledMethod = method;
49
- return jsonResponse({ ok: true, data: { downloads: [] } });
49
+ return Promise.resolve(jsonResponse({ ok: true, data: { downloads: [] } }));
50
50
  };
51
51
 
52
52
  // Act
@@ -58,8 +58,8 @@ describe("fetchDownloads", () => {
58
58
 
59
59
  it("throws BitbybitApiError when API returns error", async () => {
60
60
  // Arrange
61
- const fetcher = async () =>
62
- jsonResponse({ ok: false, error: { code: "NOT_FOUND", message: "no task" } }, 404);
61
+ const fetcher = () =>
62
+ Promise.resolve(jsonResponse({ ok: false, error: { code: "NOT_FOUND", message: "no task" } }, 404));
63
63
 
64
64
  // Act & Assert
65
65
  await expect(fetchDownloads(fetcher, "t-bad")).rejects.toThrow(BitbybitApiError);
@@ -40,10 +40,10 @@ describe("pollTask", () => {
40
40
  it("throws TASK_FAILED for failed tasks", async () => {
41
41
  // Arrange
42
42
  const fetcher = vi.fn()
43
- .mockImplementation(async () => jsonResponse({
43
+ .mockImplementation(() => Promise.resolve(jsonResponse({
44
44
  ok: true,
45
45
  data: { taskId: "t-1", status: "failed", error: "out of memory" },
46
- }));
46
+ })));
47
47
 
48
48
  // Act
49
49
  let error: BitbybitApiError | undefined;
@@ -61,10 +61,10 @@ describe("pollTask", () => {
61
61
  it("throws TASK_CANCELLED for cancelled tasks", async () => {
62
62
  // Arrange
63
63
  const fetcher = vi.fn()
64
- .mockImplementation(async () => jsonResponse({
64
+ .mockImplementation(() => Promise.resolve(jsonResponse({
65
65
  ok: true,
66
66
  data: { taskId: "t-1", status: "cancelled" },
67
- }));
67
+ })));
68
68
 
69
69
  // Act
70
70
  let error: BitbybitApiError | undefined;
@@ -81,10 +81,10 @@ describe("pollTask", () => {
81
81
  it("throws TASK_EXPIRED for expired tasks", async () => {
82
82
  // Arrange
83
83
  const fetcher = vi.fn()
84
- .mockImplementation(async () => jsonResponse({
84
+ .mockImplementation(() => Promise.resolve(jsonResponse({
85
85
  ok: true,
86
86
  data: { taskId: "t-1", status: "expired" },
87
- }));
87
+ })));
88
88
 
89
89
  // Act
90
90
  let error: BitbybitApiError | undefined;
@@ -101,10 +101,10 @@ describe("pollTask", () => {
101
101
  it("throws POLL_TIMEOUT when maxAttempts exceeded", async () => {
102
102
  // Arrange
103
103
  const fetcher = vi.fn()
104
- .mockImplementation(async () => jsonResponse({
104
+ .mockImplementation(() => Promise.resolve(jsonResponse({
105
105
  ok: true,
106
106
  data: { taskId: "t-1", status: "processing" },
107
- }));
107
+ })));
108
108
 
109
109
  // Act
110
110
  let error: BitbybitApiError | undefined;
@@ -123,10 +123,10 @@ describe("pollTask", () => {
123
123
  it("throws BitbybitApiError when API returns error envelope", async () => {
124
124
  // Arrange
125
125
  const fetcher = vi.fn()
126
- .mockImplementation(async () => jsonResponse(
126
+ .mockImplementation(() => Promise.resolve(jsonResponse(
127
127
  { ok: false, error: { code: "UNAUTHORIZED", message: "bad key" } },
128
128
  401,
129
- ));
129
+ )));
130
130
 
131
131
  // Act
132
132
  let error: BitbybitApiError | undefined;
@@ -2504,8 +2504,11 @@ export interface components {
2504
2504
  outerArcLength: number;
2505
2505
  /** @enum {string} */
2506
2506
  direction: "up" | "down";
2507
- /** @enum {string} */
2508
- kind: "cyl" | "cone";
2507
+ /**
2508
+ * @description 'cyl' and 'cone' fold through a bend face of that surface; 'sharp' folds along a shared edge with no bend face (faceIndex -1, inner radius 0), and a 0 degree 'sharp' fold joins two coplanar panels.
2509
+ * @enum {string}
2510
+ */
2511
+ kind: "cyl" | "cone" | "sharp";
2509
2512
  layoutApprox: boolean;
2510
2513
  };
2511
2514
  /** @description A classified source face: stable key (index + BRepGraph uid), role, and label anchors. */
@@ -3051,8 +3054,11 @@ export interface components {
3051
3054
  outerArcLength: number;
3052
3055
  /** @enum {string} */
3053
3056
  direction: "up" | "down";
3054
- /** @enum {string} */
3055
- kind: "cyl" | "cone";
3057
+ /**
3058
+ * @description 'cyl' and 'cone' fold through a bend face of that surface; 'sharp' folds along a shared edge with no bend face (faceIndex -1, inner radius 0), and a 0 degree 'sharp' fold joins two coplanar panels.
3059
+ * @enum {string}
3060
+ */
3061
+ kind: "cyl" | "cone" | "sharp";
3056
3062
  layoutApprox: boolean;
3057
3063
  };
3058
3064
  /** @description A classified source face: stable key (index + BRepGraph uid), role, and label anchors. */