@squidcloud/client 1.0.113 → 1.0.114

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 CHANGED
@@ -28869,33 +28869,28 @@ const ExecuteFunctionSecureAnnotations = (/* unused pure expression or super */
28869
28869
  'secureAiAssistantMutation',
28870
28870
  ]));
28871
28871
  /** @internal */
28872
- function transformParams(args, executeFunctionAnnotationType) {
28872
+ function transformParams(params, executeFunctionAnnotationType) {
28873
28873
  switch (executeFunctionAnnotationType) {
28874
- case 'webhook':
28875
- case 'executable':
28876
- case 'trigger':
28877
- case 'transformRead':
28878
- case 'transformWrite':
28879
- case 'metadata':
28880
- return args;
28881
28874
  case 'scheduler':
28882
28875
  return [];
28883
28876
  case 'secureQuery':
28884
- return [new QueryContext(args[0].query)];
28877
+ return [new QueryContext(params[0].query)];
28885
28878
  case 'secureMutation':
28886
- return [new MutationContext(args[0].mutation, args[0].beforeAndAfterDocs, args[0].serverTimestamp)];
28879
+ return [new MutationContext(params[0].mutation, params[0].beforeAndAfterDocs, params[0].serverTimestamp)];
28887
28880
  case 'secureNamedQuery':
28888
- return [new NamedQueryContext(args[0])];
28881
+ return [new NamedQueryContext(params[0])];
28889
28882
  case 'secureDistributedLock':
28890
- return [new DistributedLockContext(args[0].mutex, args[0].exclusive)];
28883
+ return [new DistributedLockContext(params[0].mutex, params[0].exclusive)];
28891
28884
  case 'secureGraphQL':
28892
- return [new GraphqlContext(args[0])];
28885
+ return [new GraphqlContext(params[0])];
28893
28886
  case 'secureApi':
28894
- return [new ApiCallContext(args[0])];
28887
+ return [new ApiCallContext(params[0])];
28895
28888
  case 'secureAiAssistantChat':
28896
- return [new AiAssistantChatContext(args[0])];
28889
+ return [new AiAssistantChatContext(params[0])];
28897
28890
  case 'secureAiAssistantMutation':
28898
- return [new AiAssistantMutationContext(args[0])];
28891
+ return [new AiAssistantMutationContext(params[0])];
28892
+ default:
28893
+ return params;
28899
28894
  }
28900
28895
  }
28901
28896
  /** @internal */
@@ -29680,6 +29675,17 @@ const MessageFromClientSchema = {
29680
29675
  ],
29681
29676
  };
29682
29677
 
29678
+ ;// CONCATENATED MODULE: ../common/src/socket.types.ts
29679
+ var ClientConnectionState;
29680
+ (function (ClientConnectionState) {
29681
+ // The client just connected to the socket
29682
+ ClientConnectionState["CONNECTED"] = "CONNECTED";
29683
+ // The client disconnected from the socket but Squid still keeps the clientID in case the client reconnects
29684
+ ClientConnectionState["DISCONNECTED"] = "DISCONNECTED";
29685
+ // The client disconnected from the socket and Squid removed the clientID
29686
+ ClientConnectionState["REMOVED"] = "REMOVED";
29687
+ })(ClientConnectionState || (ClientConnectionState = {}));
29688
+
29683
29689
  ;// CONCATENATED MODULE: ../common/src/time-units.ts
29684
29690
  /** @internal */
29685
29691
  const SECONDS_PER_MINUTE = 60;
@@ -8,12 +8,15 @@ 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
+ import { ClientId } from './communication.types';
12
+ import { ClientConnectionState } from './socket.types';
11
13
  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
14
  export type SecureApiAction = ((context: ApiCallContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
13
15
  export type SecureNamedQueryAction = ((context: NamedQueryContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
14
16
  export type SecureDistributedLockAction = ((context: DistributedLockContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
15
17
  export type SecureGraphQLAction = ((context: GraphqlContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
16
18
  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>);
19
+ export type ClientConnectionStateChangeAction = (clientId: ClientId, clientConnectionState: ClientConnectionState) => Promise<void> | void;
17
20
  export type ExecutableAction = (...args: any[]) => any;
18
21
  export type TriggerAction = ((request: TriggerRequest) => void | Promise<void>) | (() => void | Promise<void>);
19
22
  /** The context provided to a trigger function. */
@@ -1 +1,5 @@
1
- export {};
1
+ export declare enum ClientConnectionState {
2
+ CONNECTED = "CONNECTED",
3
+ DISCONNECTED = "DISCONNECTED",
4
+ REMOVED = "REMOVED"
5
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@squidcloud/client",
3
- "version": "1.0.113",
3
+ "version": "1.0.114",
4
4
  "description": "A typescript implementation of the Squid client",
5
5
  "main": "dist/cjs/index.js",
6
6
  "types": "dist/typescript-client/src/index.d.ts",