@ductape/sdk 0.0.7 → 0.0.8

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.
@@ -76,6 +76,10 @@ class ProductsBuilderService {
76
76
  }
77
77
  }
78
78
  fetchPrivateKey() {
79
+ var _a;
80
+ if (!((_a = this.product) === null || _a === void 0 ? void 0 : _a.private_key)) {
81
+ throw new Error('Product not initialized or missing private_key (ensure bootstrap/init ran successfully)');
82
+ }
79
83
  return this.product.private_key;
80
84
  }
81
85
  fetchWorkspaceId() {
@@ -354,10 +358,18 @@ class ProductsBuilderService {
354
358
  async bootstrapAction(params) {
355
359
  try {
356
360
  const result = await this.productApi.bootstrapAction(params, this.getUserAccess());
357
- // Initialize minimal product data
361
+ // Initialize minimal product data so fetchPrivateKey/fetchProductId/fetchWorkspaceId work
358
362
  if (result.product_id) {
359
363
  this.product_id = result.product_id;
360
364
  }
365
+ if (result.private_key != null) {
366
+ this.product = {
367
+ _id: result.product_id,
368
+ workspace_id: result.workspace_id,
369
+ private_key: result.private_key,
370
+ tag: params.product_tag,
371
+ };
372
+ }
361
373
  return result;
362
374
  }
363
375
  catch (e) {