@clivly/sdk 0.11.0-next.0 → 0.12.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.
- package/dist/chat-session.d.cts +2 -3
- package/dist/chat-session.d.mts +2 -3
- package/dist/drizzle.cjs +1 -0
- package/dist/drizzle.d.cts +21 -6
- package/dist/drizzle.d.mts +21 -6
- package/dist/drizzle.mjs +1 -0
- package/dist/index.d.cts +7 -7
- package/dist/index.d.mts +7 -7
- package/dist/vite.d.cts +3 -4
- package/dist/vite.d.mts +3 -4
- package/package.json +3 -3
package/dist/chat-session.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { c as CreateChatSessionHandlerOptions } from "./types-CvhxV-IX.cjs";
|
|
2
2
|
//#region src/chat-session.d.ts
|
|
3
|
-
declare function createChatSessionHandler({ allowedOrigins, apiKey, apiUrl, fetchImpl, resolveUser }: CreateChatSessionHandlerOptions): (request: Request) => Promise<Response>;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { createChatSessionHandler };
|
|
3
|
+
export declare function createChatSessionHandler({ allowedOrigins, apiKey, apiUrl, fetchImpl, resolveUser }: CreateChatSessionHandlerOptions): (request: Request) => Promise<Response>;
|
|
4
|
+
//#endregion
|
package/dist/chat-session.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { c as CreateChatSessionHandlerOptions } from "./types-CvhxV-IX.mjs";
|
|
2
2
|
//#region src/chat-session.d.ts
|
|
3
|
-
declare function createChatSessionHandler({ allowedOrigins, apiKey, apiUrl, fetchImpl, resolveUser }: CreateChatSessionHandlerOptions): (request: Request) => Promise<Response>;
|
|
4
|
-
//#endregion
|
|
5
|
-
export { createChatSessionHandler };
|
|
3
|
+
export declare function createChatSessionHandler({ allowedOrigins, apiKey, apiUrl, fetchImpl, resolveUser }: CreateChatSessionHandlerOptions): (request: Request) => Promise<Response>;
|
|
4
|
+
//#endregion
|
package/dist/drizzle.cjs
CHANGED
|
@@ -141,6 +141,7 @@ function fromDrizzle(db, table, opts) {
|
|
|
141
141
|
const idColumnName = idColumn.name;
|
|
142
142
|
const source = {
|
|
143
143
|
entity: opts.entity,
|
|
144
|
+
...opts.pushSource === void 0 ? {} : { pushSource: opts.pushSource },
|
|
144
145
|
cursorField: cursorColumnName,
|
|
145
146
|
idField: idColumnName,
|
|
146
147
|
fetchPage: ({ since, limit }) => drizzleDb.select(projection).from(table).where(since ? drizzle_orm.sql`(${cursorColumn}, ${idColumn}) > (${since.time}, ${since.id})` : void 0).orderBy((0, drizzle_orm.asc)(cursorColumn), (0, drizzle_orm.asc)(idColumn)).limit(limit),
|
package/dist/drizzle.d.cts
CHANGED
|
@@ -54,12 +54,12 @@ interface FromDrizzleProjectionOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
objectType?: string;
|
|
56
56
|
}
|
|
57
|
-
declare function fromDrizzleProjection(db: unknown, projection: ProjectionMapping, opts: FromDrizzleProjectionOptions & {
|
|
57
|
+
export declare function fromDrizzleProjection(db: unknown, projection: ProjectionMapping, opts: FromDrizzleProjectionOptions & {
|
|
58
58
|
objectType: string;
|
|
59
59
|
}): SyncSource & {
|
|
60
60
|
objectType: string;
|
|
61
61
|
};
|
|
62
|
-
declare function fromDrizzleProjection(db: unknown, projection: ProjectionMapping, opts: FromDrizzleProjectionOptions): SyncSource;
|
|
62
|
+
export declare function fromDrizzleProjection(db: unknown, projection: ProjectionMapping, opts: FromDrizzleProjectionOptions): SyncSource;
|
|
63
63
|
//#endregion
|
|
64
64
|
//#region src/drizzle.d.ts
|
|
65
65
|
interface DrizzleDb {
|
|
@@ -82,6 +82,21 @@ interface FromDrizzleOptions {
|
|
|
82
82
|
* check and a false explanation.
|
|
83
83
|
*/
|
|
84
84
|
objectType?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The label this source's pushes carry, when it differs from `entity`.
|
|
87
|
+
*
|
|
88
|
+
* `entity` is the CURSOR KEY — two sources sharing it share a cursor, so the
|
|
89
|
+
* first to run advances it and the second silently pushes nothing. The push
|
|
90
|
+
* LABEL is matched against a mapping's `sourceTable`, which is the host
|
|
91
|
+
* table name. Those two requirements conflict whenever one table feeds two
|
|
92
|
+
* concepts: an `organization` table mapped as both a company and a
|
|
93
|
+
* subscription deal needs distinct cursors but the same table name on the
|
|
94
|
+
* wire.
|
|
95
|
+
*
|
|
96
|
+
* `fromDrizzleProjection` stamps this itself for the projection case. This
|
|
97
|
+
* is the same escape hatch for a plain single-table source.
|
|
98
|
+
*/
|
|
99
|
+
pushSource?: string;
|
|
85
100
|
}
|
|
86
101
|
/**
|
|
87
102
|
* Build a `SyncSource` from a Drizzle table, generating the keyset-paginated
|
|
@@ -94,17 +109,17 @@ interface FromDrizzleOptions {
|
|
|
94
109
|
* `drizzle-orm` is an optional peer dependency — installed only when you import
|
|
95
110
|
* `@clivly/sdk/drizzle`.
|
|
96
111
|
*/
|
|
97
|
-
declare function fromDrizzle(db: DrizzleDb, table: Table, opts: FromDrizzleOptions & {
|
|
112
|
+
export declare function fromDrizzle(db: DrizzleDb, table: Table, opts: FromDrizzleOptions & {
|
|
98
113
|
objectType: string;
|
|
99
114
|
}): SyncSource & {
|
|
100
115
|
objectType: string;
|
|
101
116
|
};
|
|
102
|
-
declare function fromDrizzle(db: DrizzleDb, table: Table, opts: FromDrizzleOptions): SyncSource;
|
|
117
|
+
export declare function fromDrizzle(db: DrizzleDb, table: Table, opts: FromDrizzleOptions): SyncSource;
|
|
103
118
|
/**
|
|
104
119
|
* Build a `NamespaceIntrospector` from any Drizzle client that exposes
|
|
105
120
|
* `.execute()`. Reads `information_schema` in the connection's default schema
|
|
106
121
|
* (`current_schema()`), so it reports exactly the tables the app can reach.
|
|
107
122
|
*/
|
|
108
|
-
declare function drizzleIntrospector(db: unknown): NamespaceIntrospector;
|
|
123
|
+
export declare function drizzleIntrospector(db: unknown): NamespaceIntrospector;
|
|
109
124
|
//#endregion
|
|
110
|
-
export { type FromDrizzleProjectionOptions, buildUniqueConstraints, discoverFromDrizzle
|
|
125
|
+
export { type FromDrizzleProjectionOptions, buildUniqueConstraints, discoverFromDrizzle };
|
package/dist/drizzle.d.mts
CHANGED
|
@@ -54,12 +54,12 @@ interface FromDrizzleProjectionOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
objectType?: string;
|
|
56
56
|
}
|
|
57
|
-
declare function fromDrizzleProjection(db: unknown, projection: ProjectionMapping, opts: FromDrizzleProjectionOptions & {
|
|
57
|
+
export declare function fromDrizzleProjection(db: unknown, projection: ProjectionMapping, opts: FromDrizzleProjectionOptions & {
|
|
58
58
|
objectType: string;
|
|
59
59
|
}): SyncSource & {
|
|
60
60
|
objectType: string;
|
|
61
61
|
};
|
|
62
|
-
declare function fromDrizzleProjection(db: unknown, projection: ProjectionMapping, opts: FromDrizzleProjectionOptions): SyncSource;
|
|
62
|
+
export declare function fromDrizzleProjection(db: unknown, projection: ProjectionMapping, opts: FromDrizzleProjectionOptions): SyncSource;
|
|
63
63
|
//#endregion
|
|
64
64
|
//#region src/drizzle.d.ts
|
|
65
65
|
interface DrizzleDb {
|
|
@@ -82,6 +82,21 @@ interface FromDrizzleOptions {
|
|
|
82
82
|
* check and a false explanation.
|
|
83
83
|
*/
|
|
84
84
|
objectType?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The label this source's pushes carry, when it differs from `entity`.
|
|
87
|
+
*
|
|
88
|
+
* `entity` is the CURSOR KEY — two sources sharing it share a cursor, so the
|
|
89
|
+
* first to run advances it and the second silently pushes nothing. The push
|
|
90
|
+
* LABEL is matched against a mapping's `sourceTable`, which is the host
|
|
91
|
+
* table name. Those two requirements conflict whenever one table feeds two
|
|
92
|
+
* concepts: an `organization` table mapped as both a company and a
|
|
93
|
+
* subscription deal needs distinct cursors but the same table name on the
|
|
94
|
+
* wire.
|
|
95
|
+
*
|
|
96
|
+
* `fromDrizzleProjection` stamps this itself for the projection case. This
|
|
97
|
+
* is the same escape hatch for a plain single-table source.
|
|
98
|
+
*/
|
|
99
|
+
pushSource?: string;
|
|
85
100
|
}
|
|
86
101
|
/**
|
|
87
102
|
* Build a `SyncSource` from a Drizzle table, generating the keyset-paginated
|
|
@@ -94,17 +109,17 @@ interface FromDrizzleOptions {
|
|
|
94
109
|
* `drizzle-orm` is an optional peer dependency — installed only when you import
|
|
95
110
|
* `@clivly/sdk/drizzle`.
|
|
96
111
|
*/
|
|
97
|
-
declare function fromDrizzle(db: DrizzleDb, table: Table, opts: FromDrizzleOptions & {
|
|
112
|
+
export declare function fromDrizzle(db: DrizzleDb, table: Table, opts: FromDrizzleOptions & {
|
|
98
113
|
objectType: string;
|
|
99
114
|
}): SyncSource & {
|
|
100
115
|
objectType: string;
|
|
101
116
|
};
|
|
102
|
-
declare function fromDrizzle(db: DrizzleDb, table: Table, opts: FromDrizzleOptions): SyncSource;
|
|
117
|
+
export declare function fromDrizzle(db: DrizzleDb, table: Table, opts: FromDrizzleOptions): SyncSource;
|
|
103
118
|
/**
|
|
104
119
|
* Build a `NamespaceIntrospector` from any Drizzle client that exposes
|
|
105
120
|
* `.execute()`. Reads `information_schema` in the connection's default schema
|
|
106
121
|
* (`current_schema()`), so it reports exactly the tables the app can reach.
|
|
107
122
|
*/
|
|
108
|
-
declare function drizzleIntrospector(db: unknown): NamespaceIntrospector;
|
|
123
|
+
export declare function drizzleIntrospector(db: unknown): NamespaceIntrospector;
|
|
109
124
|
//#endregion
|
|
110
|
-
export { type FromDrizzleProjectionOptions, buildUniqueConstraints, discoverFromDrizzle
|
|
125
|
+
export { type FromDrizzleProjectionOptions, buildUniqueConstraints, discoverFromDrizzle };
|
package/dist/drizzle.mjs
CHANGED
|
@@ -140,6 +140,7 @@ function fromDrizzle(db, table, opts) {
|
|
|
140
140
|
const idColumnName = idColumn.name;
|
|
141
141
|
const source = {
|
|
142
142
|
entity: opts.entity,
|
|
143
|
+
...opts.pushSource === void 0 ? {} : { pushSource: opts.pushSource },
|
|
143
144
|
cursorField: cursorColumnName,
|
|
144
145
|
idField: idColumnName,
|
|
145
146
|
fetchPage: ({ since, limit }) => drizzleDb.select(projection).from(table).where(since ? sql`(${cursorColumn}, ${idColumn}) > (${since.time}, ${since.id})` : void 0).orderBy(asc(cursorColumn), asc(idColumn)).limit(limit),
|
package/dist/index.d.cts
CHANGED
|
@@ -2,10 +2,10 @@ import { a as ClivlySDK, c as CreateChatSessionHandlerOptions, d as DoctorCheck,
|
|
|
2
2
|
import { createChatSessionHandler } from "./chat-session.cjs";
|
|
3
3
|
import { ClivlyEntitiesConfig, ConfigValidationError, ConfigValidationResult, CustomObjectDeclaration, DiscoveredSchemaTable, customObjectDeclarations, defineClivlyConfig, validateEntitiesConfig } from "@clivly/core/entity-config";
|
|
4
4
|
//#region src/trigger-url.d.ts
|
|
5
|
-
declare function isPlaceholderUrl(value: string): boolean;
|
|
5
|
+
export declare function isPlaceholderUrl(value: string): boolean;
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/errors.d.ts
|
|
8
|
-
declare class ClivlyError extends Error {
|
|
8
|
+
export declare class ClivlyError extends Error {
|
|
9
9
|
/** HTTP status, or null when the request never completed (network error). */
|
|
10
10
|
readonly status: number | null;
|
|
11
11
|
readonly reason: ClivlyConnectResult["reason"];
|
|
@@ -19,11 +19,11 @@ declare class ClivlyError extends Error {
|
|
|
19
19
|
static from(result: ClivlyConnectResult): ClivlyError | null;
|
|
20
20
|
}
|
|
21
21
|
/** The API key was rejected (401) or lacks access (403). Not retryable. */
|
|
22
|
-
declare class ClivlyAuthError extends ClivlyError {}
|
|
22
|
+
export declare class ClivlyAuthError extends ClivlyError {}
|
|
23
23
|
/** Rate limited (429). Retryable after backoff / `Retry-After`. */
|
|
24
|
-
declare class ClivlyRateLimitError extends ClivlyError {}
|
|
24
|
+
export declare class ClivlyRateLimitError extends ClivlyError {}
|
|
25
25
|
/** The request never reached the server (network/DNS/TLS). Retryable. */
|
|
26
|
-
declare class ClivlyNetworkError extends ClivlyError {}
|
|
26
|
+
export declare class ClivlyNetworkError extends ClivlyError {}
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/index.d.ts
|
|
29
29
|
/**
|
|
@@ -32,6 +32,6 @@ declare class ClivlyNetworkError extends ClivlyError {}
|
|
|
32
32
|
* backend today. Tunnel management and CRM write-back are scaffolded (see the
|
|
33
33
|
* clearly-marked TODOs) and land with the Cloudflare infrastructure.
|
|
34
34
|
*/
|
|
35
|
-
declare function createClivlySDK(config: ClivlySDKConfig): ClivlySDK;
|
|
35
|
+
export declare function createClivlySDK(config: ClivlySDKConfig): ClivlySDK;
|
|
36
36
|
//#endregion
|
|
37
|
-
export { type ChatSessionRequestBody, type ChatWidgetVisitor,
|
|
37
|
+
export { type ChatSessionRequestBody, type ChatWidgetVisitor, type ClivlyConnectReason, type ClivlyConnectResult, type ClivlyEntitiesConfig, type ClivlySDK, type ClivlySDKConfig, type ClivlyUser, type ConfigValidationError, type ConfigValidationResult, type CreateChatSessionHandlerOptions, type CursorStore, type CustomObjectDeclaration, type DiscoveredSchemaTable, type DiscoveredTable, type DoctorCheck, type DoctorReport, type EnsureSchemaResult, type EnsuredMappingResult, type EnsuredObjectTypeResult, type RemoteProjectionsDescription, type SyncTriggerDescription, createChatSessionHandler, customObjectDeclarations, defineClivlyConfig, validateEntitiesConfig };
|
package/dist/index.d.mts
CHANGED
|
@@ -2,10 +2,10 @@ import { a as ClivlySDK, c as CreateChatSessionHandlerOptions, d as DoctorCheck,
|
|
|
2
2
|
import { createChatSessionHandler } from "./chat-session.mjs";
|
|
3
3
|
import { ClivlyEntitiesConfig, ConfigValidationError, ConfigValidationResult, CustomObjectDeclaration, DiscoveredSchemaTable, customObjectDeclarations, defineClivlyConfig, validateEntitiesConfig } from "@clivly/core/entity-config";
|
|
4
4
|
//#region src/trigger-url.d.ts
|
|
5
|
-
declare function isPlaceholderUrl(value: string): boolean;
|
|
5
|
+
export declare function isPlaceholderUrl(value: string): boolean;
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/errors.d.ts
|
|
8
|
-
declare class ClivlyError extends Error {
|
|
8
|
+
export declare class ClivlyError extends Error {
|
|
9
9
|
/** HTTP status, or null when the request never completed (network error). */
|
|
10
10
|
readonly status: number | null;
|
|
11
11
|
readonly reason: ClivlyConnectResult["reason"];
|
|
@@ -19,11 +19,11 @@ declare class ClivlyError extends Error {
|
|
|
19
19
|
static from(result: ClivlyConnectResult): ClivlyError | null;
|
|
20
20
|
}
|
|
21
21
|
/** The API key was rejected (401) or lacks access (403). Not retryable. */
|
|
22
|
-
declare class ClivlyAuthError extends ClivlyError {}
|
|
22
|
+
export declare class ClivlyAuthError extends ClivlyError {}
|
|
23
23
|
/** Rate limited (429). Retryable after backoff / `Retry-After`. */
|
|
24
|
-
declare class ClivlyRateLimitError extends ClivlyError {}
|
|
24
|
+
export declare class ClivlyRateLimitError extends ClivlyError {}
|
|
25
25
|
/** The request never reached the server (network/DNS/TLS). Retryable. */
|
|
26
|
-
declare class ClivlyNetworkError extends ClivlyError {}
|
|
26
|
+
export declare class ClivlyNetworkError extends ClivlyError {}
|
|
27
27
|
//#endregion
|
|
28
28
|
//#region src/index.d.ts
|
|
29
29
|
/**
|
|
@@ -32,6 +32,6 @@ declare class ClivlyNetworkError extends ClivlyError {}
|
|
|
32
32
|
* backend today. Tunnel management and CRM write-back are scaffolded (see the
|
|
33
33
|
* clearly-marked TODOs) and land with the Cloudflare infrastructure.
|
|
34
34
|
*/
|
|
35
|
-
declare function createClivlySDK(config: ClivlySDKConfig): ClivlySDK;
|
|
35
|
+
export declare function createClivlySDK(config: ClivlySDKConfig): ClivlySDK;
|
|
36
36
|
//#endregion
|
|
37
|
-
export { type ChatSessionRequestBody, type ChatWidgetVisitor,
|
|
37
|
+
export { type ChatSessionRequestBody, type ChatWidgetVisitor, type ClivlyConnectReason, type ClivlyConnectResult, type ClivlyEntitiesConfig, type ClivlySDK, type ClivlySDKConfig, type ClivlyUser, type ConfigValidationError, type ConfigValidationResult, type CreateChatSessionHandlerOptions, type CursorStore, type CustomObjectDeclaration, type DiscoveredSchemaTable, type DiscoveredTable, type DoctorCheck, type DoctorReport, type EnsureSchemaResult, type EnsuredMappingResult, type EnsuredObjectTypeResult, type RemoteProjectionsDescription, type SyncTriggerDescription, createChatSessionHandler, customObjectDeclarations, defineClivlyConfig, validateEntitiesConfig };
|
package/dist/vite.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as ClivlySDK } from "./types-CvhxV-IX.cjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
//#region src/vite.d.ts
|
|
4
|
-
interface ClivlyViteOptions {
|
|
4
|
+
export interface ClivlyViteOptions {
|
|
5
5
|
/** Log prefix for Clivly's boot lines. Defaults to "clivly". */
|
|
6
6
|
name?: string;
|
|
7
7
|
}
|
|
@@ -17,6 +17,5 @@ interface ClivlyViteOptions {
|
|
|
17
17
|
* Vite is an optional peer dependency imported type-only (`import type`), so
|
|
18
18
|
* the built bundle carries no runtime dependency on Vite.
|
|
19
19
|
*/
|
|
20
|
-
declare function clivlyVite(sdk: ClivlySDK, options?: ClivlyViteOptions): Plugin;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { ClivlyViteOptions, clivlyVite };
|
|
20
|
+
export declare function clivlyVite(sdk: ClivlySDK, options?: ClivlyViteOptions): Plugin;
|
|
21
|
+
//#endregion
|
package/dist/vite.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as ClivlySDK } from "./types-CvhxV-IX.mjs";
|
|
2
2
|
import { Plugin } from "vite";
|
|
3
3
|
//#region src/vite.d.ts
|
|
4
|
-
interface ClivlyViteOptions {
|
|
4
|
+
export interface ClivlyViteOptions {
|
|
5
5
|
/** Log prefix for Clivly's boot lines. Defaults to "clivly". */
|
|
6
6
|
name?: string;
|
|
7
7
|
}
|
|
@@ -17,6 +17,5 @@ interface ClivlyViteOptions {
|
|
|
17
17
|
* Vite is an optional peer dependency imported type-only (`import type`), so
|
|
18
18
|
* the built bundle carries no runtime dependency on Vite.
|
|
19
19
|
*/
|
|
20
|
-
declare function clivlyVite(sdk: ClivlySDK, options?: ClivlyViteOptions): Plugin;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { ClivlyViteOptions, clivlyVite };
|
|
20
|
+
export declare function clivlyVite(sdk: ClivlySDK, options?: ClivlyViteOptions): Plugin;
|
|
21
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clivly/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Clivly SDK — connect your app to Clivly Cloud (heartbeat, discovery, auth bridge).",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
"README.md"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@clivly/core": "0.
|
|
56
|
+
"@clivly/core": "0.12.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@electric-sql/pglite": "^0.5.4",
|
|
60
60
|
"drizzle-orm": "^0.45.2",
|
|
61
61
|
"tsdown": "^0.23.0",
|
|
62
62
|
"typescript": "^6",
|
|
63
|
-
"vite": "^8.0
|
|
63
|
+
"vite": "^8.3.0",
|
|
64
64
|
"vitest": "^3.2.0"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|