@oddington/sdk 0.1.53 → 0.1.55

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.
@@ -15,7 +15,7 @@ export type { GmailRuntimeConnection, AirtableRuntimeConnection, DropboxRuntimeC
15
15
  export type { Connections } from '../../../shared/airtable-contract.js';
16
16
  export declare const connections: import('../../../shared/airtable-contract.js').Connections;
17
17
  export { DataOperationError } from '../../../shared/data-contract.js';
18
- export type { DataRepository, DataErrorCode, DataValidationDetail, DataFieldExpectation, PublicValueDefinition, PublicField, CollectionSummary, CollectionSchema, QueryScalar, SelectionOptions, RecordSelection, RecordsQuery, DataValue, SelectedRecord, SelectionMetadata, RecordsResult, RecordsReadInput, RecordsReadResult, RecordsSearchOptions, RecordsSearchResult, RecordIdentity, RecordCreation, RecordUpdateSet, AppliedChanges, PublishedChanges, DataChangeOptions, DataChangeSet, DataEffect, DataFailureDetail, DataPublicationDetail, DataFailureCauseCode, LocalDataFileAction } from '../../../shared/data-contract.js';
18
+ export type { DataRepository, DataErrorCode, DataValidationDetail, DataFieldExpectation, PublicValueDefinition, PublicField, CollectionSummary, CollectionSchema, QueryScalar, SelectionOptions, RecordSelection, RecordsQuery, DataValue, SelectedRecord, SelectionMetadata, SnapshotChange, RecordsResult, RecordsReadInput, RecordsReadResult, RecordsSearchOptions, RecordsSearchResult, RecordIdentity, RecordCreation, RecordUpdateSet, AppliedChanges, PublishedChanges, DataChangeOptions, DataChangeSet, DataEffect, DataFailureDetail, DataPublicationDetail, DataFailureCauseCode, LocalDataFileAction } from '../../../shared/data-contract.js';
19
19
  declare global {
20
20
  namespace __OddingtonOS {
21
21
  /** Import-free OS-generated metadata; no runtime namespace is created. */
@@ -26,8 +26,20 @@ declare global {
26
26
  /** Reserved for OS-generated snapshots, including legacy module augmentations. */
27
27
  export interface DataRepositorySchemas extends __OddingtonOS.DataRepositorySchemas {
28
28
  }
29
+ export type DataSnapshot<Name extends string = string> = {
30
+ records: Pick<import('./data-schema-types.js').RepositoryFor<Name>['records'], 'query' | 'pages' | 'all'> & {
31
+ read(ref: string): Promise<import('../../../shared/data-contract.js').SelectedRecord | null>;
32
+ };
33
+ changes: {
34
+ list(): Promise<import('../../../shared/data-contract.js').SnapshotChange[]>;
35
+ };
36
+ };
29
37
  export declare const data: {
30
38
  repository<const Name extends string>(name: Name): import('./data-schema-types.js').RepositoryFor<Name>;
39
+ init<const Name extends string>(input: {
40
+ repository: Name;
41
+ snapshot: string;
42
+ }): Promise<DataSnapshot<Name>>;
31
43
  };
32
44
  export { FileOperationError } from '../../../shared/files-contract.js';
33
45
  export { source } from './source.js';
@@ -196,6 +196,31 @@ export interface DataRepository {
196
196
  };
197
197
  changes(options?: DataChangeOptions): DataChangeSet;
198
198
  }
199
+ /** Raw logical facts relevant to one initialized named snapshot. */
200
+ export type SnapshotChange = {
201
+ id: string;
202
+ version: string;
203
+ ref: string;
204
+ recordVersion: string;
205
+ updatedAt: string;
206
+ effect: {
207
+ kind: 'set';
208
+ field: string;
209
+ value: DataValue;
210
+ } | {
211
+ kind: 'create' | 'delete';
212
+ fields: Record<string, DataValue>;
213
+ };
214
+ personId?: string;
215
+ source?: {
216
+ kind: 'app' | 'routine';
217
+ id: string;
218
+ };
219
+ publication?: {
220
+ commit: string;
221
+ time: string;
222
+ };
223
+ };
199
224
  export type DataErrorCode = 'context_unavailable' | 'unauthenticated' | 'access_denied' | 'invalid_query' | 'request_too_large' | 'capacity' | 'unavailable' | 'invalid_change' | 'conflict' | 'apply_pending';
200
225
  export type DataEffect = 'unapplied' | 'uncertain' | 'applied';
201
226
  export type DataFieldExpectation = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oddington/sdk",
3
- "version": "0.1.53",
3
+ "version": "0.1.55",
4
4
  "description": "OS routine and response-handler SDK",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",