proto.io 0.0.217 → 0.0.219
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/adapters/file/aliyun-oss.d.ts +3 -3
- package/dist/adapters/file/database.d.ts +2 -2
- package/dist/adapters/file/database.js +2 -2
- package/dist/adapters/file/database.mjs +2 -2
- package/dist/adapters/file/filesystem.d.ts +3 -3
- package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
- package/dist/adapters/storage/progres.d.ts +1 -1
- package/dist/adapters/storage/progres.js +38 -38
- package/dist/adapters/storage/progres.js.map +1 -1
- package/dist/adapters/storage/progres.mjs +38 -38
- package/dist/adapters/storage/progres.mjs.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.js +2 -2
- package/dist/client.mjs +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +27 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -28
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{base-CWnOBKD5.d.ts → base-C1uAg1dD.d.ts} +2 -2
- package/dist/internals/base-C1uAg1dD.d.ts.map +1 -0
- package/dist/internals/{chunk-CNNSQpRF.d.ts → chunk-CpgqvFNO.d.ts} +3 -3
- package/dist/internals/chunk-CpgqvFNO.d.ts.map +1 -0
- package/dist/internals/{index-Bs8n7Q8f.d.ts → index-82GLvDiN.d.ts} +18 -18
- package/dist/internals/index-82GLvDiN.d.ts.map +1 -0
- package/dist/internals/{index-B8TESzd9.js → index-CLKTEIj0.js} +2 -2
- package/dist/internals/index-CLKTEIj0.js.map +1 -0
- package/dist/internals/{index-BRIlS3mY.d.ts → index-CWhqANZM.d.ts} +3 -3
- package/dist/internals/index-CWhqANZM.d.ts.map +1 -0
- package/dist/internals/{index-DfqABzjr.mjs → index-CZ5fKgiJ.mjs} +26 -26
- package/dist/internals/index-CZ5fKgiJ.mjs.map +1 -0
- package/dist/internals/{index-BzDsTt4R.mjs → index-gWcE22mf.mjs} +2 -2
- package/dist/internals/index-gWcE22mf.mjs.map +1 -0
- package/dist/internals/{index-DylUjD_1.js → index-xHeu-AjT.js} +26 -26
- package/dist/internals/index-xHeu-AjT.js.map +1 -0
- package/dist/internals/{validator-mcBCJP4P.js → validator-B5yHpyvb.js} +10 -10
- package/dist/internals/validator-B5yHpyvb.js.map +1 -0
- package/dist/internals/{validator-CEcBF4Cn.mjs → validator-DX2nXeQo.mjs} +10 -10
- package/dist/internals/validator-DX2nXeQo.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/internals/base-CWnOBKD5.d.ts.map +0 -1
- package/dist/internals/chunk-CNNSQpRF.d.ts.map +0 -1
- package/dist/internals/index-B8TESzd9.js.map +0 -1
- package/dist/internals/index-BRIlS3mY.d.ts.map +0 -1
- package/dist/internals/index-Bs8n7Q8f.d.ts.map +0 -1
- package/dist/internals/index-BzDsTt4R.mjs.map +0 -1
- package/dist/internals/index-DfqABzjr.mjs.map +0 -1
- package/dist/internals/index-DylUjD_1.js.map +0 -1
- package/dist/internals/validator-CEcBF4Cn.mjs.map +0 -1
- package/dist/internals/validator-mcBCJP4P.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as TFileStorage, T as TSchema, P as ProtoService, G as TFileInfo } from './index-
|
|
1
|
+
import { d as TFileStorage, T as TSchema, P as ProtoService, G as TFileInfo } from './index-82GLvDiN.js';
|
|
2
2
|
import { BinaryData } from '@o2ter/utils-js';
|
|
3
3
|
|
|
4
4
|
type FileStorageOptions = {
|
|
@@ -23,4 +23,4 @@ declare abstract class FileStorageBase implements TFileStorage {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export { FileStorageBase as F, type FileStorageOptions as a };
|
|
26
|
-
//# sourceMappingURL=base-
|
|
26
|
+
//# sourceMappingURL=base-C1uAg1dD.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-C1uAg1dD.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FileStorageBase } from './base-
|
|
2
|
-
import { P as ProtoService } from './index-
|
|
1
|
+
import { F as FileStorageBase } from './base-C1uAg1dD.js';
|
|
2
|
+
import { P as ProtoService } from './index-82GLvDiN.js';
|
|
3
3
|
|
|
4
4
|
declare abstract class FileChunkStorageBase<File> extends FileStorageBase {
|
|
5
5
|
abstract listChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{
|
|
@@ -14,4 +14,4 @@ declare abstract class FileChunkStorageBase<File> extends FileStorageBase {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export { FileChunkStorageBase as F };
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-CpgqvFNO.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-CpgqvFNO.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -771,9 +771,9 @@ type Callback<T, R, E> = (request: ProtoService<E> & T) => Awaitable<R>;
|
|
|
771
771
|
* @param request - The request object.
|
|
772
772
|
* @returns An awaitable response.
|
|
773
773
|
*/
|
|
774
|
-
type ProtoFunction<E> = Callback<{
|
|
775
|
-
params:
|
|
776
|
-
},
|
|
774
|
+
type ProtoFunction<E, P extends TSerializable, R extends TSerializable | void> = Callback<{
|
|
775
|
+
params: P;
|
|
776
|
+
}, R, E>;
|
|
777
777
|
/**
|
|
778
778
|
* A trigger callback function type.
|
|
779
779
|
* @param request - The request object.
|
|
@@ -787,8 +787,8 @@ type ProtoTriggerFunction<T, E> = Callback<{
|
|
|
787
787
|
* @param request - The request object.
|
|
788
788
|
* @returns An awaitable response.
|
|
789
789
|
*/
|
|
790
|
-
type ProtoJobFunction<E> = Callback<{
|
|
791
|
-
params:
|
|
790
|
+
type ProtoJobFunction<E, P extends TValueWithoutObject> = Callback<{
|
|
791
|
+
params: P;
|
|
792
792
|
user?: TUser;
|
|
793
793
|
job: TObjectType<'_Job', E>;
|
|
794
794
|
}, void, E>;
|
|
@@ -820,7 +820,7 @@ type ProtoFunctionOptions<E> = {
|
|
|
820
820
|
/**
|
|
821
821
|
* The callback function for the proto function.
|
|
822
822
|
*/
|
|
823
|
-
callback: ProtoFunction<E>;
|
|
823
|
+
callback: ProtoFunction<E, any, any>;
|
|
824
824
|
/**
|
|
825
825
|
* Optional validator for the proto function.
|
|
826
826
|
*/
|
|
@@ -833,7 +833,7 @@ type ProtoJobFunctionOptions<E> = {
|
|
|
833
833
|
/**
|
|
834
834
|
* The callback function for the proto job function.
|
|
835
835
|
*/
|
|
836
|
-
callback: ProtoJobFunction<E>;
|
|
836
|
+
callback: ProtoJobFunction<E, any>;
|
|
837
837
|
/**
|
|
838
838
|
* Optional scopes for the proto job function.
|
|
839
839
|
*/
|
|
@@ -936,7 +936,7 @@ declare abstract class ProtoType<Ext> {
|
|
|
936
936
|
* @param options - Additional options for running the function.
|
|
937
937
|
* @returns A promise that resolves to the result of the function.
|
|
938
938
|
*/
|
|
939
|
-
abstract run(name: string, data?: TSerializable, options?: ExtraOptions<boolean>): Promise<
|
|
939
|
+
abstract run<R extends TSerializable | void = any>(name: string, data?: TSerializable, options?: ExtraOptions<boolean>): Promise<R>;
|
|
940
940
|
/**
|
|
941
941
|
* Schedules a job.
|
|
942
942
|
* @param name - The name of the job to schedule.
|
|
@@ -979,10 +979,10 @@ declare abstract class ProtoType<Ext> {
|
|
|
979
979
|
/**
|
|
980
980
|
* Creates a new object.
|
|
981
981
|
* @param className - The name of the class to create.
|
|
982
|
-
* @param
|
|
982
|
+
* @param id - The ID of the object to create.
|
|
983
983
|
* @returns The created object.
|
|
984
984
|
*/
|
|
985
|
-
Object<T extends string>(className: T,
|
|
985
|
+
Object<T extends string>(className: T, id?: string): TObjectType<T, Ext>;
|
|
986
986
|
/**
|
|
987
987
|
* Creates a new file object.
|
|
988
988
|
* @param filename - The name of the file.
|
|
@@ -1094,7 +1094,7 @@ interface ProtoType<Ext> {
|
|
|
1094
1094
|
* @param callback - The function callback.
|
|
1095
1095
|
* @param options - Optional function options excluding the callback.
|
|
1096
1096
|
*/
|
|
1097
|
-
define(name: string, callback: ProtoFunction<Ext>, options?: Omit<ProtoFunctionOptions<Ext>, 'callback'>): void;
|
|
1097
|
+
define<P extends TSerializable = any, R extends TSerializable | void = any>(name: string, callback: ProtoFunction<Ext, P, R>, options?: Omit<ProtoFunctionOptions<Ext>, 'callback'>): void;
|
|
1098
1098
|
/**
|
|
1099
1099
|
* Registers a callback to be executed after an object is created.
|
|
1100
1100
|
* @param className - The name of the class.
|
|
@@ -1119,7 +1119,7 @@ interface ProtoType<Ext> {
|
|
|
1119
1119
|
* @param callback - The job function callback.
|
|
1120
1120
|
* @param options - Optional job function options excluding the callback.
|
|
1121
1121
|
*/
|
|
1122
|
-
defineJob(name: string, callback: ProtoJobFunction<Ext>, options?: Omit<ProtoJobFunctionOptions<Ext>, 'callback'>): void;
|
|
1122
|
+
defineJob<P extends TValueWithoutObject = any>(name: string, callback: ProtoJobFunction<Ext, P>, options?: Omit<ProtoJobFunctionOptions<Ext>, 'callback'>): void;
|
|
1123
1123
|
/**
|
|
1124
1124
|
* Locks a table for updates.
|
|
1125
1125
|
* @param className - The name of the class or an array of class names.
|
|
@@ -1233,7 +1233,7 @@ declare class TObject {
|
|
|
1233
1233
|
/**
|
|
1234
1234
|
* Gets the object ID.
|
|
1235
1235
|
*/
|
|
1236
|
-
get
|
|
1236
|
+
get id(): string | undefined;
|
|
1237
1237
|
/**
|
|
1238
1238
|
* Gets the creation date of the object.
|
|
1239
1239
|
*/
|
|
@@ -1704,7 +1704,7 @@ type FindOptions = {
|
|
|
1704
1704
|
type RelationOptions = {
|
|
1705
1705
|
relatedBy?: {
|
|
1706
1706
|
className: string;
|
|
1707
|
-
|
|
1707
|
+
id: string;
|
|
1708
1708
|
key: string;
|
|
1709
1709
|
};
|
|
1710
1710
|
};
|
|
@@ -1974,13 +1974,13 @@ declare class ProtoService<Ext = any> extends ProtoType<Ext> {
|
|
|
1974
1974
|
master: true;
|
|
1975
1975
|
acl?: string[];
|
|
1976
1976
|
}): Promise<void>;
|
|
1977
|
-
run(name: string, params?: TSerializable, options?: ExtraOptions<boolean>): Promise<
|
|
1978
|
-
define(name: string, callback: ProtoFunction<Ext>, options?: Omit<ProtoFunctionOptions<Ext>, 'callback'>): void;
|
|
1977
|
+
run<R extends TSerializable | void = any>(name: string, params?: TSerializable, options?: ExtraOptions<boolean>): Promise<R>;
|
|
1978
|
+
define<P extends TSerializable = any, R extends TSerializable | void = any>(name: string, callback: ProtoFunction<Ext, P, R>, options?: Omit<ProtoFunctionOptions<Ext>, 'callback'>): void;
|
|
1979
1979
|
afterCreate<T extends string>(className: string, callback: ProtoTriggerFunction<T, Ext>): void;
|
|
1980
1980
|
afterUpdate<T extends string>(className: string, callback: ProtoTriggerFunction<T, Ext>): void;
|
|
1981
1981
|
afterDelete<T extends string>(className: string, callback: ProtoTriggerFunction<T, Ext>): void;
|
|
1982
1982
|
scheduleJob(name: string, params?: TValueWithoutObject, options?: ExtraOptions<boolean>): Promise<TObjectType<"_Job", Ext>>;
|
|
1983
|
-
defineJob(name: string, callback: ProtoJobFunction<Ext>, options?: Omit<ProtoJobFunctionOptions<Ext>, 'callback'>): void;
|
|
1983
|
+
defineJob<P extends TValueWithoutObject = any>(name: string, callback: ProtoJobFunction<Ext, P>, options?: Omit<ProtoJobFunctionOptions<Ext>, 'callback'>): void;
|
|
1984
1984
|
lockTable(className: string | string[], update: boolean): Promise<void>;
|
|
1985
1985
|
withTransaction<T>(callback: (connection: ProtoService<Ext>) => PromiseLike<T>, options?: TransactionOptions): PromiseLike<T>;
|
|
1986
1986
|
generateUploadToken(options?: {
|
|
@@ -2001,4 +2001,4 @@ declare class ProtoService<Ext = any> extends ProtoType<Ext> {
|
|
|
2001
2001
|
}
|
|
2002
2002
|
|
|
2003
2003
|
export { type TransactionOptions as A, type QueryRandomOptions as B, type TPubSub as C, type DeserializeOptions as D, type ExtraOptions as E, FieldSelectorExpression as F, type TFileInfo as G, type InsertOptions as I, ProtoService as P, QueryExpression as Q, type RelationOptions as R, type SerializeOptions as S, TSchema as T, type TValueWithoutObject as a, type ProtoServiceOptions as b, type ProtoServiceKeyOptions as c, type TFileStorage as d, type TNumber as e, type TSerializable as f, deserialize as g, type TExtensions as h, ProtoType as i, TQuery as j, TObject as k, type PathName as l, type TObjectType as m, TUser as n, type EventData as o, type TQuerySelector as p, type TValueWithUndefined as q, type TValue as r, serialize as s, type TUpdateOp as t, QueryAccumulator as u, QuerySelector as v, type DecodedSortOption as w, type DecodedQuery as x, type FindOptions as y, type TStorage as z };
|
|
2004
|
-
//# sourceMappingURL=index-
|
|
2004
|
+
//# sourceMappingURL=index-82GLvDiN.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-82GLvDiN.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -169,7 +169,7 @@ class TObject {
|
|
|
169
169
|
/**
|
|
170
170
|
* Gets the object ID.
|
|
171
171
|
*/
|
|
172
|
-
get
|
|
172
|
+
get id() {
|
|
173
173
|
return this[_private.PVK].attributes._id;
|
|
174
174
|
}
|
|
175
175
|
/**
|
|
@@ -498,4 +498,4 @@ exports.isShape = isShape;
|
|
|
498
498
|
exports.isValue = isValue;
|
|
499
499
|
exports.isVector = isVector;
|
|
500
500
|
exports.shapePaths = shapePaths;
|
|
501
|
-
//# sourceMappingURL=index-
|
|
501
|
+
//# sourceMappingURL=index-CLKTEIj0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CLKTEIj0.js","sources":["../../../src/internals/schema.ts","../../../src/internals/object/index.ts"],"sourcesContent":["//\n// schema.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { TValueWithoutObject } from './types';\n\nexport namespace TSchema {\n /**\n * Access Control List represented as an array of strings.\n */\n export type ACL = string[];\n\n /**\n * Access Control Lists for read and update operations.\n */\n export type ACLs = { \n /**\n * ACL for read operation.\n */\n read: TSchema.ACL; \n\n /**\n * ACL for update operation.\n */\n update: TSchema.ACL; \n };\n\n /**\n * Primitive data types.\n */\n export type Primitive = 'boolean' | 'number' | 'decimal' | 'string' | 'string[]' | 'date' | 'object' | 'array';\n\n /**\n * Primitive type with an optional default value.\n */\n export type PrimitiveType = Primitive | { \n /**\n * The type of the primitive.\n */\n type: Primitive; \n\n /**\n * Optional default value.\n */\n default?: TValueWithoutObject; \n };\n\n /**\n * Vector type with a specified dimension and an optional default value.\n */\n export type VectorType = { \n /**\n * The type of the vector.\n */\n type: 'vector'; \n\n /**\n * The dimension of the vector.\n */\n dimension: number; \n\n /**\n * Optional default value.\n */\n default?: number[]; \n };\n\n /**\n * Shape type with a specified shape.\n */\n export type ShapeType = { \n /**\n * The type of the shape.\n */\n type: 'shape'; \n\n /**\n * The shape definition.\n */\n shape: Record<string, DataType>; \n };\n\n /**\n * Pointer type with a target.\n */\n export type PointerType = { \n /**\n * The type of the pointer.\n */\n type: 'pointer'; \n\n /**\n * The target class of the pointer.\n */\n target: string; \n };\n\n /**\n * Relation type with a target and an optional foreign field.\n */\n export type RelationType = { \n /**\n * The type of the relation.\n */\n type: 'relation'; \n\n /**\n * The target class of the relation.\n */\n target: string; \n\n /**\n * Optional foreign field.\n */\n foreignField?: string; \n };\n\n /**\n * Data type which can be a primitive, vector, shape, pointer, or relation type.\n */\n export type DataType = PrimitiveType | VectorType | ShapeType | PointerType | RelationType;\n\n /**\n * Class Level Permissions.\n */\n export type CLPs = {\n /**\n * ACL for get operation.\n */\n get?: TSchema.ACL;\n\n /**\n * ACL for find operation.\n */\n find?: TSchema.ACL;\n\n /**\n * ACL for count operation.\n */\n count?: TSchema.ACL;\n\n /**\n * ACL for create operation.\n */\n create?: TSchema.ACL;\n\n /**\n * ACL for update operation.\n */\n update?: TSchema.ACL;\n\n /**\n * ACL for delete operation.\n */\n delete?: TSchema.ACL;\n };\n\n /**\n * Field Level Permissions.\n */\n export type FLPs = {\n /**\n * ACL for read operation.\n */\n read?: TSchema.ACL;\n\n /**\n * ACL for create operation.\n */\n create?: TSchema.ACL;\n\n /**\n * ACL for update operation.\n */\n update?: TSchema.ACL;\n };\n\n /**\n * Indexes for the schema.\n */\n export type Indexes = {\n /**\n * Type of the index, default is 'basic'.\n */\n type?: 'basic';\n\n /**\n * Keys for the index.\n */\n keys: Record<string, 1 | -1>;\n\n /**\n * Whether the index is unique.\n */\n unique?: boolean;\n } | {\n /**\n * Type of the index, must be 'vector'.\n */\n type: 'vector';\n\n /**\n * Keys for the vector index.\n */\n keys: string | string[];\n\n /**\n * Method for the vector index.\n */\n method?: 'hnsw' | 'ivfflat';\n };\n}\n\nexport const _isTypeof = (x: TSchema.DataType, types: string | string[]) => {\n if (_.isString(x)) return _.includes(_.castArray(types), x);\n return _.includes(_.castArray(types), x.type);\n};\nexport const isPrimitive = (x: TSchema.DataType): x is TSchema.PrimitiveType => _.isString(x) || (x.type !== 'pointer' && x.type !== 'relation' && x.type !== 'shape');\nexport const isVector = (x: TSchema.DataType): x is TSchema.VectorType => !_.isString(x) && x.type === 'vector';\nexport const dimensionOf = (x: TSchema.DataType) => isVector(x) ? x.dimension : 0;\nexport const isShape = (x: TSchema.DataType): x is TSchema.ShapeType => !_.isString(x) && x.type === 'shape';\nexport const isPointer = (x: TSchema.DataType): x is TSchema.PointerType => !_.isString(x) && x.type === 'pointer';\nexport const isRelation = (x: TSchema.DataType): x is TSchema.RelationType => !_.isString(x) && x.type === 'relation';\nexport const _typeof = (x: TSchema.DataType) => _.isString(x) ? x : x.type !== 'pointer' && x.type !== 'relation' ? x.type : x.target;\n\nexport const shapePaths = (x: TSchema.ShapeType): {\n path: string,\n type: Exclude<TSchema.DataType, TSchema.ShapeType>,\n}[] => _.flatMap(x.shape, (v, k) => (\n isShape(v) ? _.map(shapePaths(v), x => ({ path: `${k}.${x.path}`, type: x.type })) : { path: k, type: v }\n));\n\nexport interface TSchema {\n /**\n * Fields of the schema, where each field is a data type.\n */\n fields: Record<string, TSchema.DataType>;\n\n /**\n * Class level permissions for the schema.\n */\n classLevelPermissions?: TSchema.CLPs;\n\n /**\n * Additional object permissions for the schema.\n */\n additionalObjectPermissions?: TSchema.ACLs;\n\n /**\n * Field level permissions for the schema, where each field can have its own permissions.\n */\n fieldLevelPermissions?: Record<string, TSchema.FLPs>;\n\n /**\n * Secure fields in the schema.\n */\n secureFields?: string[];\n\n /**\n * Indexes for the schema.\n */\n indexes?: TSchema.Indexes[];\n\n /**\n * Indicates if live query is enabled for the schema.\n */\n liveQuery?: boolean;\n}\n\nexport const defaultObjectKeyTypes: Record<string, TSchema.DataType> = {\n _id: 'string',\n __v: 'number',\n __i: 'number',\n _created_at: 'date',\n _updated_at: 'date',\n _expired_at: 'date',\n _rperm: 'string[]',\n _wperm: 'string[]',\n};\n\nexport const defaultObjectReadonlyKeys = ['_id', '__v', '__i', '_created_at', '_updated_at'];\nexport const defaultObjectKeys = [...defaultObjectReadonlyKeys, '_expired_at', '_rperm', '_wperm'];\n","//\n// object.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { PVK } from '../private';\nimport { ExtraOptions } from '../options';\nimport { Decimal } from 'decimal.js';\nimport { TPrimitiveValue, TValue, TValueWithoutObject, TValueWithUndefined } from '../types';\nimport { TSchema, defaultObjectKeys, defaultObjectReadonlyKeys } from '../schema';\nimport { IncludePaths, PathName } from '../query/types';\nimport { TUpdateOp, TUpdateOpKeys } from './types';\nimport { TQuery } from '../query';\n\nexport const isPrimitiveValue = (x: any): x is TPrimitiveValue => {\n if (_.isNil(x) || _.isNumber(x) || _.isBoolean(x) || _.isString(x) || _.isDate(x)) return true;\n if (x instanceof Decimal) return true;\n return false;\n}\n\nexport const isValue = (x: any): x is TValue => {\n if (isPrimitiveValue(x) || x instanceof TObject) return true;\n if (_.isArray(x)) return _.every(x, v => isValue(v));\n if (_.isPlainObject(x)) return _.every(x, v => isValue(v));\n return false;\n}\n\nexport const cloneValue = <T extends TValue>(x: T): T => {\n if (isPrimitiveValue(x) || x instanceof TObject) return x;\n if (_.isArray(x)) return x.map(v => cloneValue(v)) as T;\n return _.mapValues(x, v => cloneValue(v)) as T;\n}\n\nexport const _decodeValue = (value: TValueWithoutObject): TValueWithoutObject => {\n if (isPrimitiveValue(value)) return value;\n if (_.isArray(value)) return _.map(value, x => _decodeValue(x));\n if (_.isString(value.$date)) return new Date(value.$date);\n if (_.isString(value.$decimal)) return new Decimal(value.$decimal);\n return _.transform(value, (r, v, k) => {\n r[k.startsWith('$') ? k.substring(1) : k] = _decodeValue(v);\n }, {} as any);\n};\n\nexport const _encodeValue = (value: TValueWithUndefined): TValueWithoutObject => {\n if (_.isNil(value)) return value ?? null;\n if (value instanceof TObject) throw Error('Invalid data type');\n if (_.isDate(value)) return { $date: value.toISOString() };\n if (value instanceof Decimal) return { $decimal: value.toString() };\n if (isPrimitiveValue(value)) return value;\n if (_.isArray(value)) return _.map(value, x => _encodeValue(x));\n return _.transform(value, (r, v, k) => {\n r[k.startsWith('$') ? `$${k}` : k] = _encodeValue(v);\n }, {} as any);\n};\n\nexport const decodeUpdateOp = (update: TUpdateOp) => {\n const pairs = _.toPairs(update);\n if (pairs.length !== 1) throw Error('Invalid update operation');\n return pairs[0] as [typeof TUpdateOpKeys[number], TValue];\n}\n\n/**\n * Interface representing a object.\n */\nexport interface TObject {\n /**\n * Clones the object.\n * @returns A clone of the object.\n */\n clone(): TObject;\n\n /**\n * Gets a relation query for the specified key.\n * @param key - The key of the relation.\n * @returns A query object for the relation.\n */\n relation<T extends string>(key: PathName<T>): TQuery<string, any, boolean>;\n\n /**\n * Fetches the object with the specified keys included.\n * @param keys - The keys to include.\n * @param options - Additional options for the fetch operation.\n * @returns A promise that resolves to the fetched object.\n */\n fetchWithInclude<T extends _.RecursiveArray<string>>(keys: IncludePaths<T>, options?: ExtraOptions<boolean>): PromiseLike<this>;\n\n /**\n * Saves the object.\n * @param options - Additional options for the save operation.\n * @returns A promise that resolves to the saved object.\n */\n save(options?: ExtraOptions<boolean> & { cascadeSave?: boolean }): PromiseLike<this>;\n\n /**\n * Destroys the object.\n * @param options - Additional options for the destroy operation.\n * @returns A promise that resolves to the destroyed object.\n */\n destroy(options?: ExtraOptions<boolean>): PromiseLike<this>;\n}\n\n/**\n * Class representing a object.\n */\nexport class TObject {\n\n static defaultReadonlyKeys = defaultObjectReadonlyKeys;\n static defaultKeys = defaultObjectKeys;\n\n /** @internal */\n [PVK]: {\n className: string;\n attributes: Record<string, TValue>;\n mutated: Record<string, TUpdateOp>;\n extra: Record<string, any>;\n };\n\n constructor(\n className: string,\n attributes?: Record<string, TValue> | ((self: TObject) => Record<string, TValue>),\n ) {\n const _attributes = _.isFunction(attributes) ? attributes(this) : attributes ?? {};\n this[PVK] = {\n className,\n attributes: cloneValue(_attributes),\n mutated: {},\n extra: {},\n }\n }\n\n /**\n * Gets the class name of the object.\n */\n get className(): string {\n return this[PVK].className;\n }\n\n /**\n * Gets the attributes of the object.\n */\n get attributes(): Record<string, TValue> {\n return cloneValue(this[PVK].attributes);\n }\n\n /**\n * Gets the object ID.\n */\n get id(): string | undefined {\n return this[PVK].attributes._id as string;\n }\n\n /**\n * Gets the creation date of the object.\n */\n get createdAt(): Date | undefined {\n return this[PVK].attributes._created_at as Date;\n }\n\n /**\n * Gets the last updated date of the object.\n */\n get updatedAt(): Date | undefined {\n return this[PVK].attributes._updated_at as Date;\n }\n\n /**\n * Gets the version number of the object.\n */\n get __v(): number {\n return this[PVK].attributes.__v as number;\n }\n\n /**\n * Gets the sequence number of the object.\n */\n get __i(): number {\n return this[PVK].attributes.__i as number;\n }\n\n /**\n * Gets the expiration date of the object.\n */\n get expiredAt(): Date | undefined {\n return this.get('_expired_at');\n }\n\n /**\n * Sets the expiration date of the object.\n * @param value - The expiration date.\n */\n set expiredAt(value: Date | undefined) {\n this.set('_expired_at', value);\n }\n\n /**\n * Gets the access control list (ACL) of the object.\n * @returns The ACL of the object.\n */\n acl(): TSchema.ACLs {\n return {\n read: this.get('_rperm') ?? ['*'],\n update: this.get('_wperm') ?? ['*'],\n };\n }\n\n /**\n * Sets the access control list (ACL) of the object.\n * @param value - The ACL to set.\n */\n setAcl(value: Partial<TSchema.ACLs>) {\n this.set('_rperm', value.read ?? ['*']);\n this.set('_wperm', value.update ?? ['*']);\n }\n\n /**\n * Sets the read access control list (ACL) of the object.\n * @param value - The read ACL to set.\n */\n setReadAcl(value: TSchema.ACL) {\n this.set('_rperm', value);\n }\n\n /**\n * Sets the write access control list (ACL) of the object.\n * @param value - The write ACL to set.\n */\n setWriteAcl(value: TSchema.ACL) {\n this.set('_wperm', value);\n }\n\n /**\n * Gets the keys of the object's attributes and mutated attributes.\n * @returns An array of keys.\n */\n keys(): string[] {\n return _.uniq([..._.keys(this[PVK].attributes), ..._.compact(_.map(_.keys(this[PVK].mutated), x => _.first(_.toPath(x))))]);\n }\n\n /**\n * Gets an iterator for the entries of the object's attributes.\n * @returns An iterator for the entries.\n */\n *entries() {\n for (const key of this.keys()) {\n yield [key, this.get(key)] as [string, any];\n }\n }\n\n /** @internal */\n *_set_entries() {\n for (const [key, op] of _.entries(this[PVK].mutated)) {\n for (const [_op, value] of _.entries(op)) {\n if (_op === '$set') yield [key, value] as [string, any];\n }\n }\n }\n\n /**\n * Converts the object to a plain object.\n * @param replacer - An optional function to replace values during the conversion.\n * @returns The plain object representation of the object.\n */\n toObject(replacer?: (value: TObject) => any): any {\n const toObject = (value: TValue): any => {\n if (isPrimitiveValue(value)) return value;\n if (value instanceof TObject) return replacer?.(value) ?? value.toObject(replacer);\n if (_.isArray(value)) return _.map(value, toObject);\n return _.mapValues(value, toObject);\n };\n return _.fromPairs(_.map(this.keys(), k => [k, toObject(this.get(k))]));\n }\n\n private _value(key: string): TValue {\n let value: TValue = this[PVK].attributes;\n for (const k of _.toPath(key)) {\n if (isPrimitiveValue(value)) return null;\n if (value instanceof TObject) {\n value = value.get(k);\n } else {\n value = _.get(value, k);\n }\n }\n return cloneValue(value);\n }\n\n /**\n * Get the value of the attribute.\n * @param key - The key of the attribute.\n * @returns The value of the attribute.\n */\n get<T extends string>(key: PathName<T>): any {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (_.isNil(this[PVK].mutated[key])) return this._value(key);\n const [op, value] = decodeUpdateOp(this[PVK].mutated[key]);\n return op === '$set' ? value : this._value(key);\n }\n\n /**\n * Set the value of the attribute.\n * @param key - The key of the attribute.\n * @param value - The value to set.\n */\n set<T extends string>(key: PathName<T>, value: TValueWithUndefined) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $set: value ?? null };\n }\n\n /**\n * Is the object dirty.\n */\n get isDirty(): boolean {\n return !_.isEmpty(this[PVK].mutated);\n }\n\n /**\n * Increment the value of the attribute.\n * @param key - The key to increment.\n * @param value - The value to increment by.\n */\n increment<T extends string>(key: PathName<T>, value: number | Decimal) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $inc: value };\n }\n\n /**\n * Decrement the value of the attribute.\n * @param key - The key to decrement.\n * @param value - The value to decrement by.\n */\n decrement<T extends string>(key: PathName<T>, value: number | Decimal) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $dec: value };\n }\n\n /**\n * Multiplies the value of the specified attribute.\n * @param key - The key of the attribute to multiply.\n * @param value - The multiplier value.\n */\n multiply<T extends string>(key: PathName<T>, value: number | Decimal) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $mul: value };\n }\n\n /**\n * Divides the value of the specified attribute.\n * @param key - The key of the attribute to divide.\n * @param value - The divisor value.\n */\n divide<T extends string>(key: PathName<T>, value: number | Decimal) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $div: value };\n }\n\n /**\n * Sets the value of the specified attribute to the maximum of the current value and the provided value.\n * @param key - The key of the attribute to compare.\n * @param value - The value to compare against.\n */\n max<T extends string>(key: PathName<T>, value: TValue) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $max: value };\n }\n\n /**\n * Sets the value of the specified attribute to the minimum of the current value and the provided value.\n * @param key - The key of the attribute to compare.\n * @param value - The value to compare against.\n */\n min<T extends string>(key: PathName<T>, value: TValue) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $min: value };\n }\n\n /**\n * Adds the specified values to the set of the specified attribute.\n * @param key - The key of the attribute.\n * @param values - The values to add to the set.\n */\n addToSet<T extends string>(key: PathName<T>, values: TValue[]) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $addToSet: values };\n }\n\n /**\n * Adds the values to the array of the attribute.\n * @param key - The key of the attribute.\n * @param values - The values to add.\n */\n push<T extends string>(key: PathName<T>, values: TValue[]) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $push: values };\n }\n\n /**\n * Removes the values from the array of the attribute.\n * @param key - The key of the attribute.\n * @param values - The values to remove.\n */\n removeAll<T extends string>(key: PathName<T>, values: TValue[]) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $removeAll: values };\n }\n\n /**\n * Removes the first elements from the array of the attribute.\n * @param key - The key of the attribute.\n * @param count - The number of elements to remove. Defaults to 1.\n */\n popFirst<T extends string>(key: PathName<T>, count = 1) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $popFirst: count };\n }\n\n /**\n * Removes the last elements from the array of the attribute.\n * @param key - The key of the attribute.\n * @param count - The number of elements to remove. Defaults to 1.\n */\n popLast<T extends string>(key: PathName<T>, count = 1) {\n if (_.isEmpty(key)) throw Error('Invalid key');\n if (TObject.defaultReadonlyKeys.includes(_.first(_.toPath(key))!)) return;\n this[PVK].mutated[key] = { $popLast: count };\n }\n\n /**\n * Fetches the object data.\n * @param options - Additional options for the fetch operation.\n * @returns A promise that resolves to the fetched object.\n */\n async fetch(options?: ExtraOptions<boolean>) {\n return this.fetchWithInclude(_.keys(this[PVK].attributes), options);\n }\n\n /**\n * Fetches the object data if needed.\n * @param keys - The keys of the attributes to fetch.\n * @param options - Additional options for the fetch operation.\n * @returns A promise that resolves to the fetched object.\n */\n async fetchIfNeeded<T extends _.RecursiveArray<string>>(keys: IncludePaths<T>, options?: ExtraOptions<boolean>) {\n const current = _.keys(this[PVK].attributes);\n if (_.every(keys, k => _.includes(current, k))) return this;\n return this.fetchWithInclude([current, keys], options);\n }\n\n}\n"],"names":["Decimal","PVK"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;MAoNa,SAAS,GAAG,CAAC,CAAmB,EAAE,KAAwB,KAAI;AACzE,IAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;AAAE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,GAAG,CAAC,CAAE,CAAC;YAAE;AACnE,QAAA,IAAI,CAACA,YAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE;;AAG9C;;;;AAIG;IACH,MAAM,KAAK,CAAC,OAA+B,EAAA;AACzC,QAAA,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAACA,YAAG,CAAC,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;;AAGrE;;;;;AAKG;AACH,IAAA,MAAM,aAAa,CAAqC,IAAqB,EAAE,OAA+B,EAAA;AAC5G,QAAA,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAACA,YAAG,CAAC,CAAC,UAAU,CAAC;AAC5C,QAAA,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAAE,YAAA,OAAO,IAAI;AAC3D,QAAA,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as TExtensions, E as ExtraOptions, S as SerializeOptions, i as ProtoType, j as TQuery, k as TObject, l as PathName, a as TValueWithoutObject, f as TSerializable, m as TObjectType, n as TUser, T as TSchema, o as EventData, p as TQuerySelector } from './index-
|
|
1
|
+
import { h as TExtensions, E as ExtraOptions, S as SerializeOptions, i as ProtoType, j as TQuery, k as TObject, l as PathName, a as TValueWithoutObject, f as TSerializable, m as TObjectType, n as TUser, T as TSchema, o as EventData, p as TQuerySelector } from './index-82GLvDiN.js';
|
|
2
2
|
import * as _o2ter_utils_js from '@o2ter/utils-js';
|
|
3
3
|
import * as socket_io_client from 'socket.io-client';
|
|
4
4
|
import * as _socket_io_component_emitter from '@socket.io/component-emitter';
|
|
@@ -64,7 +64,7 @@ declare class ProtoClient<Ext = any> extends ProtoType<Ext> {
|
|
|
64
64
|
setConfig(values: Record<string, TValueWithoutObject>, options: RequestOptions<true> & {
|
|
65
65
|
acl?: string[];
|
|
66
66
|
}): Promise<void>;
|
|
67
|
-
run(name: string, data?: TSerializable, options?: RequestOptions<boolean>): Promise<
|
|
67
|
+
run<R extends TSerializable | void = any>(name: string, data?: TSerializable, options?: RequestOptions<boolean>): Promise<R>;
|
|
68
68
|
scheduleJob(name: string, data?: TValueWithoutObject, options?: RequestOptions<boolean>): any;
|
|
69
69
|
setSessionToken(token?: string): void;
|
|
70
70
|
sessionInfo(options?: RequestOptions<boolean>): Promise<TSerializable>;
|
|
@@ -84,4 +84,4 @@ declare class ProtoClient<Ext = any> extends ProtoType<Ext> {
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export { ProtoClient as P, classExtends as c };
|
|
87
|
-
//# sourceMappingURL=index-
|
|
87
|
+
//# sourceMappingURL=index-CWhqANZM.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CWhqANZM.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EventIterator, prototypes, asyncStream, isBinaryData, isReadableStream, isBlob, base64ToBuffer, iterableToStream } from '@o2ter/utils-js';
|
|
2
2
|
import { P as PVK } from './private-CNw40LZ7.mjs';
|
|
3
3
|
import _ from 'lodash';
|
|
4
|
-
import { T as TObject, e as decodeUpdateOp } from './index-
|
|
4
|
+
import { T as TObject, e as decodeUpdateOp } from './index-gWcE22mf.mjs';
|
|
5
5
|
import axios from 'axios';
|
|
6
6
|
import { A as AUTH_COOKIE_KEY, M as MASTER_USER_HEADER_NAME, b as MASTER_PASS_HEADER_NAME, U as UPLOAD_TOKEN_HEADER_NAME } from './const-Dkp7Nsv5.mjs';
|
|
7
7
|
import { XSRF_COOKIE_NAME, XSRF_HEADER_NAME } from '@o2ter/server-js/dist/const';
|
|
@@ -1075,10 +1075,10 @@ const applyObjectMethods = (object, proto) => {
|
|
|
1075
1075
|
url: {
|
|
1076
1076
|
get() {
|
|
1077
1077
|
const filename = this.filename;
|
|
1078
|
-
if (_.isNil(this.
|
|
1078
|
+
if (_.isNil(this.id) || _.isNil(filename))
|
|
1079
1079
|
return;
|
|
1080
1080
|
const endpoint = proto[PVK].options.endpoint;
|
|
1081
|
-
const path = `files/${this.
|
|
1081
|
+
const path = `files/${this.id}/${encodeURIComponent(filename)}`;
|
|
1082
1082
|
return endpoint.endsWith('/') ? `${endpoint}${path}` : `${endpoint}/${path}`;
|
|
1083
1083
|
}
|
|
1084
1084
|
},
|
|
@@ -1106,7 +1106,7 @@ const applyObjectMethods = (object, proto) => {
|
|
|
1106
1106
|
},
|
|
1107
1107
|
fetchWithInclude: {
|
|
1108
1108
|
async value(keys, options) {
|
|
1109
|
-
const fetched = await query().equalTo('_id', this.
|
|
1109
|
+
const fetched = await query().equalTo('_id', this.id).includes(keys).first(options);
|
|
1110
1110
|
if (!fetched)
|
|
1111
1111
|
throw Error('Unable to fetch document');
|
|
1112
1112
|
this[PVK].attributes = fetched.attributes;
|
|
@@ -1119,13 +1119,13 @@ const applyObjectMethods = (object, proto) => {
|
|
|
1119
1119
|
if (options?.cascadeSave !== false) {
|
|
1120
1120
|
for (const update of _.values(mutated)) {
|
|
1121
1121
|
const [, value] = decodeUpdateOp(update);
|
|
1122
|
-
if (value instanceof TObject && (_.isNil(value.
|
|
1122
|
+
if (value instanceof TObject && (_.isNil(value.id) || value.isDirty))
|
|
1123
1123
|
await value.save(options);
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
|
-
if (this.
|
|
1126
|
+
if (this.id) {
|
|
1127
1127
|
const updated = await query()
|
|
1128
|
-
.equalTo('_id', this.
|
|
1128
|
+
.equalTo('_id', this.id)
|
|
1129
1129
|
.includes(...this.keys())
|
|
1130
1130
|
.updateOne(this[PVK].mutated, options);
|
|
1131
1131
|
if (!updated)
|
|
@@ -1146,7 +1146,7 @@ const applyObjectMethods = (object, proto) => {
|
|
|
1146
1146
|
destroy: {
|
|
1147
1147
|
async value(options) {
|
|
1148
1148
|
const deleted = await query()
|
|
1149
|
-
.equalTo('_id', this.
|
|
1149
|
+
.equalTo('_id', this.id)
|
|
1150
1150
|
.includes(...this.keys())
|
|
1151
1151
|
.deleteOne(options);
|
|
1152
1152
|
if (!deleted)
|
|
@@ -1230,11 +1230,11 @@ class ProtoType {
|
|
|
1230
1230
|
/**
|
|
1231
1231
|
* Creates a new object.
|
|
1232
1232
|
* @param className - The name of the class to create.
|
|
1233
|
-
* @param
|
|
1233
|
+
* @param id - The ID of the object to create.
|
|
1234
1234
|
* @returns The created object.
|
|
1235
1235
|
*/
|
|
1236
|
-
Object(className,
|
|
1237
|
-
const attrs =
|
|
1236
|
+
Object(className, id) {
|
|
1237
|
+
const attrs = id ? { _id: id } : {};
|
|
1238
1238
|
const obj = isObjKey(className, TObjectTypes) ? new TObjectTypes[className](attrs) : new TObject(className, attrs);
|
|
1239
1239
|
return this.rebind(obj);
|
|
1240
1240
|
}
|
|
@@ -1555,7 +1555,7 @@ class Service {
|
|
|
1555
1555
|
const objects = deserialize(JSON.stringify(data));
|
|
1556
1556
|
for (const [id, { callback }] of _.entries(queries)) {
|
|
1557
1557
|
const keys = _.keys(_.pickBy(ids, v => _.includes(v, id)));
|
|
1558
|
-
callback(_.filter(objects, x => _.includes(keys, x.
|
|
1558
|
+
callback(_.filter(objects, x => _.includes(keys, x.id)));
|
|
1559
1559
|
}
|
|
1560
1560
|
});
|
|
1561
1561
|
socket.on('connect', register);
|
|
@@ -1717,7 +1717,7 @@ class ProtoClientInternal {
|
|
|
1717
1717
|
});
|
|
1718
1718
|
}
|
|
1719
1719
|
async setPassword(user, password, options) {
|
|
1720
|
-
if (!user.
|
|
1720
|
+
if (!user.id)
|
|
1721
1721
|
throw Error('Invalid user');
|
|
1722
1722
|
if (_.isEmpty(password))
|
|
1723
1723
|
throw Error('Invalid password');
|
|
@@ -1725,20 +1725,20 @@ class ProtoClientInternal {
|
|
|
1725
1725
|
await this.service.request({
|
|
1726
1726
|
method: 'post',
|
|
1727
1727
|
baseURL: this.options.endpoint,
|
|
1728
|
-
url: `user/${user.
|
|
1728
|
+
url: `user/${user.id}/password`,
|
|
1729
1729
|
data: serialize({ password }, serializeOpts),
|
|
1730
1730
|
responseType: 'text',
|
|
1731
1731
|
...opts,
|
|
1732
1732
|
});
|
|
1733
1733
|
}
|
|
1734
1734
|
async unsetPassword(user, options) {
|
|
1735
|
-
if (!user.
|
|
1735
|
+
if (!user.id)
|
|
1736
1736
|
throw Error('Invalid user');
|
|
1737
1737
|
const { serializeOpts, ...opts } = options ?? {};
|
|
1738
1738
|
await this.service.request({
|
|
1739
1739
|
method: 'post',
|
|
1740
1740
|
baseURL: this.options.endpoint,
|
|
1741
|
-
url: `user/${user.
|
|
1741
|
+
url: `user/${user.id}/password`,
|
|
1742
1742
|
responseType: 'text',
|
|
1743
1743
|
...opts,
|
|
1744
1744
|
});
|
|
@@ -1756,7 +1756,7 @@ class ProtoClientInternal {
|
|
|
1756
1756
|
}
|
|
1757
1757
|
async updateFile(proto, object, options) {
|
|
1758
1758
|
const updated = await proto.Query(object.className)
|
|
1759
|
-
.equalTo('_id', object.
|
|
1759
|
+
.equalTo('_id', object.id)
|
|
1760
1760
|
.includes(...object.keys())
|
|
1761
1761
|
.updateOne(object[PVK].mutated, options);
|
|
1762
1762
|
if (updated) {
|
|
@@ -1807,11 +1807,11 @@ class ProtoClientInternal {
|
|
|
1807
1807
|
return object;
|
|
1808
1808
|
}
|
|
1809
1809
|
async saveFile(proto, object, options) {
|
|
1810
|
-
return object.
|
|
1810
|
+
return object.id ? this.updateFile(proto, object, options) : this.createFile(proto, object, options);
|
|
1811
1811
|
}
|
|
1812
1812
|
async deleteFile(proto, object, options) {
|
|
1813
1813
|
const deleted = await proto.Query(object.className)
|
|
1814
|
-
.equalTo('_id', object.
|
|
1814
|
+
.equalTo('_id', object.id)
|
|
1815
1815
|
.deleteOne(options);
|
|
1816
1816
|
if (deleted) {
|
|
1817
1817
|
object[PVK].attributes = deleted.attributes;
|
|
@@ -1829,7 +1829,7 @@ class ProtoClientInternal {
|
|
|
1829
1829
|
const res = await this.service.request({
|
|
1830
1830
|
method: 'get',
|
|
1831
1831
|
baseURL: this.options.endpoint,
|
|
1832
|
-
url: `files/${object.
|
|
1832
|
+
url: `files/${object.id}/${encodeURIComponent(filename)}`,
|
|
1833
1833
|
responseType: 'stream',
|
|
1834
1834
|
headers: {
|
|
1835
1835
|
'Content-Type': 'multipart/form-data',
|
|
@@ -1893,14 +1893,14 @@ class ProtoClientInternal {
|
|
|
1893
1893
|
};
|
|
1894
1894
|
}
|
|
1895
1895
|
refs(proto, object, options) {
|
|
1896
|
-
if (!object.
|
|
1896
|
+
if (!object.id)
|
|
1897
1897
|
throw Error('Invalid object');
|
|
1898
1898
|
const request = async () => {
|
|
1899
1899
|
const { serializeOpts, ...opts } = options ?? {};
|
|
1900
1900
|
const res = await this.service.request({
|
|
1901
1901
|
method: 'get',
|
|
1902
1902
|
baseURL: this.options.endpoint,
|
|
1903
|
-
url: `classes/${encodeURIComponent(object.className)}/${object.
|
|
1903
|
+
url: `classes/${encodeURIComponent(object.className)}/${object.id}/refs`,
|
|
1904
1904
|
serializeOpts: {
|
|
1905
1905
|
objAttrs: TObject.defaultReadonlyKeys,
|
|
1906
1906
|
},
|
|
@@ -1948,13 +1948,13 @@ class ProtoClient extends ProtoType {
|
|
|
1948
1948
|
return new ProtoClientQuery(className, this, {});
|
|
1949
1949
|
}
|
|
1950
1950
|
Relation(object, key) {
|
|
1951
|
-
const
|
|
1952
|
-
if (!
|
|
1951
|
+
const id = object.id;
|
|
1952
|
+
if (!id)
|
|
1953
1953
|
throw Error('Invalid object');
|
|
1954
1954
|
return new ProtoClientRelationQuery(this, {
|
|
1955
1955
|
relatedBy: {
|
|
1956
1956
|
className: object.className,
|
|
1957
|
-
|
|
1957
|
+
id,
|
|
1958
1958
|
key,
|
|
1959
1959
|
},
|
|
1960
1960
|
});
|
|
@@ -2019,4 +2019,4 @@ class ProtoClient extends ProtoType {
|
|
|
2019
2019
|
}
|
|
2020
2020
|
|
|
2021
2021
|
export { LiveQuerySubscription as L, ProtoType as P, TQuery as T, _logLevels as _, TUser as a, ProtoClient as b, classExtends as c, deserialize as d, serialize as s };
|
|
2022
|
-
//# sourceMappingURL=index-
|
|
2022
|
+
//# sourceMappingURL=index-CZ5fKgiJ.mjs.map
|