techne-sdk 0.3.2 → 0.3.4

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 (60) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +5 -4
  3. package/dist/auth/app-key.js +2 -2
  4. package/dist/auth/index.js +1 -1
  5. package/dist/auth/placement.gen.d.ts +1 -1
  6. package/dist/auth/placement.gen.js +2 -0
  7. package/dist/catalog/catalog.gen.d.ts +6 -33
  8. package/dist/catalog/catalog.gen.js +528 -6
  9. package/dist/connect.d.ts +96 -12
  10. package/dist/connect.js +83 -12
  11. package/dist/generated/index.d.ts +56 -0
  12. package/dist/generated/index.js +72 -0
  13. package/dist/generated/lexicons.d.ts +328 -6
  14. package/dist/generated/lexicons.js +201 -3
  15. package/dist/generated/nsid.d.ts +7 -0
  16. package/dist/generated/nsid.js +7 -0
  17. package/dist/generated/nsid.json +7 -0
  18. package/dist/generated/records.d.ts +48 -44
  19. package/dist/generated/types/pub/techne/draft/collective.d.ts +2 -0
  20. package/dist/generated/types/pub/techne/draft/placeResearch.d.ts +47 -0
  21. package/dist/generated/types/pub/techne/draft/placeResearch.js +26 -0
  22. package/dist/generated/types/pub/techne/draft/questionSet.d.ts +3 -0
  23. package/dist/generated/types/pub/techne/draft/summary.d.ts +16 -0
  24. package/dist/generated/types/pub/techne/draft/summary.js +12 -0
  25. package/dist/item.d.ts +130 -0
  26. package/dist/item.js +74 -0
  27. package/dist/links/index.d.ts +15 -8
  28. package/dist/links/index.js +18 -0
  29. package/dist/put/contacts.d.ts +2 -2
  30. package/dist/put/index.d.ts +6 -9
  31. package/dist/put/index.js +8 -166
  32. package/dist/put/put.d.ts +14 -0
  33. package/dist/put/put.js +206 -0
  34. package/dist/query/compose.d.ts +246 -0
  35. package/dist/query/compose.js +572 -0
  36. package/dist/query/hosts.d.ts +98 -1
  37. package/dist/query/hosts.js +143 -2
  38. package/dist/query/index.d.ts +60 -29
  39. package/dist/query/index.js +55 -26
  40. package/dist/react/context.d.ts +18 -0
  41. package/dist/react/context.js +19 -0
  42. package/dist/react/index.d.ts +14 -0
  43. package/dist/react/index.js +14 -0
  44. package/dist/react/query.d.ts +75 -0
  45. package/dist/react/query.js +116 -0
  46. package/dist/read/index.d.ts +60 -0
  47. package/dist/read/index.js +107 -0
  48. package/dist/resend.d.ts +25 -0
  49. package/dist/resend.js +52 -0
  50. package/dist/versions/entities.gen.d.ts +8 -0
  51. package/dist/versions/entities.gen.js +9 -0
  52. package/dist/versions/index.d.ts +59 -17
  53. package/dist/versions/index.js +156 -22
  54. package/dist/versions/react.d.ts +1 -1
  55. package/dist/versions/react.js +1 -1
  56. package/dist/versions/text.d.ts +19 -0
  57. package/dist/versions/text.js +73 -0
  58. package/dist/wasm/techne-wasm.gen.js +1 -1
  59. package/dist/wasm/techne-wasm2js.gen.js +22469 -21460
  60. package/package.json +17 -5
package/CHANGELOG.md CHANGED
@@ -3,6 +3,89 @@
3
3
  `techne-sdk` on npm and the `techne-sdk` crate share a version. Each entry names what changes for an app or
4
4
  a crate user.
5
5
 
6
+ ## 0.3.4 (2026-11-10)
7
+
8
+ Lexicons `v0.1.22-techne.64` as in 0.3.3; the platform's published API re-pinned to platform `07fc8a1ec`, whose
9
+ one change is `social.scenius.ask`'s `timeChip` (known values now `now`, `today`, `thisWeek`; seen in
10
+ `techne-sdk/catalog`). The crate is unchanged and stays 0.3.3. This release brings in the platform's own SDK code (platform `07fc8a1ec` `sdk/`) that Beacon
11
+ imports, so Beacon can run on `techne-sdk`. No export is removed. What changes for an app already on
12
+ 0.3.3:
13
+
14
+ - **`Techne` is wider.** It is now `Clients` (`did`, `pds`, `platform` as in 0.3.3's `Techne`, and an optional `claims`) plus
15
+ seven methods: `query`, `get`, `versions`, `put`, `queryOptions`, `getOptions`, `versionsOptions`. Code
16
+ that reads a `Techne` is unchanged; code that builds one by hand (a test double, an object literal typed
17
+ `Techne`) must now type it `Clients`, or make it with `bind(clients)`.
18
+ - **`versionName` never shows a service handle.** A version with no name written by a `mirror-` account
19
+ (or tagged `mirror`) is named by its calendar's site, else `"Imported calendar"`; one by a `rule-`
20
+ account is `"Someone"`. 0.3.3 showed the handle.
21
+ - **`eventState` counts a description that contains, or is contained in, the one shown as agreeing**
22
+ (after decoding text). A version that only adds a longer write-up moves from `differs` to `same`, and
23
+ the field's conflict count drops; 0.3.3 compared descriptions as equal or not.
24
+ - **`useEvent`'s `pill` is `null` while the versions agree.** It follows `versionPill`'s new default
25
+ (below): 0.3.3 showed `"N versions"` whenever there were two or more.
26
+ - **`MAX_PAGE` is 500 (was 100)**, same name: see `techne-sdk/query` below.
27
+
28
+ What is new:
29
+
30
+ - **The client has its reads and its write.** `connect`, `connectHosted` and the new `connectAnonymous`
31
+ (public reads, no session) answer a `Techne` with `query`, `get`, `versions` (each answering items with
32
+ the check's verdict) and their TanStack Query options forms (`queryOptions`, `getOptions`,
33
+ `versionsOptions`), and `put` (the same write as `techne-sdk/put`'s `put`, `deletes` included).
34
+ `bind(clients)` makes one over clients made elsewhere; `connect`'s platform now defaults to
35
+ `TECHNE_PLATFORM_DID`. Also `resolveAppview`, `didDocumentUrl`, `PLC_DIRECTORY`, and `Clients`.
36
+ - **`put` sends once more when a call got no response at all** (the connection lost before any answer): it
37
+ runs again from the start, re-reading first, so nothing is written or deleted twice. A status (a 500
38
+ too) or an abort is not retried. `connectHosted` and `connectAnonymous` also resend a POST that got no
39
+ response once, with the same `Idempotency-Key` (`resendingOnce`, `IDEMPOTENCY_KEY`). `plan` takes `now`
40
+ as a `Date` or as unix seconds. A delete whose answer the first run lost answers `deleted: true` on the
41
+ second run, which finds the record gone (or, rarely, when that call never arrived and nothing was there). `PutOptions` (`wait`, `deletes`) is exported
42
+ from `techne-sdk/put`.
43
+ - **`techne-sdk/react/query`: the client's reads as hooks over TanStack Query**: `useRecordQuery`,
44
+ `useRecord`, `useVersions`, `defaultQueryClient`. `techne-sdk/react` keeps `useEvent` and adds
45
+ `TechneProvider` and `useTechne`, and still needs React only. `@tanstack/react-query` 5 is a new
46
+ optional peer dependency, needed only by an app that imports `techne-sdk/react/query`.
47
+ - **`techne-sdk/query` composes.** `compose` builds one `pub.techne.draft.query.composeRecords` call of
48
+ several steps, a later one reading what an earlier one answered (`Composition`, `Composed`, `StepRef`,
49
+ `MAX_STEP_*`, `ENVELOPE_ONLY`); `emulateCompose`, `withPost` and `testReader` run it against a stand-in.
50
+ "Hosted by" on one composed call: `hostSteps`, `hostsFrom`, `HOST_ENVELOPE`, `HOST_SOURCES_QUERY`. Also
51
+ `listRecordsCounted`, `answerOf`, `curationOf` (now exported), `shownHandle`, and the `has` condition
52
+ (`HasCondition`) in a query's `where`.
53
+ - **`MAX_PAGE` is now 500** (the lexicon's `listRecords` `limit` maximum), so `listAllRecords` asks pages
54
+ of 500; the new **`MAX_BATCH` (100)** is what one `getRecords` call or one `in` list takes. URI lists
55
+ are still sent in runs that also fit the 8 KB request line.
56
+ - **`getRecordsAnswer`**: a `handle.invalid` handle is left out of `handles`, and `defaults` keeps only
57
+ object values (`Map<string, Record<string, unknown>>`).
58
+ - **`techne-sdk/versions`**: `versionPill` is the platform's: before a pick, `"N versions"` and only when the
59
+ versions conflict (`{ hideAgreeing: false }` shows it whenever there are two or more); after a pick, who
60
+ that version is from. It now answers `accessibilityHint` too. `eventState` reads text fields decoded
61
+ (`decodeTextFields`: no `&amp;`), and a version's name is never `handle.invalid`. New: `shownVersion`,
62
+ `isImported`, `IMPORTED_CALENDAR`, `conflictsOf`.
63
+ - **`techne-sdk/links`**: a PDS refusing a link call for a missing scope throws `LinkScopeError` (links
64
+ need a platform session, or the identity methods' `rpc:` scopes).
65
+
66
+ ## 0.3.3 (2026-11-10)
67
+
68
+ Built on lexicons `v0.1.22-techne.64` (b1407281) and the platform's published API at platform
69
+ `e4cc8b0ef` (`inputs.pin.json`). The crate depends on `techne-lexicon-check` 0.3.3 from crates.io, packaged
70
+ from that lexicons tag. Additive only: no export is removed or renamed.
71
+
72
+ - **New record types `pub.techne.draft.placeResearch` and `pub.techne.draft.summary`.** `placeResearch` is
73
+ what a writer found out about a place (`subject`, `kind`, `about`, `website`, `facts`, `tags`, `sources`,
74
+ `confidence`); `summary` is a short text about any record (`subject`, `text`). Both are public, one per
75
+ subject per writer (`sidecar_rkey` of the subject's AT-URI). They get generated types, `NSID.PLACE_RESEARCH`
76
+ and `NSID.SUMMARY`, catalog and placement entries, and `put` and the WebAssembly validate them. The
77
+ publish scope (`authWrite`) now covers both.
78
+ - **`questionSet` has `howToAnswer`.** Optional answering instructions shared by every question in a set,
79
+ stated once; each question's `prompt` (still required) is then the question's own text.
80
+ - **Bigger question sets.** `questionSet.questions` and `assessment.answers` / `assessment.missing` now
81
+ allow up to 1000 items (was 200).
82
+ - **A collective can have an emoji.** Optional `collective.emoji`: one emoji (one grapheme cluster, checked by
83
+ the WebAssembly too). A client shows the avatar if there is one, else the emoji, else the name's first
84
+ letter.
85
+ - **`METHOD.GET_EVENT_ANNOTATIONS`** (`social.scenius.getEventAnnotations`), and the `social.scenius.ask`
86
+ method lexicon as the platform now publishes it (optional `chips` and `timeChip` on its answer), are in the
87
+ inputs (names only; no new client method).
88
+
6
89
  ## 0.3.2 (2026-11-10)
7
90
 
8
91
  Built on lexicons `v0.1.22-techne.63` (693f27ce) and the platform's published API at regenOS main `d3f224e6a`
package/README.md CHANGED
@@ -10,7 +10,7 @@ The SDK depends on two things only: the published lexicons (the `lexicons` repo
10
10
  ## Install
11
11
 
12
12
  ```sh
13
- npm i techne-sdk # react >= 19 is an optional peer, needed only for techne-sdk/react
13
+ npm i techne-sdk # optional peers: react >= 19 for techne-sdk/react, and @tanstack/react-query 5 too for techne-sdk/react/query
14
14
  ```
15
15
 
16
16
  Every import goes through the package's `exports`, so the resolver has to read them:
@@ -23,12 +23,13 @@ Every import goes through the package's `exports`, so the resolver has to read t
23
23
  | `techne-sdk` (also `techne-sdk/generated`) | the generated XRPC client (`AtpBaseClient`) and every lexicon type |
24
24
  | `techne-sdk/lexicons` | the generated lexicon dictionary (`schemaDict`, `schemas`, `lexicons`, `ids`): every lexicon document the client was built from, for reading descriptions at run time (large; keep it server side) |
25
25
  | `techne-sdk/types/<nsid path>` | one lexicon's types, e.g. `techne-sdk/types/social/scenius/getContactInvite` |
26
- | `techne-sdk/react` | `useEvent(uri)`: one commons event or place as its versions, with the check's verdict |
26
+ | `techne-sdk/react` | `TechneProvider` / `useTechne` (the client in React), and `useEvent(uri)`: one commons event or place as its versions, with the check's verdict (React only) |
27
+ | `techne-sdk/react/query` | the client's reads as hooks over TanStack Query (`useRecordQuery`, `useRecord`, `useVersions`, `defaultQueryClient`); needs `@tanstack/react-query` |
27
28
  | `techne-sdk/versions` | the same state without React: `eventState`, `verifyAnswer`, version labels |
28
29
  | `techne-sdk/auth` | sign-in ("Sign in with Techne"): `signIn`, `signUp`, `restore`, `signOut`, `clientMetadata`, `scopes`, `appKey`, `appSpace` (browser OAuth) |
29
- | `techne-sdk/connect` | `connect(session, platform)` / `connectHosted(did, fetchHandler)`: the clients over one session |
30
+ | `techne-sdk/connect` | `connect(session, platform?)` / `connectHosted(did, fetchHandler)` / `connectAnonymous(platform?)`: the client over one session, with its reads (`query`, `get`, `versions`, their options forms) and `put`; `bind(clients)` over clients made elsewhere |
30
31
  | `techne-sdk/put` | `put(techne, records, { deletes })`: the one write, deletes included (public deletes hinted to the platform); `put(techne, [], { deletes })` for deletes alone |
31
- | `techne-sdk/query` | the platform's generic queries: `listRecords`, `getRecords`, hosts |
32
+ | `techne-sdk/query` | the platform's generic queries: `listRecords`, `getRecords`, `compose` (several steps in one `composeRecords` call), hosts (`hostsOf`, `hostSteps`/`hostsFrom`) |
32
33
  | `techne-sdk/links` | link tokens: create, redeem, check, revoke |
33
34
  | `techne-sdk/wasm` | the check itself: `validate`, `decide`, `verify` (`validate` knows the built-in lexicons only; a runtime type is checked by the platform on write) |
34
35
  | `techne-sdk/catalog` | the browsable lexicon catalog |
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * An app's own private space (`pub.techne.draft.space.private`): its key and address. The key is the
3
- * platform's `sidecar_rkey(client_id)` (regenOS crates/regenos-lexicons/src/sidecar.rs): RFC 4648 base32,
3
+ * platform's `sidecar_rkey(client_id)` (platform crates/regenos-lexicons/src/sidecar.rs): RFC 4648 base32,
4
4
  * lowercase, no padding, of the SHA-256 of the client id's UTF-8 bytes. Synchronous (no WebCrypto), so
5
5
  * `scopes()` and `clientMetadata()` stay synchronous.
6
6
  */
@@ -61,7 +61,7 @@ export function sha256(bytes) {
61
61
  outView.setUint32(i * 4, h[i]);
62
62
  return out;
63
63
  }
64
- /** RFC 4648 base32, lowercase, no padding (regenOS `base32_lower_nopad`). */
64
+ /** RFC 4648 base32, lowercase, no padding (platform `base32_lower_nopad`). */
65
65
  function base32LowerNoPad(bytes) {
66
66
  const alphabet = 'abcdefghijklmnopqrstuvwxyz234567';
67
67
  let out = '';
@@ -86,7 +86,7 @@ function scopeList({ platform = TECHNE_PLATFORM_DID, types = [], everything, pub
86
86
  ...(publish ? [`rpc:${NSID.REGISTRY_PUBLISH_TYPE}?aud=${aud}`] : []),
87
87
  ];
88
88
  }
89
- /** A `repo` scope for `collections`, every action (regenOS `regenos_appview::nsid_rewrite::repo_scope`,
89
+ /** A `repo` scope for `collections`, every action (platform `regenos_appview::nsid_rewrite::repo_scope`,
90
90
  * crates/regenos-appview/src/nsid_rewrite.rs). */
91
91
  function repoScope(collections) {
92
92
  const actions = 'action=create&action=update&action=delete';
@@ -1 +1 @@
1
- export declare const PUBLIC_HOMES: readonly ["pub.techne.draft.appConfig", "pub.techne.draft.approval", "pub.techne.draft.connection", "pub.techne.draft.contactChannel", "pub.techne.draft.channelVerification", "pub.techne.draft.containedIn", "pub.techne.draft.derivation", "pub.techne.draft.distinctFrom", "pub.techne.draft.geo", "pub.techne.draft.heldAt", "pub.techne.draft.operator", "pub.techne.draft.org", "pub.techne.draft.profile", "pub.techne.draft.assessment", "pub.techne.draft.provenance", "pub.techne.draft.questionSet", "pub.techne.draft.receipt", "pub.techne.draft.registry.typeRequest", "pub.techne.draft.verdict", "pub.techne.draft.verification", "pub.techne.draft.retirement", "pub.techne.draft.credential", "pub.techne.draft.credentialRevocation", "pub.techne.draft.publisher", "pub.techne.draft.sameAs", "pub.techne.draft.source", "pub.techne.draft.sourceAttribution", "pub.techne.draft.sourceRef", "pub.techne.draft.evaluation", "pub.techne.draft.event.config", "pub.techne.draft.event.listing", "pub.techne.draft.feed.recipe", "pub.techne.draft.query", "pub.techne.draft.invite", "pub.techne.draft.market.ask", "pub.techne.draft.market.offer", "pub.techne.draft.membership", "pub.techne.draft.place", "pub.techne.draft.presence", "pub.techne.draft.actor.profile", "pub.techne.draft.collective", "community.lexicon.calendar.event", "community.lexicon.calendar.rsvp"];
1
+ export declare const PUBLIC_HOMES: readonly ["pub.techne.draft.appConfig", "pub.techne.draft.approval", "pub.techne.draft.connection", "pub.techne.draft.contactChannel", "pub.techne.draft.channelVerification", "pub.techne.draft.containedIn", "pub.techne.draft.derivation", "pub.techne.draft.distinctFrom", "pub.techne.draft.geo", "pub.techne.draft.heldAt", "pub.techne.draft.operator", "pub.techne.draft.org", "pub.techne.draft.profile", "pub.techne.draft.assessment", "pub.techne.draft.placeResearch", "pub.techne.draft.summary", "pub.techne.draft.provenance", "pub.techne.draft.questionSet", "pub.techne.draft.receipt", "pub.techne.draft.registry.typeRequest", "pub.techne.draft.verdict", "pub.techne.draft.verification", "pub.techne.draft.retirement", "pub.techne.draft.credential", "pub.techne.draft.credentialRevocation", "pub.techne.draft.publisher", "pub.techne.draft.sameAs", "pub.techne.draft.source", "pub.techne.draft.sourceAttribution", "pub.techne.draft.sourceRef", "pub.techne.draft.evaluation", "pub.techne.draft.event.config", "pub.techne.draft.event.listing", "pub.techne.draft.feed.recipe", "pub.techne.draft.query", "pub.techne.draft.invite", "pub.techne.draft.market.ask", "pub.techne.draft.market.offer", "pub.techne.draft.membership", "pub.techne.draft.place", "pub.techne.draft.presence", "pub.techne.draft.actor.profile", "pub.techne.draft.collective", "community.lexicon.calendar.event", "community.lexicon.calendar.rsvp"];
@@ -18,6 +18,8 @@ export const PUBLIC_HOMES = [
18
18
  NSID.ORG,
19
19
  NSID.PROFILE,
20
20
  NSID.ASSESSMENT,
21
+ NSID.PLACE_RESEARCH,
22
+ NSID.SUMMARY,
21
23
  NSID.PROVENANCE,
22
24
  NSID.QUESTION_SET,
23
25
  NSID.RECEIPT,
@@ -546,6 +546,12 @@ export declare const catalog: {
546
546
  required: boolean;
547
547
  description: string;
548
548
  knownValues?: undefined;
549
+ } | {
550
+ name: string;
551
+ type: string;
552
+ required: boolean;
553
+ description: string;
554
+ knownValues: string[];
549
555
  })[];
550
556
  doc: unknown;
551
557
  params?: undefined;
@@ -798,39 +804,6 @@ export declare const catalog: {
798
804
  }[];
799
805
  doc: unknown;
800
806
  params?: undefined;
801
- } | {
802
- nsid: string;
803
- name: string;
804
- group: string;
805
- kind: string;
806
- class: string;
807
- description: string;
808
- input: ({
809
- name: string;
810
- type: string;
811
- required: boolean;
812
- description?: undefined;
813
- } | {
814
- name: string;
815
- type: string;
816
- required: boolean;
817
- description: string;
818
- })[];
819
- output: ({
820
- name: string;
821
- type: string;
822
- required: boolean;
823
- description: string;
824
- knownValues?: undefined;
825
- } | {
826
- name: string;
827
- type: string;
828
- required: boolean;
829
- description: string;
830
- knownValues: string[];
831
- })[];
832
- doc: unknown;
833
- params?: undefined;
834
807
  })[];
835
808
  counts: {
836
809
  records: number;