skapi-js 2.0.0-rc.7 → 2.0.0-rc.9

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/skapi.d.mts CHANGED
@@ -248,6 +248,13 @@ type Connection = {
248
248
  prevent_inquiry: boolean;
249
249
  prevent_signup: boolean;
250
250
  prevent_anonymous: boolean;
251
+ /**
252
+ * Project-wide default for `table.access_group`, set by the project
253
+ * owner. Applied by getRecords / postRecord / deleteRecords unless the
254
+ * `default_access_group` init option overrides it. Absent when the owner
255
+ * has not set one, in which case the SDK's own default (0) stands.
256
+ */
257
+ default_access_group?: DefaultAccessGroup;
251
258
  };
252
259
  ai_agent?: string;
253
260
  };
@@ -564,6 +571,20 @@ type FileInfo = {
564
571
  uploaded: number;
565
572
  fileKey: string;
566
573
  };
574
+ /**
575
+ * A project-wide default for `table.access_group`.
576
+ *
577
+ * Accepts everything `table.access_group` itself accepts (a number 0-99, or one
578
+ * of 'public' / 'private' / 'authorized' / 'admin'), plus 'ask'.
579
+ *
580
+ * 'ask' does not pick a group: it makes an OMITTED `access_group` an error, so
581
+ * the caller has to state one on every record it reads, writes or deletes by
582
+ * table. Meant for projects that hold data at more than one visibility and would
583
+ * rather fail loudly than quietly fall back to public. Calls addressed by
584
+ * `record_id` or `unique_id`, and updates to an existing record, are unaffected:
585
+ * they do not carry a table at all.
586
+ */
587
+ type DefaultAccessGroup = number | 'public' | 'private' | 'authorized' | 'admin' | 'ask';
567
588
  type ConnectionInfo = {
568
589
  /** Public project ID (service + owner composed into the two-segment token). Empty when the service has no uuid owner. */
569
590
  project_id: string;
@@ -579,6 +600,13 @@ type ConnectionInfo = {
579
600
  prevent_signup: boolean;
580
601
  prevent_inquiry: boolean;
581
602
  prevent_anonymous: boolean;
603
+ /**
604
+ * Project-wide default for `table.access_group`, set by the project
605
+ * owner. Applied by getRecords / postRecord / deleteRecords unless the
606
+ * `default_access_group` init option overrides it. Absent when the owner
607
+ * has not set one, in which case the SDK's own default (0) stands.
608
+ */
609
+ default_access_group?: DefaultAccessGroup;
582
610
  };
583
611
  };
584
612
  type Table = {
@@ -627,6 +655,7 @@ type Types_Condition = Condition;
627
655
  type Types_Connection = Connection;
628
656
  type Types_ConnectionInfo = ConnectionInfo;
629
657
  type Types_DatabaseResponse<T> = DatabaseResponse<T>;
658
+ type Types_DefaultAccessGroup = DefaultAccessGroup;
630
659
  type Types_DelRecordQuery = DelRecordQuery;
631
660
  type Types_EncryptionOptions = EncryptionOptions;
632
661
  type Types_FetchOptions = FetchOptions;
@@ -655,7 +684,7 @@ type Types_UserProfile = UserProfile;
655
684
  type Types_UserPublic = UserPublic;
656
685
  type Types_WebSocketMessage = WebSocketMessage;
657
686
  declare namespace Types {
658
- export type { Types_BinaryFile as BinaryFile, Types_Condition as Condition, Types_Connection as Connection, Types_ConnectionInfo as ConnectionInfo, Types_DatabaseResponse as DatabaseResponse, Types_DelRecordQuery as DelRecordQuery, Types_EncryptionOptions as EncryptionOptions, Types_FetchOptions as FetchOptions, Types_FileInfo as FileInfo, Types_Form as Form, Types_GetRecordQuery as GetRecordQuery, Types_Index as Index, Types_Newsletter as Newsletter, Types_PostRecordConfig as PostRecordConfig, Types_ProgressCallback as ProgressCallback, Types_RTCConnector as RTCConnector, Types_RTCConnectorParams as RTCConnectorParams, Types_RTCEvent as RTCEvent, Types_RTCReceiverParams as RTCReceiverParams, Types_RTCResolved as RTCResolved, Types_RealtimeCallback as RealtimeCallback, Types_RecordData as RecordData, Types_RecordEncryptionInfo as RecordEncryptionInfo, Types_RequestHistory as RequestHistory, Types_Subscription as Subscription, Types_Table as Table, Types_Tag as Tag, Types_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
687
+ export type { Types_BinaryFile as BinaryFile, Types_Condition as Condition, Types_Connection as Connection, Types_ConnectionInfo as ConnectionInfo, Types_DatabaseResponse as DatabaseResponse, Types_DefaultAccessGroup as DefaultAccessGroup, Types_DelRecordQuery as DelRecordQuery, Types_EncryptionOptions as EncryptionOptions, Types_FetchOptions as FetchOptions, Types_FileInfo as FileInfo, Types_Form as Form, Types_GetRecordQuery as GetRecordQuery, Types_Index as Index, Types_Newsletter as Newsletter, Types_PostRecordConfig as PostRecordConfig, Types_ProgressCallback as ProgressCallback, Types_RTCConnector as RTCConnector, Types_RTCConnectorParams as RTCConnectorParams, Types_RTCEvent as RTCEvent, Types_RTCReceiverParams as RTCReceiverParams, Types_RTCResolved as RTCResolved, Types_RealtimeCallback as RealtimeCallback, Types_RecordData as RecordData, Types_RecordEncryptionInfo as RecordEncryptionInfo, Types_RequestHistory as RequestHistory, Types_Subscription as Subscription, Types_Table as Table, Types_Tag as Tag, Types_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
659
688
  }
660
689
 
661
690
  declare function terminatePendingRequests(): void;
@@ -698,6 +727,19 @@ type Options = {
698
727
  autoLogin: boolean;
699
728
  refetchServiceInfo?: boolean;
700
729
  requestBatchSize?: number;
730
+ /**
731
+ * Default value for `table.access_group` on getRecords, postRecord and
732
+ * deleteRecords when the caller omits one. Overrides the project's own
733
+ * `default_access_group` setting; when neither is set, the SDK's historical
734
+ * default of 0 (public) stands.
735
+ *
736
+ * 'ask' picks no group. It makes an omitted `access_group` an ERROR, for
737
+ * projects that hold data at more than one visibility and would rather fail
738
+ * loudly than quietly write to public. Calls addressed by `record_id` or
739
+ * `unique_id`, and updates to an existing record, carry no table and are
740
+ * unaffected.
741
+ */
742
+ default_access_group?: DefaultAccessGroup;
701
743
  /**
702
744
  * Enable client-side encryption of `data` on records written to
703
745
  * access_group 'private'. Off by default. See EncryptionOptions.
@@ -752,6 +794,14 @@ declare class Skapi {
752
794
  private host;
753
795
  private hostDomain;
754
796
  private target_cdn;
797
+ /**
798
+ * The `default_access_group` INIT OPTION, if one was given. Kept separate
799
+ * from the project's own setting (connection.opt.default_access_group)
800
+ * because the two have a precedence order and collapsing them would lose it:
801
+ * an app that pins a value in code must not have it changed under it by a
802
+ * dashboard edit.
803
+ */
804
+ private __default_access_group;
755
805
  private customApiDomain;
756
806
  private requestBatchSize;
757
807
  private __disabledAccount;
@@ -830,6 +880,25 @@ declare class Skapi {
830
880
  * @param params Request parameters. When `refresh` is true, the cached connection metadata is re-fetched before returning; otherwise the cached connection is returned.
831
881
  * @returns A promise that resolves to Promise<ConnectionInfo>.
832
882
  */
883
+ /**
884
+ * The effective `default_access_group` for this instance, or null when there
885
+ * is none and the SDK's historical default (0) stands.
886
+ *
887
+ * Precedence: the INIT OPTION wins, then the project's own setting. An app
888
+ * that pins a value in code is stating an intent the dashboard must not
889
+ * silently override; a project that has set one is stating a default for
890
+ * every app that has not.
891
+ *
892
+ * Reads `this.connection` rather than awaiting it: every caller
893
+ * (getRecords / postRecord / deleteRecords) has already awaited
894
+ * `__connection` before it gets here, so the project value is populated. A
895
+ * miss degrades to "no default", never to a wrong one.
896
+ *
897
+ * A malformed project value is IGNORED rather than thrown: it arrives from
898
+ * the server, not from the caller, and taking down every record call over it
899
+ * would be a worse failure than falling back to the SDK default.
900
+ */
901
+ private _defaultAccessGroup;
833
902
  getConnectionInfo(params?: {
834
903
  refresh?: boolean;
835
904
  }): Promise<ConnectionInfo>;
package/dist/skapi.d.ts CHANGED
@@ -248,6 +248,13 @@ type Connection = {
248
248
  prevent_inquiry: boolean;
249
249
  prevent_signup: boolean;
250
250
  prevent_anonymous: boolean;
251
+ /**
252
+ * Project-wide default for `table.access_group`, set by the project
253
+ * owner. Applied by getRecords / postRecord / deleteRecords unless the
254
+ * `default_access_group` init option overrides it. Absent when the owner
255
+ * has not set one, in which case the SDK's own default (0) stands.
256
+ */
257
+ default_access_group?: DefaultAccessGroup;
251
258
  };
252
259
  ai_agent?: string;
253
260
  };
@@ -564,6 +571,20 @@ type FileInfo = {
564
571
  uploaded: number;
565
572
  fileKey: string;
566
573
  };
574
+ /**
575
+ * A project-wide default for `table.access_group`.
576
+ *
577
+ * Accepts everything `table.access_group` itself accepts (a number 0-99, or one
578
+ * of 'public' / 'private' / 'authorized' / 'admin'), plus 'ask'.
579
+ *
580
+ * 'ask' does not pick a group: it makes an OMITTED `access_group` an error, so
581
+ * the caller has to state one on every record it reads, writes or deletes by
582
+ * table. Meant for projects that hold data at more than one visibility and would
583
+ * rather fail loudly than quietly fall back to public. Calls addressed by
584
+ * `record_id` or `unique_id`, and updates to an existing record, are unaffected:
585
+ * they do not carry a table at all.
586
+ */
587
+ type DefaultAccessGroup = number | 'public' | 'private' | 'authorized' | 'admin' | 'ask';
567
588
  type ConnectionInfo = {
568
589
  /** Public project ID (service + owner composed into the two-segment token). Empty when the service has no uuid owner. */
569
590
  project_id: string;
@@ -579,6 +600,13 @@ type ConnectionInfo = {
579
600
  prevent_signup: boolean;
580
601
  prevent_inquiry: boolean;
581
602
  prevent_anonymous: boolean;
603
+ /**
604
+ * Project-wide default for `table.access_group`, set by the project
605
+ * owner. Applied by getRecords / postRecord / deleteRecords unless the
606
+ * `default_access_group` init option overrides it. Absent when the owner
607
+ * has not set one, in which case the SDK's own default (0) stands.
608
+ */
609
+ default_access_group?: DefaultAccessGroup;
582
610
  };
583
611
  };
584
612
  type Table = {
@@ -627,6 +655,7 @@ type Types_Condition = Condition;
627
655
  type Types_Connection = Connection;
628
656
  type Types_ConnectionInfo = ConnectionInfo;
629
657
  type Types_DatabaseResponse<T> = DatabaseResponse<T>;
658
+ type Types_DefaultAccessGroup = DefaultAccessGroup;
630
659
  type Types_DelRecordQuery = DelRecordQuery;
631
660
  type Types_EncryptionOptions = EncryptionOptions;
632
661
  type Types_FetchOptions = FetchOptions;
@@ -655,7 +684,7 @@ type Types_UserProfile = UserProfile;
655
684
  type Types_UserPublic = UserPublic;
656
685
  type Types_WebSocketMessage = WebSocketMessage;
657
686
  declare namespace Types {
658
- export type { Types_BinaryFile as BinaryFile, Types_Condition as Condition, Types_Connection as Connection, Types_ConnectionInfo as ConnectionInfo, Types_DatabaseResponse as DatabaseResponse, Types_DelRecordQuery as DelRecordQuery, Types_EncryptionOptions as EncryptionOptions, Types_FetchOptions as FetchOptions, Types_FileInfo as FileInfo, Types_Form as Form, Types_GetRecordQuery as GetRecordQuery, Types_Index as Index, Types_Newsletter as Newsletter, Types_PostRecordConfig as PostRecordConfig, Types_ProgressCallback as ProgressCallback, Types_RTCConnector as RTCConnector, Types_RTCConnectorParams as RTCConnectorParams, Types_RTCEvent as RTCEvent, Types_RTCReceiverParams as RTCReceiverParams, Types_RTCResolved as RTCResolved, Types_RealtimeCallback as RealtimeCallback, Types_RecordData as RecordData, Types_RecordEncryptionInfo as RecordEncryptionInfo, Types_RequestHistory as RequestHistory, Types_Subscription as Subscription, Types_Table as Table, Types_Tag as Tag, Types_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
687
+ export type { Types_BinaryFile as BinaryFile, Types_Condition as Condition, Types_Connection as Connection, Types_ConnectionInfo as ConnectionInfo, Types_DatabaseResponse as DatabaseResponse, Types_DefaultAccessGroup as DefaultAccessGroup, Types_DelRecordQuery as DelRecordQuery, Types_EncryptionOptions as EncryptionOptions, Types_FetchOptions as FetchOptions, Types_FileInfo as FileInfo, Types_Form as Form, Types_GetRecordQuery as GetRecordQuery, Types_Index as Index, Types_Newsletter as Newsletter, Types_PostRecordConfig as PostRecordConfig, Types_ProgressCallback as ProgressCallback, Types_RTCConnector as RTCConnector, Types_RTCConnectorParams as RTCConnectorParams, Types_RTCEvent as RTCEvent, Types_RTCReceiverParams as RTCReceiverParams, Types_RTCResolved as RTCResolved, Types_RealtimeCallback as RealtimeCallback, Types_RecordData as RecordData, Types_RecordEncryptionInfo as RecordEncryptionInfo, Types_RequestHistory as RequestHistory, Types_Subscription as Subscription, Types_Table as Table, Types_Tag as Tag, Types_UniqueId as UniqueId, Types_UserAttributes as UserAttributes, Types_UserProfile as UserProfile, Types_UserPublic as UserPublic, Types_WebSocketMessage as WebSocketMessage };
659
688
  }
660
689
 
661
690
  declare function terminatePendingRequests(): void;
@@ -698,6 +727,19 @@ type Options = {
698
727
  autoLogin: boolean;
699
728
  refetchServiceInfo?: boolean;
700
729
  requestBatchSize?: number;
730
+ /**
731
+ * Default value for `table.access_group` on getRecords, postRecord and
732
+ * deleteRecords when the caller omits one. Overrides the project's own
733
+ * `default_access_group` setting; when neither is set, the SDK's historical
734
+ * default of 0 (public) stands.
735
+ *
736
+ * 'ask' picks no group. It makes an omitted `access_group` an ERROR, for
737
+ * projects that hold data at more than one visibility and would rather fail
738
+ * loudly than quietly write to public. Calls addressed by `record_id` or
739
+ * `unique_id`, and updates to an existing record, carry no table and are
740
+ * unaffected.
741
+ */
742
+ default_access_group?: DefaultAccessGroup;
701
743
  /**
702
744
  * Enable client-side encryption of `data` on records written to
703
745
  * access_group 'private'. Off by default. See EncryptionOptions.
@@ -752,6 +794,14 @@ declare class Skapi {
752
794
  private host;
753
795
  private hostDomain;
754
796
  private target_cdn;
797
+ /**
798
+ * The `default_access_group` INIT OPTION, if one was given. Kept separate
799
+ * from the project's own setting (connection.opt.default_access_group)
800
+ * because the two have a precedence order and collapsing them would lose it:
801
+ * an app that pins a value in code must not have it changed under it by a
802
+ * dashboard edit.
803
+ */
804
+ private __default_access_group;
755
805
  private customApiDomain;
756
806
  private requestBatchSize;
757
807
  private __disabledAccount;
@@ -830,6 +880,25 @@ declare class Skapi {
830
880
  * @param params Request parameters. When `refresh` is true, the cached connection metadata is re-fetched before returning; otherwise the cached connection is returned.
831
881
  * @returns A promise that resolves to Promise<ConnectionInfo>.
832
882
  */
883
+ /**
884
+ * The effective `default_access_group` for this instance, or null when there
885
+ * is none and the SDK's historical default (0) stands.
886
+ *
887
+ * Precedence: the INIT OPTION wins, then the project's own setting. An app
888
+ * that pins a value in code is stating an intent the dashboard must not
889
+ * silently override; a project that has set one is stating a default for
890
+ * every app that has not.
891
+ *
892
+ * Reads `this.connection` rather than awaiting it: every caller
893
+ * (getRecords / postRecord / deleteRecords) has already awaited
894
+ * `__connection` before it gets here, so the project value is populated. A
895
+ * miss degrades to "no default", never to a wrong one.
896
+ *
897
+ * A malformed project value is IGNORED rather than thrown: it arrives from
898
+ * the server, not from the caller, and taking down every record call over it
899
+ * would be a worse failure than falling back to the SDK default.
900
+ */
901
+ private _defaultAccessGroup;
833
902
  getConnectionInfo(params?: {
834
903
  refresh?: boolean;
835
904
  }): Promise<ConnectionInfo>;