@stoker-platform/web-client 0.2.1
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/bundle.js +12911 -0
- package/dist/types/authenticateStoker.d.ts +1 -0
- package/dist/types/connectionStatus.d.ts +3 -0
- package/dist/types/initializeErrorEvents.d.ts +2 -0
- package/dist/types/initializeStoker.d.ts +22 -0
- package/dist/types/main.d.ts +42 -0
- package/dist/types/multiFactorEnroll.d.ts +2 -0
- package/dist/types/read/cache/preloadCache.d.ts +11 -0
- package/dist/types/read/cache/preloadCollection.d.ts +3 -0
- package/dist/types/read/cache/preloadData.d.ts +3 -0
- package/dist/types/read/getCollectionRefs.d.ts +3 -0
- package/dist/types/read/getDocumentRefs.d.ts +2 -0
- package/dist/types/read/getFiles.d.ts +2 -0
- package/dist/types/read/getMaintenanceInfo.d.ts +4 -0
- package/dist/types/read/getOne.d.ts +21 -0
- package/dist/types/read/getOneServer.d.ts +2 -0
- package/dist/types/read/getSome.d.ts +39 -0
- package/dist/types/read/getSomeServer.d.ts +7 -0
- package/dist/types/read/getUserData.d.ts +6 -0
- package/dist/types/read/getVersionInfo.d.ts +3 -0
- package/dist/types/read/subscribeMany.d.ts +24 -0
- package/dist/types/read/subscribeOne.d.ts +9 -0
- package/dist/types/retryPendingWrites.d.ts +5 -0
- package/dist/types/signOut.d.ts +1 -0
- package/dist/types/utils/callFunction.d.ts +1 -0
- package/dist/types/utils/convertToTimezone.d.ts +7 -0
- package/dist/types/utils/deserializeDeleteSentinels.d.ts +2 -0
- package/dist/types/utils/deserializeTimestamps.d.ts +2 -0
- package/dist/types/utils/onPermissionsChange.d.ts +1 -0
- package/dist/types/utils/onReady.d.ts +1 -0
- package/dist/types/utils/onSignOut.d.ts +1 -0
- package/dist/types/utils/sendAdminEmail.d.ts +1 -0
- package/dist/types/utils/sendAdminSMS.d.ts +1 -0
- package/dist/types/utils/sendMail.d.ts +5 -0
- package/dist/types/utils/sendMessage.d.ts +1 -0
- package/dist/types/utils/serializeDeleteSentinels.d.ts +2 -0
- package/dist/types/utils/serializeTimestamps.d.ts +2 -0
- package/dist/types/utils/waitForPendingWrites.d.ts +1 -0
- package/dist/types/write/addRecord.d.ts +27 -0
- package/dist/types/write/addRecordServer.d.ts +5 -0
- package/dist/types/write/deleteFolder.d.ts +2 -0
- package/dist/types/write/deleteRecord.d.ts +20 -0
- package/dist/types/write/deleteRecordServer.d.ts +2 -0
- package/dist/types/write/saveRecord.d.ts +3 -0
- package/dist/types/write/uniqueValidation.d.ts +2 -0
- package/dist/types/write/updateRecord.d.ts +25 -0
- package/dist/types/write/updateRecordServer.d.ts +6 -0
- package/dist/types/write/writeLog.d.ts +2 -0
- package/package.json +46 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const authenticateStoker: (email: string, password: string, getMultiFactorTOTP?: () => Promise<string>) => Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Auth, Unsubscribe, User, ParsedToken } from "firebase/auth";
|
|
2
|
+
import { Firestore } from "firebase/firestore";
|
|
3
|
+
import { AppCheck } from "firebase/app-check";
|
|
4
|
+
import type { CollectionsSchema, GlobalConfig, RoleGroup } from "@stoker-platform/types";
|
|
5
|
+
import { StokerCollection, CollectionCustomization } from "@stoker-platform/types/src/types/schema";
|
|
6
|
+
import { getCurrentUserPermissions } from "./read/getUserData.js";
|
|
7
|
+
import { getVersionInfo } from "./read/getVersionInfo.js";
|
|
8
|
+
import { getMaintenanceInfo } from "./read/getMaintenanceInfo.js";
|
|
9
|
+
import { getLoadingState } from "./read/cache/preloadCache.js";
|
|
10
|
+
import { getConnectionStatus, getNetworkStatus } from "./connectionStatus.js";
|
|
11
|
+
declare global {
|
|
12
|
+
var FIREBASE_APPCHECK_DEBUG_TOKEN: boolean | string | undefined;
|
|
13
|
+
}
|
|
14
|
+
declare const getUnsubscribes: () => Unsubscribe[];
|
|
15
|
+
declare const clearUnsubscribes: () => void;
|
|
16
|
+
export declare const initializeStoker: (config: any, collectionFiles: any, envVars: Record<string, string>, context?: any) => Promise<boolean>;
|
|
17
|
+
export declare const getEnv: () => Record<string, string>, getTimezone: () => string, getSchema: (includeComputedFields?: boolean) => CollectionsSchema, getCurrentUser: () => User & {
|
|
18
|
+
token: {
|
|
19
|
+
claims: ParsedToken;
|
|
20
|
+
};
|
|
21
|
+
}, getCurrentUserRoleGroups: () => Record<StokerCollection, RoleGroup>, getAllRoleGroups: () => Record<StokerCollection, Set<RoleGroup>>, getGlobalConfigModule: () => GlobalConfig, getCollectionConfigModule: (collection: string) => CollectionCustomization, getAppCheck: () => AppCheck, getAppCheckFirestoreWrite: () => AppCheck, getFirestoreWriteAuth: () => Auth, getFirestoreWrite: () => Firestore, getFirestoreMaintenance: () => Firestore;
|
|
22
|
+
export { getConnectionStatus, getNetworkStatus, getVersionInfo, getMaintenanceInfo, getCurrentUserPermissions, getLoadingState, getUnsubscribes, clearUnsubscribes, };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { DocumentSnapshot } from "firebase/firestore";
|
|
2
|
+
export * from "./initializeStoker.js";
|
|
3
|
+
export { authenticateStoker } from "./authenticateStoker.js";
|
|
4
|
+
export { onStokerReady } from "./utils/onReady.js";
|
|
5
|
+
export { onStokerSignOut } from "./utils/onSignOut.js";
|
|
6
|
+
export { onStokerPermissionsChange } from "./utils/onPermissionsChange.js";
|
|
7
|
+
export { multiFactorEnroll } from "./multiFactorEnroll.js";
|
|
8
|
+
export { addRecord } from "./write/addRecord.js";
|
|
9
|
+
export { updateRecord } from "./write/updateRecord.js";
|
|
10
|
+
export { deleteRecord } from "./write/deleteRecord.js";
|
|
11
|
+
export { deleteFolder } from "./write/deleteFolder.js";
|
|
12
|
+
export { addRecordServer } from "./write/addRecordServer.js";
|
|
13
|
+
export { updateRecordServer } from "./write/updateRecordServer.js";
|
|
14
|
+
export { deleteRecordServer } from "./write/deleteRecordServer.js";
|
|
15
|
+
export { waitForPendingWrites } from "./utils/waitForPendingWrites.js";
|
|
16
|
+
export { getCollectionRefs } from "./read/getCollectionRefs.js";
|
|
17
|
+
export { getDocumentRefs } from "./read/getDocumentRefs.js";
|
|
18
|
+
export { getOne } from "./read/getOne.js";
|
|
19
|
+
export { getSome } from "./read/getSome.js";
|
|
20
|
+
export { subscribeOne } from "./read/subscribeOne.js";
|
|
21
|
+
export { subscribeMany } from "./read/subscribeMany.js";
|
|
22
|
+
export { getOneServer } from "./read/getOneServer.js";
|
|
23
|
+
export { getSomeServer } from "./read/getSomeServer.js";
|
|
24
|
+
export { getFiles } from "./read/getFiles.js";
|
|
25
|
+
export { preloadCache } from "./read/cache/preloadCache.js";
|
|
26
|
+
export { preloadCollection } from "./read/cache/preloadCollection.js";
|
|
27
|
+
export { sendMail } from "./utils/sendMail.js";
|
|
28
|
+
export { sendMessage } from "./utils/sendMessage.js";
|
|
29
|
+
export { sendAdminEmail } from "./utils/sendAdminEmail.js";
|
|
30
|
+
export { sendAdminSMS } from "./utils/sendAdminSMS.js";
|
|
31
|
+
export { signOut } from "./signOut.js";
|
|
32
|
+
export { serializeTimestamps } from "./utils/serializeTimestamps.js";
|
|
33
|
+
export { deserializeTimestamps } from "./utils/deserializeTimestamps.js";
|
|
34
|
+
export { convertDateToTimezone, convertTimestampToTimezone, keepTimezone, removeTimezone, displayDate, } from "./utils/convertToTimezone.js";
|
|
35
|
+
export { callFunction } from "./utils/callFunction.js";
|
|
36
|
+
export { tryPromise, getCachedConfigValue, getSchema as getZodSchema, isDeleteSentinel } from "@stoker-platform/utils";
|
|
37
|
+
export type { GetSomeOptions } from "./read/getSome.js";
|
|
38
|
+
export type { SubscribeManyOptions } from "./read/subscribeMany.js";
|
|
39
|
+
export type Cursor = {
|
|
40
|
+
first: Map<number, DocumentSnapshot>;
|
|
41
|
+
last: Map<number, DocumentSnapshot>;
|
|
42
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Unsubscribe } from "firebase/firestore";
|
|
2
|
+
import { PreloadCacheInitial } from "@stoker-platform/types";
|
|
3
|
+
export declare const preloadCache: (initial?: PreloadCacheInitial) => Promise<{
|
|
4
|
+
[collection: string]: Unsubscribe[];
|
|
5
|
+
}>;
|
|
6
|
+
export declare const getLoadingState: () => {
|
|
7
|
+
[collection: string]: "Loading" | "Loaded" | "Error";
|
|
8
|
+
};
|
|
9
|
+
export declare const getPreloadListeners: () => {
|
|
10
|
+
[collection: string]: Unsubscribe[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PreloadCacheRange, StokerCollection } from "@stoker-platform/types";
|
|
2
|
+
import { WhereFilterOp } from "firebase/firestore";
|
|
3
|
+
export declare const preloadCollection: (collection: StokerCollection, constraints?: [string, WhereFilterOp, unknown][], rangeConstraints?: PreloadCacheRange, orQueries?: [string, WhereFilterOp, unknown][]) => Promise<void>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { WhereFilterOp } from "firebase/firestore";
|
|
2
|
+
import { CollectionSchema, PreloadCacheRange } from "@stoker-platform/types";
|
|
3
|
+
export declare const preloadData: (collectionSchema: CollectionSchema, constraints?: [string, WhereFilterOp, unknown][], rangeConstraints?: PreloadCacheRange, orQueries?: [string, WhereFilterOp, unknown][]) => Promise<unknown>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { RoleGroup } from "@stoker-platform/types";
|
|
2
|
+
import { Query } from "firebase/firestore";
|
|
3
|
+
export declare const getCollectionRefs: (path: string[], roleGroup: RoleGroup, getAll?: boolean) => Query<import("@firebase/firestore").DocumentData, import("@firebase/firestore").DocumentData>[];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { RoleGroup } from "@stoker-platform/types";
|
|
2
|
+
export declare const getDocumentRefs: (path: string[], docId: string, roleGroup: RoleGroup) => import("@firebase/firestore").DocumentReference<import("@firebase/firestore").DocumentData, import("@firebase/firestore").DocumentData>[];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { QueryConstraint } from "firebase/firestore";
|
|
2
|
+
import { CollectionField, StokerCollection, StokerRecord } from "@stoker-platform/types";
|
|
3
|
+
export declare const getOne: (path: string[], docId: string, options?: {
|
|
4
|
+
only?: "cache" | "server";
|
|
5
|
+
relations?: {
|
|
6
|
+
fields?: (string | CollectionField)[];
|
|
7
|
+
depth: number;
|
|
8
|
+
};
|
|
9
|
+
subcollections?: {
|
|
10
|
+
collections?: StokerCollection[];
|
|
11
|
+
depth: number;
|
|
12
|
+
constraints?: QueryConstraint[];
|
|
13
|
+
limit?: {
|
|
14
|
+
number: number;
|
|
15
|
+
orderByField: string;
|
|
16
|
+
orderByDirection: "asc" | "desc";
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
noComputedFields?: boolean;
|
|
20
|
+
noEmbeddingFields?: boolean;
|
|
21
|
+
}) => Promise<StokerRecord>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FieldPath, QueryConstraint, WhereFilterOp } from "firebase/firestore";
|
|
2
|
+
import { CollectionField, StokerCollection, StokerRecord } from "@stoker-platform/types";
|
|
3
|
+
import { Cursor } from "../main";
|
|
4
|
+
export interface GetSomeOptions {
|
|
5
|
+
getAll?: boolean;
|
|
6
|
+
only?: "cache" | "server";
|
|
7
|
+
relations?: {
|
|
8
|
+
fields?: (string | CollectionField)[];
|
|
9
|
+
depth: number;
|
|
10
|
+
};
|
|
11
|
+
subcollections?: {
|
|
12
|
+
collections?: StokerCollection[];
|
|
13
|
+
depth: number;
|
|
14
|
+
constraints?: QueryConstraint[];
|
|
15
|
+
limit?: {
|
|
16
|
+
number: number;
|
|
17
|
+
orderByField: string;
|
|
18
|
+
orderByDirection: "asc" | "desc";
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
pagination?: {
|
|
22
|
+
number: number;
|
|
23
|
+
orderByField?: string | FieldPath;
|
|
24
|
+
orderByDirection?: "asc" | "desc";
|
|
25
|
+
startAfter?: Cursor;
|
|
26
|
+
endBefore?: Cursor;
|
|
27
|
+
};
|
|
28
|
+
noEmbeddingFields?: boolean;
|
|
29
|
+
noComputedFields?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare const getSome: (path: string[], constraints?: QueryConstraint[] | [string, WhereFilterOp, unknown][], options?: GetSomeOptions) => Promise<{
|
|
32
|
+
cursor: {};
|
|
33
|
+
pages: number;
|
|
34
|
+
docs: never[];
|
|
35
|
+
} | {
|
|
36
|
+
cursor: Cursor;
|
|
37
|
+
pages: number | undefined;
|
|
38
|
+
docs: StokerRecord[];
|
|
39
|
+
}>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StokerRecord } from "@stoker-platform/types";
|
|
2
|
+
import { Cursor } from "../main";
|
|
3
|
+
export declare const getSomeServer: (path: string[], constraints?: [string, string, unknown][], options?: any) => Promise<{
|
|
4
|
+
docs: StokerRecord[];
|
|
5
|
+
pages: number;
|
|
6
|
+
cursor: Cursor;
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IdTokenResult, User } from "firebase/auth";
|
|
2
|
+
import { Unsubscribe } from "firebase/firestore";
|
|
3
|
+
import { StokerPermissions } from "@stoker-platform/types";
|
|
4
|
+
export declare const initializeUserListeners: (user: User, idTokenResult: IdTokenResult) => Promise<Unsubscribe[]>;
|
|
5
|
+
export declare const getCurrentUserPermissions: () => StokerPermissions | null;
|
|
6
|
+
export declare const clearCurrentUser: () => void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FieldPath, QueryConstraint, SnapshotMetadata } from "firebase/firestore";
|
|
2
|
+
import { CollectionField, StokerRecord } from "@stoker-platform/types";
|
|
3
|
+
import { Cursor } from "../main";
|
|
4
|
+
export interface SubscribeManyOptions {
|
|
5
|
+
only?: "cache" | "default";
|
|
6
|
+
getAll?: boolean;
|
|
7
|
+
relations?: boolean | {
|
|
8
|
+
fields: (string | CollectionField)[];
|
|
9
|
+
};
|
|
10
|
+
pagination?: {
|
|
11
|
+
number?: number;
|
|
12
|
+
orderByField?: string | FieldPath;
|
|
13
|
+
orderByDirection?: "asc" | "desc";
|
|
14
|
+
startAfter?: Cursor;
|
|
15
|
+
endBefore?: Cursor;
|
|
16
|
+
startAt?: Cursor;
|
|
17
|
+
endAt?: Cursor;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare const subscribeMany: (path: string[], constraints: QueryConstraint[], callback: (docs: StokerRecord[], cursor: Cursor, metadata: SnapshotMetadata | undefined) => void, errorCallback?: (error: Error) => void, options?: SubscribeManyOptions) => Promise<{
|
|
21
|
+
pages: number | undefined;
|
|
22
|
+
count: number | undefined;
|
|
23
|
+
unsubscribe: (direction?: "first" | "last") => void;
|
|
24
|
+
}>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CollectionField, StokerRecord } from "@stoker-platform/types";
|
|
2
|
+
export declare const subscribeOne: (path: string[], docId: string, callback: (docData: StokerRecord | undefined) => void, errorCallback?: (error: Error) => void, options?: {
|
|
3
|
+
only?: "cache" | "default";
|
|
4
|
+
relations?: boolean | {
|
|
5
|
+
fields: (string | CollectionField)[];
|
|
6
|
+
};
|
|
7
|
+
noComputedFields?: boolean;
|
|
8
|
+
noEmbeddingFields?: boolean;
|
|
9
|
+
}) => Promise<() => void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CollectionsSchema } from "@stoker-platform/types";
|
|
2
|
+
import { User } from "firebase/auth";
|
|
3
|
+
export declare const retryPendingWrites: (schema: CollectionsSchema, user: User) => Promise<void>;
|
|
4
|
+
export declare const isRetrying: (docId: string) => boolean;
|
|
5
|
+
export declare const clearRetrying: () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const signOut: () => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const callFunction: (functionName: string, payload: Record<string, any>) => Promise<unknown>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DateTime } from "luxon";
|
|
2
|
+
import { FieldValue, Timestamp } from "firebase/firestore";
|
|
3
|
+
export declare const convertDateToTimezone: (date: Date) => DateTime<true> | DateTime<false>;
|
|
4
|
+
export declare const convertTimestampToTimezone: (timestamp: Timestamp) => DateTime<true> | DateTime<false>;
|
|
5
|
+
export declare const keepTimezone: (date: Date, timezone: string) => Date;
|
|
6
|
+
export declare const removeTimezone: (date: Date, timezone: string) => Date;
|
|
7
|
+
export declare const displayDate: (timestamp: Timestamp | FieldValue) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const onStokerPermissionsChange: (callback: () => unknown) => () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const onStokerReady: (callback: () => unknown) => () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const onStokerSignOut: (callback: () => unknown) => () => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sendAdminEmail: (subject: string, text?: string, html?: string, cc?: string | string[], bcc?: string | string[], replyTo?: string) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sendAdminSMS: (body: string) => Promise<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const sendMail: (to: string | string[], subject: string, text?: string, html?: string, cc?: string | string[], bcc?: string | string[], replyTo?: string, attachments?: {
|
|
2
|
+
filename: string;
|
|
3
|
+
content: Buffer;
|
|
4
|
+
contentType: string;
|
|
5
|
+
}[], from?: string) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sendMessage: (to: string, body: string) => Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const waitForPendingWrites: () => Promise<void>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Timestamp } from "firebase/firestore";
|
|
2
|
+
import { StokerRecord, StokerPermissions } from "@stoker-platform/types";
|
|
3
|
+
export declare const addRecord: (path: string[], data: Partial<StokerRecord>, user?: {
|
|
4
|
+
password: string;
|
|
5
|
+
passwordConfirm: string;
|
|
6
|
+
permissions?: StokerPermissions;
|
|
7
|
+
}, options?: {
|
|
8
|
+
retry?: {
|
|
9
|
+
type: string;
|
|
10
|
+
docId: string;
|
|
11
|
+
};
|
|
12
|
+
}, id?: string, onValid?: () => void) => Promise<StokerRecord | {
|
|
13
|
+
Collection_Path: string[];
|
|
14
|
+
Last_Write_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
15
|
+
Last_Save_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
16
|
+
Last_Write_By: string;
|
|
17
|
+
Last_Write_App: string;
|
|
18
|
+
Last_Write_Connection_Status: "Online" | "Offline";
|
|
19
|
+
Last_Write_Version: number;
|
|
20
|
+
Created_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
21
|
+
Saved_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
22
|
+
Created_By: string;
|
|
23
|
+
id: string;
|
|
24
|
+
} | {
|
|
25
|
+
docId: string;
|
|
26
|
+
record: StokerRecord;
|
|
27
|
+
}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Timestamp } from "firebase/firestore";
|
|
2
|
+
import { StokerRecord } from "@stoker-platform/types";
|
|
3
|
+
export declare const deleteRecord: (path: string[], docId: string, options?: {
|
|
4
|
+
retry?: {
|
|
5
|
+
type: string;
|
|
6
|
+
record: StokerRecord;
|
|
7
|
+
};
|
|
8
|
+
}) => Promise<StokerRecord | {
|
|
9
|
+
Collection_Path: string[];
|
|
10
|
+
Last_Write_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
11
|
+
Last_Save_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
12
|
+
Last_Write_By: string;
|
|
13
|
+
Last_Write_App: string;
|
|
14
|
+
Last_Write_Connection_Status: "Online" | "Offline";
|
|
15
|
+
Last_Write_Version: number;
|
|
16
|
+
Created_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
17
|
+
Saved_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
18
|
+
Created_By: string;
|
|
19
|
+
id: string;
|
|
20
|
+
}>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CollectionCustomization, CollectionSchema, StokerPermissions, StokerRecord } from "@stoker-platform/types";
|
|
2
|
+
import { WriteBatch } from "firebase/firestore";
|
|
3
|
+
export declare const saveRecord: (operation: "create" | "update" | "delete", path: string[], docId: string, record: StokerRecord, context: any, collectionSchema: CollectionSchema, customization: CollectionCustomization, batch: WriteBatch, userId: string, enableWriteLog: boolean, permissions: StokerPermissions, retry?: boolean, originalRecord?: StokerRecord) => Promise<void>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { CollectionSchema, StokerPermissions, StokerRecord } from "@stoker-platform/types";
|
|
2
|
+
export declare const uniqueValidation: (operation: "create" | "update", docId: string, data: StokerRecord, collectionSchema: CollectionSchema, permissions: StokerPermissions) => Promise<void>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Timestamp } from "firebase/firestore";
|
|
2
|
+
import { StokerRecord, StokerPermissions } from "@stoker-platform/types";
|
|
3
|
+
export declare const updateRecord: (path: string[], docId: string, data: Partial<StokerRecord>, user?: {
|
|
4
|
+
operation: "create" | "update" | "delete";
|
|
5
|
+
password?: string;
|
|
6
|
+
passwordConfirm?: string;
|
|
7
|
+
permissions?: StokerPermissions;
|
|
8
|
+
}, options?: {
|
|
9
|
+
retry?: {
|
|
10
|
+
type: string;
|
|
11
|
+
originalRecord: StokerRecord;
|
|
12
|
+
};
|
|
13
|
+
}, originalRecord?: StokerRecord) => Promise<StokerRecord | {
|
|
14
|
+
Collection_Path: string[];
|
|
15
|
+
Last_Write_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
16
|
+
Last_Save_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
17
|
+
Last_Write_By: string;
|
|
18
|
+
Last_Write_App: string;
|
|
19
|
+
Last_Write_Connection_Status: "Online" | "Offline";
|
|
20
|
+
Last_Write_Version: number;
|
|
21
|
+
Created_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
22
|
+
Saved_At: Timestamp | FirebaseFirestore.FieldValue;
|
|
23
|
+
Created_By: string;
|
|
24
|
+
id: string;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StokerPermissions, StokerRecord } from "@stoker-platform/types";
|
|
2
|
+
export declare const updateRecordServer: (path: string[], id: string, record: Partial<StokerRecord>, user?: {
|
|
3
|
+
operation: string;
|
|
4
|
+
permissions?: StokerPermissions;
|
|
5
|
+
password?: string;
|
|
6
|
+
}) => Promise<StokerRecord>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { CollectionSchema, StokerRecord } from "@stoker-platform/types";
|
|
2
|
+
export declare const writeLog: (operation: "create" | "update" | "delete", status: "started" | "written" | "success" | "failed", data: StokerRecord, path: string[], docId: string, collectionSchema: CollectionSchema, userId: string, error?: unknown, originalRecord?: StokerRecord) => Promise<void>;
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@stoker-platform/web-client",
|
|
3
|
+
"publishConfig": {
|
|
4
|
+
"access": "restricted"
|
|
5
|
+
},
|
|
6
|
+
"version": "0.2.1",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"license": "UNLICENSED",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"main": "./dist/bundle.js",
|
|
13
|
+
"module": "./dist/bundle.js",
|
|
14
|
+
"browser": "./dist/bundle.js",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./dist/bundle.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"types": "./dist/types/main.d.ts",
|
|
21
|
+
"scripts": {
|
|
22
|
+
"dev": "vite build --watch",
|
|
23
|
+
"lint": "tsc",
|
|
24
|
+
"build": "vite build",
|
|
25
|
+
"test": "echo \"Error: no test specified\""
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@stoker-platform/types": "0.2.1",
|
|
29
|
+
"@stoker-platform/utils": "0.2.1",
|
|
30
|
+
"@types/lodash": "^4.17.21",
|
|
31
|
+
"@types/luxon": "^3.7.1",
|
|
32
|
+
"firebase": "^12.6.0",
|
|
33
|
+
"lodash": "^4.17.21",
|
|
34
|
+
"luxon": "^3.7.2"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@rollup/plugin-typescript": "^12.3.0",
|
|
38
|
+
"eslint-config-custom": "*",
|
|
39
|
+
"tsconfig": "*",
|
|
40
|
+
"vite-plugin-eslint": "^1.8.1"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": "22",
|
|
44
|
+
"npm": "11"
|
|
45
|
+
}
|
|
46
|
+
}
|