@squidcloud/backend 1.0.338 → 1.0.339
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/backend/src/actions.d.ts +57 -18
- package/dist/backend/src/public-types.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/internal-common/src/public-types-backend/{ai-chatbot.public-context.d.ts → ai-agent.public-context.d.ts} +10 -0
- package/dist/internal-common/src/public-types-backend/application.public-types.d.ts +94 -0
- package/dist/internal-common/src/public-types-backend/bundle-api.public-types.d.ts +26 -7
- package/dist/internal-common/src/public-types-backend/bundle-data.public-types.d.ts +24 -0
- package/dist/internal-common/src/public-types-backend/metric.public-context.d.ts +4 -1
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +99 -3
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +12 -0
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +33 -5
- package/dist/internal-common/src/public-types-backend/storage.types.d.ts +9 -0
- package/package.json +11 -4
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/** A type alias for a string that represents a webhook. */
|
|
2
|
+
export type WebhookId = string;
|
|
3
|
+
/** A type alias for a string that represents a trigger id. */
|
|
4
|
+
export type TriggerId = string;
|
|
5
|
+
/** A type alias for a string that represents a scheduler id. */
|
|
6
|
+
export type SchedulerId = string;
|
|
7
|
+
/** The supported cron expression string. */
|
|
8
|
+
export type CronExpressionString = `${string} ${string} ${string} ${string} ${string}` | `${string} ${string} ${string} ${string}`;
|
|
9
|
+
/** A set of predefined cron expressions. */
|
|
10
|
+
export declare enum CronExpression {
|
|
11
|
+
EVERY_SECOND = "* * * * * *",
|
|
12
|
+
EVERY_5_SECONDS = "*/5 * * * * *",
|
|
13
|
+
EVERY_10_SECONDS = "*/10 * * * * *",
|
|
14
|
+
EVERY_30_SECONDS = "*/30 * * * * *",
|
|
15
|
+
EVERY_MINUTE = "*/1 * * * *",
|
|
16
|
+
EVERY_5_MINUTES = "0 */5 * * * *",
|
|
17
|
+
EVERY_10_MINUTES = "0 */10 * * * *",
|
|
18
|
+
EVERY_30_MINUTES = "0 */30 * * * *",
|
|
19
|
+
EVERY_HOUR = "0 0-23/1 * * *",
|
|
20
|
+
EVERY_2_HOURS = "0 0-23/2 * * *",
|
|
21
|
+
EVERY_3_HOURS = "0 0-23/3 * * *",
|
|
22
|
+
EVERY_4_HOURS = "0 0-23/4 * * *",
|
|
23
|
+
EVERY_5_HOURS = "0 0-23/5 * * *",
|
|
24
|
+
EVERY_6_HOURS = "0 0-23/6 * * *",
|
|
25
|
+
EVERY_7_HOURS = "0 0-23/7 * * *",
|
|
26
|
+
EVERY_8_HOURS = "0 0-23/8 * * *",
|
|
27
|
+
EVERY_9_HOURS = "0 0-23/9 * * *",
|
|
28
|
+
EVERY_10_HOURS = "0 0-23/10 * * *",
|
|
29
|
+
EVERY_11_HOURS = "0 0-23/11 * * *",
|
|
30
|
+
EVERY_12_HOURS = "0 0-23/12 * * *",
|
|
31
|
+
EVERY_DAY_AT_1AM = "0 01 * * *",
|
|
32
|
+
EVERY_DAY_AT_2AM = "0 02 * * *",
|
|
33
|
+
EVERY_DAY_AT_3AM = "0 03 * * *",
|
|
34
|
+
EVERY_DAY_AT_4AM = "0 04 * * *",
|
|
35
|
+
EVERY_DAY_AT_5AM = "0 05 * * *",
|
|
36
|
+
EVERY_DAY_AT_6AM = "0 06 * * *",
|
|
37
|
+
EVERY_DAY_AT_7AM = "0 07 * * *",
|
|
38
|
+
EVERY_DAY_AT_8AM = "0 08 * * *",
|
|
39
|
+
EVERY_DAY_AT_9AM = "0 09 * * *",
|
|
40
|
+
EVERY_DAY_AT_10AM = "0 10 * * *",
|
|
41
|
+
EVERY_DAY_AT_11AM = "0 11 * * *",
|
|
42
|
+
EVERY_DAY_AT_NOON = "0 12 * * *",
|
|
43
|
+
EVERY_DAY_AT_1PM = "0 13 * * *",
|
|
44
|
+
EVERY_DAY_AT_2PM = "0 14 * * *",
|
|
45
|
+
EVERY_DAY_AT_3PM = "0 15 * * *",
|
|
46
|
+
EVERY_DAY_AT_4PM = "0 16 * * *",
|
|
47
|
+
EVERY_DAY_AT_5PM = "0 17 * * *",
|
|
48
|
+
EVERY_DAY_AT_6PM = "0 18 * * *",
|
|
49
|
+
EVERY_DAY_AT_7PM = "0 19 * * *",
|
|
50
|
+
EVERY_DAY_AT_8PM = "0 20 * * *",
|
|
51
|
+
EVERY_DAY_AT_9PM = "0 21 * * *",
|
|
52
|
+
EVERY_DAY_AT_10PM = "0 22 * * *",
|
|
53
|
+
EVERY_DAY_AT_11PM = "0 23 * * *",
|
|
54
|
+
EVERY_DAY_AT_MIDNIGHT = "0 0 * * *",
|
|
55
|
+
EVERY_WEEK = "0 0 * * 7",
|
|
56
|
+
EVERY_WEEKDAY = "0 0 * * 1-5",
|
|
57
|
+
EVERY_WEEKEND = "0 0 * * 6,7",
|
|
58
|
+
EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT = "0 0 1 * *",
|
|
59
|
+
EVERY_1ST_DAY_OF_MONTH_AT_NOON = "0 12 1 * *",
|
|
60
|
+
EVERY_2ND_HOUR = "0 */2 * * *",
|
|
61
|
+
EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM = "0 1-23/2 * * *",
|
|
62
|
+
EVERY_2ND_MONTH = "0 0 1 */2 *",
|
|
63
|
+
EVERY_QUARTER = "0 0 1 */3 *",
|
|
64
|
+
EVERY_6_MONTHS = "0 0 1 */6 *",
|
|
65
|
+
EVERY_YEAR = "0 0 1 1 *",
|
|
66
|
+
EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM = "0 */30 9-17 * * *",
|
|
67
|
+
EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM = "0 */30 9-18 * * *",
|
|
68
|
+
EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM = "0 */30 10-19 * * *",
|
|
69
|
+
MONDAY_TO_FRIDAY_AT_1AM = "0 0 01 * * 1-5",
|
|
70
|
+
MONDAY_TO_FRIDAY_AT_2AM = "0 0 02 * * 1-5",
|
|
71
|
+
MONDAY_TO_FRIDAY_AT_3AM = "0 0 03 * * 1-5",
|
|
72
|
+
MONDAY_TO_FRIDAY_AT_4AM = "0 0 04 * * 1-5",
|
|
73
|
+
MONDAY_TO_FRIDAY_AT_5AM = "0 0 05 * * 1-5",
|
|
74
|
+
MONDAY_TO_FRIDAY_AT_6AM = "0 0 06 * * 1-5",
|
|
75
|
+
MONDAY_TO_FRIDAY_AT_7AM = "0 0 07 * * 1-5",
|
|
76
|
+
MONDAY_TO_FRIDAY_AT_8AM = "0 0 08 * * 1-5",
|
|
77
|
+
MONDAY_TO_FRIDAY_AT_9AM = "0 0 09 * * 1-5",
|
|
78
|
+
MONDAY_TO_FRIDAY_AT_09_30AM = "0 30 09 * * 1-5",
|
|
79
|
+
MONDAY_TO_FRIDAY_AT_10AM = "0 0 10 * * 1-5",
|
|
80
|
+
MONDAY_TO_FRIDAY_AT_11AM = "0 0 11 * * 1-5",
|
|
81
|
+
MONDAY_TO_FRIDAY_AT_11_30AM = "0 30 11 * * 1-5",
|
|
82
|
+
MONDAY_TO_FRIDAY_AT_12PM = "0 0 12 * * 1-5",
|
|
83
|
+
MONDAY_TO_FRIDAY_AT_1PM = "0 0 13 * * 1-5",
|
|
84
|
+
MONDAY_TO_FRIDAY_AT_2PM = "0 0 14 * * 1-5",
|
|
85
|
+
MONDAY_TO_FRIDAY_AT_3PM = "0 0 15 * * 1-5",
|
|
86
|
+
MONDAY_TO_FRIDAY_AT_4PM = "0 0 16 * * 1-5",
|
|
87
|
+
MONDAY_TO_FRIDAY_AT_5PM = "0 0 17 * * 1-5",
|
|
88
|
+
MONDAY_TO_FRIDAY_AT_6PM = "0 0 18 * * 1-5",
|
|
89
|
+
MONDAY_TO_FRIDAY_AT_7PM = "0 0 19 * * 1-5",
|
|
90
|
+
MONDAY_TO_FRIDAY_AT_8PM = "0 0 20 * * 1-5",
|
|
91
|
+
MONDAY_TO_FRIDAY_AT_9PM = "0 0 21 * * 1-5",
|
|
92
|
+
MONDAY_TO_FRIDAY_AT_10PM = "0 0 22 * * 1-5",
|
|
93
|
+
MONDAY_TO_FRIDAY_AT_11PM = "0 0 23 * * 1-5"
|
|
94
|
+
}
|
|
@@ -1,30 +1,46 @@
|
|
|
1
|
-
import { MutationContext } from './mutation.public-context';
|
|
1
|
+
import { MutationContext, MutationType } from './mutation.public-context';
|
|
2
2
|
import { ApiCallContext } from './api-call.public-context';
|
|
3
3
|
import { QueryContext } from './query.public-context';
|
|
4
|
-
import { DatabaseActionType, MetricActionType, StorageActionType, TopicActionType } from '@squidcloud/client';
|
|
5
4
|
import { ClientConnectionState } from '@squidcloud/client';
|
|
6
5
|
import { CollectionName, DocIdOrDocIdObj, DocumentData } from '@squidcloud/client';
|
|
7
|
-
import { MutationType } from '@squidcloud/client';
|
|
8
6
|
import { ClientId, IntegrationId, SquidDocId } from '@squidcloud/client';
|
|
9
7
|
import { TopicReadContext, TopicWriteContext } from './topic.public-context';
|
|
10
8
|
import { DistributedLockContext } from './distributed-lock.public-context';
|
|
11
9
|
import { GraphqlContext } from './graphql.public-context';
|
|
12
|
-
import { AiFunctionContext } from './ai-chatbot.public-context';
|
|
13
|
-
import { StorageContext } from '@squidcloud/client';
|
|
14
10
|
import { NativeQueryContext } from './native-query.public-context';
|
|
15
11
|
import { SecureMetricContext } from './metric.public-context';
|
|
16
|
-
import {
|
|
12
|
+
import { DatabaseActionType, MetricActionType, StorageActionType, TopicActionType } from './bundle-data.public-types';
|
|
13
|
+
import { StorageContext } from './storage.types';
|
|
14
|
+
import { AiFunctionContext, SecureAiAgentContext } from './ai-agent.public-context';
|
|
15
|
+
/**
|
|
16
|
+
* @category Database
|
|
17
|
+
*/
|
|
17
18
|
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>);
|
|
19
|
+
/**
|
|
20
|
+
* @category Storage
|
|
21
|
+
*/
|
|
18
22
|
export type SecureStorageAction<T extends StorageActionType> = T extends 'all' ? () => boolean | Promise<boolean> : (context: StorageContext) => boolean | Promise<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* @category Queue
|
|
25
|
+
*/
|
|
19
26
|
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>);
|
|
20
27
|
export type SecureMetricAction<T extends MetricActionType> = T extends 'all' ? ((context: SecureMetricContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : T extends 'write' ? ((context: SecureMetricContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>) : never;
|
|
21
28
|
export type SecureApiAction = ((context: ApiCallContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
29
|
+
/**
|
|
30
|
+
* @category Database
|
|
31
|
+
*/
|
|
22
32
|
export type SecureNativeQueryAction = ((context: NativeQueryContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
23
33
|
export type SecureDistributedLockAction = ((context: DistributedLockContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
24
34
|
export type SecureGraphQLAction = ((context: GraphqlContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
35
|
+
/**
|
|
36
|
+
* @category AI
|
|
37
|
+
*/
|
|
25
38
|
export type SecureAiAgentAction = ((context: SecureAiAgentContext) => boolean | Promise<boolean>) | (() => boolean | Promise<boolean>);
|
|
26
39
|
export type ClientConnectionStateChangeAction = (clientId: ClientId, clientConnectionState: ClientConnectionState) => Promise<void> | void;
|
|
27
40
|
export type ExecutableAction = (...args: any[]) => any;
|
|
41
|
+
/**
|
|
42
|
+
* @category AI
|
|
43
|
+
*/
|
|
28
44
|
export type AiFunctionAction<T extends Record<string, any> = any> = (params: T, context: AiFunctionContext<any, any>) => any;
|
|
29
45
|
export type TriggerAction = ((request: TriggerRequest) => void | Promise<void>) | (() => void | Promise<void>);
|
|
30
46
|
/** The context provided to a trigger function. */
|
|
@@ -39,7 +55,7 @@ export interface TriggerRequest<T extends DocumentData = any> {
|
|
|
39
55
|
docAfter?: T;
|
|
40
56
|
}
|
|
41
57
|
export type SchedulerAction = () => void | Promise<void>;
|
|
42
|
-
export type
|
|
58
|
+
export type LimitsAction = (...args: any[]) => any | Promise<any>;
|
|
43
59
|
export type LimiterScope = 'ip' | 'user' | 'global';
|
|
44
60
|
export type QuotaRenewPeriod = 'hourly' | 'daily' | 'weekly' | 'monthly' | 'quarterly' | 'annually';
|
|
45
61
|
/**
|
|
@@ -105,4 +121,7 @@ export interface SquidFile {
|
|
|
105
121
|
size: number;
|
|
106
122
|
encoding?: string;
|
|
107
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Base type for all decorators used in backend projects.
|
|
126
|
+
*/
|
|
108
127
|
export type ActionMethodDecorator<U> = <T extends U>(target: Object, propertyName: string, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IntegrationType } from '@squidcloud/client';
|
|
2
|
+
/** The different types of actions that can be performed on a database. */
|
|
3
|
+
export type DatabaseActionType = 'read' | 'write' | 'update' | 'insert' | 'delete' | 'all';
|
|
4
|
+
/** The different types of actions that can be performed for storage. */
|
|
5
|
+
export type StorageActionType = 'read' | 'write' | 'update' | 'insert' | 'delete' | 'all';
|
|
6
|
+
/** The different types of actions that can be performed on a topic. */
|
|
7
|
+
export type TopicActionType = 'read' | 'write' | 'all';
|
|
8
|
+
/** The different type of actions for metrics. */
|
|
9
|
+
export type MetricActionType = 'write' | 'all';
|
|
10
|
+
export type AiFunctionParamType = 'string' | 'number' | 'boolean' | 'date';
|
|
11
|
+
export interface AiFunctionParam {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
type: AiFunctionParamType;
|
|
15
|
+
required: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** Additional optional readonly metadata for AI function. */
|
|
18
|
+
export interface AiFunctionAttributes {
|
|
19
|
+
/**
|
|
20
|
+
* Type of integration this function is used for.
|
|
21
|
+
* Functions with defined 'integrationType' require 'integrationId' to be passed as part of the function context.
|
|
22
|
+
*/
|
|
23
|
+
integrationType?: Array<IntegrationType>;
|
|
24
|
+
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* A context passed to functions annotated with the '@secureMetric' decorator.
|
|
3
|
+
* @category Platform
|
|
4
|
+
*/
|
|
2
5
|
export interface SecureMetricContext {
|
|
3
6
|
/** Name of the metric to check. */
|
|
4
7
|
name: string;
|
|
@@ -1,7 +1,102 @@
|
|
|
1
1
|
import { Paths } from '@squidcloud/client';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { SquidDocIdObj, SquidDocument } from '@squidcloud/client';
|
|
3
|
+
/**
|
|
4
|
+
* The mutation type.
|
|
5
|
+
* @category Database
|
|
6
|
+
*/
|
|
7
|
+
export declare const MUTATION_TYPES: readonly ["insert", "update", "delete"];
|
|
8
|
+
/**
|
|
9
|
+
* @category Database
|
|
10
|
+
*/
|
|
11
|
+
export type MutationType = (typeof MUTATION_TYPES)[number];
|
|
12
|
+
interface BaseMutation {
|
|
13
|
+
type: MutationType;
|
|
14
|
+
squidDocIdObj: SquidDocIdObj;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A mutation on a document.
|
|
18
|
+
* @category Database
|
|
19
|
+
*/
|
|
20
|
+
export type Mutation<T = any> = UpdateMutation<T> | InsertMutation<T> | DeleteMutation;
|
|
21
|
+
/**
|
|
22
|
+
* @category Database
|
|
23
|
+
*/
|
|
24
|
+
export interface DeleteMutation extends BaseMutation {
|
|
25
|
+
type: 'delete';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @category Database
|
|
29
|
+
*/
|
|
30
|
+
export interface UpdateMutation<T = any> extends BaseMutation {
|
|
31
|
+
type: 'update';
|
|
32
|
+
/** The updated properties */
|
|
33
|
+
properties: {
|
|
34
|
+
[key in keyof T & string]?: Array<PropertyMutation<T[key]>>;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* @category Database
|
|
39
|
+
*/
|
|
40
|
+
export interface InsertMutation<T = any> extends BaseMutation {
|
|
41
|
+
type: 'insert';
|
|
42
|
+
/** The inserted document */
|
|
43
|
+
properties: T;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A representation of a single property update.
|
|
47
|
+
* @category Database
|
|
48
|
+
*/
|
|
49
|
+
export type PropertyMutation<Value = any> = ApplyNumericFnPropertyMutation | ApplyStringFnPropertyMutation | ValueUpdatePropertyMutation<Value> | RemovePropertyMutation;
|
|
50
|
+
/**
|
|
51
|
+
* A value update property mutation.
|
|
52
|
+
* @category Database
|
|
53
|
+
*/
|
|
54
|
+
export interface ValueUpdatePropertyMutation<Value = any> {
|
|
55
|
+
type: 'update';
|
|
56
|
+
value: Value;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Applying a numeric function to a property.
|
|
60
|
+
* @category Database
|
|
61
|
+
*/
|
|
62
|
+
export interface ApplyNumericFnPropertyMutation {
|
|
63
|
+
type: 'applyNumericFn';
|
|
64
|
+
fn: 'increment';
|
|
65
|
+
value: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A property update that removes a property from a document.
|
|
69
|
+
* @category Database
|
|
70
|
+
*/
|
|
71
|
+
export interface RemovePropertyMutation {
|
|
72
|
+
type: 'removeProperty';
|
|
73
|
+
}
|
|
74
|
+
interface ApplyExtendString {
|
|
75
|
+
type: 'applyStringFn';
|
|
76
|
+
fn: 'extendString';
|
|
77
|
+
value: string;
|
|
78
|
+
}
|
|
79
|
+
interface ApplyTrimString {
|
|
80
|
+
type: 'applyStringFn';
|
|
81
|
+
fn: 'trim';
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A property mutation that modifies a string.
|
|
85
|
+
* @category Database
|
|
86
|
+
*/
|
|
87
|
+
export type ApplyStringFnPropertyMutation = ApplyExtendString | ApplyTrimString;
|
|
88
|
+
/**
|
|
89
|
+
* The before and after documents of a document change.
|
|
90
|
+
* @category Database
|
|
91
|
+
*/
|
|
92
|
+
export interface BeforeAndAfterDocs<T = SquidDocument> {
|
|
93
|
+
before: T | undefined;
|
|
94
|
+
after: T | undefined;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The mutation context that will be provided to the security function.
|
|
98
|
+
* @category Database
|
|
99
|
+
*/
|
|
5
100
|
export declare class MutationContext<T = any> {
|
|
6
101
|
readonly mutation: Mutation<T>;
|
|
7
102
|
readonly beforeAndAfterDocs: BeforeAndAfterDocs<T>;
|
|
@@ -22,3 +117,4 @@ export declare class MutationContext<T = any> {
|
|
|
22
117
|
affectedPaths(startingRoot?: Paths<T> | string): Array<Paths<T>>;
|
|
23
118
|
private checkPath;
|
|
24
119
|
}
|
|
120
|
+
export {};
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import { IntegrationId } from '@squidcloud/client';
|
|
2
|
+
/**
|
|
3
|
+
* @category Database
|
|
4
|
+
*/
|
|
2
5
|
export type NativeQueryRequestType = 'relational' | 'mongo';
|
|
3
6
|
interface BaseNativeQueryContext {
|
|
4
7
|
type: NativeQueryRequestType;
|
|
5
8
|
integrationId: IntegrationId;
|
|
6
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @category Database
|
|
12
|
+
*/
|
|
7
13
|
export interface RelationalNativeQueryContext extends BaseNativeQueryContext {
|
|
8
14
|
type: 'relational';
|
|
9
15
|
query: string;
|
|
10
16
|
params: Record<string, any>;
|
|
11
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* @category Database
|
|
20
|
+
*/
|
|
12
21
|
export interface MongoNativeQueryContext extends BaseNativeQueryContext {
|
|
13
22
|
type: 'mongo';
|
|
14
23
|
collectionName: string;
|
|
15
24
|
aggregationPipeline: Array<any | undefined>;
|
|
16
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* @category Database
|
|
28
|
+
*/
|
|
17
29
|
export type NativeQueryContext = RelationalNativeQueryContext | MongoNativeQueryContext;
|
|
18
30
|
export {};
|
|
@@ -5,6 +5,7 @@ import { IntegrationId } from '@squidcloud/client';
|
|
|
5
5
|
/**
|
|
6
6
|
* Represents the Squid query context.
|
|
7
7
|
* Passed to methods that require query details, such as those annotated with the `@secureCollection` annotation.
|
|
8
|
+
* @category Database
|
|
8
9
|
*/
|
|
9
10
|
export declare class QueryContext<T extends DocumentData = any> {
|
|
10
11
|
readonly query: Query<T>;
|
|
@@ -97,31 +98,58 @@ export declare class QueryContext<T extends DocumentData = any> {
|
|
|
97
98
|
*/
|
|
98
99
|
documentMatchesQuery(doc: DocumentData): boolean;
|
|
99
100
|
}
|
|
100
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* A list of context conditions.
|
|
103
|
+
* @category Database
|
|
104
|
+
*/
|
|
101
105
|
export type ContextConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<ContextCondition<Doc, F>>;
|
|
102
|
-
/**
|
|
106
|
+
/**
|
|
107
|
+
* A Context condition - a condition that replaces multiple '==' or '!=' conditions with 'in' and 'not in'.
|
|
108
|
+
* @category Database
|
|
109
|
+
*/
|
|
103
110
|
export type ContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = InContextCondition<Doc, F> | NotInContextCondition<Doc, F> | OtherContextCondition<Doc, F>;
|
|
111
|
+
/**
|
|
112
|
+
* @category Database
|
|
113
|
+
*/
|
|
104
114
|
export interface InContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'in'> {
|
|
105
115
|
operator: 'in';
|
|
106
116
|
value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
|
|
107
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* @category Database
|
|
120
|
+
*/
|
|
108
121
|
export interface NotInContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, 'not in'> {
|
|
109
122
|
operator: 'not in';
|
|
110
123
|
value: Array<FieldOf<DeepRecord<Doc>, Paths<Doc>> | any>;
|
|
111
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* @category Database
|
|
127
|
+
*/
|
|
112
128
|
export interface OtherContextCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, Exclude<ContextOperator, 'in' | 'not in'>> {
|
|
113
129
|
operator: Exclude<ContextOperator, 'in' | 'not in'>;
|
|
114
130
|
value: FieldOf<DeepRecord<Doc>, Paths<Doc>> | any;
|
|
115
131
|
}
|
|
116
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* A condition that includes the 'in' and 'not in' operators.
|
|
134
|
+
* @category Database
|
|
135
|
+
*/
|
|
117
136
|
export interface GeneralCondition<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> extends SimpleCondition<Doc, F, AllOperators> {
|
|
118
137
|
operator: AllOperators;
|
|
119
138
|
value: any;
|
|
120
139
|
}
|
|
121
|
-
/**
|
|
140
|
+
/**
|
|
141
|
+
* A list of general conditions.
|
|
142
|
+
* @category Database
|
|
143
|
+
*/
|
|
122
144
|
export type GeneralConditions<Doc extends DocumentData = any, F extends Paths<Doc> = Paths<Doc>> = Array<GeneralCondition<Doc, F>>;
|
|
145
|
+
/**
|
|
146
|
+
* @category Database
|
|
147
|
+
*/
|
|
123
148
|
export type ContextOperator = Exclude<Operator, '==' | '!='> | 'in' | 'not in';
|
|
124
149
|
type AllOperators = Operator | 'in' | 'not in';
|
|
125
|
-
/**
|
|
150
|
+
/**
|
|
151
|
+
* A generic value that can exist in a query.
|
|
152
|
+
* @category Database
|
|
153
|
+
*/
|
|
126
154
|
export type GenericValue<Doc = any, F extends Paths<Doc> = Paths<Doc>, O extends AllOperators = any> = O extends 'in' ? Array<DeepRecord<Doc>[F]> | null : O extends 'not in' ? Array<DeepRecord<Doc>[F]> | null : DeepRecord<Doc>[F] | null;
|
|
127
155
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { StorageActionType } from './bundle-data.public-types';
|
|
2
|
+
import { IntegrationId } from '@squidcloud/client';
|
|
3
|
+
export type StorageFunctionality = 'fileUpload' | 'getFileMetadata' | 'getDownloadUrl' | 'deleteFiles' | 'listDirectoryContents';
|
|
4
|
+
export interface StorageContext {
|
|
5
|
+
integrationId: IntegrationId;
|
|
6
|
+
pathsInBucket: Array<string>;
|
|
7
|
+
action: StorageActionType;
|
|
8
|
+
functionality: StorageFunctionality;
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@squidcloud/backend",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.339",
|
|
4
4
|
"description": "Squid Cloud's backend SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/backend/src/index.d.ts",
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
"publish:public": "npm run build && npm publish --access public",
|
|
12
12
|
"build-and-check-public-types": "npm run build && npm run check-public-types",
|
|
13
13
|
"keep-only-public-types": "del-cli 'dist/internal-common/src/**' '!dist/internal-common/src/public-types-backend' '!dist/internal-common/src/public-utils-backend'",
|
|
14
|
-
"check-public-types": "tsc -p tsconfig.types.json"
|
|
14
|
+
"check-public-types": "tsc -p tsconfig.types.json",
|
|
15
|
+
"generate-docs-html": "typedoc",
|
|
16
|
+
"generate-docs-markdown": "typedoc --plugin typedoc-plugin-markdown --readme none --out ./generated-docs/markdown"
|
|
15
17
|
},
|
|
16
18
|
"files": [
|
|
17
19
|
"dist/**/*"
|
|
@@ -23,10 +25,15 @@
|
|
|
23
25
|
"assertic": "^1.2.1",
|
|
24
26
|
"lodash": "^4.17.21",
|
|
25
27
|
"tsoa": "^6.3.0",
|
|
26
|
-
"graphql": "^16.9.0"
|
|
28
|
+
"graphql": "^16.9.0",
|
|
29
|
+
"otrie": "^1.1.3"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"typedoc": "^0.28.0",
|
|
33
|
+
"typedoc-plugin-markdown": "^4.5.2"
|
|
27
34
|
},
|
|
28
35
|
"peerDependencies": {
|
|
29
|
-
"@squidcloud/client": "^1.0.
|
|
36
|
+
"@squidcloud/client": "^1.0.339"
|
|
30
37
|
},
|
|
31
38
|
"engines": {
|
|
32
39
|
"node": ">=20.0.0"
|