@lark-apaas/db-schema-sync 0.1.0-alpha.5 → 0.1.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  __toESM,
7
7
  generateSchema,
8
8
  resolveEnvOptions
9
- } from "./chunk-OF4XHR3O.js";
9
+ } from "./chunk-MTFKSLNU.js";
10
10
 
11
11
  // node_modules/dotenv/package.json
12
12
  var require_package = __commonJS({
@@ -973,7 +973,10 @@ Body: ${body.slice(0, 500)}`);
973
973
  }
974
974
  const json = await response.json();
975
975
  const data = json.data;
976
- return data?.data ?? data?.schema ?? data;
976
+ if (!data) {
977
+ return {};
978
+ }
979
+ return data?.data ?? data?.schema ?? data ?? {};
977
980
  } catch (err) {
978
981
  if (err?.response) {
979
982
  const headers = err.response.headers;
@@ -1153,6 +1156,9 @@ function extractSyncedTableMap(tables) {
1153
1156
  return map;
1154
1157
  }
1155
1158
  function normalizeApiResponse(response) {
1159
+ if (!response) {
1160
+ return { tables: [], views: [], materializedViews: [], enums: [], sequences: [], syncedTableMap: /* @__PURE__ */ new Map() };
1161
+ }
1156
1162
  const usedTableIdentifiers = /* @__PURE__ */ new Set();
1157
1163
  const usedViewIdentifiers = /* @__PURE__ */ new Set();
1158
1164
  const usedMViewIdentifiers = /* @__PURE__ */ new Set();
package/dist/index.d.ts CHANGED
@@ -162,7 +162,7 @@ interface FetchOptions {
162
162
  }
163
163
  declare function resolveEnvOptions(env?: Record<string, string | undefined>): FetchOptions;
164
164
 
165
- declare function normalizeApiResponse(response: ApiTableViewResponse): SchemaData;
165
+ declare function normalizeApiResponse(response: ApiTableViewResponse | null | undefined): SchemaData;
166
166
 
167
167
  declare function generateSchemaCode(data: SchemaData): string;
168
168
 
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  generateSchemaFromData,
6
6
  normalizeApiResponse,
7
7
  resolveEnvOptions
8
- } from "./chunk-OF4XHR3O.js";
8
+ } from "./chunk-MTFKSLNU.js";
9
9
  export {
10
10
  generateSchema,
11
11
  generateSchemaCode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/db-schema-sync",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",