@tspvivek/baasix-sdk 0.1.0-alpha.4 → 0.1.0-alpha.5
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/README.md +79 -0
- package/dist/{client-aXK_gEyr.d.cts → client-BeD1V4Xg.d.cts} +54 -4
- package/dist/{client-CzF9B60b.d.ts → client-C7qJEINh.d.ts} +54 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modules/auth.cjs.map +1 -1
- package/dist/modules/auth.d.cts +1 -1
- package/dist/modules/auth.d.ts +1 -1
- package/dist/modules/auth.js.map +1 -1
- package/dist/modules/files.d.cts +1 -1
- package/dist/modules/files.d.ts +1 -1
- package/dist/modules/items.d.cts +2 -2
- package/dist/modules/items.d.ts +2 -2
- package/dist/modules/schemas.d.cts +1 -1
- package/dist/modules/schemas.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -451,15 +451,54 @@ await baasix.schemas.create({
|
|
|
451
451
|
primaryKey: true,
|
|
452
452
|
defaultValue: { type: 'UUIDV4' },
|
|
453
453
|
},
|
|
454
|
+
sku: {
|
|
455
|
+
type: 'SUID',
|
|
456
|
+
unique: true,
|
|
457
|
+
defaultValue: { type: 'SUID' },
|
|
458
|
+
},
|
|
454
459
|
name: {
|
|
455
460
|
type: 'String',
|
|
456
461
|
allowNull: false,
|
|
457
462
|
values: { length: 255 },
|
|
463
|
+
validate: {
|
|
464
|
+
notEmpty: true,
|
|
465
|
+
len: [3, 255],
|
|
466
|
+
},
|
|
458
467
|
},
|
|
459
468
|
price: {
|
|
460
469
|
type: 'Decimal',
|
|
461
470
|
values: { precision: 10, scale: 2 },
|
|
462
471
|
defaultValue: 0,
|
|
472
|
+
validate: {
|
|
473
|
+
min: 0,
|
|
474
|
+
max: 999999.99,
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
quantity: {
|
|
478
|
+
type: 'Integer',
|
|
479
|
+
defaultValue: 0,
|
|
480
|
+
validate: {
|
|
481
|
+
isInt: true,
|
|
482
|
+
min: 0,
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
email: {
|
|
486
|
+
type: 'String',
|
|
487
|
+
validate: {
|
|
488
|
+
isEmail: true,
|
|
489
|
+
},
|
|
490
|
+
},
|
|
491
|
+
website: {
|
|
492
|
+
type: 'String',
|
|
493
|
+
validate: {
|
|
494
|
+
isUrl: true,
|
|
495
|
+
},
|
|
496
|
+
},
|
|
497
|
+
slug: {
|
|
498
|
+
type: 'String',
|
|
499
|
+
validate: {
|
|
500
|
+
matches: '^[a-z0-9-]+$',
|
|
501
|
+
},
|
|
463
502
|
},
|
|
464
503
|
tags: {
|
|
465
504
|
type: 'Array',
|
|
@@ -470,11 +509,51 @@ await baasix.schemas.create({
|
|
|
470
509
|
type: 'JSONB',
|
|
471
510
|
defaultValue: {},
|
|
472
511
|
},
|
|
512
|
+
status: {
|
|
513
|
+
type: 'String',
|
|
514
|
+
defaultValue: 'draft',
|
|
515
|
+
},
|
|
516
|
+
isActive: {
|
|
517
|
+
type: 'Boolean',
|
|
518
|
+
defaultValue: true,
|
|
519
|
+
},
|
|
520
|
+
sortOrder: {
|
|
521
|
+
type: 'Integer',
|
|
522
|
+
defaultValue: { type: 'AUTOINCREMENT' },
|
|
523
|
+
},
|
|
524
|
+
publishedAt: {
|
|
525
|
+
type: 'DateTime',
|
|
526
|
+
defaultValue: { type: 'NOW' },
|
|
527
|
+
},
|
|
473
528
|
},
|
|
474
529
|
},
|
|
475
530
|
});
|
|
476
531
|
```
|
|
477
532
|
|
|
533
|
+
### Validation Rules
|
|
534
|
+
|
|
535
|
+
| Rule | Type | Description |
|
|
536
|
+
|------|------|-------------|
|
|
537
|
+
| `min` | number | Minimum value for numeric fields |
|
|
538
|
+
| `max` | number | Maximum value for numeric fields |
|
|
539
|
+
| `isInt` | boolean | Validate as integer |
|
|
540
|
+
| `notEmpty` | boolean | String must not be empty |
|
|
541
|
+
| `isEmail` | boolean | Validate email format |
|
|
542
|
+
| `isUrl` | boolean | Validate URL format |
|
|
543
|
+
| `len` | [min, max] | String length range |
|
|
544
|
+
| `is` / `matches` | string | Pattern matching with regex |
|
|
545
|
+
|
|
546
|
+
### Default Value Types
|
|
547
|
+
|
|
548
|
+
| Type | Description |
|
|
549
|
+
|------|-------------|
|
|
550
|
+
| `UUIDV4` | Random UUID v4 |
|
|
551
|
+
| `SUID` | Short unique ID (compact, URL-safe) |
|
|
552
|
+
| `NOW` | Current timestamp |
|
|
553
|
+
| `AUTOINCREMENT` | Auto-incrementing integer |
|
|
554
|
+
| `SQL` | Custom SQL expression |
|
|
555
|
+
| Static | Any constant value (`"active"`, `false`, `0`) |
|
|
556
|
+
|
|
478
557
|
### Relationships
|
|
479
558
|
|
|
480
559
|
```typescript
|
|
@@ -296,13 +296,49 @@ interface BulkResponse<T = string[]> {
|
|
|
296
296
|
error: string;
|
|
297
297
|
}>;
|
|
298
298
|
}
|
|
299
|
-
type FieldType = "String" | "Text" | "Integer" | "BigInt" | "Float" | "Double" | "Decimal" | "Boolean" | "Date" | "DateTime" | "Time" | "UUID" | "JSON" | "JSONB" | "Array" | "Geometry" | "Point" | "LineString" | "Polygon" | "Enum";
|
|
299
|
+
type FieldType = "String" | "Text" | "Integer" | "BigInt" | "Float" | "Real" | "Double" | "Decimal" | "Boolean" | "Date" | "DateTime" | "Time" | "UUID" | "SUID" | "JSON" | "JSONB" | "Array" | "Geometry" | "Point" | "LineString" | "Polygon" | "Enum";
|
|
300
|
+
/**
|
|
301
|
+
* Default value types supported by Baasix
|
|
302
|
+
*/
|
|
303
|
+
type DefaultValueType = {
|
|
304
|
+
type: "UUIDV4";
|
|
305
|
+
} | {
|
|
306
|
+
type: "SUID";
|
|
307
|
+
} | {
|
|
308
|
+
type: "NOW";
|
|
309
|
+
} | {
|
|
310
|
+
type: "AUTOINCREMENT";
|
|
311
|
+
} | {
|
|
312
|
+
type: "SQL";
|
|
313
|
+
value: string;
|
|
314
|
+
} | {
|
|
315
|
+
type: "CURRENT_USER";
|
|
316
|
+
} | {
|
|
317
|
+
type: "CURRENT_TENANT";
|
|
318
|
+
};
|
|
300
319
|
interface FieldDefinition {
|
|
301
320
|
type: FieldType;
|
|
302
321
|
primaryKey?: boolean;
|
|
303
322
|
allowNull?: boolean;
|
|
304
323
|
unique?: boolean;
|
|
305
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Default value for the field
|
|
326
|
+
* Can be a static value or a dynamic type
|
|
327
|
+
* @example
|
|
328
|
+
* // Static values
|
|
329
|
+
* defaultValue: "active"
|
|
330
|
+
* defaultValue: 0
|
|
331
|
+
* defaultValue: false
|
|
332
|
+
* defaultValue: []
|
|
333
|
+
*
|
|
334
|
+
* // Dynamic types
|
|
335
|
+
* defaultValue: { type: "UUIDV4" }
|
|
336
|
+
* defaultValue: { type: "SUID" }
|
|
337
|
+
* defaultValue: { type: "NOW" }
|
|
338
|
+
* defaultValue: { type: "AUTOINCREMENT" }
|
|
339
|
+
* defaultValue: { type: "SQL", value: "CURRENT_DATE" }
|
|
340
|
+
*/
|
|
341
|
+
defaultValue?: DefaultValueType | string | number | boolean | null | unknown[] | Record<string, unknown>;
|
|
306
342
|
values?: {
|
|
307
343
|
length?: number;
|
|
308
344
|
precision?: number;
|
|
@@ -311,11 +347,25 @@ interface FieldDefinition {
|
|
|
311
347
|
values?: string[];
|
|
312
348
|
};
|
|
313
349
|
validate?: {
|
|
350
|
+
/** Minimum value for numeric fields */
|
|
314
351
|
min?: number;
|
|
352
|
+
/** Maximum value for numeric fields */
|
|
315
353
|
max?: number;
|
|
316
|
-
|
|
354
|
+
/** Validate as integer */
|
|
355
|
+
isInt?: boolean;
|
|
356
|
+
/** String must not be empty */
|
|
357
|
+
notEmpty?: boolean;
|
|
358
|
+
/** Validate email format */
|
|
317
359
|
isEmail?: boolean;
|
|
360
|
+
/** Validate URL format */
|
|
318
361
|
isUrl?: boolean;
|
|
362
|
+
/** String length range [min, max] */
|
|
363
|
+
len?: [number, number];
|
|
364
|
+
/** Pattern matching with regex (alias: matches) */
|
|
365
|
+
is?: string;
|
|
366
|
+
/** Pattern matching with regex (alias: is) */
|
|
367
|
+
matches?: string;
|
|
368
|
+
/** @deprecated Use 'is' or 'matches' instead */
|
|
319
369
|
regex?: string;
|
|
320
370
|
};
|
|
321
371
|
comment?: string;
|
|
@@ -611,4 +661,4 @@ declare class HttpClient {
|
|
|
611
661
|
}): Promise<T>;
|
|
612
662
|
}
|
|
613
663
|
|
|
614
|
-
export { type
|
|
664
|
+
export { type PermissionAction as $, type AuthMode as A, type BaseItem as B, type CreatePermissionData as C, type DeleteResponse as D, type FilterValue as E, type Filter as F, type FilterCondition as G, HttpClient as H, type IndexDefinition as I, type LogicalFilter as J, type SortDirection as K, type LoginCredentials as L, type MagicLinkOptions as M, type Notification as N, type AggregateFunction as O, type PasswordResetOptions as P, type QueryParams as Q, type RegisterData as R, type Sort as S, type Tenant as T, type User as U, type AggregateConfig as V, type Workflow as W, type FieldType as X, type DefaultValueType as Y, type FieldDefinition as Z, type RelationshipType as _, type AuthStateEvent as a, type WorkflowTrigger as a0, type WorkflowNode as a1, type WorkflowEdge as a2, type BaasixErrorDetails as a3, BaasixError as a4, type DeepPartial as a5, type CollectionItem as a6, type AuthResponse as b, type AuthTokens as c, type AuthState as d, type PaginatedResponse as e, type BulkResponse as f, type MutationResponse as g, type SingleResponse as h, type UploadOptions as i, type FileMetadata as j, type AssetTransformOptions as k, type SchemaInfo as l, type SchemaDefinition as m, type RelationshipDefinition as n, type SendNotificationData as o, type Permission as p, type Role as q, type Settings as r, type ReportConfig as s, type ReportResult as t, type Aggregate as u, type WorkflowExecution as v, type BaasixConfig as w, type RequestOptions as x, type HttpClientConfig as y, type FilterOperator as z };
|
|
@@ -296,13 +296,49 @@ interface BulkResponse<T = string[]> {
|
|
|
296
296
|
error: string;
|
|
297
297
|
}>;
|
|
298
298
|
}
|
|
299
|
-
type FieldType = "String" | "Text" | "Integer" | "BigInt" | "Float" | "Double" | "Decimal" | "Boolean" | "Date" | "DateTime" | "Time" | "UUID" | "JSON" | "JSONB" | "Array" | "Geometry" | "Point" | "LineString" | "Polygon" | "Enum";
|
|
299
|
+
type FieldType = "String" | "Text" | "Integer" | "BigInt" | "Float" | "Real" | "Double" | "Decimal" | "Boolean" | "Date" | "DateTime" | "Time" | "UUID" | "SUID" | "JSON" | "JSONB" | "Array" | "Geometry" | "Point" | "LineString" | "Polygon" | "Enum";
|
|
300
|
+
/**
|
|
301
|
+
* Default value types supported by Baasix
|
|
302
|
+
*/
|
|
303
|
+
type DefaultValueType = {
|
|
304
|
+
type: "UUIDV4";
|
|
305
|
+
} | {
|
|
306
|
+
type: "SUID";
|
|
307
|
+
} | {
|
|
308
|
+
type: "NOW";
|
|
309
|
+
} | {
|
|
310
|
+
type: "AUTOINCREMENT";
|
|
311
|
+
} | {
|
|
312
|
+
type: "SQL";
|
|
313
|
+
value: string;
|
|
314
|
+
} | {
|
|
315
|
+
type: "CURRENT_USER";
|
|
316
|
+
} | {
|
|
317
|
+
type: "CURRENT_TENANT";
|
|
318
|
+
};
|
|
300
319
|
interface FieldDefinition {
|
|
301
320
|
type: FieldType;
|
|
302
321
|
primaryKey?: boolean;
|
|
303
322
|
allowNull?: boolean;
|
|
304
323
|
unique?: boolean;
|
|
305
|
-
|
|
324
|
+
/**
|
|
325
|
+
* Default value for the field
|
|
326
|
+
* Can be a static value or a dynamic type
|
|
327
|
+
* @example
|
|
328
|
+
* // Static values
|
|
329
|
+
* defaultValue: "active"
|
|
330
|
+
* defaultValue: 0
|
|
331
|
+
* defaultValue: false
|
|
332
|
+
* defaultValue: []
|
|
333
|
+
*
|
|
334
|
+
* // Dynamic types
|
|
335
|
+
* defaultValue: { type: "UUIDV4" }
|
|
336
|
+
* defaultValue: { type: "SUID" }
|
|
337
|
+
* defaultValue: { type: "NOW" }
|
|
338
|
+
* defaultValue: { type: "AUTOINCREMENT" }
|
|
339
|
+
* defaultValue: { type: "SQL", value: "CURRENT_DATE" }
|
|
340
|
+
*/
|
|
341
|
+
defaultValue?: DefaultValueType | string | number | boolean | null | unknown[] | Record<string, unknown>;
|
|
306
342
|
values?: {
|
|
307
343
|
length?: number;
|
|
308
344
|
precision?: number;
|
|
@@ -311,11 +347,25 @@ interface FieldDefinition {
|
|
|
311
347
|
values?: string[];
|
|
312
348
|
};
|
|
313
349
|
validate?: {
|
|
350
|
+
/** Minimum value for numeric fields */
|
|
314
351
|
min?: number;
|
|
352
|
+
/** Maximum value for numeric fields */
|
|
315
353
|
max?: number;
|
|
316
|
-
|
|
354
|
+
/** Validate as integer */
|
|
355
|
+
isInt?: boolean;
|
|
356
|
+
/** String must not be empty */
|
|
357
|
+
notEmpty?: boolean;
|
|
358
|
+
/** Validate email format */
|
|
317
359
|
isEmail?: boolean;
|
|
360
|
+
/** Validate URL format */
|
|
318
361
|
isUrl?: boolean;
|
|
362
|
+
/** String length range [min, max] */
|
|
363
|
+
len?: [number, number];
|
|
364
|
+
/** Pattern matching with regex (alias: matches) */
|
|
365
|
+
is?: string;
|
|
366
|
+
/** Pattern matching with regex (alias: is) */
|
|
367
|
+
matches?: string;
|
|
368
|
+
/** @deprecated Use 'is' or 'matches' instead */
|
|
319
369
|
regex?: string;
|
|
320
370
|
};
|
|
321
371
|
comment?: string;
|
|
@@ -611,4 +661,4 @@ declare class HttpClient {
|
|
|
611
661
|
}): Promise<T>;
|
|
612
662
|
}
|
|
613
663
|
|
|
614
|
-
export { type
|
|
664
|
+
export { type PermissionAction as $, type AuthMode as A, type BaseItem as B, type CreatePermissionData as C, type DeleteResponse as D, type FilterValue as E, type Filter as F, type FilterCondition as G, HttpClient as H, type IndexDefinition as I, type LogicalFilter as J, type SortDirection as K, type LoginCredentials as L, type MagicLinkOptions as M, type Notification as N, type AggregateFunction as O, type PasswordResetOptions as P, type QueryParams as Q, type RegisterData as R, type Sort as S, type Tenant as T, type User as U, type AggregateConfig as V, type Workflow as W, type FieldType as X, type DefaultValueType as Y, type FieldDefinition as Z, type RelationshipType as _, type AuthStateEvent as a, type WorkflowTrigger as a0, type WorkflowNode as a1, type WorkflowEdge as a2, type BaasixErrorDetails as a3, BaasixError as a4, type DeepPartial as a5, type CollectionItem as a6, type AuthResponse as b, type AuthTokens as c, type AuthState as d, type PaginatedResponse as e, type BulkResponse as f, type MutationResponse as g, type SingleResponse as h, type UploadOptions as i, type FileMetadata as j, type AssetTransformOptions as k, type SchemaInfo as l, type SchemaDefinition as m, type RelationshipDefinition as n, type SendNotificationData as o, type Permission as p, type Role as q, type Settings as r, type ReportConfig as s, type ReportResult as t, type Aggregate as u, type WorkflowExecution as v, type BaasixConfig as w, type RequestOptions as x, type HttpClientConfig as y, type FilterOperator as z };
|