@vaiftechnologies/vaif-client 0.2.1 → 0.3.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.
package/dist/index.cjs CHANGED
@@ -2153,11 +2153,18 @@ var VaifSchema = class {
2153
2153
  * ```
2154
2154
  */
2155
2155
  async preview(request) {
2156
+ const body = {
2157
+ ...request,
2158
+ definition: {
2159
+ schemaVersion: "1.0",
2160
+ ...request.definition
2161
+ }
2162
+ };
2156
2163
  const response = await this.client.request(
2157
2164
  "/schema-engine/preview",
2158
2165
  {
2159
2166
  method: "POST",
2160
- body: request
2167
+ body
2161
2168
  }
2162
2169
  );
2163
2170
  if (response.error) {
@@ -2206,11 +2213,18 @@ var VaifSchema = class {
2206
2213
  * ```
2207
2214
  */
2208
2215
  async apply(request) {
2216
+ const body = {
2217
+ ...request,
2218
+ definition: {
2219
+ schemaVersion: "1.0",
2220
+ ...request.definition
2221
+ }
2222
+ };
2209
2223
  const response = await this.client.request(
2210
2224
  "/schema-engine/apply",
2211
2225
  {
2212
2226
  method: "POST",
2213
- body: request
2227
+ body
2214
2228
  }
2215
2229
  );
2216
2230
  if (response.error) {
package/dist/index.d.cts CHANGED
@@ -2932,14 +2932,14 @@ interface ColumnDefinition {
2932
2932
  name: string;
2933
2933
  type: string;
2934
2934
  nullable?: boolean;
2935
- default?: string;
2935
+ default?: string | number | boolean;
2936
2936
  unique?: boolean;
2937
2937
  primaryKey?: boolean;
2938
2938
  references?: {
2939
2939
  table: string;
2940
- column: string;
2941
- onDelete?: 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION';
2942
- onUpdate?: 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION';
2940
+ column?: string;
2941
+ onDelete?: 'CASCADE' | 'SET NULL' | 'SET DEFAULT' | 'RESTRICT' | 'NO ACTION';
2942
+ onUpdate?: 'CASCADE' | 'SET NULL' | 'SET DEFAULT' | 'RESTRICT' | 'NO ACTION';
2943
2943
  };
2944
2944
  }
2945
2945
  /**
@@ -2963,6 +2963,7 @@ interface TableDefinition {
2963
2963
  * Schema definition containing all tables
2964
2964
  */
2965
2965
  interface SchemaDefinition {
2966
+ schemaVersion?: '1.0';
2966
2967
  tables: TableDefinition[];
2967
2968
  }
2968
2969
  /**
@@ -3035,8 +3036,20 @@ interface SchemaIntrospectResult {
3035
3036
  nullable: boolean;
3036
3037
  default?: string;
3037
3038
  primaryKey?: boolean;
3039
+ unique?: boolean;
3038
3040
  }>;
3039
3041
  indexes: string[];
3042
+ indexDetails?: Array<{
3043
+ name: string;
3044
+ columns: string[];
3045
+ unique: boolean;
3046
+ }>;
3047
+ foreignKeys?: Array<{
3048
+ constraintName: string;
3049
+ columnName: string;
3050
+ refTable: string;
3051
+ refColumn: string;
3052
+ }>;
3040
3053
  }>;
3041
3054
  }
3042
3055
  /**
package/dist/index.d.ts CHANGED
@@ -2932,14 +2932,14 @@ interface ColumnDefinition {
2932
2932
  name: string;
2933
2933
  type: string;
2934
2934
  nullable?: boolean;
2935
- default?: string;
2935
+ default?: string | number | boolean;
2936
2936
  unique?: boolean;
2937
2937
  primaryKey?: boolean;
2938
2938
  references?: {
2939
2939
  table: string;
2940
- column: string;
2941
- onDelete?: 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION';
2942
- onUpdate?: 'CASCADE' | 'SET NULL' | 'RESTRICT' | 'NO ACTION';
2940
+ column?: string;
2941
+ onDelete?: 'CASCADE' | 'SET NULL' | 'SET DEFAULT' | 'RESTRICT' | 'NO ACTION';
2942
+ onUpdate?: 'CASCADE' | 'SET NULL' | 'SET DEFAULT' | 'RESTRICT' | 'NO ACTION';
2943
2943
  };
2944
2944
  }
2945
2945
  /**
@@ -2963,6 +2963,7 @@ interface TableDefinition {
2963
2963
  * Schema definition containing all tables
2964
2964
  */
2965
2965
  interface SchemaDefinition {
2966
+ schemaVersion?: '1.0';
2966
2967
  tables: TableDefinition[];
2967
2968
  }
2968
2969
  /**
@@ -3035,8 +3036,20 @@ interface SchemaIntrospectResult {
3035
3036
  nullable: boolean;
3036
3037
  default?: string;
3037
3038
  primaryKey?: boolean;
3039
+ unique?: boolean;
3038
3040
  }>;
3039
3041
  indexes: string[];
3042
+ indexDetails?: Array<{
3043
+ name: string;
3044
+ columns: string[];
3045
+ unique: boolean;
3046
+ }>;
3047
+ foreignKeys?: Array<{
3048
+ constraintName: string;
3049
+ columnName: string;
3050
+ refTable: string;
3051
+ refColumn: string;
3052
+ }>;
3040
3053
  }>;
3041
3054
  }
3042
3055
  /**
package/dist/index.js CHANGED
@@ -2095,11 +2095,18 @@ var VaifSchema = class {
2095
2095
  * ```
2096
2096
  */
2097
2097
  async preview(request) {
2098
+ const body = {
2099
+ ...request,
2100
+ definition: {
2101
+ schemaVersion: "1.0",
2102
+ ...request.definition
2103
+ }
2104
+ };
2098
2105
  const response = await this.client.request(
2099
2106
  "/schema-engine/preview",
2100
2107
  {
2101
2108
  method: "POST",
2102
- body: request
2109
+ body
2103
2110
  }
2104
2111
  );
2105
2112
  if (response.error) {
@@ -2148,11 +2155,18 @@ var VaifSchema = class {
2148
2155
  * ```
2149
2156
  */
2150
2157
  async apply(request) {
2158
+ const body = {
2159
+ ...request,
2160
+ definition: {
2161
+ schemaVersion: "1.0",
2162
+ ...request.definition
2163
+ }
2164
+ };
2151
2165
  const response = await this.client.request(
2152
2166
  "/schema-engine/apply",
2153
2167
  {
2154
2168
  method: "POST",
2155
- body: request
2169
+ body
2156
2170
  }
2157
2171
  );
2158
2172
  if (response.error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaiftechnologies/vaif-client",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Official VAIF Studio client library for JavaScript and TypeScript",
6
6
  "main": "dist/index.js",
@@ -21,7 +21,8 @@
21
21
  "build": "tsup src/index.ts --format cjs,esm --dts --clean",
22
22
  "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
23
23
  "lint": "tsc --noEmit",
24
- "test": "vitest"
24
+ "test": "vitest",
25
+ "prepublishOnly": "pnpm build"
25
26
  },
26
27
  "keywords": [
27
28
  "vaif",