@seaverse/conversation-sdk 0.2.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 (150) hide show
  1. package/README.md +284 -0
  2. package/dist/aggregated/apps-with-conversations.d.ts +47 -0
  3. package/dist/aggregated/apps-with-conversations.d.ts.map +1 -0
  4. package/dist/aggregated/apps-with-conversations.js +90 -0
  5. package/dist/aggregated/apps-with-conversations.js.map +1 -0
  6. package/dist/aggregated/index.d.ts +3 -0
  7. package/dist/aggregated/index.d.ts.map +1 -0
  8. package/dist/aggregated/index.js +2 -0
  9. package/dist/aggregated/index.js.map +1 -0
  10. package/dist/client/ConversationClient.d.ts +24 -0
  11. package/dist/client/ConversationClient.d.ts.map +1 -0
  12. package/dist/client/ConversationClient.js +56 -0
  13. package/dist/client/ConversationClient.js.map +1 -0
  14. package/dist/client/ConversationsClient.d.ts +31 -0
  15. package/dist/client/ConversationsClient.d.ts.map +1 -0
  16. package/dist/client/ConversationsClient.js +50 -0
  17. package/dist/client/ConversationsClient.js.map +1 -0
  18. package/dist/client/EnvironmentConfig.d.ts +12 -0
  19. package/dist/client/EnvironmentConfig.d.ts.map +1 -0
  20. package/dist/client/EnvironmentConfig.js +21 -0
  21. package/dist/client/EnvironmentConfig.js.map +1 -0
  22. package/dist/client/MessagesClient.d.ts +31 -0
  23. package/dist/client/MessagesClient.d.ts.map +1 -0
  24. package/dist/client/MessagesClient.js +57 -0
  25. package/dist/client/MessagesClient.js.map +1 -0
  26. package/dist/client/index.d.ts +3 -0
  27. package/dist/client/index.d.ts.map +1 -0
  28. package/dist/client/index.js +3 -0
  29. package/dist/client/index.js.map +1 -0
  30. package/dist/data/DbClient.d.ts +76 -0
  31. package/dist/data/DbClient.d.ts.map +1 -0
  32. package/dist/data/DbClient.js +107 -0
  33. package/dist/data/DbClient.js.map +1 -0
  34. package/dist/data/index.d.ts +2 -0
  35. package/dist/data/index.d.ts.map +1 -0
  36. package/dist/data/index.js +2 -0
  37. package/dist/data/index.js.map +1 -0
  38. package/dist/data/postgrest-headers.d.ts +10 -0
  39. package/dist/data/postgrest-headers.d.ts.map +1 -0
  40. package/dist/data/postgrest-headers.js +58 -0
  41. package/dist/data/postgrest-headers.js.map +1 -0
  42. package/dist/data/query.types.d.ts +62 -0
  43. package/dist/data/query.types.d.ts.map +1 -0
  44. package/dist/data/query.types.js +2 -0
  45. package/dist/data/query.types.js.map +1 -0
  46. package/dist/errors/AuthError.d.ts +8 -0
  47. package/dist/errors/AuthError.d.ts.map +1 -0
  48. package/dist/errors/AuthError.js +10 -0
  49. package/dist/errors/AuthError.js.map +1 -0
  50. package/dist/errors/BaseError.d.ts +17 -0
  51. package/dist/errors/BaseError.d.ts.map +1 -0
  52. package/dist/errors/BaseError.js +26 -0
  53. package/dist/errors/BaseError.js.map +1 -0
  54. package/dist/errors/NetworkError.d.ts +8 -0
  55. package/dist/errors/NetworkError.d.ts.map +1 -0
  56. package/dist/errors/NetworkError.js +10 -0
  57. package/dist/errors/NetworkError.js.map +1 -0
  58. package/dist/errors/ProtocolError.d.ts +8 -0
  59. package/dist/errors/ProtocolError.d.ts.map +1 -0
  60. package/dist/errors/ProtocolError.js +10 -0
  61. package/dist/errors/ProtocolError.js.map +1 -0
  62. package/dist/errors/TimeoutError.d.ts +8 -0
  63. package/dist/errors/TimeoutError.d.ts.map +1 -0
  64. package/dist/errors/TimeoutError.js +10 -0
  65. package/dist/errors/TimeoutError.js.map +1 -0
  66. package/dist/errors/index.d.ts +6 -0
  67. package/dist/errors/index.d.ts.map +1 -0
  68. package/dist/errors/index.js +6 -0
  69. package/dist/errors/index.js.map +1 -0
  70. package/dist/functional-api.d.ts +24 -0
  71. package/dist/functional-api.d.ts.map +1 -0
  72. package/dist/functional-api.js +59 -0
  73. package/dist/functional-api.js.map +1 -0
  74. package/dist/index.d.ts +5 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +9 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/resources/AppsResource.d.ts +37 -0
  79. package/dist/resources/AppsResource.d.ts.map +1 -0
  80. package/dist/resources/AppsResource.js +51 -0
  81. package/dist/resources/AppsResource.js.map +1 -0
  82. package/dist/resources/ConversationsResource.d.ts +81 -0
  83. package/dist/resources/ConversationsResource.d.ts.map +1 -0
  84. package/dist/resources/ConversationsResource.js +103 -0
  85. package/dist/resources/ConversationsResource.js.map +1 -0
  86. package/dist/resources/MessagesResource.d.ts +56 -0
  87. package/dist/resources/MessagesResource.d.ts.map +1 -0
  88. package/dist/resources/MessagesResource.js +115 -0
  89. package/dist/resources/MessagesResource.js.map +1 -0
  90. package/dist/session/session-token.d.ts +38 -0
  91. package/dist/session/session-token.d.ts.map +1 -0
  92. package/dist/session/session-token.js +74 -0
  93. package/dist/session/session-token.js.map +1 -0
  94. package/dist/transforms/app.transform.d.ts +6 -0
  95. package/dist/transforms/app.transform.d.ts.map +1 -0
  96. package/dist/transforms/app.transform.js +39 -0
  97. package/dist/transforms/app.transform.js.map +1 -0
  98. package/dist/transforms/conversation.transform.d.ts +10 -0
  99. package/dist/transforms/conversation.transform.d.ts.map +1 -0
  100. package/dist/transforms/conversation.transform.js +45 -0
  101. package/dist/transforms/conversation.transform.js.map +1 -0
  102. package/dist/transforms/message.transform.d.ts +12 -0
  103. package/dist/transforms/message.transform.d.ts.map +1 -0
  104. package/dist/transforms/message.transform.js +119 -0
  105. package/dist/transforms/message.transform.js.map +1 -0
  106. package/dist/transport/HttpClient.d.ts +34 -0
  107. package/dist/transport/HttpClient.d.ts.map +1 -0
  108. package/dist/transport/HttpClient.js +158 -0
  109. package/dist/transport/HttpClient.js.map +1 -0
  110. package/dist/transport/config.types.d.ts +40 -0
  111. package/dist/transport/config.types.d.ts.map +1 -0
  112. package/dist/transport/config.types.js +2 -0
  113. package/dist/transport/config.types.js.map +1 -0
  114. package/dist/transport/index.d.ts +10 -0
  115. package/dist/transport/index.d.ts.map +1 -0
  116. package/dist/transport/index.js +11 -0
  117. package/dist/transport/index.js.map +1 -0
  118. package/dist/transport/timeout.d.ts +12 -0
  119. package/dist/transport/timeout.d.ts.map +1 -0
  120. package/dist/transport/timeout.js +29 -0
  121. package/dist/transport/timeout.js.map +1 -0
  122. package/dist/types/common.types.d.ts +24 -0
  123. package/dist/types/common.types.d.ts.map +1 -0
  124. package/dist/types/common.types.js +5 -0
  125. package/dist/types/common.types.js.map +1 -0
  126. package/dist/types/config.types.d.ts +28 -0
  127. package/dist/types/config.types.d.ts.map +1 -0
  128. package/dist/types/config.types.js +2 -0
  129. package/dist/types/config.types.js.map +1 -0
  130. package/dist/types/http.types.d.ts +47 -0
  131. package/dist/types/http.types.d.ts.map +1 -0
  132. package/dist/types/http.types.js +2 -0
  133. package/dist/types/http.types.js.map +1 -0
  134. package/dist/types/index.d.ts +7 -0
  135. package/dist/types/index.d.ts.map +1 -0
  136. package/dist/types/index.js +2 -0
  137. package/dist/types/index.js.map +1 -0
  138. package/dist/types/models.types.d.ts +118 -0
  139. package/dist/types/models.types.d.ts.map +1 -0
  140. package/dist/types/models.types.js +5 -0
  141. package/dist/types/models.types.js.map +1 -0
  142. package/dist/types/pagination.types.d.ts +69 -0
  143. package/dist/types/pagination.types.d.ts.map +1 -0
  144. package/dist/types/pagination.types.js +24 -0
  145. package/dist/types/pagination.types.js.map +1 -0
  146. package/dist/types/token.types.d.ts +6 -0
  147. package/dist/types/token.types.d.ts.map +1 -0
  148. package/dist/types/token.types.js +2 -0
  149. package/dist/types/token.types.js.map +1 -0
  150. package/package.json +38 -0
@@ -0,0 +1,31 @@
1
+ import type { DbClient } from '../data/DbClient.js';
2
+ import type { QueryOptions, MutationOptions } from '../data/query.types.js';
3
+ import type { Message } from '../types/index.js';
4
+ /**
5
+ * Client for message operations
6
+ */
7
+ export declare class MessagesClient {
8
+ private readonly db;
9
+ constructor(db: DbClient);
10
+ /**
11
+ * List messages for a conversation
12
+ */
13
+ list(conversationId: string, options?: QueryOptions): Promise<Message[]>;
14
+ /**
15
+ * Get a single message by ID
16
+ */
17
+ get(messageId: string): Promise<Message | null>;
18
+ /**
19
+ * Add a new message to a conversation
20
+ */
21
+ add(conversationId: string, data: Partial<Message>, options?: MutationOptions): Promise<Message>;
22
+ /**
23
+ * Update a message
24
+ */
25
+ update(messageId: string, data: Partial<Message>, options?: MutationOptions): Promise<Message>;
26
+ /**
27
+ * Delete a message
28
+ */
29
+ delete(messageId: string): Promise<void>;
30
+ }
31
+ //# sourceMappingURL=MessagesClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessagesClient.d.ts","sourceRoot":"","sources":["../../src/client/MessagesClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;GAEG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,QAAQ;IAEzC;;OAEG;IACG,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAS9E;;OAEG;IACG,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAMrD;;OAEG;IACG,GAAG,CACP,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,EACtB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,OAAO,CAAC;IAenB;;OAEG;IACG,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,EACtB,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,OAAO,CAAC;IAanB;;OAEG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Client for message operations
3
+ */
4
+ export class MessagesClient {
5
+ constructor(db) {
6
+ this.db = db;
7
+ }
8
+ /**
9
+ * List messages for a conversation
10
+ */
11
+ async list(conversationId, options) {
12
+ const result = await this.db.get('messages', {
13
+ filter: { conversation_id: `eq.${conversationId}` },
14
+ order: 'created_at.asc',
15
+ ...options,
16
+ });
17
+ return result.data;
18
+ }
19
+ /**
20
+ * Get a single message by ID
21
+ */
22
+ async get(messageId) {
23
+ return this.db.getOne('messages', {
24
+ filter: { id: `eq.${messageId}` },
25
+ });
26
+ }
27
+ /**
28
+ * Add a new message to a conversation
29
+ */
30
+ async add(conversationId, data, options) {
31
+ const results = await this.db.post('messages', {
32
+ conversation_id: conversationId,
33
+ ...data,
34
+ }, {
35
+ returning: 'representation',
36
+ ...options,
37
+ });
38
+ return results[0];
39
+ }
40
+ /**
41
+ * Update a message
42
+ */
43
+ async update(messageId, data, options) {
44
+ const results = await this.db.patch('messages', { id: `eq.${messageId}` }, data, {
45
+ returning: 'representation',
46
+ ...options,
47
+ });
48
+ return results[0];
49
+ }
50
+ /**
51
+ * Delete a message
52
+ */
53
+ async delete(messageId) {
54
+ await this.db.delete('messages', { id: `eq.${messageId}` });
55
+ }
56
+ }
57
+ //# sourceMappingURL=MessagesClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessagesClient.js","sourceRoot":"","sources":["../../src/client/MessagesClient.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,OAAO,cAAc;IACzB,YAA6B,EAAY;QAAZ,OAAE,GAAF,EAAE,CAAU;IAAG,CAAC;IAE7C;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,cAAsB,EAAE,OAAsB;QACvD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,GAAG,CAAU,UAAU,EAAE;YACpD,MAAM,EAAE,EAAE,eAAe,EAAE,MAAM,cAAc,EAAE,EAAE;YACnD,KAAK,EAAE,gBAAgB;YACvB,GAAG,OAAO;SACX,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,SAAiB;QACzB,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,CAAU,UAAU,EAAE;YACzC,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,SAAS,EAAE,EAAE;SAClC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CACP,cAAsB,EACtB,IAAsB,EACtB,OAAyB;QAEzB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAChC,UAAU,EACV;YACE,eAAe,EAAE,cAAc;YAC/B,GAAG,IAAI;SACR,EACD;YACE,SAAS,EAAE,gBAAgB;YAC3B,GAAG,OAAO;SACX,CACF,CAAC;QACF,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CACV,SAAiB,EACjB,IAAsB,EACtB,OAAyB;QAEzB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CACjC,UAAU,EACV,EAAE,EAAE,EAAE,MAAM,SAAS,EAAE,EAAE,EACzB,IAAI,EACJ;YACE,SAAS,EAAE,gBAAgB;YAC3B,GAAG,OAAO;SACX,CACF,CAAC;QACF,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,SAAiB;QAC5B,MAAM,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,MAAM,SAAS,EAAE,EAAE,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export { ConversationsClient } from './ConversationsClient.js';
2
+ export { MessagesClient } from './MessagesClient.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ConversationsClient } from './ConversationsClient.js';
2
+ export { MessagesClient } from './MessagesClient.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC"}
@@ -0,0 +1,76 @@
1
+ import type { HttpClient } from '../transport/HttpClient.js';
2
+ import type { QueryOptions, MutationOptions } from './query.types.js';
3
+ /**
4
+ * 带总数的查询结果
5
+ */
6
+ export interface QueryResultWithCount<T> {
7
+ data: T[];
8
+ count: number | null;
9
+ }
10
+ /**
11
+ * Simple PostgREST database client
12
+ */
13
+ export declare class DbClient {
14
+ private readonly http;
15
+ constructor(http: HttpClient);
16
+ /**
17
+ * Get multiple rows from a table
18
+ *
19
+ * @example
20
+ * const conversations = await db.get('conversations', {
21
+ * filter: { user_id: 'eq.123' },
22
+ * order: 'created_at.desc',
23
+ * limit: 10
24
+ * });
25
+ *
26
+ * @example
27
+ * // With count
28
+ * const result = await db.get('conversations', {
29
+ * filter: { user_id: 'eq.123' },
30
+ * limit: 10,
31
+ * count: 'exact'
32
+ * });
33
+ * console.log(result.count); // Total count
34
+ * console.log(result.data); // Page data
35
+ */
36
+ get<T = unknown>(table: string, options?: QueryOptions): Promise<QueryResultWithCount<T>>;
37
+ /**
38
+ * Get a single row from a table
39
+ *
40
+ * @example
41
+ * const conversation = await db.getOne('conversations', {
42
+ * filter: { id: 'eq.123' }
43
+ * });
44
+ */
45
+ getOne<T = unknown>(table: string, options?: QueryOptions): Promise<T | null>;
46
+ /**
47
+ * Insert one or more rows into a table
48
+ *
49
+ * @example
50
+ * const newConversation = await db.post('conversations', {
51
+ * app_id: 'xxx',
52
+ * user_id: 'yyy'
53
+ * }, {
54
+ * returning: 'representation'
55
+ * });
56
+ */
57
+ post<T = unknown>(table: string, data: unknown, options?: MutationOptions): Promise<T[]>;
58
+ /**
59
+ * Update rows in a table
60
+ *
61
+ * @example
62
+ * const updated = await db.patch('conversations',
63
+ * { id: 'eq.123' },
64
+ * { title: 'New Title' }
65
+ * );
66
+ */
67
+ patch<T = unknown>(table: string, filter: Record<string, string>, data: unknown, options?: MutationOptions): Promise<T[]>;
68
+ /**
69
+ * Delete rows from a table
70
+ *
71
+ * @example
72
+ * await db.delete('conversations', { id: 'eq.123' });
73
+ */
74
+ delete(table: string, filter: Record<string, string>): Promise<void>;
75
+ }
76
+ //# sourceMappingURL=DbClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DbClient.d.ts","sourceRoot":"","sources":["../../src/data/DbClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGtE;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC,IAAI,EAAE,CAAC,EAAE,CAAC;IACV,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;;;;;;;;;OAmBG;IACG,GAAG,CAAC,CAAC,GAAG,OAAO,EACnB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC;IAyBnC;;;;;;;OAOG;IACG,MAAM,CAAC,CAAC,GAAG,OAAO,EACtB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IASpB;;;;;;;;;;OAUG;IACG,IAAI,CAAC,CAAC,GAAG,OAAO,EACpB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,CAAC,EAAE,CAAC;IAQf;;;;;;;;OAQG;IACG,KAAK,CAAC,CAAC,GAAG,OAAO,EACrB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,CAAC,EAAE,CAAC;IASf;;;;;OAKG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,OAAO,CAAC,IAAI,CAAC;CAKjB"}
@@ -0,0 +1,107 @@
1
+ import { buildPostgrestHeaders, buildQueryString } from './postgrest-headers.js';
2
+ /**
3
+ * Simple PostgREST database client
4
+ */
5
+ export class DbClient {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ /**
10
+ * Get multiple rows from a table
11
+ *
12
+ * @example
13
+ * const conversations = await db.get('conversations', {
14
+ * filter: { user_id: 'eq.123' },
15
+ * order: 'created_at.desc',
16
+ * limit: 10
17
+ * });
18
+ *
19
+ * @example
20
+ * // With count
21
+ * const result = await db.get('conversations', {
22
+ * filter: { user_id: 'eq.123' },
23
+ * limit: 10,
24
+ * count: 'exact'
25
+ * });
26
+ * console.log(result.count); // Total count
27
+ * console.log(result.data); // Page data
28
+ */
29
+ async get(table, options = {}) {
30
+ const query = buildQueryString(options);
31
+ const headers = buildPostgrestHeaders(options);
32
+ const response = await this.http.get(`/${table}${query}`, { headers });
33
+ // 解析 Content-Range header 获取总数
34
+ // Format: "0-9/total" or "0-9/*" (if no count requested)
35
+ let count = null;
36
+ const contentRange = response.headers.get('Content-Range');
37
+ if (contentRange && options.count) {
38
+ const match = contentRange.match(/\/(\d+)$/);
39
+ if (match) {
40
+ count = parseInt(match[1], 10);
41
+ }
42
+ }
43
+ return {
44
+ // PostgREST:当 offset 超出范围时,可能返回 416(Range Not Satisfiable)。
45
+ // 在这种情况下,上层分页应得到空数组,而不是抛异常。
46
+ data: response.status === 416 ? [] : response.data,
47
+ count,
48
+ };
49
+ }
50
+ /**
51
+ * Get a single row from a table
52
+ *
53
+ * @example
54
+ * const conversation = await db.getOne('conversations', {
55
+ * filter: { id: 'eq.123' }
56
+ * });
57
+ */
58
+ async getOne(table, options = {}) {
59
+ const results = await this.get(table, {
60
+ ...options,
61
+ limit: 1,
62
+ });
63
+ return results.data[0] || null;
64
+ }
65
+ /**
66
+ * Insert one or more rows into a table
67
+ *
68
+ * @example
69
+ * const newConversation = await db.post('conversations', {
70
+ * app_id: 'xxx',
71
+ * user_id: 'yyy'
72
+ * }, {
73
+ * returning: 'representation'
74
+ * });
75
+ */
76
+ async post(table, data, options = {}) {
77
+ const headers = buildPostgrestHeaders(options);
78
+ const response = await this.http.post(`/${table}`, data, { headers });
79
+ return response.data;
80
+ }
81
+ /**
82
+ * Update rows in a table
83
+ *
84
+ * @example
85
+ * const updated = await db.patch('conversations',
86
+ * { id: 'eq.123' },
87
+ * { title: 'New Title' }
88
+ * );
89
+ */
90
+ async patch(table, filter, data, options = {}) {
91
+ const query = buildQueryString({ filter });
92
+ const headers = buildPostgrestHeaders(options);
93
+ const response = await this.http.patch(`/${table}${query}`, data, { headers });
94
+ return response.data;
95
+ }
96
+ /**
97
+ * Delete rows from a table
98
+ *
99
+ * @example
100
+ * await db.delete('conversations', { id: 'eq.123' });
101
+ */
102
+ async delete(table, filter) {
103
+ const query = buildQueryString({ filter });
104
+ await this.http.delete(`/${table}${query}`);
105
+ }
106
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IAC9C,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export type { QueryOptions, MutationOptions } from './query.types.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/data/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { QueryOptions, MutationOptions } from './query.types.js';
2
+ /**
3
+ * Build PostgREST headers from query options
4
+ */
5
+ export declare function buildPostgrestHeaders(options?: QueryOptions | MutationOptions): Record<string, string>;
6
+ /**
7
+ * Build query string from filter options
8
+ */
9
+ export declare function buildQueryString(options?: QueryOptions): string;
10
+ //# sourceMappingURL=postgrest-headers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgrest-headers.d.ts","sourceRoot":"","sources":["../../src/data/postgrest-headers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEtE;;GAEG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,YAAY,GAAG,eAAoB,GAC3C,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA8BxB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,YAAiB,GAAG,MAAM,CAgCnE"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Build PostgREST headers from query options
3
+ */
4
+ export function buildPostgrestHeaders(options = {}) {
5
+ const headers = {};
6
+ // Count preference
7
+ if ('count' in options && options.count) {
8
+ headers['Prefer'] = `count=${options.count}`;
9
+ }
10
+ // Mutation preferences
11
+ if ('returning' in options) {
12
+ const prefer = [];
13
+ if (options.returning) {
14
+ prefer.push(`return=${options.returning}`);
15
+ }
16
+ if (options.resolution) {
17
+ prefer.push(`resolution=${options.resolution}`);
18
+ }
19
+ if (options.missing) {
20
+ prefer.push(`missing=${options.missing}`);
21
+ }
22
+ if (prefer.length > 0) {
23
+ headers['Prefer'] = prefer.join(',');
24
+ }
25
+ }
26
+ return headers;
27
+ }
28
+ /**
29
+ * Build query string from filter options
30
+ */
31
+ export function buildQueryString(options = {}) {
32
+ const params = new URLSearchParams();
33
+ // Select columns
34
+ if (options.select) {
35
+ params.set('select', options.select);
36
+ }
37
+ // Filters
38
+ if (options.filter) {
39
+ for (const [key, value] of Object.entries(options.filter)) {
40
+ params.set(key, value);
41
+ }
42
+ }
43
+ // Order
44
+ if (options.order) {
45
+ params.set('order', options.order);
46
+ }
47
+ // Limit
48
+ if (options.limit !== undefined) {
49
+ params.set('limit', String(options.limit));
50
+ }
51
+ // Offset
52
+ if (options.offset !== undefined) {
53
+ params.set('offset', String(options.offset));
54
+ }
55
+ const query = params.toString();
56
+ return query ? `?${query}` : '';
57
+ }
58
+ //# sourceMappingURL=postgrest-headers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgrest-headers.js","sourceRoot":"","sources":["../../src/data/postgrest-headers.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAA0C,EAAE;IAE5C,MAAM,OAAO,GAA2B,EAAE,CAAC;IAE3C,mBAAmB;IACnB,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QACxC,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS,OAAO,CAAC,KAAK,EAAE,CAAC;IAC/C,CAAC;IAED,uBAAuB;IACvB,IAAI,WAAW,IAAI,OAAO,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,C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AAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED,SAAS;IACT,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAChC,OAAO,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AAClC,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * PostgREST query options
3
+ */
4
+ export interface QueryOptions {
5
+ /**
6
+ * Columns to select (default: *)
7
+ * @example "id,name,created_at"
8
+ * @example "*,conversations(*)"
9
+ */
10
+ select?: string;
11
+ /**
12
+ * Filter conditions
13
+ * @example { id: "eq.123", status: "neq.deleted" }
14
+ */
15
+ filter?: Record<string, string>;
16
+ /**
17
+ * Order by clause
18
+ * @example "created_at.desc"
19
+ * @example "name.asc,created_at.desc"
20
+ */
21
+ order?: string;
22
+ /**
23
+ * Limit number of results
24
+ */
25
+ limit?: number;
26
+ /**
27
+ * Offset for pagination
28
+ */
29
+ offset?: number;
30
+ /**
31
+ * Count mode
32
+ * - "exact": Return exact count in Content-Range header
33
+ * - "planned": Return estimated count
34
+ * - "estimated": Return estimated count
35
+ */
36
+ count?: 'exact' | 'planned' | 'estimated';
37
+ }
38
+ /**
39
+ * PostgREST insert/update options
40
+ */
41
+ export interface MutationOptions {
42
+ /**
43
+ * What to return after mutation
44
+ * - "representation": Return the modified rows
45
+ * - "minimal": Return nothing
46
+ * - "headers-only": Return only headers
47
+ */
48
+ returning?: 'representation' | 'minimal' | 'headers-only';
49
+ /**
50
+ * Resolution strategy for conflicts
51
+ * - "merge-duplicates": Merge duplicate rows
52
+ * - "ignore-duplicates": Ignore conflicts
53
+ */
54
+ resolution?: 'merge-duplicates' | 'ignore-duplicates';
55
+ /**
56
+ * Missing columns
57
+ * - "default": Use default values
58
+ * - "null": Use null values
59
+ */
60
+ missing?: 'default' | 'null';
61
+ }
62
+ //# sourceMappingURL=query.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.types.d.ts","sourceRoot":"","sources":["../../src/data/query.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,WAAW,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,gBAAgB,GAAG,SAAS,GAAG,cAAc,CAAC;IAE1D;;;;OAIG;IACH,UAAU,CAAC,EAAE,kBAAkB,GAAG,mBAAmB,CAAC;IAEtD;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CAC9B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=query.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query.types.js","sourceRoot":"","sources":["../../src/data/query.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { BaseError } from './BaseError.js';
2
+ /**
3
+ * Authentication and authorization errors
4
+ */
5
+ export declare class AuthError extends BaseError {
6
+ constructor(message: string, statusCode?: number, details?: unknown);
7
+ }
8
+ //# sourceMappingURL=AuthError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthError.d.ts","sourceRoot":"","sources":["../../src/errors/AuthError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,qBAAa,SAAU,SAAQ,SAAS;gBAC1B,OAAO,EAAE,MAAM,EAAE,UAAU,GAAE,MAAY,EAAE,OAAO,CAAC,EAAE,OAAO;CAGzE"}
@@ -0,0 +1,10 @@
1
+ import { BaseError } from './BaseError.js';
2
+ /**
3
+ * Authentication and authorization errors
4
+ */
5
+ export class AuthError extends BaseError {
6
+ constructor(message, statusCode = 401, details) {
7
+ super(message, 'AUTH_ERROR', statusCode, details);
8
+ }
9
+ }
10
+ //# sourceMappingURL=AuthError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthError.js","sourceRoot":"","sources":["../../src/errors/AuthError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,YAAY,OAAe,EAAE,aAAqB,GAAG,EAAE,OAAiB;QACtE,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACpD,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Base error class for all SeaLink SDK errors
3
+ */
4
+ export declare class BaseError extends Error {
5
+ readonly code: string;
6
+ readonly statusCode?: number;
7
+ readonly details?: unknown;
8
+ constructor(message: string, code: string, statusCode?: number, details?: unknown);
9
+ toJSON(): {
10
+ name: string;
11
+ message: string;
12
+ code: string;
13
+ statusCode: number | undefined;
14
+ details: unknown;
15
+ };
16
+ }
17
+ //# sourceMappingURL=BaseError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseError.d.ts","sourceRoot":"","sources":["../../src/errors/BaseError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;IAClC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpC,SAAgB,OAAO,CAAC,EAAE,OAAO,CAAC;gBAGhC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,OAAO;IAcnB,MAAM;;;;;;;CASP"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Base error class for all SeaLink SDK errors
3
+ */
4
+ export class BaseError extends Error {
5
+ constructor(message, code, statusCode, details) {
6
+ super(message);
7
+ this.name = this.constructor.name;
8
+ this.code = code;
9
+ this.statusCode = statusCode;
10
+ this.details = details;
11
+ // Maintains proper stack trace for where our error was thrown (only available on V8)
12
+ if (Error.captureStackTrace) {
13
+ Error.captureStackTrace(this, this.constructor);
14
+ }
15
+ }
16
+ toJSON() {
17
+ return {
18
+ name: this.name,
19
+ message: this.message,
20
+ code: this.code,
21
+ statusCode: this.statusCode,
22
+ details: this.details,
23
+ };
24
+ }
25
+ }
26
+ //# sourceMappingURL=BaseError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseError.js","sourceRoot":"","sources":["../../src/errors/BaseError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,KAAK;IAKlC,YACE,OAAe,EACf,IAAY,EACZ,UAAmB,EACnB,OAAiB;QAEjB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,qFAAqF;QACrF,IAAI,KAAK,CAAC,iBAAiB,EAAE,CAAC;YAC5B,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,OAAO,EAAE,IAAI,CAAC,OAAO;SACtB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import { BaseError } from './BaseError.js';
2
+ /**
3
+ * Network-related errors (connection, DNS, etc.)
4
+ */
5
+ export declare class NetworkError extends BaseError {
6
+ constructor(message: string, details?: unknown);
7
+ }
8
+ //# sourceMappingURL=NetworkError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NetworkError.d.ts","sourceRoot":"","sources":["../../src/errors/NetworkError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,qBAAa,YAAa,SAAQ,SAAS;gBAC7B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAG/C"}
@@ -0,0 +1,10 @@
1
+ import { BaseError } from './BaseError.js';
2
+ /**
3
+ * Network-related errors (connection, DNS, etc.)
4
+ */
5
+ export class NetworkError extends BaseError {
6
+ constructor(message, details) {
7
+ super(message, 'NETWORK_ERROR', undefined, details);
8
+ }
9
+ }
10
+ //# sourceMappingURL=NetworkError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NetworkError.js","sourceRoot":"","sources":["../../src/errors/NetworkError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,SAAS;IACzC,YAAY,OAAe,EAAE,OAAiB;QAC5C,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import { BaseError } from './BaseError.js';
2
+ /**
3
+ * Protocol-level errors (invalid response format, etc.)
4
+ */
5
+ export declare class ProtocolError extends BaseError {
6
+ constructor(message: string, details?: unknown);
7
+ }
8
+ //# sourceMappingURL=ProtocolError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProtocolError.d.ts","sourceRoot":"","sources":["../../src/errors/ProtocolError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,qBAAa,aAAc,SAAQ,SAAS;gBAC9B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO;CAG/C"}
@@ -0,0 +1,10 @@
1
+ import { BaseError } from './BaseError.js';
2
+ /**
3
+ * Protocol-level errors (invalid response format, etc.)
4
+ */
5
+ export class ProtocolError extends BaseError {
6
+ constructor(message, details) {
7
+ super(message, 'PROTOCOL_ERROR', undefined, details);
8
+ }
9
+ }
10
+ //# sourceMappingURL=ProtocolError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProtocolError.js","sourceRoot":"","sources":["../../src/errors/ProtocolError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,YAAY,OAAe,EAAE,OAAiB;QAC5C,KAAK,CAAC,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACF"}
@@ -0,0 +1,8 @@
1
+ import { BaseError } from './BaseError.js';
2
+ /**
3
+ * Request timeout errors
4
+ */
5
+ export declare class TimeoutError extends BaseError {
6
+ constructor(message?: string, timeoutMs?: number);
7
+ }
8
+ //# sourceMappingURL=TimeoutError.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TimeoutError.d.ts","sourceRoot":"","sources":["../../src/errors/TimeoutError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;GAEG;AACH,qBAAa,YAAa,SAAQ,SAAS;gBAC7B,OAAO,GAAE,MAA0B,EAAE,SAAS,CAAC,EAAE,MAAM;CAGpE"}
@@ -0,0 +1,10 @@
1
+ import { BaseError } from './BaseError.js';
2
+ /**
3
+ * Request timeout errors
4
+ */
5
+ export class TimeoutError extends BaseError {
6
+ constructor(message = 'Request timeout', timeoutMs) {
7
+ super(message, 'TIMEOUT_ERROR', 408, { timeoutMs });
8
+ }
9
+ }
10
+ //# sourceMappingURL=TimeoutError.js.map