@squidcloud/client 1.0.194 → 1.0.196
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 +799 -759
- package/dist/internal-common/src/public-types/ai-chatbot.public-types.d.ts +1 -1
- package/dist/internal-common/src/public-types/bundle-api.public-types.d.ts +2 -2
- package/dist/internal-common/src/public-types/document.public-types.d.ts +2 -0
- package/dist/internal-common/src/public-types/integration.public-types.d.ts +1 -0
- package/dist/internal-common/src/public-types/storage.types.d.ts +2 -2
- package/dist/internal-common/src/public-utils/id-utils.d.ts +5 -2
- package/dist/internal-common/src/utils/object.d.ts +1 -1
- package/dist/typescript-client/src/ai-chatbot-client.d.ts +2 -2
- package/dist/typescript-client/src/collection-reference.d.ts +22 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** The supported AI model names. */
|
|
2
|
-
export declare const AI_MODEL_NAMES: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-1106", "gpt-4", "claude-
|
|
2
|
+
export declare const AI_MODEL_NAMES: readonly ["gpt-3.5-turbo", "gpt-3.5-turbo-1106", "gpt-4", "claude-3-opus-20240229", "claude-3-sonnet-20240229", "claude-3-haiku-20240307", "gpt-4-turbo-preview"];
|
|
3
3
|
export type AiModelName = (typeof AI_MODEL_NAMES)[number];
|
|
4
4
|
/** The possible sources for the LLM provider API key. */
|
|
5
5
|
export type ApiKeySource = 'user' | 'system';
|
|
@@ -11,9 +11,9 @@ import { NativeQueryContext } from './native-query.public-context';
|
|
|
11
11
|
import { DistributedLockContext } from './distributed-lock.public-context';
|
|
12
12
|
import { GraphqlContext } from './graphql.public-context';
|
|
13
13
|
import { AiChatbotChatContext, AiChatbotMutationContext } from './ai-chatbot.public-context';
|
|
14
|
-
import {
|
|
14
|
+
import { StorageContext } from './storage.types';
|
|
15
15
|
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>);
|
|
16
|
-
export type SecureStorageAction<T extends StorageActionType> = T extends 'all' ? () => boolean | Promise<boolean> : (
|
|
16
|
+
export type SecureStorageAction<T extends StorageActionType> = T extends 'all' ? () => boolean | Promise<boolean> : (context: StorageContext) => boolean | Promise<boolean>;
|
|
17
17
|
export type SecureTopicAction<T extends TopicActionType> = T extends 'all' ? () => boolean | Promise<boolean> : T extends 'read' ? ((context: TopicReadContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : ((context: TopicWriteContext<T>) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
18
18
|
export type SecureApiAction = ((context: ApiCallContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
19
19
|
export type SecureNativeQueryAction = ((context: NativeQueryContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
@@ -9,6 +9,8 @@ export type FieldName<T = any> = string & keyof T;
|
|
|
9
9
|
export type DocId = string;
|
|
10
10
|
/** A type alias for a document id object when the ID is a composite of primary keys. */
|
|
11
11
|
export type DocIdObj = Record<FieldName, any>;
|
|
12
|
+
/** A type alias for a document id or a document id object. */
|
|
13
|
+
export type DocIdOrDocIdObj = DocId | DocIdObj;
|
|
12
14
|
/** A type alias for a collection name. */
|
|
13
15
|
export type CollectionName = string;
|
|
14
16
|
/** A generic document data type. */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IntegrationId } from './communication.public-types';
|
|
2
2
|
import { StorageActionType } from './bundle-data.public-types';
|
|
3
|
-
export type StorageFunctionality = 'fileUpload';
|
|
4
|
-
export interface
|
|
3
|
+
export type StorageFunctionality = 'fileUpload' | 'getFileMetadata' | 'getDownloadUrl' | 'deleteFiles' | 'listDirectoryContents';
|
|
4
|
+
export interface StorageContext {
|
|
5
5
|
integrationId: IntegrationId;
|
|
6
6
|
pathsInBucket: Array<string>;
|
|
7
7
|
action: StorageActionType;
|
|
@@ -2,5 +2,8 @@
|
|
|
2
2
|
export declare function generateId(): string;
|
|
3
3
|
/** Default length if ID produced by `generateShortId`. */
|
|
4
4
|
export declare const DEFAULT_SHORT_ID_LENGTH = 18;
|
|
5
|
-
/**
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Generates an ID of the given `length` using lowercase latin letters and digits.
|
|
7
|
+
* If the 'prefix' provided replaces the first generated characters with the prefix.
|
|
8
|
+
*/
|
|
9
|
+
export declare function generateShortId(length?: number, prefix?: string): string;
|
|
@@ -24,4 +24,4 @@ export declare function groupBy<T, K extends PropertyKey>(array: T[], getKey: (i
|
|
|
24
24
|
* Picks selected fields from the object and returns a new object with the fields selected.
|
|
25
25
|
* The selected fields are assigned by reference (there is no cloning).
|
|
26
26
|
*/
|
|
27
|
-
export declare function pick<T extends object, K extends keyof T>(obj: T, keys: K
|
|
27
|
+
export declare function pick<T extends object, K extends keyof T>(obj: T, keys: ReadonlyArray<K>): Pick<T, K>;
|
|
@@ -73,7 +73,7 @@ export declare class AiChatbotProfileReference {
|
|
|
73
73
|
* Adds a new profile to the chatbot. This will result in an error if a profile already exists with the same id.
|
|
74
74
|
*
|
|
75
75
|
* @param data An object containing options for creating the profile.
|
|
76
|
-
* @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-
|
|
76
|
+
* @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4`, `claude-3-opus-20240229`, `claude-3-sonnet-20240229` or `claude-3-haiku-20240307`).
|
|
77
77
|
* @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
|
|
78
78
|
* @returns A promise that resolves when the profile is successfully created.
|
|
79
79
|
*/
|
|
@@ -83,7 +83,7 @@ export declare class AiChatbotProfileReference {
|
|
|
83
83
|
* current profile id.
|
|
84
84
|
*
|
|
85
85
|
* @param data An object containing options for updating the profile.
|
|
86
|
-
* @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4` or `claude-
|
|
86
|
+
* @param data.modelName - The name of the OpenAI model (`gpt-3.5, `gpt-4`, `claude-3-opus-20240229`, `claude-3-sonnet-20240229` or `claude-3-haiku-20240307`).
|
|
87
87
|
* @param data.isPublic - Whether the chat functionality of the profile can be accessed without security rules.
|
|
88
88
|
* @returns A promise that resolves when the profile is successfully updated.
|
|
89
89
|
*/
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import { Alias,
|
|
1
|
+
import { Alias, DocIdOrDocIdObj, DocumentData } from './public-types';
|
|
2
2
|
import { DocumentReference } from './document-reference';
|
|
3
3
|
import { JoinQueryBuilder } from './query/join-query-builder.factory';
|
|
4
4
|
import { QueryBuilder } from './query/query-builder.factory';
|
|
5
5
|
import { SnapshotEmitter } from './query/snapshot-emitter';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a docId and the data to be inserted.
|
|
8
|
+
* If the docId is not provided, it will be generated on the server in case the integration supports it.
|
|
9
|
+
* Read more about docId in the
|
|
10
|
+
* {@link https://docs.squid.cloud/docs/api-reference/client-sdk-reference/classes/CollectionReference#doc
|
|
11
|
+
* documentation}.
|
|
12
|
+
*/
|
|
13
|
+
export interface DocIdAndData<T extends DocumentData> {
|
|
14
|
+
id?: DocIdOrDocIdObj;
|
|
15
|
+
data: T;
|
|
16
|
+
}
|
|
6
17
|
/**
|
|
7
18
|
* Holds a reference to a data collection. A collection reference is a reference to a collection in a database. You
|
|
8
19
|
* can use it to read or write data to the collection. A collection can refer to a table in a relational database or a
|
|
@@ -18,6 +29,7 @@ export declare class CollectionReference<T extends DocumentData> {
|
|
|
18
29
|
private readonly documentReferenceFactory;
|
|
19
30
|
private readonly queryBuilderFactory;
|
|
20
31
|
private readonly querySubscriptionManager;
|
|
32
|
+
private readonly dataManager;
|
|
21
33
|
/** A string that uniquely identifies this collection reference. */
|
|
22
34
|
refId: string;
|
|
23
35
|
/**
|
|
@@ -53,7 +65,15 @@ export declare class CollectionReference<T extends DocumentData> {
|
|
|
53
65
|
* @param docId The document id as an object for the different fields in the primary key or a string.
|
|
54
66
|
* @returns A document reference for the given document id.
|
|
55
67
|
*/
|
|
56
|
-
doc(docId?:
|
|
68
|
+
doc(docId?: DocIdOrDocIdObj): DocumentReference<T>;
|
|
69
|
+
/**
|
|
70
|
+
* Inserts multiple documents into the collection.
|
|
71
|
+
*/
|
|
72
|
+
insertMany(docs: Array<DocIdAndData<T>>, txId?: string): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Deletes multiple documents from the collection.
|
|
75
|
+
*/
|
|
76
|
+
deleteMany(docIdsOrReferences: Array<DocIdOrDocIdObj | DocumentReference<T>>, txId?: string): Promise<void>;
|
|
57
77
|
/**
|
|
58
78
|
* Creates a `QueryBuilder` that can be used to query the collection.
|
|
59
79
|
*
|