@oddington/sdk 0.1.67 → 0.1.69

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.
@@ -1,4 +1,4 @@
1
- import type { CollectionSchema, DataRepository, DataValue, SnapshotChange, PublicValueDefinition, RecordsQuery, RecordsResult, SelectionMetadata } from '../../../shared/data-contract.js';
1
+ import type { CollectionSchema, DataRepository, DataValue, SnapshotChange, PublicValueDefinition, RecordsQuery, RecordsResult, SelectionMetadata, RecordSignal, TimelineEntry, SignalInput, TimelineInput, SignalCondition } from '../../../shared/data-contract.js';
2
2
  import type { DataRepositorySchemas, SnapshotRecordsAllOptions } from './public.js';
3
3
  type ReadonlySchema<Value> = Value extends object ? {
4
4
  readonly [Key in keyof Value]: ReadonlySchema<Value[Key]>;
@@ -100,8 +100,11 @@ type RefField = {
100
100
  };
101
101
  type Options<Schema extends Collection, Mode> = {
102
102
  fields?: Array<Fields<Schema>['name'] | '$ref' | '$version'>;
103
+ timeline?: true;
103
104
  where?: {
104
105
  [F in FilterField<Schema> | RefField as F['name']]?: Condition<F>;
106
+ } & {
107
+ $signals?: Record<string, SignalCondition>;
105
108
  };
106
109
  } & (Mode extends 'one' ? {} : {
107
110
  order?: {
@@ -115,7 +118,9 @@ type Options<Schema extends Collection, Mode> = {
115
118
  type Exact<Actual, Allowed> = Actual extends Allowed ? Record<Exclude<keyof Actual, keyof Allowed>, never> : never;
116
119
  type ExactUnion<Actual, Allowed> = Allowed extends unknown ? Exact<Actual, Allowed> : never;
117
120
  type CheckWhere<Schema extends Collection, Actual> = {
118
- [Key in keyof Actual]: Key extends (FilterField<Schema> | RefField)['name'] ? Actual[Key] extends object ? ExactUnion<Actual[Key], Condition<Extract<FilterField<Schema> | RefField, {
121
+ [Key in keyof Actual]: Key extends '$signals' ? {
122
+ [Signal in keyof Actual[Key]]: ExactUnion<Actual[Key][Signal], SignalCondition>;
123
+ } : Key extends (FilterField<Schema> | RefField)['name'] ? Actual[Key] extends object ? ExactUnion<Actual[Key], Condition<Extract<FilterField<Schema> | RefField, {
119
124
  name: Key;
120
125
  }>>> : unknown : never;
121
126
  };
@@ -150,7 +155,16 @@ type Expanded<Schemas extends Catalogue, F, Query, Body extends boolean> = F ext
150
155
  type Project<Schemas extends Catalogue, Schema extends Collection, Query, Body extends boolean> = Schema extends Collection ? {
151
156
  $ref: string;
152
157
  $version: string;
153
- } & (Body extends true ? {
158
+ $signals: RecordSignal[];
159
+ } & (Query extends {
160
+ $: {
161
+ timeline: true;
162
+ };
163
+ } ? {
164
+ $timeline: TimelineEntry[];
165
+ } : {
166
+ $timeline?: TimelineEntry[];
167
+ }) & (Body extends true ? {
154
168
  $body?: string;
155
169
  } : {}) & {
156
170
  [F in Fields<Schema> as F['nullable'] extends true ? never : F['name'] extends SelectedNames<Schema, Query> | Exclude<keyof Query, '$'> ? F['name'] : never]: F['name'] extends keyof Query ? Expanded<Schemas, F, Query[F['name']], Body> : Value<F>;
@@ -195,6 +209,8 @@ type RecordBuilder<Create, Update, Links> = {
195
209
  update<Input extends Update>(fields: Input & Exact<Input, Update>): RecordBuilder<Create, Update, Links>;
196
210
  link<Input extends Links>(fields: Input & Exact<Input, Links>): RecordBuilder<Create, Update, Links>;
197
211
  unlink<Input extends Links>(fields: Input & Exact<Input, Links>): RecordBuilder<Create, Update, Links>;
212
+ setSignal(input: SignalInput): RecordBuilder<Create, Update, Links>;
213
+ appendTimeline(input: TimelineInput): RecordBuilder<Create, Update, Links>;
198
214
  delete(): RecordBuilder<Create, Update, Links>;
199
215
  };
200
216
  type Editable<Schema extends Collection> = Exclude<Fields<Schema>, {
@@ -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, SnapshotChange, 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 { RecordSignal, TimelineEntry, SignalRelated, SignalRelatedInput, SignalInput, TimelineInput, SignalCondition, 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. */
@@ -31,6 +31,7 @@ export type { SnapshotTransaction } from './data-schema-types.js';
31
31
  export type SnapshotRecordsAllOptions = {
32
32
  maxRecords: number;
33
33
  body?: true;
34
+ timeline?: true;
34
35
  };
35
36
  export type { SnapshotHistory, SnapshotHistoryRecord, SnapshotHistoryRecords, SnapshotHistoryChange, SnapshotHistoryEvent, SnapshotHistorySlot } from './data-snapshot-history-types.js';
36
37
  export type DataSnapshot<Name extends string = string> = {
@@ -66,8 +67,9 @@ export { InboxOperationError } from '../../../shared/inbox-member-contract.js';
66
67
  export type { InboxMember, InboxCurrent, InboxItem, QuestionWork, QuestionStatus, ActionStatus, QuestionSnapshot, QuestionAvailability, QuestionUnavailableReason, ResponseConsequence, LinkedAskSnapshot, AskUpdate, DigestReadConfirmation, RecipientCandidate, RecipientAddition, ResponseAcceptance, InboxAnswerInput, InboxSearchInput } from '../../../shared/inbox-member-types.js';
67
68
  export type { RecordSelectionResult } from '../../../shared/record-selection.js';
68
69
  export declare const inbox: import('../../../shared/inbox-member-types.js').InboxMember;
69
- export type { File, FileInput, FileStorage, FileCreateInput, FileCreateOptions, FileEnrichment, FileEnrichOptions, FileEnrichResult, FileErrorCode, FileErrorDetail } from '../../../shared/files-contract.js';
70
+ export type { File, FileInput, FileStorage, FileCreateInput, FileCreateOptions, FileUpdate, FileEnrichment, FileEnrichOptions, FileEnrichResult, FileErrorCode, FileErrorDetail } from '../../../shared/files-contract.js';
70
71
  export declare const files: {
72
+ update(id: string, changes: import('../../../shared/files-contract.js').FileUpdate): Promise<import('../../../shared/files-contract.js').File>;
71
73
  create(input: import('../../../shared/files-contract.js').FileCreateInput, options?: import('../../../shared/files-contract.js').FileCreateOptions): Promise<import('../../../shared/files-contract.js').File>;
72
74
  get(id: string): Promise<import('../../../shared/files-contract.js').File>;
73
75
  upload(id: string): Promise<import('../../../shared/files-contract.js').File>;
@@ -1,3 +1,5 @@
1
+ import type { RecordSignal, TimelineEntry, SignalInput, TimelineInput } from './data-signals.js';
2
+ export type { RecordSignal, TimelineEntry, SignalRelated, SignalRelatedInput, SignalInput, TimelineInput } from './data-signals.js';
1
3
  /** Canonical value vocabulary shared by schema normalization and public reads. */
2
4
  export type DataValueDefinition<Extra extends object = object> = {
3
5
  nullable: boolean;
@@ -74,8 +76,12 @@ export type QueryCondition = QueryScalar | RangeCondition | {
74
76
  $lt?: never;
75
77
  $lte?: never;
76
78
  };
79
+ type FieldInitial = 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | 'g' | 'h' | 'i' | 'j' | 'k' | 'l' | 'm' | 'n' | 'o' | 'p' | 'q' | 'r' | 's' | 't' | 'u' | 'v' | 'w' | 'x' | 'y' | 'z';
77
80
  export type SelectionOptions = {
78
- where?: Record<string, QueryCondition>;
81
+ where?: Partial<Record<`${FieldInitial | Uppercase<FieldInitial>}${string}` | '$ref', QueryCondition>> & {
82
+ $signals?: Record<string, SignalCondition>;
83
+ };
84
+ timeline?: true;
79
85
  fields?: string[];
80
86
  order?: Record<string, 'asc' | 'desc'>;
81
87
  limit?: number;
@@ -95,6 +101,9 @@ export type SelectedRecord = {
95
101
  $version: string;
96
102
  [field: string]: DataValue;
97
103
  } & {
104
+ /** Complete on every returned current Record occurrence. */
105
+ $signals: RecordSignal[];
106
+ $timeline?: TimelineEntry[];
98
107
  /** Present on explicit body reads, including snapshot all for body-enabled collections. */
99
108
  $body?: string;
100
109
  /** Present only on an expanded qualified link occurrence. */
@@ -123,6 +132,14 @@ export type RecordIdentity = Pick<SelectedRecord, '$ref' | '$version'>;
123
132
  export type RecordsReadInput = string | readonly string[];
124
133
  export type RecordsReadOptions = {
125
134
  body?: true;
135
+ timeline?: true;
136
+ };
137
+ export type SignalCondition = string | {
138
+ $in: string[];
139
+ $exists?: never;
140
+ } | {
141
+ $exists: false;
142
+ $in?: never;
126
143
  };
127
144
  export type RecordsReadResult = {
128
145
  $meta: {
@@ -173,6 +190,8 @@ export type DataChangeOptions = {
173
190
  export interface DataChangeSet {
174
191
  create(record: RecordCreation): void;
175
192
  update(ref: string, set: RecordUpdateSet): void;
193
+ setSignal(ref: string, input: SignalInput): void;
194
+ appendTimeline(ref: string, input: TimelineInput): void;
176
195
  delete(record: RecordIdentity): void;
177
196
  validate(): Promise<void>;
178
197
  apply(): Promise<AppliedChanges>;
@@ -216,9 +235,20 @@ export type SnapshotChange = {
216
235
  kind: 'unlink';
217
236
  field: string;
218
237
  refs: string[];
238
+ } | {
239
+ kind: 'signal';
240
+ key: string;
241
+ value: Omit<RecordSignal, 'key' | 'number'> & {
242
+ number?: number;
243
+ };
244
+ } | {
245
+ kind: 'timeline';
246
+ entry: TimelineEntry;
219
247
  } | {
220
248
  kind: 'create' | 'delete';
221
249
  fields: Record<string, DataValue>;
250
+ signals?: RecordSignal[];
251
+ timeline?: TimelineEntry[];
222
252
  };
223
253
  person?: {
224
254
  id: string;
@@ -302,4 +332,3 @@ export declare class DataOperationError extends Error {
302
332
  readonly detail?: DataOperationDetail | undefined;
303
333
  constructor(code: DataErrorCode, retryable?: boolean, effect?: DataEffect | undefined, component?: string | undefined, detail?: DataOperationDetail | undefined);
304
334
  }
305
- export {};
@@ -0,0 +1,6 @@
1
+ export declare const dataText: (value: unknown) => value is string;
2
+ export declare const dataVersion: (value: unknown) => value is string;
3
+ /** Own enumerable data properties only; authored getters and symbols never run. */
4
+ export declare function dataProperties(value: unknown): Record<string, PropertyDescriptor>;
5
+ /** Dense own data only: reject holes, getters, symbols and extra properties. */
6
+ export declare function dataArray(value: unknown): unknown[];
@@ -0,0 +1,59 @@
1
+ export type SignalRelated = {
2
+ type: 'record';
3
+ ref: string;
4
+ } | {
5
+ type: 'signal';
6
+ record: string;
7
+ number: number;
8
+ } | {
9
+ type: 'ask';
10
+ number: number;
11
+ };
12
+ export type RecordSignal = {
13
+ number: number;
14
+ key: string;
15
+ label: string;
16
+ status: string;
17
+ reason?: string;
18
+ related: SignalRelated[];
19
+ asOf: string;
20
+ };
21
+ export type TimelineEntry = {
22
+ when: string;
23
+ event?: string;
24
+ activity: string;
25
+ related: SignalRelated[];
26
+ };
27
+ export type SignalRelatedInput = {
28
+ record: string;
29
+ } | {
30
+ signal: {
31
+ record: string;
32
+ number: number;
33
+ };
34
+ } | {
35
+ ask: number;
36
+ };
37
+ export type SignalInput = {
38
+ key: string;
39
+ label: string;
40
+ status: string;
41
+ reason?: string;
42
+ related?: SignalRelatedInput[];
43
+ };
44
+ export type TimelineInput = {
45
+ when: string;
46
+ event?: string;
47
+ activity: string;
48
+ related?: SignalRelatedInput[];
49
+ };
50
+ export type SignalAssessment = Omit<RecordSignal, 'number'>;
51
+ export declare const validSignalKey: (value: unknown) => value is string;
52
+ export declare const validSignalText: (value: unknown) => value is string;
53
+ export declare function validSignalInstant(value: unknown): value is string;
54
+ /** Public inputs capture assessment time once; wire recapture must retain it. */
55
+ export declare function captureSignal(value: unknown, acceptedAt?: string): SignalAssessment;
56
+ export declare function captureTimeline(value: unknown, compact?: boolean): TimelineEntry;
57
+ /** Complete canonical rows carried by snapshot artifacts and confirmed effects. */
58
+ export declare function captureRecordSignal(value: unknown): RecordSignal;
59
+ export declare function captureRecordSignals(value: unknown): RecordSignal[];
@@ -12,6 +12,11 @@ export type FileCreateInput = {
12
12
  export type FileCreateOptions = {
13
13
  requestKey?: string;
14
14
  };
15
+ export type FileUpdate = {
16
+ name?: string;
17
+ path?: string;
18
+ mediaType?: string;
19
+ };
15
20
  export type FileEnrichment = {
16
21
  mediaType: string;
17
22
  size: number;
@@ -109,6 +114,8 @@ export declare function safeManagedFilePath(value: unknown): value is string;
109
114
  export type OriginalMediaType = string;
110
115
  export declare function declaredOriginalMediaType(value: unknown): string;
111
116
  export declare function isCanonicalOriginalMediaType(value: unknown): value is string;
117
+ /** Updates admit only supplied mutable original metadata, using creation rules. */
118
+ export declare function parseFileUpdate(value: unknown): FileUpdate;
112
119
  /** Private transport metadata: normalized material options exclude the request key and size declaration. */
113
120
  export type FileCreateMetadata = {
114
121
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oddington/sdk",
3
- "version": "0.1.67",
3
+ "version": "0.1.69",
4
4
  "description": "OS routine and response-handler SDK",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",