@squidcloud/client 1.0.88 → 1.0.89
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/cjs/index.js +5 -5
- package/dist/common/src/ai-assistant.types.d.ts +10 -0
- package/dist/common/src/bundle-api.types.d.ts +8 -9
- package/dist/common/src/integrations/ai_assistant.types.d.ts +2 -2
- package/dist/common/src/query/base-query-builder.d.ts +2 -0
- package/dist/common/src/query/index.d.ts +1 -0
- package/dist/common/src/query/serialized-query.types.d.ts +24 -0
- package/dist/common/src/query.types.d.ts +14 -0
- package/dist/common/src/utils/nullish.d.ts +1 -0
- package/dist/esm/index.js +5 -5
- package/dist/typescript-client/src/ai-assistant-client.d.ts +3 -3
- package/dist/typescript-client/src/collection-reference.d.ts +1 -2
- package/dist/typescript-client/src/index.d.ts +1 -1
- package/dist/typescript-client/src/query/deserializer.d.ts +3 -0
- package/dist/typescript-client/src/query/join-query-builder.factory.d.ts +18 -6
- package/dist/typescript-client/src/query/query-builder.factory.d.ts +2 -1
- package/dist/typescript-client/src/query/query-subscription.manager.d.ts +1 -2
- package/package.json +1 -1
- package/dist/typescript-client/src/query/query.types.d.ts +0 -14
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
/** The supported Open AI model names. */
|
|
2
2
|
export type OpenAiModelName = 'gpt-3.5-turbo' | 'gpt-4';
|
|
3
|
+
export type AiAssistantContextType = 'text' | 'url';
|
|
4
|
+
export interface AiAssistantTextContext {
|
|
5
|
+
type: 'text';
|
|
6
|
+
data: string;
|
|
7
|
+
}
|
|
8
|
+
export interface AiAssistantUrlContext {
|
|
9
|
+
type: 'url';
|
|
10
|
+
data: string;
|
|
11
|
+
}
|
|
12
|
+
export type AiAssistantContext = AiAssistantTextContext | AiAssistantUrlContext;
|
|
@@ -8,15 +8,14 @@ import { NamedQueryContext } from './named-query.context';
|
|
|
8
8
|
import { GraphqlContext } from './graphql.context';
|
|
9
9
|
import { DistributedLockContext } from './distributed-lock.context';
|
|
10
10
|
import { AiAssistantChatContext, AiAssistantMutationContext } from './ai-assistant.context';
|
|
11
|
-
export type SecureDatabaseAction<T extends DatabaseActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'read' ? (context
|
|
12
|
-
export type SecureApiAction = (context
|
|
13
|
-
export type SecureNamedQueryAction = (context
|
|
14
|
-
export type SecureDistributedLockAction = (context
|
|
15
|
-
export type SecureGraphQLAction = (context
|
|
16
|
-
export type SecureAiAssistantAction<T extends AiAssistantActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'chat' ? (context
|
|
17
|
-
export type TransformDatabaseAction<T extends DatabaseActionType> = T extends 'read' ? (request?: TransformDatabaseReadRequest) => TransformDatabaseReadResponse | Promise<TransformDatabaseReadResponse> : (request?: TransformDatabaseWriteRequest) => TransformDatabaseWriteResponse | Promise<TransformDatabaseWriteResponse>;
|
|
11
|
+
export type SecureDatabaseAction<T extends DatabaseActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'read' ? ((context: QueryContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : ((context: MutationContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
12
|
+
export type SecureApiAction = ((context: ApiCallContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
13
|
+
export type SecureNamedQueryAction = ((context: NamedQueryContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
14
|
+
export type SecureDistributedLockAction = ((context: DistributedLockContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
15
|
+
export type SecureGraphQLAction = ((context: GraphqlContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
16
|
+
export type SecureAiAssistantAction<T extends AiAssistantActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'chat' ? ((context: AiAssistantChatContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : ((context: AiAssistantMutationContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
18
17
|
export type ExecutableAction = (...args: any[]) => any;
|
|
19
|
-
export type TriggerAction = (request
|
|
18
|
+
export type TriggerAction = ((request: TriggerRequest) => void | Promise<void>) | (() => void | Promise<void>);
|
|
20
19
|
/** The context provided to a trigger function. */
|
|
21
20
|
export interface TriggerRequest<T extends DocumentData = any> {
|
|
22
21
|
squidDocId: SquidDocId;
|
|
@@ -25,7 +24,7 @@ export interface TriggerRequest<T extends DocumentData = any> {
|
|
|
25
24
|
docAfter?: T;
|
|
26
25
|
}
|
|
27
26
|
export type SchedulerAction = () => void | Promise<void>;
|
|
28
|
-
export type WebhookAction = (request
|
|
27
|
+
export type WebhookAction = ((request: WebhookRequest) => any) | (() => any);
|
|
29
28
|
/** The context provided to a webhook function. */
|
|
30
29
|
export interface WebhookRequest {
|
|
31
30
|
body: any;
|
|
@@ -12,9 +12,9 @@ export type AiAssistantProfile = {
|
|
|
12
12
|
modelName: string;
|
|
13
13
|
strictContext: boolean;
|
|
14
14
|
instructions: Record<string, string>;
|
|
15
|
-
contexts: Record<string,
|
|
15
|
+
contexts: Record<string, AiAssistantContextMetadata>;
|
|
16
16
|
};
|
|
17
|
-
export type
|
|
17
|
+
export type AiAssistantContextMetadata = {
|
|
18
18
|
title: string;
|
|
19
19
|
text: string;
|
|
20
20
|
preview: boolean;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { DocumentData, FieldName, PrimitiveFieldType } from '../document.types';
|
|
3
3
|
import { Operator } from '../query.types';
|
|
4
|
+
import { SerializedQuery } from './serialized-query.types';
|
|
4
5
|
export interface SnapshotEmitter<ReturnType> {
|
|
5
6
|
/**
|
|
6
7
|
* Returns a promise that resolves to the query results.
|
|
@@ -24,6 +25,7 @@ export interface SnapshotEmitter<ReturnType> {
|
|
|
24
25
|
* @param options The pagination options. Defaults to `{ subscribe: true, pageSize: 100 }`.
|
|
25
26
|
*/
|
|
26
27
|
paginate(options?: Partial<PaginationOptions>): Pagination<ReturnType>;
|
|
28
|
+
serialize(): SerializedQuery;
|
|
27
29
|
}
|
|
28
30
|
/** Query builder base class. */
|
|
29
31
|
export declare abstract class BaseQueryBuilder<MyDocType extends DocumentData> {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DocumentData } from '../document.types';
|
|
2
|
+
import { Query, Alias, JoinCondition } from '../query.types';
|
|
3
|
+
export type SerializedSimpleQuery = {
|
|
4
|
+
type: 'simple';
|
|
5
|
+
query: Query;
|
|
6
|
+
dereference: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type SerializedJoinQuery = {
|
|
9
|
+
type: 'join';
|
|
10
|
+
grouped: boolean;
|
|
11
|
+
dereference: boolean;
|
|
12
|
+
root: {
|
|
13
|
+
alias: Alias;
|
|
14
|
+
query: Query;
|
|
15
|
+
};
|
|
16
|
+
leftToRight: Record<Alias, Alias[]>;
|
|
17
|
+
joins: Record<Alias, Query<DocumentData>>;
|
|
18
|
+
joinConditions: Record<Alias, JoinCondition>;
|
|
19
|
+
};
|
|
20
|
+
export type SerializedMergedQuery = {
|
|
21
|
+
type: 'merged';
|
|
22
|
+
queries: Array<SerializedQuery>;
|
|
23
|
+
};
|
|
24
|
+
export type SerializedQuery = SerializedSimpleQuery | SerializedJoinQuery | SerializedMergedQuery;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import { ClientRequestId } from './communication.types';
|
|
2
2
|
import { CollectionName, DocumentData, FieldName } from './document.types';
|
|
3
3
|
import { Paths } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* An alias for a join result. This is used to disambiguate fields in the result.
|
|
6
|
+
*/
|
|
7
|
+
export type Alias = string;
|
|
8
|
+
/**
|
|
9
|
+
* A join condition.
|
|
10
|
+
* The join conditions defines the alias for the left side of the join and the field names to join on.
|
|
11
|
+
*/
|
|
12
|
+
export interface JoinCondition {
|
|
13
|
+
leftAlias: Alias;
|
|
14
|
+
left: FieldName;
|
|
15
|
+
right: FieldName;
|
|
16
|
+
isInner: boolean;
|
|
17
|
+
}
|
|
4
18
|
/** A list of query conditions. */
|
|
5
19
|
export type Condition<Doc extends DocumentData = any> = SimpleCondition<Doc> | CompositeCondition<Doc>;
|
|
6
20
|
export type Conditions<Doc extends DocumentData = any> = Array<Condition<Doc>>;
|