@oddington/sdk 0.1.48 → 0.1.50
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 +46 -10
- package/dist/browser.js +110 -167
- package/dist/index.js +3 -3
- package/dist/types/packages/sdk/src/public.d.ts +7 -4
- package/dist/types/shared/data-contract.d.ts +14 -2
- package/dist/types/shared/inbox-contract.d.ts +10 -37
- package/dist/types/shared/inbox-member-contract.d.ts +3 -5
- package/dist/types/shared/inbox-member-types.d.ts +7 -2
- package/dist/types/shared/inbox-records.d.ts +19 -0
- package/dist/types/shared/inbox-views.d.ts +6 -91
- package/dist/types/shared/record-selection.d.ts +0 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -606,7 +606,7 @@ links retain their ordinary Data shapes.
|
|
|
606
606
|
`source.location.dropbox({ connection, file, revision?, path?, url? })` build flat
|
|
607
607
|
Locations from successful provider responses. Use
|
|
608
608
|
`source.locations.merge(existingLocations, incomingLocations)` in an ordinary
|
|
609
|
-
|
|
609
|
+
Data field update. Known objects match by OS File ID, Gmail connection/message/
|
|
610
610
|
attachment, or Dropbox connection/File ID; newer Locations replace old path,
|
|
611
611
|
revision and URL facts. Distinct objects and custom provider values remain.
|
|
612
612
|
Helpers need no initialization and perform no I/O, choose no ref, and add no
|
|
@@ -846,7 +846,21 @@ continues to mean a day/month without a timezone.
|
|
|
846
846
|
For reads, only `capacity` and `unavailable` are retryable; an error never includes private
|
|
847
847
|
server details. Server boundaries own query bounds and authorization.
|
|
848
848
|
|
|
849
|
-
|
|
849
|
+
Response handlers receive the same `data` interface as routines. They execute
|
|
850
|
+
in a fresh managed runtime and use the pinned deployment's repository access,
|
|
851
|
+
even when the originating routine ran locally. Read current hosted Records when
|
|
852
|
+
business logic needs them; assigning known fields needs no preliminary read:
|
|
853
|
+
|
|
854
|
+
```ts
|
|
855
|
+
async run({ data }) {
|
|
856
|
+
const changes = data.repository('general').changes();
|
|
857
|
+
changes.update('transactions/one', { bookingstate: 'booked' });
|
|
858
|
+
await changes.publish();
|
|
859
|
+
return resolveAsk({ outcome: 'Booking recorded' });
|
|
860
|
+
}
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
Schema-driven creates, direct field updates and guarded deletions use the same handle
|
|
850
864
|
in immediate and captured local routines:
|
|
851
865
|
|
|
852
866
|
```ts
|
|
@@ -855,25 +869,27 @@ changes.create({
|
|
|
855
869
|
$ref: 'invoices/INV-124', $filing: { year: '2026' },
|
|
856
870
|
type: 'invoice', number: 'INV-124', status: 'draft', amount: 1200,
|
|
857
871
|
});
|
|
858
|
-
changes.update(first.invoices[0], { amount: 30 });
|
|
872
|
+
changes.update(first.invoices[0].$ref, { amount: 30 });
|
|
859
873
|
changes.delete(first.invoices[1]);
|
|
860
|
-
await changes.validate();
|
|
861
874
|
const applied = await changes.apply();
|
|
862
875
|
```
|
|
863
876
|
|
|
877
|
+
`apply()` validates before writing. Call `validate()` separately only when you
|
|
878
|
+
want to check a proposed change without applying it.
|
|
879
|
+
|
|
864
880
|
Use reserved `$body` to author a Record's Markdown content independently of its
|
|
865
|
-
schema fields, in the same
|
|
881
|
+
schema fields, in the same change set:
|
|
866
882
|
|
|
867
883
|
```ts
|
|
868
884
|
changes.create({ $ref: 'emails/email-123', type: 'email', subject: 'Invoice',
|
|
869
885
|
$body: 'Hello,\n\nPlease find our invoice attached.\n' });
|
|
870
|
-
changes.update(existingEmail, { $body: revisedMarkdown }); // body-only change
|
|
886
|
+
changes.update(existingEmail.$ref, { $body: revisedMarkdown }); // body-only change
|
|
871
887
|
```
|
|
872
888
|
|
|
873
889
|
Omitted `$body` on create means empty; omitted on update preserves the existing
|
|
874
890
|
body exactly. A string deliberately replaces it, `''` clears it, and `null` is
|
|
875
891
|
invalid. Body-only edits preserve front matter, field-only edits preserve the
|
|
876
|
-
body
|
|
892
|
+
body. Ordinary updates take a ref and do not require a version. Bodies round-trip
|
|
877
893
|
without Markdown interpretation, formatting, trimming, or fence semantics.
|
|
878
894
|
Selections and search return structured fields only. Exact reads remain
|
|
879
895
|
body-free unless they explicitly request the body:
|
|
@@ -895,7 +911,10 @@ Creation captures a complete Record and stable `$ref`, without I/O or a caller
|
|
|
895
911
|
path. OS resolves exactly one collection and its schema-declared filing path.
|
|
896
912
|
Optional `$filing` supplies only unresolved named safe components and is never
|
|
897
913
|
stored or returned as Record data; missing components reject by name. Updates
|
|
898
|
-
capture only
|
|
914
|
+
capture only the ref string and explicit fields. The caller need not read first.
|
|
915
|
+
OS assigns those fields on the current Record, preserving unspecified fields.
|
|
916
|
+
Objects and arrays replace the named field as a whole; the last successful
|
|
917
|
+
commit wins when writers assign the same field. Deletion captures only the
|
|
899
918
|
selected `$ref` and `$version`. For hosted Data, links within the deletion set
|
|
900
919
|
are allowed; schema-declared links from any committed Record outside it refuse
|
|
901
920
|
the whole group, even if a proposed update removes that link. Hosted validation
|
|
@@ -907,7 +926,7 @@ Deleted identities keep their captured versions; deletion creates no new Record
|
|
|
907
926
|
version or tombstone. A Source deletion removes only that guarded Record, retaining
|
|
908
927
|
its File, enrichments and existing durable uses.
|
|
909
928
|
During a local Run, `changes.apply()` validates the touched Records, paths,
|
|
910
|
-
authored links and
|
|
929
|
+
authored links and deletion versions without auditing unrelated Record
|
|
911
930
|
contents, then writes individual complete files atomically. Completed paths
|
|
912
931
|
remain after a later filesystem failure. `validate()` grants no later
|
|
913
932
|
permission to write; subsequent operations read the current checkout. There is
|
|
@@ -1012,12 +1031,29 @@ App-started local routines use the same current-checkout and live-effects owner.
|
|
|
1012
1031
|
|
|
1013
1032
|
Retain evidence with shared `files.create({ file: bytes, name: 'evidence.txt' })`
|
|
1014
1033
|
and put the returned File into `fileBlock({ label, files })`. Inbox has no byte
|
|
1015
|
-
intake API. Local publication uploads that same File before exposing the item. Use `data.repository(name)` for Record reads and `changes()` for guarded
|
|
1034
|
+
intake API. Local publication uploads that same File before exposing the item. Use `data.repository(name)` for Record reads and `changes()` for direct field updates and guarded
|
|
1016
1035
|
creates, updates and deletions. Local Runs read current checkout files and leave
|
|
1017
1036
|
completed Data writes as ordinary uncommitted files for review, even after later
|
|
1018
1037
|
failure. Inbox publication has no Record methods;
|
|
1019
1038
|
managed Response handlers retain their separately injected repository capability.
|
|
1020
1039
|
|
|
1040
|
+
Record presentation uses qualified current identities:
|
|
1041
|
+
|
|
1042
|
+
```ts
|
|
1043
|
+
body: [
|
|
1044
|
+
recordBlock({ label: 'Transaction', record: { repository: 'general', ref: 'transactions/one' } }),
|
|
1045
|
+
recordsBlock({ label: 'Accounts', records: [
|
|
1046
|
+
{ repository: 'general', ref: 'accounts/one' },
|
|
1047
|
+
{ repository: 'general', ref: 'accounts/two' },
|
|
1048
|
+
] }),
|
|
1049
|
+
]
|
|
1050
|
+
```
|
|
1051
|
+
|
|
1052
|
+
Inbox reads current values and schemas through its authorized member boundary.
|
|
1053
|
+
Blocks cannot supply copied fields, titles, versions or registered common View
|
|
1054
|
+
names. Missing Records stay unavailable without disabling the Ask. Handler write
|
|
1055
|
+
guards remain private handler input; immutable review evidence uses prose or Files.
|
|
1056
|
+
|
|
1021
1057
|
Hosts publishing as a member supply the existing `request` option:
|
|
1022
1058
|
|
|
1023
1059
|
```ts
|