proto.io 0.0.223 → 0.0.224

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 (46) hide show
  1. package/dist/adapters/file/aliyun-oss.d.ts +3 -3
  2. package/dist/adapters/file/database.d.ts +2 -2
  3. package/dist/adapters/file/database.js +1 -1
  4. package/dist/adapters/file/database.mjs +1 -1
  5. package/dist/adapters/file/filesystem.d.ts +3 -3
  6. package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
  7. package/dist/adapters/storage/progres.d.ts +1 -1
  8. package/dist/adapters/storage/progres.js +3 -3
  9. package/dist/adapters/storage/progres.js.map +1 -1
  10. package/dist/adapters/storage/progres.mjs +3 -3
  11. package/dist/adapters/storage/progres.mjs.map +1 -1
  12. package/dist/client.d.ts +3 -3
  13. package/dist/client.js +1 -1
  14. package/dist/client.mjs +2 -2
  15. package/dist/index.d.ts +3 -3
  16. package/dist/index.js +53 -51
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +54 -52
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/internals/{base-D7eiLTdl.d.ts → base-NZIvB1zK.d.ts} +2 -2
  21. package/dist/internals/base-NZIvB1zK.d.ts.map +1 -0
  22. package/dist/internals/{chunk-B95QS-B7.d.ts → chunk-B9i8NMB_.d.ts} +3 -3
  23. package/dist/internals/chunk-B9i8NMB_.d.ts.map +1 -0
  24. package/dist/internals/{index-B9kyejqo.d.ts → index-BOboD1oK.d.ts} +84 -35
  25. package/dist/internals/index-BOboD1oK.d.ts.map +1 -0
  26. package/dist/internals/{index-BozJOOCD.mjs → index-BZ79Ljis.mjs} +12 -1
  27. package/dist/internals/index-BZ79Ljis.mjs.map +1 -0
  28. package/dist/internals/{index-DRgs8WkW.d.ts → index-BcNiVp-e.d.ts} +3 -2
  29. package/dist/internals/index-BcNiVp-e.d.ts.map +1 -0
  30. package/dist/internals/index-CLKTEIj0.js.map +1 -1
  31. package/dist/internals/index-gWcE22mf.mjs.map +1 -1
  32. package/dist/internals/{index-C01HL8O6.js → index-vOFh8pVc.js} +12 -1
  33. package/dist/internals/index-vOFh8pVc.js.map +1 -0
  34. package/dist/internals/{validator-DX2nXeQo.mjs → validator-0I1kvhsL.mjs} +42 -10
  35. package/dist/internals/validator-0I1kvhsL.mjs.map +1 -0
  36. package/dist/internals/{validator-B5yHpyvb.js → validator-Bc1jRJfA.js} +42 -10
  37. package/dist/internals/validator-Bc1jRJfA.js.map +1 -0
  38. package/package.json +1 -1
  39. package/dist/internals/base-D7eiLTdl.d.ts.map +0 -1
  40. package/dist/internals/chunk-B95QS-B7.d.ts.map +0 -1
  41. package/dist/internals/index-B9kyejqo.d.ts.map +0 -1
  42. package/dist/internals/index-BozJOOCD.mjs.map +0 -1
  43. package/dist/internals/index-C01HL8O6.js.map +0 -1
  44. package/dist/internals/index-DRgs8WkW.d.ts.map +0 -1
  45. package/dist/internals/validator-B5yHpyvb.js.map +0 -1
  46. package/dist/internals/validator-DX2nXeQo.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { d as TFileStorage, T as TSchema, P as ProtoService, G as TFileInfo } from './index-B9kyejqo.js';
1
+ import { d as TFileStorage, T as TSchema, P as ProtoService, G as TFileInfo } from './index-BOboD1oK.js';
2
2
  import { BinaryData } from '@o2ter/utils-js';
3
3
 
4
4
  type FileStorageOptions = {
@@ -23,4 +23,4 @@ declare abstract class FileStorageBase implements TFileStorage {
23
23
  }
24
24
 
25
25
  export { FileStorageBase as F, type FileStorageOptions as a };
26
- //# sourceMappingURL=base-D7eiLTdl.d.ts.map
26
+ //# sourceMappingURL=base-NZIvB1zK.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-NZIvB1zK.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
- import { F as FileStorageBase } from './base-D7eiLTdl.js';
2
- import { P as ProtoService } from './index-B9kyejqo.js';
1
+ import { F as FileStorageBase } from './base-NZIvB1zK.js';
2
+ import { P as ProtoService } from './index-BOboD1oK.js';
3
3
 
4
4
  declare abstract class FileChunkStorageBase<File> extends FileStorageBase {
5
5
  abstract listChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{
@@ -14,4 +14,4 @@ declare abstract class FileChunkStorageBase<File> extends FileStorageBase {
14
14
  }
15
15
 
16
16
  export { FileChunkStorageBase as F };
17
- //# sourceMappingURL=chunk-B95QS-B7.d.ts.map
17
+ //# sourceMappingURL=chunk-B9i8NMB_.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chunk-B9i8NMB_.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1054,6 +1054,15 @@ interface ProtoType<Ext> {
1054
1054
  }) => T)): Promise<this & {
1055
1055
  session?: _Session;
1056
1056
  } & T>;
1057
+ /**
1058
+ * Refreshes the authentication/session status for the socket connection.
1059
+ *
1060
+ * This method should be called when the session token or authentication state changes,
1061
+ * ensuring that any active socket connections are updated to reflect the new session.
1062
+ * Useful for maintaining real-time features (such as LiveQuery) after login, logout,
1063
+ * or session renewal.
1064
+ */
1065
+ refreshSocketSession(): void;
1057
1066
  /**
1058
1067
  * Sets the session token.
1059
1068
  * @param token - The session token.
@@ -1195,6 +1204,8 @@ type ExtraOptions<M extends boolean> = {
1195
1204
  abortSignal?: AbortSignal;
1196
1205
  /**
1197
1206
  * Disable the triggers.
1207
+ *
1208
+ * Only effective when `master` is `true`.
1198
1209
  */
1199
1210
  silent?: boolean;
1200
1211
  };
@@ -1430,113 +1441,147 @@ type ExactOneProp<T> = {
1430
1441
 
1431
1442
  declare namespace TSchema {
1432
1443
  /**
1433
- * Access Control List represented as an array of strings.
1444
+ * Access Control List (ACL).
1445
+ *
1446
+ * An array of strings representing users or roles that have access to a resource.
1434
1447
  */
1435
1448
  type ACL = string[];
1436
1449
  /**
1437
1450
  * Access Control Lists for read and update operations.
1451
+ *
1452
+ * Defines separate ACLs for reading and updating an object.
1438
1453
  */
1439
1454
  type ACLs = {
1440
1455
  /**
1441
1456
  * ACL for read operation.
1457
+ * Users or roles allowed to read the object.
1442
1458
  */
1443
1459
  read: TSchema.ACL;
1444
1460
  /**
1445
1461
  * ACL for update operation.
1462
+ * Users or roles allowed to update the object.
1446
1463
  */
1447
1464
  update: TSchema.ACL;
1448
1465
  };
1449
1466
  /**
1450
- * Primitive data types.
1467
+ * Supported primitive data types.
1451
1468
  */
1452
1469
  type Primitive = 'boolean' | 'number' | 'decimal' | 'string' | 'string[]' | 'date' | 'object' | 'array';
1453
1470
  /**
1454
- * Primitive type with an optional default value.
1471
+ * Primitive type with optional default value.
1472
+ *
1473
+ * Can be a string literal (e.g., 'string') or an object specifying the type and a default value.
1455
1474
  */
1456
1475
  type PrimitiveType = Primitive | {
1457
1476
  /**
1458
- * The type of the primitive.
1477
+ * The primitive type.
1459
1478
  */
1460
1479
  type: Primitive;
1461
1480
  /**
1462
- * Optional default value.
1481
+ * Optional default value for the field.
1463
1482
  */
1464
1483
  default?: TValueWithoutObject;
1465
1484
  };
1466
1485
  /**
1467
- * Vector type with a specified dimension and an optional default value.
1486
+ * Vector type with a specified dimension and optional default value.
1487
+ *
1488
+ * Used for fields storing fixed-length numeric arrays (vectors).
1468
1489
  */
1469
1490
  type VectorType = {
1470
1491
  /**
1471
- * The type of the vector.
1492
+ * The type of the field. Always 'vector'.
1472
1493
  */
1473
1494
  type: 'vector';
1474
1495
  /**
1475
- * The dimension of the vector.
1496
+ * The dimension (length) of the vector.
1476
1497
  */
1477
1498
  dimension: number;
1478
1499
  /**
1479
- * Optional default value.
1500
+ * Optional default value for the vector.
1480
1501
  */
1481
1502
  default?: number[];
1482
1503
  };
1483
1504
  /**
1484
- * Shape type with a specified shape.
1505
+ * Shape type for nested objects.
1506
+ *
1507
+ * Allows defining complex, nested object structures with their own field types.
1485
1508
  */
1486
1509
  type ShapeType = {
1487
1510
  /**
1488
- * The type of the shape.
1511
+ * The type of the field. Always 'shape'.
1489
1512
  */
1490
1513
  type: 'shape';
1491
1514
  /**
1492
- * The shape definition.
1515
+ * The shape definition, mapping field names to their data types.
1493
1516
  */
1494
1517
  shape: Record<string, DataType>;
1495
1518
  };
1496
1519
  /**
1497
- * Pointer type with a target.
1498
- */
1520
+ * Pointer type for referencing another class.
1521
+ *
1522
+ * Represents a one-to-one relationship to another object.
1523
+ */
1499
1524
  type PointerType = {
1500
1525
  /**
1501
- * The type of the pointer.
1526
+ * The type of the field. Always 'pointer'.
1502
1527
  */
1503
1528
  type: 'pointer';
1504
1529
  /**
1505
- * The target class of the pointer.
1530
+ * The name of the target class being referenced.
1506
1531
  */
1507
1532
  target: string;
1508
1533
  };
1509
1534
  /**
1510
- * Relation type with a target and an optional foreign field.
1535
+ * Relation type for referencing multiple objects in another class.
1536
+ *
1537
+ * Represents a one-to-many or many-to-many relationship.
1538
+ * - `target`: The related class name.
1539
+ * - `foreignField`: (Optional) The field in the target class that refers back to this class.
1540
+ * - `match`: (Optional) Default match query options (filter, sort, etc.) applied when querying this relation.
1541
+ * Only used if `foreignField` is set.
1511
1542
  */
1512
1543
  type RelationType = {
1513
1544
  /**
1514
- * The type of the relation.
1545
+ * The type of the field. Always 'relation'.
1515
1546
  */
1516
1547
  type: 'relation';
1517
1548
  /**
1518
- * The target class of the relation.
1549
+ * The name of the target class for this relation.
1519
1550
  */
1520
1551
  target: string;
1521
1552
  /**
1522
- * Optional foreign field.
1553
+ * (Optional) The field in the target class that refers back to this class.
1554
+ * If provided, the relation is managed via this foreign key.
1523
1555
  */
1524
1556
  foreignField?: string;
1557
+ /**
1558
+ * (Optional) Default match query options for this relation.
1559
+ *
1560
+ * These options define default query behaviors—such as filtering, sorting, limiting results, and other query parameters—
1561
+ * that will be automatically applied when querying this relation via the specified `foreignField`.
1562
+ *
1563
+ * Note: `match` is only applicable if `foreignField` is set. If `foreignField` is not provided, `match` will be ignored.
1564
+ */
1565
+ match?: TQueryBaseOptions;
1525
1566
  };
1526
1567
  /**
1527
- * Data type which can be a primitive, vector, shape, pointer, or relation type.
1568
+ * Data type for schema fields.
1569
+ *
1570
+ * Can be a primitive, vector, shape, pointer, or relation type.
1528
1571
  */
1529
1572
  type DataType = PrimitiveType | VectorType | ShapeType | PointerType | RelationType;
1530
1573
  /**
1531
- * Class Level Permissions.
1574
+ * Class Level Permissions (CLPs).
1575
+ *
1576
+ * Defines access control for various operations at the class level.
1532
1577
  */
1533
1578
  type CLPs = {
1534
1579
  /**
1535
- * ACL for get operation.
1580
+ * ACL for get (read single object) operation.
1536
1581
  */
1537
1582
  get?: TSchema.ACL;
1538
1583
  /**
1539
- * ACL for find operation.
1584
+ * ACL for find (query multiple objects) operation.
1540
1585
  */
1541
1586
  find?: TSchema.ACL;
1542
1587
  /**
@@ -1557,32 +1602,36 @@ declare namespace TSchema {
1557
1602
  delete?: TSchema.ACL;
1558
1603
  };
1559
1604
  /**
1560
- * Field Level Permissions.
1605
+ * Field Level Permissions (FLPs).
1606
+ *
1607
+ * Defines access control for individual fields.
1561
1608
  */
1562
1609
  type FLPs = {
1563
1610
  /**
1564
- * ACL for read operation.
1611
+ * ACL for reading the field.
1565
1612
  */
1566
1613
  read?: TSchema.ACL;
1567
1614
  /**
1568
- * ACL for create operation.
1615
+ * ACL for creating the field.
1569
1616
  */
1570
1617
  create?: TSchema.ACL;
1571
1618
  /**
1572
- * ACL for update operation.
1619
+ * ACL for updating the field.
1573
1620
  */
1574
1621
  update?: TSchema.ACL;
1575
1622
  };
1576
1623
  /**
1577
- * Indexes for the schema.
1624
+ * Index definitions for the schema.
1625
+ *
1626
+ * Supports both basic and vector indexes.
1578
1627
  */
1579
1628
  type Indexes = {
1580
1629
  /**
1581
- * Type of the index, default is 'basic'.
1630
+ * Type of the index. Default is 'basic'.
1582
1631
  */
1583
1632
  type?: 'basic';
1584
1633
  /**
1585
- * Keys for the index.
1634
+ * Keys for the index, mapping field names to sort order (1 for ascending, -1 for descending).
1586
1635
  */
1587
1636
  keys: Record<string, 1 | -1>;
1588
1637
  /**
@@ -1591,15 +1640,15 @@ declare namespace TSchema {
1591
1640
  unique?: boolean;
1592
1641
  } | {
1593
1642
  /**
1594
- * Type of the index, must be 'vector'.
1643
+ * Type of the index. Must be 'vector' for vector indexes.
1595
1644
  */
1596
1645
  type: 'vector';
1597
1646
  /**
1598
- * Keys for the vector index.
1647
+ * Keys for the vector index. Can be a single field or an array of fields.
1599
1648
  */
1600
1649
  keys: string | string[];
1601
1650
  /**
1602
- * Method for the vector index.
1651
+ * Method for the vector index. Supported: 'hnsw', 'ivfflat'.
1603
1652
  */
1604
1653
  method?: 'hnsw' | 'ivfflat';
1605
1654
  };
@@ -2012,4 +2061,4 @@ declare class ProtoService<Ext = any> extends ProtoType<Ext> {
2012
2061
  }
2013
2062
 
2014
2063
  export { type TransactionOptions as A, type QueryRandomOptions as B, type TPubSub as C, type DeserializeOptions as D, type ExtraOptions as E, FieldSelectorExpression as F, type TFileInfo as G, type InsertOptions as I, ProtoService as P, QueryExpression as Q, type RelationOptions as R, type SerializeOptions as S, TSchema as T, type TValueWithoutObject as a, type ProtoServiceOptions as b, type ProtoServiceKeyOptions as c, type TFileStorage as d, type TNumber as e, type TSerializable as f, deserialize as g, type TExtensions as h, ProtoType as i, TQuery as j, TObject as k, type PathName as l, type TObjectType as m, TUser as n, type EventData as o, type TQuerySelector as p, type TValueWithUndefined as q, type TValue as r, serialize as s, type TUpdateOp as t, QueryAccumulator as u, QuerySelector as v, type DecodedSortOption as w, type DecodedQuery as x, type FindOptions as y, type TStorage as z };
2015
- //# sourceMappingURL=index-B9kyejqo.d.ts.map
2064
+ //# sourceMappingURL=index-BOboD1oK.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BOboD1oK.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1527,6 +1527,11 @@ class Service {
1527
1527
  this.retryLimit = retryLimit;
1528
1528
  this.cookieKey = cookieKey || AUTH_COOKIE_KEY;
1529
1529
  }
1530
+ refreshSocketSession() {
1531
+ for (const socket of this.sockets) {
1532
+ socket.emit('auth', this.token);
1533
+ }
1534
+ }
1530
1535
  setSessionToken(token) {
1531
1536
  this.token = token;
1532
1537
  if (typeof window === 'undefined') {
@@ -1698,6 +1703,9 @@ class ProtoClientInternal {
1698
1703
  });
1699
1704
  return proto.rebind(deserialize(res.data));
1700
1705
  }
1706
+ refreshSocketSession() {
1707
+ this.service.refreshSocketSession();
1708
+ }
1701
1709
  setSessionToken(proto, token) {
1702
1710
  this.service.setSessionToken(token);
1703
1711
  }
@@ -2039,6 +2047,9 @@ class ProtoClient extends ProtoType {
2039
2047
  ...(options ?? {})
2040
2048
  });
2041
2049
  }
2050
+ refreshSocketSession() {
2051
+ this[PVK].refreshSocketSession();
2052
+ }
2042
2053
  setSessionToken(token) {
2043
2054
  this[PVK].setSessionToken(this, token);
2044
2055
  }
@@ -2072,4 +2083,4 @@ class ProtoClient extends ProtoType {
2072
2083
  }
2073
2084
 
2074
2085
  export { LiveQuerySubscription as L, ProtoType as P, TQuery as T, _logLevels as _, TUser as a, ProtoClient as b, classExtends as c, deserialize as d, serialize as s };
2075
- //# sourceMappingURL=index-BozJOOCD.mjs.map
2086
+ //# sourceMappingURL=index-BZ79Ljis.mjs.map