@archastro/sdk 0.7.0 → 0.9.0

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 (251) hide show
  1. package/README.md +3 -0
  2. package/dist/app-session.d.ts +3 -3
  3. package/dist/app-session.d.ts.map +1 -1
  4. package/dist/app-session.js +2 -3
  5. package/dist/app-session.js.map +1 -1
  6. package/dist/auth.d.ts +5 -3
  7. package/dist/auth.d.ts.map +1 -1
  8. package/dist/auth.js +7 -5
  9. package/dist/auth.js.map +1 -1
  10. package/dist/channels/api_activity_feed_channel.js +2 -2
  11. package/dist/channels/api_activity_feed_channel.js.map +1 -1
  12. package/dist/channels/api_chat_channel.js +2 -2
  13. package/dist/channels/api_chat_channel.js.map +1 -1
  14. package/dist/channels/api_object_channel.d.ts +13 -2
  15. package/dist/channels/api_object_channel.d.ts.map +1 -1
  16. package/dist/channels/api_object_channel.js +21 -6
  17. package/dist/channels/api_object_channel.js.map +1 -1
  18. package/dist/channels/api_tasks_channel.d.ts +30 -0
  19. package/dist/channels/api_tasks_channel.d.ts.map +1 -0
  20. package/dist/channels/api_tasks_channel.js +45 -0
  21. package/dist/channels/api_tasks_channel.js.map +1 -0
  22. package/dist/client.d.ts +28 -5
  23. package/dist/client.d.ts.map +1 -1
  24. package/dist/client.js +24 -9
  25. package/dist/client.js.map +1 -1
  26. package/dist/custom-object-subscriptions.d.ts +94 -0
  27. package/dist/custom-object-subscriptions.d.ts.map +1 -0
  28. package/dist/custom-object-subscriptions.js +549 -0
  29. package/dist/custom-object-subscriptions.js.map +1 -0
  30. package/dist/index.d.ts +3 -1
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +4 -2
  33. package/dist/index.js.map +1 -1
  34. package/dist/phx_channel/channel.d.ts +8 -0
  35. package/dist/phx_channel/channel.d.ts.map +1 -1
  36. package/dist/phx_channel/channel.js +36 -1
  37. package/dist/phx_channel/channel.js.map +1 -1
  38. package/dist/phx_channel/socket.d.ts.map +1 -1
  39. package/dist/phx_channel/socket.js +4 -0
  40. package/dist/phx_channel/socket.js.map +1 -1
  41. package/dist/platform-socket.d.ts +5 -2
  42. package/dist/platform-socket.d.ts.map +1 -1
  43. package/dist/platform-socket.js +6 -5
  44. package/dist/platform-socket.js.map +1 -1
  45. package/dist/runtime/http-client.d.ts +21 -0
  46. package/dist/runtime/http-client.d.ts.map +1 -1
  47. package/dist/runtime/http-client.js +28 -0
  48. package/dist/runtime/http-client.js.map +1 -1
  49. package/dist/runtime/url.d.ts +1 -1
  50. package/dist/runtime/url.d.ts.map +1 -1
  51. package/dist/runtime/url.js +3 -2
  52. package/dist/runtime/url.js.map +1 -1
  53. package/dist/types/ai.d.ts +66 -52
  54. package/dist/types/ai.d.ts.map +1 -1
  55. package/dist/types/ai.js +7 -2
  56. package/dist/types/ai.js.map +1 -1
  57. package/dist/types/artifacts.d.ts +8 -8
  58. package/dist/types/artifacts.js +2 -2
  59. package/dist/types/artifacts.js.map +1 -1
  60. package/dist/types/automations.d.ts +68 -10
  61. package/dist/types/automations.d.ts.map +1 -1
  62. package/dist/types/automations.js +22 -2
  63. package/dist/types/automations.js.map +1 -1
  64. package/dist/types/chat.d.ts +18446 -3559
  65. package/dist/types/chat.d.ts.map +1 -1
  66. package/dist/types/chat.js +2 -2
  67. package/dist/types/chat.js.map +1 -1
  68. package/dist/types/common.d.ts +12646 -2316
  69. package/dist/types/common.d.ts.map +1 -1
  70. package/dist/types/common.js +372 -80
  71. package/dist/types/common.js.map +1 -1
  72. package/dist/types/config.d.ts +22 -10
  73. package/dist/types/config.d.ts.map +1 -1
  74. package/dist/types/config.js +4 -2
  75. package/dist/types/config.js.map +1 -1
  76. package/dist/types/device.d.ts +60 -0
  77. package/dist/types/device.d.ts.map +1 -0
  78. package/dist/types/device.js +25 -0
  79. package/dist/types/device.js.map +1 -0
  80. package/dist/types/extractions.d.ts +452 -0
  81. package/dist/types/extractions.d.ts.map +1 -0
  82. package/dist/types/extractions.js +52 -0
  83. package/dist/types/extractions.js.map +1 -0
  84. package/dist/types/image.js +2 -2
  85. package/dist/types/image.js.map +1 -1
  86. package/dist/types/index.d.ts +3 -0
  87. package/dist/types/index.d.ts.map +1 -1
  88. package/dist/types/index.js +5 -2
  89. package/dist/types/index.js.map +1 -1
  90. package/dist/types/invites.js +2 -2
  91. package/dist/types/invites.js.map +1 -1
  92. package/dist/types/notifications.d.ts +2 -2
  93. package/dist/types/notifications.js +2 -2
  94. package/dist/types/notifications.js.map +1 -1
  95. package/dist/types/oauth.d.ts +117 -0
  96. package/dist/types/oauth.d.ts.map +1 -0
  97. package/dist/types/oauth.js +21 -0
  98. package/dist/types/oauth.js.map +1 -0
  99. package/dist/types/teams.d.ts +2402 -242
  100. package/dist/types/teams.d.ts.map +1 -1
  101. package/dist/types/teams.js +2 -2
  102. package/dist/types/teams.js.map +1 -1
  103. package/dist/types/threads.d.ts +1419 -328
  104. package/dist/types/threads.d.ts.map +1 -1
  105. package/dist/types/threads.js +18 -17
  106. package/dist/types/threads.js.map +1 -1
  107. package/dist/types/users.d.ts +2 -2
  108. package/dist/types/users.js +2 -2
  109. package/dist/types/users.js.map +1 -1
  110. package/dist/v1/resources/activity_feed.d.ts +84 -0
  111. package/dist/v1/resources/activity_feed.d.ts.map +1 -1
  112. package/dist/v1/resources/activity_feed.js +2 -2
  113. package/dist/v1/resources/activity_feed.js.map +1 -1
  114. package/dist/v1/resources/agent_computers.js +2 -2
  115. package/dist/v1/resources/agent_computers.js.map +1 -1
  116. package/dist/v1/resources/agent_env_vars.js +2 -2
  117. package/dist/v1/resources/agent_env_vars.js.map +1 -1
  118. package/dist/v1/resources/agent_health_actions.js +2 -2
  119. package/dist/v1/resources/agent_health_actions.js.map +1 -1
  120. package/dist/v1/resources/agent_installations.d.ts +2 -2
  121. package/dist/v1/resources/agent_installations.d.ts.map +1 -1
  122. package/dist/v1/resources/agent_installations.js +3 -3
  123. package/dist/v1/resources/agent_installations.js.map +1 -1
  124. package/dist/v1/resources/agent_routine_runs.d.ts +16 -1
  125. package/dist/v1/resources/agent_routine_runs.d.ts.map +1 -1
  126. package/dist/v1/resources/agent_routine_runs.js +16 -2
  127. package/dist/v1/resources/agent_routine_runs.js.map +1 -1
  128. package/dist/v1/resources/agent_routines.d.ts +47 -3
  129. package/dist/v1/resources/agent_routines.d.ts.map +1 -1
  130. package/dist/v1/resources/agent_routines.js +42 -3
  131. package/dist/v1/resources/agent_routines.js.map +1 -1
  132. package/dist/v1/resources/agent_sessions.d.ts +14 -2
  133. package/dist/v1/resources/agent_sessions.d.ts.map +1 -1
  134. package/dist/v1/resources/agent_sessions.js +14 -3
  135. package/dist/v1/resources/agent_sessions.js.map +1 -1
  136. package/dist/v1/resources/agent_skills.js +2 -2
  137. package/dist/v1/resources/agent_skills.js.map +1 -1
  138. package/dist/v1/resources/agent_tools.d.ts +2 -2
  139. package/dist/v1/resources/agent_tools.d.ts.map +1 -1
  140. package/dist/v1/resources/agent_tools.js +3 -3
  141. package/dist/v1/resources/agent_tools.js.map +1 -1
  142. package/dist/v1/resources/agents.d.ts +152 -35
  143. package/dist/v1/resources/agents.d.ts.map +1 -1
  144. package/dist/v1/resources/agents.js +148 -42
  145. package/dist/v1/resources/agents.js.map +1 -1
  146. package/dist/v1/resources/ai.d.ts +81 -40
  147. package/dist/v1/resources/ai.d.ts.map +1 -1
  148. package/dist/v1/resources/ai.js +52 -17
  149. package/dist/v1/resources/ai.js.map +1 -1
  150. package/dist/v1/resources/artifacts.js +2 -2
  151. package/dist/v1/resources/artifacts.js.map +1 -1
  152. package/dist/v1/resources/automation_runs.d.ts +41 -6
  153. package/dist/v1/resources/automation_runs.d.ts.map +1 -1
  154. package/dist/v1/resources/automation_runs.js +47 -8
  155. package/dist/v1/resources/automation_runs.js.map +1 -1
  156. package/dist/v1/resources/automations.d.ts +14 -1
  157. package/dist/v1/resources/automations.d.ts.map +1 -1
  158. package/dist/v1/resources/automations.js +15 -3
  159. package/dist/v1/resources/automations.js.map +1 -1
  160. package/dist/v1/resources/bug_reports.js +2 -2
  161. package/dist/v1/resources/bug_reports.js.map +1 -1
  162. package/dist/v1/resources/config.d.ts +3 -0
  163. package/dist/v1/resources/config.d.ts.map +1 -1
  164. package/dist/v1/resources/config.js +2 -2
  165. package/dist/v1/resources/config.js.map +1 -1
  166. package/dist/v1/resources/custom_objects.js +2 -2
  167. package/dist/v1/resources/custom_objects.js.map +1 -1
  168. package/dist/v1/resources/extractions.d.ts +50 -0
  169. package/dist/v1/resources/extractions.d.ts.map +1 -0
  170. package/dist/v1/resources/extractions.js +48 -0
  171. package/dist/v1/resources/extractions.js.map +1 -0
  172. package/dist/v1/resources/files.d.ts +88 -1
  173. package/dist/v1/resources/files.d.ts.map +1 -1
  174. package/dist/v1/resources/files.js +86 -3
  175. package/dist/v1/resources/files.js.map +1 -1
  176. package/dist/v1/resources/index.d.ts +5 -0
  177. package/dist/v1/resources/index.d.ts.map +1 -1
  178. package/dist/v1/resources/index.js +7 -2
  179. package/dist/v1/resources/index.js.map +1 -1
  180. package/dist/v1/resources/installation_sources.js +2 -2
  181. package/dist/v1/resources/installation_sources.js.map +1 -1
  182. package/dist/v1/resources/invites.js +2 -2
  183. package/dist/v1/resources/invites.js.map +1 -1
  184. package/dist/v1/resources/knowledge_documents.d.ts +33 -1
  185. package/dist/v1/resources/knowledge_documents.d.ts.map +1 -1
  186. package/dist/v1/resources/knowledge_documents.js +25 -2
  187. package/dist/v1/resources/knowledge_documents.js.map +1 -1
  188. package/dist/v1/resources/knowledge_ingestions.d.ts +16 -0
  189. package/dist/v1/resources/knowledge_ingestions.d.ts.map +1 -0
  190. package/dist/v1/resources/knowledge_ingestions.js +21 -0
  191. package/dist/v1/resources/knowledge_ingestions.js.map +1 -0
  192. package/dist/v1/resources/knowledge_sources.d.ts +2 -0
  193. package/dist/v1/resources/knowledge_sources.d.ts.map +1 -1
  194. package/dist/v1/resources/knowledge_sources.js +3 -2
  195. package/dist/v1/resources/knowledge_sources.js.map +1 -1
  196. package/dist/v1/resources/kv.js +2 -2
  197. package/dist/v1/resources/kv.js.map +1 -1
  198. package/dist/v1/resources/notification_preferences.js +2 -2
  199. package/dist/v1/resources/notification_preferences.js.map +1 -1
  200. package/dist/v1/resources/notifications.js +2 -2
  201. package/dist/v1/resources/notifications.js.map +1 -1
  202. package/dist/v1/resources/oauth.d.ts +115 -0
  203. package/dist/v1/resources/oauth.d.ts.map +1 -0
  204. package/dist/v1/resources/oauth.js +112 -0
  205. package/dist/v1/resources/oauth.js.map +1 -0
  206. package/dist/v1/resources/orgs.js +2 -2
  207. package/dist/v1/resources/orgs.js.map +1 -1
  208. package/dist/v1/resources/slack_channel_bindings.d.ts +25 -0
  209. package/dist/v1/resources/slack_channel_bindings.d.ts.map +1 -1
  210. package/dist/v1/resources/slack_channel_bindings.js +24 -2
  211. package/dist/v1/resources/slack_channel_bindings.js.map +1 -1
  212. package/dist/v1/resources/solution_categories.js +2 -2
  213. package/dist/v1/resources/solution_categories.js.map +1 -1
  214. package/dist/v1/resources/solution_instances.d.ts +26 -0
  215. package/dist/v1/resources/solution_instances.d.ts.map +1 -0
  216. package/dist/v1/resources/solution_instances.js +35 -0
  217. package/dist/v1/resources/solution_instances.js.map +1 -0
  218. package/dist/v1/resources/solution_tags.js +2 -2
  219. package/dist/v1/resources/solution_tags.js.map +1 -1
  220. package/dist/v1/resources/solutions.d.ts +85 -1
  221. package/dist/v1/resources/solutions.d.ts.map +1 -1
  222. package/dist/v1/resources/solutions.js +67 -3
  223. package/dist/v1/resources/solutions.js.map +1 -1
  224. package/dist/v1/resources/team_memberships.js +2 -2
  225. package/dist/v1/resources/team_memberships.js.map +1 -1
  226. package/dist/v1/resources/teams.d.ts +210 -4
  227. package/dist/v1/resources/teams.d.ts.map +1 -1
  228. package/dist/v1/resources/teams.js +16 -6
  229. package/dist/v1/resources/teams.js.map +1 -1
  230. package/dist/v1/resources/thread_messages.d.ts +24 -4
  231. package/dist/v1/resources/thread_messages.d.ts.map +1 -1
  232. package/dist/v1/resources/thread_messages.js +9 -6
  233. package/dist/v1/resources/thread_messages.js.map +1 -1
  234. package/dist/v1/resources/threads.d.ts +158 -42
  235. package/dist/v1/resources/threads.d.ts.map +1 -1
  236. package/dist/v1/resources/threads.js +121 -32
  237. package/dist/v1/resources/threads.js.map +1 -1
  238. package/dist/v1/resources/users.d.ts +132 -1
  239. package/dist/v1/resources/users.d.ts.map +1 -1
  240. package/dist/v1/resources/users.js +4 -2
  241. package/dist/v1/resources/users.js.map +1 -1
  242. package/dist/v1/resources/work_items.d.ts +78 -0
  243. package/dist/v1/resources/work_items.d.ts.map +1 -0
  244. package/dist/v1/resources/work_items.js +86 -0
  245. package/dist/v1/resources/work_items.js.map +1 -0
  246. package/dist/v1.d.ts +10 -0
  247. package/dist/v1.d.ts.map +1 -1
  248. package/dist/v1.js +17 -2
  249. package/dist/v1.js.map +1 -1
  250. package/docs/custom-object-collaboration.md +248 -0
  251. package/package.json +3 -2
package/dist/v1.js CHANGED
@@ -1,6 +1,6 @@
1
- // Copyright (c) 2026 ArchAstro Inc. All Rights Reserved.
1
+ // Copyright (c) 2026 ArchAstro Inc. Licensed under the MIT License.
2
2
  // This file is auto-generated by @archastro/sdk-generator. Do not edit.
3
- // Content hash: f0203c0f2a78
3
+ // Content hash: 5ca888214c05
4
4
  import { ActivityFeedResource } from "./v1/resources/activity_feed.js";
5
5
  import { AgentComputerResource } from "./v1/resources/agent_computers.js";
6
6
  import { AgentEnvVarResource } from "./v1/resources/agent_env_vars.js";
@@ -19,17 +19,21 @@ import { AutomationResource } from "./v1/resources/automations.js";
19
19
  import { BugReportResource } from "./v1/resources/bug_reports.js";
20
20
  import { ConfigResource } from "./v1/resources/config.js";
21
21
  import { CustomObjectResource } from "./v1/resources/custom_objects.js";
22
+ import { ExtractionResource } from "./v1/resources/extractions.js";
22
23
  import { FileResource } from "./v1/resources/files.js";
23
24
  import { InstallationSourceResource } from "./v1/resources/installation_sources.js";
24
25
  import { InviteResource } from "./v1/resources/invites.js";
25
26
  import { KnowledgeDocumentResource } from "./v1/resources/knowledge_documents.js";
27
+ import { KnowledgeIngestionResource } from "./v1/resources/knowledge_ingestions.js";
26
28
  import { KnowledgeSourceResource } from "./v1/resources/knowledge_sources.js";
27
29
  import { KvResource } from "./v1/resources/kv.js";
28
30
  import { NotificationPreferenceResource } from "./v1/resources/notification_preferences.js";
29
31
  import { NotificationResource } from "./v1/resources/notifications.js";
32
+ import { OauthResource } from "./v1/resources/oauth.js";
30
33
  import { OrgResource } from "./v1/resources/orgs.js";
31
34
  import { SlackChannelBindingResource } from "./v1/resources/slack_channel_bindings.js";
32
35
  import { SolutionCategoryResource } from "./v1/resources/solution_categories.js";
36
+ import { SolutionInstanceResource } from "./v1/resources/solution_instances.js";
33
37
  import { SolutionTagResource } from "./v1/resources/solution_tags.js";
34
38
  import { SolutionResource } from "./v1/resources/solutions.js";
35
39
  import { TeamMembershipResource } from "./v1/resources/team_memberships.js";
@@ -37,6 +41,7 @@ import { TeamResource } from "./v1/resources/teams.js";
37
41
  import { ThreadMessageResource } from "./v1/resources/thread_messages.js";
38
42
  import { ThreadResource } from "./v1/resources/threads.js";
39
43
  import { UserResource } from "./v1/resources/users.js";
44
+ import { WorkItemResource } from "./v1/resources/work_items.js";
40
45
  export class V1 {
41
46
  activity_feed;
42
47
  agent_computers;
@@ -55,10 +60,12 @@ export class V1 {
55
60
  bug_reports;
56
61
  config;
57
62
  custom_objects;
63
+ extractions;
58
64
  files;
59
65
  installation_sources;
60
66
  invites;
61
67
  knowledge_documents;
68
+ knowledge_ingestions;
62
69
  knowledge_sources;
63
70
  kv;
64
71
  notification_preferences;
@@ -66,6 +73,7 @@ export class V1 {
66
73
  orgs;
67
74
  slack_channel_bindings;
68
75
  solution_categories;
76
+ solution_instances;
69
77
  solution_tags;
70
78
  solutions;
71
79
  team_memberships;
@@ -73,7 +81,9 @@ export class V1 {
73
81
  thread_messages;
74
82
  threads;
75
83
  users;
84
+ work_items;
76
85
  ai;
86
+ oauth;
77
87
  constructor(http) {
78
88
  this.activity_feed = new ActivityFeedResource(http);
79
89
  this.agent_computers = new AgentComputerResource(http);
@@ -92,10 +102,12 @@ export class V1 {
92
102
  this.bug_reports = new BugReportResource(http);
93
103
  this.config = new ConfigResource(http);
94
104
  this.custom_objects = new CustomObjectResource(http);
105
+ this.extractions = new ExtractionResource(http);
95
106
  this.files = new FileResource(http);
96
107
  this.installation_sources = new InstallationSourceResource(http);
97
108
  this.invites = new InviteResource(http);
98
109
  this.knowledge_documents = new KnowledgeDocumentResource(http);
110
+ this.knowledge_ingestions = new KnowledgeIngestionResource(http);
99
111
  this.knowledge_sources = new KnowledgeSourceResource(http);
100
112
  this.kv = new KvResource(http);
101
113
  this.notification_preferences = new NotificationPreferenceResource(http);
@@ -103,6 +115,7 @@ export class V1 {
103
115
  this.orgs = new OrgResource(http);
104
116
  this.slack_channel_bindings = new SlackChannelBindingResource(http);
105
117
  this.solution_categories = new SolutionCategoryResource(http);
118
+ this.solution_instances = new SolutionInstanceResource(http);
106
119
  this.solution_tags = new SolutionTagResource(http);
107
120
  this.solutions = new SolutionResource(http);
108
121
  this.team_memberships = new TeamMembershipResource(http);
@@ -110,7 +123,9 @@ export class V1 {
110
123
  this.thread_messages = new ThreadMessageResource(http);
111
124
  this.threads = new ThreadResource(http);
112
125
  this.users = new UserResource(http);
126
+ this.work_items = new WorkItemResource(http);
113
127
  this.ai = new AiResource(http);
128
+ this.oauth = new OauthResource(http);
114
129
  }
115
130
  }
116
131
  //# sourceMappingURL=v1.js.map
package/dist/v1.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"v1.js","sourceRoot":"","sources":["../src/v1.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,wEAAwE;AACxE,6BAA6B;AAG7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC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custom objects combine persisted JSON fields with a realtime channel. Use nested
9
+ maps for independently edited records so one user's change does not replace
10
+ another user's unrelated work.
11
+
12
+ ## Same-origin browser client
13
+
14
+ When a backend owns the platform credential in an HttpOnly session cookie,
15
+ construct one client for the authenticated browser session and point both HTTP
16
+ and WebSocket traffic at that backend:
17
+
18
+ ```ts
19
+ import {
20
+ PlatformClient,
21
+ withCustomObjectSubscriptions,
22
+ } from "@archastro/sdk";
23
+
24
+ const RealtimePlatformClient = PlatformClient.extend(
25
+ withCustomObjectSubscriptions,
26
+ );
27
+
28
+ export const archAstro = new RealtimePlatformClient({
29
+ baseUrl: window.location.origin,
30
+ pathPrefix: "/api/archastro/platform",
31
+ credentials: "include",
32
+ });
33
+ ```
34
+
35
+ `extend` uses the TypeScript class-expression mixin pattern. It returns a new
36
+ client class, so generated resources and static factories remain available and
37
+ the compiler infers `customObjectSubscriptions` on its instances. Extensions
38
+ can be chained by calling `extend` again on the returned class.
39
+
40
+ The SDK sends HTTP requests to the configured `pathPrefix`. WebSocket
41
+ subscriptions connect to `socketPath`; the browser includes same-origin cookies
42
+ during the upgrade. Access and refresh tokens therefore remain unavailable to
43
+ browser JavaScript. The backend must authenticate the cookie before proxying
44
+ HTTP requests or accepting the WebSocket upgrade.
45
+
46
+ The extension derives `/api/archastro/platform/socket` from the configured
47
+ `pathPrefix`. For a nonstandard route, pass
48
+ `customObjectSubscriptionsExtension({ socketPath })` to `extend` instead.
49
+
50
+ ## List and create team-owned objects
51
+
52
+ App scope comes from the authenticated session, so these calls do not take an
53
+ app ID. Team ownership is explicit:
54
+
55
+ ```ts
56
+ const page = await archAstro.custom_objects.list({
57
+ type: "archcode-diagram",
58
+ team: [teamId],
59
+ pageSize: 100,
60
+ });
61
+
62
+ const created = await archAstro.custom_objects.create({
63
+ type: "archcode-diagram",
64
+ team: teamId,
65
+ fields: {
66
+ diagram_key: crypto.randomUUID(),
67
+ repository: "firstlanding",
68
+ title: "Request path",
69
+ elements_by_id: {},
70
+ files_by_id: {},
71
+ comments_by_id: {},
72
+ metadata: {},
73
+ },
74
+ });
75
+ ```
76
+
77
+ ## Subscribe, update, save, and close
78
+
79
+ ```ts
80
+ import { z } from "zod";
81
+ import type {
82
+ CustomObjectConnectionState,
83
+ CustomObjectSubscription,
84
+ } from "@archastro/sdk";
85
+
86
+ const DiagramFields = z.object({
87
+ diagram_key: z.string(),
88
+ repository: z.string(),
89
+ title: z.string(),
90
+ elements_by_id: z.record(z.record(z.unknown())),
91
+ files_by_id: z.record(z.record(z.unknown())),
92
+ comments_by_id: z.record(z.record(z.unknown())),
93
+ metadata: z.record(z.unknown()),
94
+ });
95
+
96
+ type DiagramFields = z.infer<typeof DiagramFields>;
97
+
98
+ let applyingRemote = false;
99
+ let state: CustomObjectConnectionState = "connecting";
100
+
101
+ const subscription: CustomObjectSubscription<DiagramFields> =
102
+ archAstro.customObjectSubscriptions.subscribe({
103
+ objectId: created.id,
104
+ connectionId: perTabConnectionId,
105
+ fieldsSchema: DiagramFields,
106
+
107
+ // Called for the initial join and again after every reconnect. A reconnect
108
+ // snapshot is authoritative and arrives before queued idempotent patches
109
+ // are replayed.
110
+ onSnapshot(snapshot) {
111
+ setReadonly(snapshot.readonly === true);
112
+ applyingRemote = true;
113
+ try {
114
+ replaceMaterializedDocument(snapshot.fields);
115
+ } finally {
116
+ applyingRemote = false;
117
+ }
118
+ },
119
+
120
+ // object_updated can contain a partial update or a complete fields map.
121
+ // Compare canonical content before applying it.
122
+ onUpdate(update) {
123
+ if (alreadyMaterialized(update.fields)) return;
124
+ applyingRemote = true;
125
+ try {
126
+ mergeMaterializedDocument(update.fields);
127
+ } finally {
128
+ applyingRemote = false;
129
+ }
130
+ },
131
+
132
+ onPresence(collaborator) {
133
+ renderCollaborator(collaborator);
134
+ },
135
+
136
+ onPresenceLeave(collaborator) {
137
+ removeCollaborator(collaborator.connectionId);
138
+ },
139
+
140
+ onStateChange(nextState) {
141
+ state = nextState;
142
+ renderConnectionState(nextState);
143
+ },
144
+
145
+ onError(error) {
146
+ reportCollaborationError(error);
147
+ },
148
+ });
149
+
150
+ // Nested map assignment: safe to replay because it is idempotent.
151
+ await subscription.update({
152
+ elements_by_id: {
153
+ "element-42": {
154
+ x: 420,
155
+ y: 180,
156
+ updated_by: currentUser.id,
157
+ },
158
+ },
159
+ });
160
+
161
+ // Presence is ephemeral and is never written into custom-object fields.
162
+ await subscription.updatePresence({
163
+ cursor: { x: 420, y: 180 },
164
+ selectedElementIds: ["element-42"],
165
+ activity: "active",
166
+ });
167
+
168
+ await subscription.save();
169
+ subscription.close();
170
+ ```
171
+
172
+ Connection states have these meanings:
173
+
174
+ - `connecting`: the initial transport and channel join are in progress.
175
+ - `live`: the current snapshot is materialized and queued patches are acknowledged.
176
+ - `reconnecting`: transport recovery is in progress.
177
+ - `offline`: the browser reports that network connectivity is unavailable.
178
+ - `unauthorized`: authentication or authorization failed. This state is terminal.
179
+ - `closed`: the caller closed the subscription or the object no longer exists.
180
+
181
+ Each snapshot also preserves the server's `readonly` flag and resolved
182
+ `connectionId`. Initial collaborators from the join response are delivered
183
+ through `onPresence` before the subscription becomes `live`.
184
+
185
+ `close()` removes channel listeners, stops reconnect attempts, rejects pending
186
+ queued updates, leaves the channel when possible, and closes the socket.
187
+
188
+ ## React effect cleanup
189
+
190
+ ```tsx
191
+ useEffect(() => {
192
+ const subscription =
193
+ archAstro.customObjectSubscriptions.subscribe<DiagramFields>({
194
+ objectId: diagramId,
195
+ fieldsSchema: DiagramFields,
196
+ onSnapshot: setDocumentFromSnapshot,
197
+ onUpdate: mergeRemoteUpdate,
198
+ onPresence: upsertCollaborator,
199
+ onPresenceLeave: removeCollaborator,
200
+ onStateChange: setConnectionState,
201
+ onError: setCollaborationError,
202
+ });
203
+
204
+ return () => {
205
+ subscription.close();
206
+ };
207
+ }, [diagramId]);
208
+ ```
209
+
210
+ Create one subscription per mounted document. Always close the old subscription
211
+ before subscribing to another object; this prevents duplicate listeners after
212
+ navigation or React effect re-runs.
213
+
214
+ ## Retry and convergence rules
215
+
216
+ Plain nested-map assignments sent through `subscription.update()` are
217
+ idempotent. While disconnected, the SDK compacts superseded nested assignments.
218
+ After reconnect it:
219
+
220
+ 1. authenticates and joins again;
221
+ 2. delivers the authoritative current snapshot;
222
+ 3. replays compacted idempotent assignments;
223
+ 4. waits for acknowledgements;
224
+ 5. transitions to `live`.
225
+
226
+ Do not blindly retry array append/prepend/remove operations, creates without a
227
+ stable upsert key, deletes, or another mutation whose first acknowledgement may
228
+ have been lost. HTTP reads are safe for the application to retry with bounded
229
+ backoff. Do not retry authentication, authorization, or validation errors.
230
+
231
+ Nested maps are preferable to one shared array for collaborative documents.
232
+ Updating `elements_by_id.element-42.x` leaves other elements and other properties
233
+ untouched, while replacing an array makes the entire collection one conflict
234
+ unit.
235
+
236
+ Presence remains ephemeral because cursors, selections, idle state, and browser
237
+ connection IDs have no durable document meaning. Persisting them would create
238
+ stale collaborators and unnecessary custom-object writes.
239
+
240
+ Snapshot and remote-update handlers must use an internal guard, as shown above,
241
+ so applying remote state does not produce a local outgoing mutation. Also compare
242
+ canonical values rather than timestamps alone.
243
+
244
+ If access is revoked, the subscription reports an authentication or
245
+ authorization error, transitions to `unauthorized`, stops reconnecting, and
246
+ rejects further durable updates. The application should disable editing while
247
+ leaving navigation and export of already authorized local data accessible as
248
+ appropriate.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archastro/sdk",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "description": "TypeScript SDK for the ArchAstro Platform API (Node, browser, React Native)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -15,9 +15,10 @@
15
15
  "build": "tsc",
16
16
  "clean": "rm -rf dist",
17
17
  "docs": "typedoc --options typedoc.json",
18
- "lint": "tsc --noEmit",
18
+ "lint": "tsc --noEmit && npm run test:types",
19
19
  "prepublishOnly": "npm run build",
20
20
  "test": "vitest run",
21
+ "test:types": "npm run build && tsc -p tsconfig.type-tests.json",
21
22
  "test:contract": "vitest run --config __tests__/contract/vitest.contract.config.ts"
22
23
  },
23
24
  "license": "MIT",