@algolia/wizard 0.71.0 → 0.72.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.
Files changed (2) hide show
  1. package/dist/main.js +74 -8
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -1969,7 +1969,7 @@ function identify(traits) {
1969
1969
  // package.json
1970
1970
  var package_default = {
1971
1971
  name: "@algolia/wizard",
1972
- version: "0.71.0",
1972
+ version: "0.72.0",
1973
1973
  description: "Magically implement Algolia functionality in your codebase",
1974
1974
  type: "module",
1975
1975
  engines: {
@@ -6028,13 +6028,21 @@ import { z as z32 } from "zod";
6028
6028
  import "zod";
6029
6029
  var DASHBOARD_API_BASE_URL = `${PROXY_BASE_URL}/dashboard`;
6030
6030
  var DashboardApiError = class extends Error {
6031
- constructor(status, message) {
6032
- super(message);
6031
+ constructor(status, body) {
6032
+ super("Couldn't complete the request.");
6033
6033
  this.status = status;
6034
+ this.body = body;
6034
6035
  this.name = "DashboardApiError";
6035
6036
  }
6036
6037
  status;
6038
+ body;
6039
+ errorBody() {
6040
+ return isRecord(this.body) ? this.body : void 0;
6041
+ }
6037
6042
  };
6043
+ function isRecord(value) {
6044
+ return !!value && typeof value === "object" && !Array.isArray(value);
6045
+ }
6038
6046
  async function dashboardRequest(path, schema, init) {
6039
6047
  const token = getAuthToken();
6040
6048
  if (!token) {
@@ -6049,17 +6057,24 @@ async function dashboardRequest(path, schema, init) {
6049
6057
  }
6050
6058
  });
6051
6059
  if (!res.ok) {
6052
- throw new DashboardApiError(
6053
- res.status,
6054
- `Dashboard API responded ${res.status} for ${path}`
6055
- );
6060
+ throw await dashboardError(res);
6056
6061
  }
6057
6062
  const body = await res.json();
6058
6063
  return { status: res.status, data: schema.parse(body) };
6059
6064
  }
6065
+ async function dashboardError(res) {
6066
+ try {
6067
+ return new DashboardApiError(res.status, await res.json());
6068
+ } catch {
6069
+ return new DashboardApiError(res.status, void 0);
6070
+ }
6071
+ }
6060
6072
 
6061
6073
  // src/lib/dashboardApi/schemas.ts
6062
6074
  import { z as z31 } from "zod";
6075
+ var messageResponseSchema = z31.object({
6076
+ message: z31.string()
6077
+ });
6063
6078
  var playbookSchema = z31.object({
6064
6079
  slug: z31.string(),
6065
6080
  category: z31.string().optional(),
@@ -6067,6 +6082,57 @@ var playbookSchema = z31.object({
6067
6082
  description: z31.string().optional()
6068
6083
  });
6069
6084
  var playbooksListSchema = z31.array(playbookSchema);
6085
+ var playbookExecutionStepSchema = z31.enum([
6086
+ "assessment",
6087
+ "optimization",
6088
+ "implement"
6089
+ ]);
6090
+ var playbookExecutionStepStatusSchema = z31.enum([
6091
+ "not_started",
6092
+ "in_progress",
6093
+ "done",
6094
+ "error"
6095
+ ]);
6096
+ var schemaComparisonEntrySchema = z31.object({
6097
+ canonical_attr: z31.string(),
6098
+ canonical_type: z31.array(z31.string()),
6099
+ canonical_roles: z31.array(z31.string()),
6100
+ canonical_required: z31.boolean(),
6101
+ index_attr: z31.string().nullable(),
6102
+ index_type: z31.array(z31.string()).nullable(),
6103
+ index_required: z31.boolean().nullable(),
6104
+ status: z31.string(),
6105
+ mapping_confidence: z31.number()
6106
+ });
6107
+ var settingsRecommendationSchema = z31.record(
6108
+ z31.string(),
6109
+ z31.object({
6110
+ current: z31.any(),
6111
+ recommended: z31.any()
6112
+ })
6113
+ );
6114
+ var assessmentResultSchema = z31.object({
6115
+ ready: z31.boolean(),
6116
+ schema_comparison: z31.array(schemaComparisonEntrySchema),
6117
+ settings_recommendation: settingsRecommendationSchema
6118
+ });
6119
+ var playbookExecutionSchema = z31.object({
6120
+ uuid: z31.string(),
6121
+ playbook_slug: z31.string(),
6122
+ application_id: z31.string(),
6123
+ source_index_name: z31.string(),
6124
+ current_step: playbookExecutionStepSchema,
6125
+ step_status: playbookExecutionStepStatusSchema,
6126
+ status_reason: z31.string().nullable(),
6127
+ completed: z31.boolean(),
6128
+ assessment_result: assessmentResultSchema.nullable(),
6129
+ settings_snapshot: z31.json().nullable(),
6130
+ created_at: z31.iso.datetime()
6131
+ });
6132
+ var playbookExecutionCreateResponseSchema = playbookExecutionSchema.extend({
6133
+ resumed: z31.boolean(),
6134
+ sample_data: z31.boolean()
6135
+ });
6070
6136
 
6071
6137
  // src/lib/dashboardApi/api.ts
6072
6138
  async function getPlaybooks() {
@@ -7589,7 +7655,7 @@ function delay(ms) {
7589
7655
  // package.json with { type: 'json' }
7590
7656
  var package_default2 = {
7591
7657
  name: "@algolia/wizard",
7592
- version: "0.71.0",
7658
+ version: "0.72.0",
7593
7659
  description: "Magically implement Algolia functionality in your codebase",
7594
7660
  type: "module",
7595
7661
  engines: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@algolia/wizard",
3
- "version": "0.71.0",
3
+ "version": "0.72.0",
4
4
  "description": "Magically implement Algolia functionality in your codebase",
5
5
  "type": "module",
6
6
  "engines": {