@quatrain/core 1.0.0-beta24 → 1.0.0-beta26

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.
Files changed (114) hide show
  1. package/lib/Core.d.ts +0 -12
  2. package/lib/Core.js +0 -16
  3. package/lib/components/AbstractObject.d.ts +1 -1
  4. package/lib/components/BaseObjectCore.d.ts +5 -46
  5. package/lib/components/BaseObjectCore.js +46 -65
  6. package/lib/components/DataObject.d.ts +2 -7
  7. package/lib/components/DataObject.js +10 -42
  8. package/lib/components/ObjectUri.d.ts +3 -3
  9. package/lib/components/ObjectUri.js +1 -3
  10. package/lib/components/index.d.ts +1 -3
  11. package/lib/components/index.js +1 -8
  12. package/lib/index.d.ts +4 -16
  13. package/lib/index.js +6 -35
  14. package/lib/properties/CollectionProperty.d.ts +1 -16
  15. package/lib/properties/CollectionProperty.js +0 -41
  16. package/lib/properties/ObjectProperty.d.ts +6 -0
  17. package/lib/properties/ObjectProperty.js +12 -5
  18. package/package.json +1 -1
  19. package/lib/Auth.d.ts +0 -25
  20. package/lib/Auth.js +0 -9
  21. package/lib/Backend copy.d.ts +0 -39
  22. package/lib/Backend copy.js +0 -11
  23. package/lib/Backend.d.ts +0 -39
  24. package/lib/Backend.js +0 -11
  25. package/lib/Storage.d.ts +0 -13
  26. package/lib/Storage.js +0 -2
  27. package/lib/authentication/AbstractAuthAdapter.d.ts +0 -18
  28. package/lib/authentication/AbstractAuthAdapter.js +0 -23
  29. package/lib/authentication/AuthenticationError.d.ts +0 -2
  30. package/lib/authentication/AuthenticationError.js +0 -6
  31. package/lib/authentication/index.d.ts +0 -4
  32. package/lib/authentication/index.js +0 -7
  33. package/lib/authentication/middlewares/AbstractAuthMiddleware.d.ts +0 -0
  34. package/lib/authentication/middlewares/AbstractAuthMiddleware.js +0 -1
  35. package/lib/authentication/middlewares/AuthMiddleware.d.ts +0 -5
  36. package/lib/authentication/middlewares/AuthMiddleware.js +0 -2
  37. package/lib/authentication/types/AuthInterface.d.ts +0 -9
  38. package/lib/authentication/types/AuthInterface.js +0 -2
  39. package/lib/backends/AbstractAdapter.d.ts +0 -45
  40. package/lib/backends/AbstractAdapter.js +0 -86
  41. package/lib/backends/BackendError.d.ts +0 -2
  42. package/lib/backends/BackendError.js +0 -6
  43. package/lib/backends/Filter.d.ts +0 -17
  44. package/lib/backends/Filter.js +0 -14
  45. package/lib/backends/FilterOperators.d.ts +0 -13
  46. package/lib/backends/FilterOperators.js +0 -16
  47. package/lib/backends/Filters.d.ts +0 -11
  48. package/lib/backends/Filters.js +0 -14
  49. package/lib/backends/Limits.d.ts +0 -9
  50. package/lib/backends/Limits.js +0 -10
  51. package/lib/backends/MockAdapter.d.ts +0 -25
  52. package/lib/backends/MockAdapter.js +0 -189
  53. package/lib/backends/NotFoundError.d.ts +0 -2
  54. package/lib/backends/NotFoundError.js +0 -6
  55. package/lib/backends/Query.d.ts +0 -56
  56. package/lib/backends/Query.js +0 -129
  57. package/lib/backends/SortAndLimit.d.ts +0 -11
  58. package/lib/backends/SortAndLimit.js +0 -11
  59. package/lib/backends/Sorting.d.ts +0 -9
  60. package/lib/backends/Sorting.js +0 -10
  61. package/lib/backends/index.d.ts +0 -12
  62. package/lib/backends/index.js +0 -46
  63. package/lib/backends/middlewares/AbstractMiddleware.d.ts +0 -0
  64. package/lib/backends/middlewares/AbstractMiddleware.js +0 -1
  65. package/lib/backends/middlewares/InjectKeywordsMiddleware.d.ts +0 -9
  66. package/lib/backends/middlewares/InjectKeywordsMiddleware.js +0 -47
  67. package/lib/backends/middlewares/InjectMetaMiddleware.d.ts +0 -13
  68. package/lib/backends/middlewares/InjectMetaMiddleware.js +0 -33
  69. package/lib/backends/middlewares/Middleware.d.ts +0 -5
  70. package/lib/backends/middlewares/Middleware.js +0 -2
  71. package/lib/backends/middlewares/types/MiddlewareParams.d.ts +0 -3
  72. package/lib/backends/middlewares/types/MiddlewareParams.js +0 -2
  73. package/lib/backends/types/BackendInterface.d.ts +0 -13
  74. package/lib/backends/types/BackendInterface.js +0 -2
  75. package/lib/backends/types/CollectionHierarchy.d.ts +0 -3
  76. package/lib/backends/types/CollectionHierarchy.js +0 -6
  77. package/lib/components/BaseRepository.d.ts +0 -25
  78. package/lib/components/BaseRepository.js +0 -138
  79. package/lib/components/EntityRepository.d.ts +0 -6
  80. package/lib/components/EntityRepository.js +0 -14
  81. package/lib/components/UserRepository.d.ts +0 -7
  82. package/lib/components/UserRepository.js +0 -36
  83. package/lib/components/types/RepositoryClass.d.ts +0 -40
  84. package/lib/components/types/RepositoryClass.js +0 -2
  85. package/lib/properties/ObjectProperty copy.d.ts +0 -16
  86. package/lib/properties/ObjectProperty copy.js +0 -85
  87. package/lib/storages/AbstractStorageAdapter.d.ts +0 -23
  88. package/lib/storages/AbstractStorageAdapter.js +0 -13
  89. package/lib/storages/StorageAdapterInterface.d.ts +0 -20
  90. package/lib/storages/StorageAdapterInterface.js +0 -2
  91. package/lib/storages/index.d.ts +0 -9
  92. package/lib/storages/index.js +0 -17
  93. package/lib/storages/types/BlobMediaType.d.ts +0 -8
  94. package/lib/storages/types/BlobMediaType.js +0 -2
  95. package/lib/storages/types/BlobType.d.ts +0 -6
  96. package/lib/storages/types/BlobType.js +0 -2
  97. package/lib/storages/types/DownloadFileMetaType.d.ts +0 -4
  98. package/lib/storages/types/DownloadFileMetaType.js +0 -2
  99. package/lib/storages/types/FileResponseLink.d.ts +0 -7
  100. package/lib/storages/types/FileResponseLink.js +0 -2
  101. package/lib/storages/types/FileResponseUrl.d.ts +0 -4
  102. package/lib/storages/types/FileResponseUrl.js +0 -2
  103. package/lib/storages/types/FileType.d.ts +0 -15
  104. package/lib/storages/types/FileType.js +0 -2
  105. package/lib/storages/types.d.ts +0 -5
  106. package/lib/storages/types.js +0 -2
  107. package/lib/utils/DataGenerator.d.ts +0 -9
  108. package/lib/utils/DataGenerator.js +0 -102
  109. package/lib/utils/index.d.ts +0 -2
  110. package/lib/utils/index.js +0 -5
  111. package/lib/wrappers/cloud/AbstractCloudWrapper.d.ts +0 -4
  112. package/lib/wrappers/cloud/AbstractCloudWrapper.js +0 -9
  113. package/lib/wrappers/cloud/types/DatabaseTriggerType.d.ts +0 -8
  114. package/lib/wrappers/cloud/types/DatabaseTriggerType.js +0 -2
package/lib/Core.d.ts CHANGED
@@ -1,24 +1,14 @@
1
- import { AbstractAuthAdapter } from './authentication';
2
- import { AbstractAdapter } from './backends/AbstractAdapter';
3
1
  import { User } from './components/User';
4
2
  import { DataObjectClass } from './components/types/DataObjectClass';
5
- export type BackendRegistry<T extends AbstractAdapter> = {
6
- [x: string]: T;
7
- };
8
- export interface AuthAdapter extends AbstractAuthAdapter {
9
- }
10
3
  export declare class Core {
11
4
  static storage: any;
12
5
  static storagePrefix: string;
13
- static defaultBackend: string;
14
6
  static userClass: typeof User;
15
7
  static classRegistry: {
16
8
  [key: string]: any;
17
9
  };
18
10
  static logger: Console;
19
- static auth: AuthAdapter | AbstractAuthAdapter;
20
11
  static timestamp: () => string;
21
- protected static _backends: BackendRegistry<any>;
22
12
  static definition(key: string): {
23
13
  manifest: {
24
14
  type: StringConstructor;
@@ -27,8 +17,6 @@ export declare class Core {
27
17
  };
28
18
  static addConfig(key: string, value: any): Promise<void>;
29
19
  static getConfig(key: string): Promise<any>;
30
- static addBackend(backend: AbstractAdapter, alias: string, setDefault?: boolean): void;
31
- static getBackend<T extends AbstractAdapter>(alias?: string): T;
32
20
  static addClass(name: string, obj: any): void;
33
21
  static getClass(name: string): any;
34
22
  /**
package/lib/Core.js CHANGED
@@ -37,20 +37,6 @@ class Core {
37
37
  return yield this.storage.get(`${this.storagePrefix}_${key}`);
38
38
  });
39
39
  }
40
- static addBackend(backend, alias, setDefault = false) {
41
- Core._backends[alias] = backend;
42
- if (setDefault) {
43
- Core.defaultBackend = alias;
44
- }
45
- }
46
- static getBackend(alias = this.defaultBackend) {
47
- if (this._backends[alias]) {
48
- return this._backends[alias];
49
- }
50
- else {
51
- throw new Error(`Unknown backend alias: '${alias}'`);
52
- }
53
- }
54
40
  static addClass(name, obj) {
55
41
  Core.classRegistry[name] = obj;
56
42
  }
@@ -78,10 +64,8 @@ class Core {
78
64
  exports.Core = Core;
79
65
  Core.storage = require('node-persist');
80
66
  Core.storagePrefix = 'core';
81
- Core.defaultBackend = '@default';
82
67
  Core.userClass = User_1.User;
83
68
  Core.classRegistry = {};
84
69
  Core.logger = console;
85
70
  // How timestamp are formatted
86
71
  Core.timestamp = () => new Date().toISOString();
87
- Core._backends = {};
@@ -23,7 +23,7 @@ export declare abstract class AbstractObject {
23
23
  get _(): any;
24
24
  get uri(): import("./ObjectUri").ObjectUri;
25
25
  toJSON(): {
26
- backend: string;
26
+ backend: string | undefined;
27
27
  ref: string;
28
28
  label: string;
29
29
  };
@@ -1,36 +1,7 @@
1
- import { ObjectUri } from './ObjectUri';
2
- import { DataObjectClass } from './types/DataObjectClass';
3
- import { BaseObjectClass } from './types/BaseObjectClass';
4
- import { AbstractObject } from './AbstractObject';
5
- import { BaseObject } from './BaseObject';
6
- import { Query } from '../backends/Query';
7
- import { DataObject } from './DataObject';
8
- import { Persisted } from './types/Persisted';
9
- import { Proxy } from './types/ProxyConstructor';
10
- import { DataObjectProperties } from '../properties';
11
- export declare class BaseObjectCore extends AbstractObject implements BaseObjectClass {
12
- static PROPS_DEFINITION: DataObjectProperties;
13
- static getProperty(key: string): (import("../properties").NumberPropertyType & {
14
- type: string;
15
- }) | (import("../properties").BooleanPropertyType & {
16
- type: string;
17
- }) | (import("../properties").EnumPropertyType & {
18
- type: string;
19
- }) | (import("../properties").ObjectPropertyType & {
20
- type: string;
21
- }) | (import("../properties").StringPropertyType & {
22
- type: string;
23
- }) | (import("../properties").HashPropertyType & {
24
- type: string;
25
- }) | (import("../properties").DateTimeProperty & {
26
- type: string;
27
- }) | (import("../properties").ArrayPropertyType & {
28
- type: string;
29
- }) | (import("../properties").MapPropertyType & {
30
- type: string;
31
- }) | (import("../properties").CollectionPropertyType & {
32
- type: string;
33
- }) | undefined;
1
+ import { ObjectUri, DataObjectClass, DataObject, AbstractObject, BaseObject } from '../';
2
+ export declare class BaseObjectCore extends AbstractObject {
3
+ static PROPS_DEFINITION: any;
4
+ static getProperty(key: string): any;
34
5
  static fillProperties(child?: any): DataObject;
35
6
  static daoFactory(src?: string | ObjectUri | DataObjectClass<any> | undefined, child?: any): Promise<DataObjectClass<any>>;
36
7
  /**
@@ -46,7 +17,7 @@ export declare class BaseObjectCore extends AbstractObject implements BaseObject
46
17
  * @param path
47
18
  * @returns
48
19
  */
49
- static fromBackend<T>(path: string): Promise<Persisted<T>>;
20
+ static fromBackend<T>(path: string): Promise<T>;
50
21
  /**
51
22
  * Instantiates from a DataObject
52
23
  * @param dao
@@ -57,17 +28,5 @@ export declare class BaseObjectCore extends AbstractObject implements BaseObject
57
28
  * Wrap instance into proxy to get access to properties
58
29
  * @returns Proxy
59
30
  */
60
- protected toProxy<T extends BaseObject>(): Proxy<Proxy<T>>;
61
31
  asReference(): any;
62
- /**
63
- * Create a query based on given class where parent is current instance
64
- * @param obj
65
- * @returns Query
66
- */
67
- query(obj: any): Query<any>;
68
- /**
69
- * Create a query based on current class
70
- * @returns Query
71
- */
72
- static query(): Query<typeof BaseObjectCore>;
73
32
  }
@@ -10,13 +10,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.BaseObjectCore = void 0;
13
- const ObjectUri_1 = require("./ObjectUri");
14
- const AbstractObject_1 = require("./AbstractObject");
15
- const BaseObject_1 = require("./BaseObject");
16
- const Query_1 = require("../backends/Query");
17
- const DataObject_1 = require("./DataObject");
18
- const ProxyConstructor_1 = require("./types/ProxyConstructor");
19
- class BaseObjectCore extends AbstractObject_1.AbstractObject {
13
+ const __1 = require("../");
14
+ class BaseObjectCore extends __1.AbstractObject {
20
15
  static getProperty(key) {
21
16
  return BaseObjectCore.PROPS_DEFINITION.find((prop) => prop.name === key);
22
17
  }
@@ -33,7 +28,7 @@ class BaseObjectCore extends AbstractObject_1.AbstractObject {
33
28
  base.push(property);
34
29
  }
35
30
  });
36
- const dao = DataObject_1.DataObject.factory({
31
+ const dao = __1.DataObject.factory({
37
32
  properties: base,
38
33
  parentProp: this.PARENT_PROP,
39
34
  });
@@ -43,7 +38,7 @@ class BaseObjectCore extends AbstractObject_1.AbstractObject {
43
38
  static daoFactory(src = undefined, child = this) {
44
39
  return __awaiter(this, void 0, void 0, function* () {
45
40
  const dao = this.fillProperties(child);
46
- if (src instanceof ObjectUri_1.ObjectUri) {
41
+ if (src instanceof __1.ObjectUri) {
47
42
  dao.uri = src;
48
43
  yield dao.read();
49
44
  }
@@ -62,7 +57,7 @@ class BaseObjectCore extends AbstractObject_1.AbstractObject {
62
57
  */
63
58
  static fromObject(src, child = this) {
64
59
  const dao = this.fillProperties(child);
65
- dao.uri = new ObjectUri_1.ObjectUri(`${this.COLLECTION}${ObjectUri_1.ObjectUri.DEFAULT}`, Reflect.get(src, 'name'));
60
+ dao.uri = new __1.ObjectUri(`${this.COLLECTION}${__1.ObjectUri.DEFAULT}`, Reflect.get(src, 'name'));
66
61
  dao.uri.class = child;
67
62
  dao.populateFromData(src);
68
63
  const obj = new this(dao);
@@ -71,12 +66,12 @@ class BaseObjectCore extends AbstractObject_1.AbstractObject {
71
66
  static factory(src = undefined, child = this) {
72
67
  return __awaiter(this, void 0, void 0, function* () {
73
68
  try {
74
- if (typeof src == 'object' && !(src instanceof ObjectUri_1.ObjectUri)) {
69
+ if (typeof src == 'object' && !(src instanceof __1.ObjectUri)) {
75
70
  return this.fromObject(src);
76
71
  }
77
72
  const dao = yield this.daoFactory(src, child);
78
73
  const constructedObject = Reflect.construct(this, [dao]);
79
- return constructedObject.toProxy();
74
+ return constructedObject;
80
75
  }
81
76
  catch (err) {
82
77
  throw new Error(`Unable to build instance for '${this.name}': ${err.message}`);
@@ -109,61 +104,47 @@ class BaseObjectCore extends AbstractObject_1.AbstractObject {
109
104
  * Wrap instance into proxy to get access to properties
110
105
  * @returns Proxy
111
106
  */
112
- toProxy() {
113
- return new ProxyConstructor_1.ProxyConstructor(this, {
114
- get: (target, prop) => {
115
- if (prop === 'uid') {
116
- return target.uid;
117
- }
118
- if (prop === 'uri') {
119
- return target.uri;
120
- }
121
- if (prop == 'toJSON') {
122
- return target.toJSON;
123
- }
124
- if (prop == 'save') {
125
- return target.save;
126
- }
127
- if (prop == 'constructor') {
128
- return target.constructor;
129
- }
130
- if (prop === 'core') {
131
- return target;
132
- }
133
- // i don't know why and i shouldn't have to wonder why
134
- // but everything crashes unless we do this terribleness
135
- if (prop == 'then') {
136
- return;
137
- }
138
- return target.val(prop);
139
- },
140
- set(target, prop, newValue) {
141
- if (prop === 'uid' || prop === 'core') {
142
- throw new Error(`Property '${prop}' is readonly`);
143
- }
144
- target.set(prop, newValue);
145
- return true;
146
- },
147
- });
148
- }
107
+ // protected toProxy<T extends BaseObject>() {
108
+ // return new ProxyConstructor<this, Proxy<T>>(this, {
109
+ // get: (target, prop) => {
110
+ // if (prop === 'uid') {
111
+ // return target.uid
112
+ // }
113
+ // if (prop === 'uri') {
114
+ // return target.uri
115
+ // }
116
+ // if (prop == 'toJSON') {
117
+ // return target.toJSON
118
+ // }
119
+ // if (prop == 'save') {
120
+ // return target.save
121
+ // }
122
+ // if (prop == 'constructor') {
123
+ // return target.constructor
124
+ // }
125
+ // if (prop === 'core') {
126
+ // return target
127
+ // }
128
+ // // i don't know why and i shouldn't have to wonder why
129
+ // // but everything crashes unless we do this terribleness
130
+ // if (prop == 'then') {
131
+ // return
132
+ // }
133
+ // return target.val(prop as string)
134
+ // },
135
+ // set(target, prop, newValue) {
136
+ // if (prop === 'uid' || prop === 'core') {
137
+ // throw new Error(`Property '${prop}' is readonly`)
138
+ // }
139
+ // target.set(prop as string, newValue)
140
+ // return true
141
+ // },
142
+ // })
143
+ // }
149
144
  asReference() {
150
145
  return this._dataObject.toReference();
151
146
  }
152
- /**
153
- * Create a query based on given class where parent is current instance
154
- * @param obj
155
- * @returns Query
156
- */
157
- query(obj) {
158
- return new Query_1.Query(obj, this);
159
- }
160
- /**
161
- * Create a query based on current class
162
- * @returns Query
163
- */
164
- static query() {
165
- return new Query_1.Query(this);
166
- }
167
147
  }
168
148
  exports.BaseObjectCore = BaseObjectCore;
169
- BaseObjectCore.PROPS_DEFINITION = BaseObject_1.BaseObjectProperties;
149
+ // implements BaseObjectClass {
150
+ BaseObjectCore.PROPS_DEFINITION = __1.BaseObjectProperties;
@@ -26,8 +26,8 @@ export declare class DataObject implements DataObjectClass<any> {
26
26
  protected _objectUri: ObjectUri;
27
27
  protected _uid: string | undefined;
28
28
  protected _properties: Properties;
29
- protected _persisted: boolean;
30
29
  protected _populated: boolean;
30
+ protected _persisted: boolean;
31
31
  protected _parentProp: string | undefined;
32
32
  protected _proxied: any;
33
33
  /**
@@ -40,6 +40,7 @@ export declare class DataObject implements DataObjectClass<any> {
40
40
  */
41
41
  protected constructor(params: DataObjectParams | undefined);
42
42
  protected _init(properties: any[]): void;
43
+ isPersisted(): boolean;
43
44
  /**
44
45
  * Wrap instance into proxy to get access to properties
45
46
  * @returns Proxy
@@ -68,13 +69,7 @@ export declare class DataObject implements DataObjectClass<any> {
68
69
  populateFromData(data: {
69
70
  [x: string]: unknown;
70
71
  }): this;
71
- /**
72
- * Populate data object from backend query
73
- * @param data
74
- */
75
- populateFromBackend(): Promise<DataObject>;
76
72
  isPopulated(): boolean;
77
- isPersisted(): boolean;
78
73
  get properties(): Properties;
79
74
  get backend(): string | undefined;
80
75
  get path(): string;
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DataObject = void 0;
13
- const Core_1 = require("../Core");
14
13
  const Property_1 = require("../properties/Property");
15
14
  const ObjectUri_1 = require("./ObjectUri");
16
15
  const ResourcesErrors_1 = require("../common/ResourcesErrors");
@@ -27,8 +26,8 @@ class DataObject {
27
26
  constructor(params) {
28
27
  this._uid = undefined;
29
28
  this._properties = {};
30
- this._persisted = false;
31
29
  this._populated = false;
30
+ this._persisted = false;
32
31
  /**
33
32
  * Has data been modified since last backend operation?
34
33
  */
@@ -54,6 +53,9 @@ class DataObject {
54
53
  this._properties[prop.name] = Property_1.Property.factory(prop, this);
55
54
  });
56
55
  }
56
+ isPersisted() {
57
+ return this._persisted;
58
+ }
57
59
  /**
58
60
  * Wrap instance into proxy to get access to properties
59
61
  * @returns Proxy
@@ -108,9 +110,8 @@ class DataObject {
108
110
  if (this._populated === false) {
109
111
  if (data) {
110
112
  this.populateFromData(data);
111
- }
112
- else if (this.path !== '/' && this.path !== '') {
113
- yield this.populateFromBackend();
113
+ // } else if (this.path !== '/' && this.path !== '') {
114
+ // await this.populateFromBackend()
114
115
  }
115
116
  this._populated = true;
116
117
  if (Reflect.get(this._properties, 'name')) {
@@ -150,30 +151,9 @@ class DataObject {
150
151
  }
151
152
  return this;
152
153
  }
153
- /**
154
- * Populate data object from backend query
155
- * @param data
156
- */
157
- populateFromBackend() {
158
- return __awaiter(this, void 0, void 0, function* () {
159
- if (this._populated === false) {
160
- if (this.path !== '/' && this.path !== '') {
161
- yield Core_1.Core.getBackend(this._objectUri.backend).read(this);
162
- }
163
- this._populated = true;
164
- if (Reflect.get(this._properties, 'name')) {
165
- this.uri.label = this.val('name');
166
- }
167
- }
168
- return this;
169
- });
170
- }
171
154
  isPopulated() {
172
155
  return this._populated;
173
156
  }
174
- isPersisted() {
175
- return this._persisted;
176
- }
177
157
  get properties() {
178
158
  return this._properties;
179
159
  }
@@ -198,7 +178,7 @@ class DataObject {
198
178
  set uri(uri) {
199
179
  this._objectUri = uri;
200
180
  if (this._objectUri.collection !== ObjectUri_1.ObjectUri.MISSING_COLLECTION) {
201
- this._persisted = true;
181
+ // this._persisted = true
202
182
  }
203
183
  }
204
184
  get uri() {
@@ -304,27 +284,15 @@ class DataObject {
304
284
  }
305
285
  read() {
306
286
  return __awaiter(this, void 0, void 0, function* () {
307
- try {
308
- return yield Core_1.Core.getBackend().read(this); //this.populate()
309
- }
310
- catch (err) {
311
- console.log(err.message);
312
- throw new Error(err.message);
313
- }
287
+ throw new Error(`This is just a stub, please use DataObject from @quatrain/backend to persist`);
314
288
  });
315
289
  }
316
290
  save() {
317
- const backend = Core_1.Core.getBackend(this.backend || Core_1.Core.defaultBackend);
318
- this._persisted = true;
319
- this._modified = false;
320
- return this.uid ? backend.update(this) : backend.create(this);
291
+ throw new Error(`This is just a stub, please use DataObject from @quatrain/backend to persist`);
321
292
  }
322
293
  delete() {
323
294
  return __awaiter(this, void 0, void 0, function* () {
324
- const backend = Core_1.Core.getBackend(this.backend || Core_1.Core.defaultBackend);
325
- this._persisted = false;
326
- this._modified = false;
327
- return yield backend.delete(this);
295
+ throw new Error(`This is just a stub, please use DataObject from @quatrain/backend to persist`);
328
296
  });
329
297
  }
330
298
  /**
@@ -4,7 +4,7 @@ export declare class ObjectUri {
4
4
  protected _str: string;
5
5
  protected _pairs: Array<string>;
6
6
  protected _literal: string;
7
- protected _backend: string;
7
+ protected _backend: string | undefined;
8
8
  protected _path: string;
9
9
  protected _uid: string | undefined;
10
10
  protected _collection: string | undefined;
@@ -21,7 +21,7 @@ export declare class ObjectUri {
21
21
  constructor(str?: string, label?: string | undefined);
22
22
  set class(objClass: any);
23
23
  get class(): any;
24
- get backend(): string;
24
+ get backend(): string | undefined;
25
25
  /**
26
26
  * Returns the full path of the resource
27
27
  * including optional parents' path
@@ -57,7 +57,7 @@ export declare class ObjectUri {
57
57
  label: string | undefined;
58
58
  };
59
59
  toJSON(): {
60
- backend: string;
60
+ backend: string | undefined;
61
61
  ref: string;
62
62
  label: string;
63
63
  };
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ObjectUri = void 0;
4
- const Core_1 = require("../Core");
5
4
  class ObjectUri {
6
5
  /**
7
6
  * create object uri from string:
@@ -13,7 +12,6 @@ class ObjectUri {
13
12
  constructor(str = '', label = '') {
14
13
  this._pairs = [];
15
14
  this._literal = '';
16
- this._backend = Core_1.Core.defaultBackend;
17
15
  this._path = ObjectUri.DEFAULT;
18
16
  this._uid = undefined;
19
17
  this._collection = undefined;
@@ -22,7 +20,7 @@ class ObjectUri {
22
20
  this._label = label;
23
21
  if (str.includes(':')) {
24
22
  const [backend, path] = str.split(':');
25
- this._backend = backend || Core_1.Core.defaultBackend;
23
+ this._backend = backend;
26
24
  this._path = path;
27
25
  }
28
26
  else {
@@ -2,9 +2,7 @@ import { DataObject, DataObjectParams } from './DataObject';
2
2
  import { DataObjectClass } from './types/DataObjectClass';
3
3
  import { ObjectUri } from './ObjectUri';
4
4
  import { AbstractObject } from './AbstractObject';
5
- import { BaseObjectCore } from './BaseObjectCore';
6
5
  import { BaseObjectProperties } from './BaseObject';
7
- import BaseRepository from './BaseRepository';
8
6
  import { User, UserProperties } from './User';
9
7
  import { Entity } from './Entity';
10
- export { DataObject, DataObjectParams, DataObjectClass, ObjectUri, AbstractObject, BaseObjectCore, BaseRepository, User, Entity, BaseObjectProperties, UserProperties, };
8
+ export { DataObject, DataObjectParams, DataObjectClass, ObjectUri, AbstractObject, User, Entity, BaseObjectProperties, UserProperties, };
@@ -1,21 +1,14 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.UserProperties = exports.BaseObjectProperties = exports.Entity = exports.User = exports.BaseRepository = exports.BaseObjectCore = exports.AbstractObject = exports.ObjectUri = exports.DataObject = void 0;
3
+ exports.UserProperties = exports.BaseObjectProperties = exports.Entity = exports.User = exports.AbstractObject = exports.ObjectUri = exports.DataObject = void 0;
7
4
  const DataObject_1 = require("./DataObject");
8
5
  Object.defineProperty(exports, "DataObject", { enumerable: true, get: function () { return DataObject_1.DataObject; } });
9
6
  const ObjectUri_1 = require("./ObjectUri");
10
7
  Object.defineProperty(exports, "ObjectUri", { enumerable: true, get: function () { return ObjectUri_1.ObjectUri; } });
11
8
  const AbstractObject_1 = require("./AbstractObject");
12
9
  Object.defineProperty(exports, "AbstractObject", { enumerable: true, get: function () { return AbstractObject_1.AbstractObject; } });
13
- const BaseObjectCore_1 = require("./BaseObjectCore");
14
- Object.defineProperty(exports, "BaseObjectCore", { enumerable: true, get: function () { return BaseObjectCore_1.BaseObjectCore; } });
15
10
  const BaseObject_1 = require("./BaseObject");
16
11
  Object.defineProperty(exports, "BaseObjectProperties", { enumerable: true, get: function () { return BaseObject_1.BaseObjectProperties; } });
17
- const BaseRepository_1 = __importDefault(require("./BaseRepository"));
18
- exports.BaseRepository = BaseRepository_1.default;
19
12
  const User_1 = require("./User");
20
13
  Object.defineProperty(exports, "User", { enumerable: true, get: function () { return User_1.User; } });
21
14
  Object.defineProperty(exports, "UserProperties", { enumerable: true, get: function () { return User_1.UserProperties; } });
package/lib/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
1
  import { Core } from './Core';
2
2
  import * as statuses from './common/statuses';
3
- import * as utils from './utils';
4
3
  import { Property } from './properties/Property';
5
4
  import { BaseProperty, BasePropertyType } from './properties/BaseProperty';
6
5
  import { StringProperty, StringPropertyType } from './properties/StringProperty';
7
6
  import { EnumProperty, EnumPropertyType } from './properties/EnumProperty';
8
7
  import { BooleanProperty, BooleanPropertyType } from './properties/BooleanProperty';
9
- import { ObjectProperty, ObjectPropertyType } from './properties/ObjectProperty';
8
+ import { ObjectProperty, ObjectPropertyType, returnAs } from './properties/ObjectProperty';
10
9
  import { DateTimeProperty, DateTimePropertyType } from './properties/DateTimeProperty';
11
10
  import { HashProperty, HashPropertyType } from './properties/HashProperty';
11
+ import { CollectionProperty, CollectionPropertyType } from './properties/CollectionProperty';
12
+ import { ArrayProperty, ArrayPropertyType } from './properties/ArrayProperty';
12
13
  import { AbstractObject } from './components/AbstractObject';
13
14
  import { ObjectUri } from './components/ObjectUri';
14
15
  import { DataObjectClass } from './components/types/DataObjectClass';
@@ -16,20 +17,7 @@ import { DataObject } from './components/DataObject';
16
17
  import { BaseObjectCore } from './components/BaseObjectCore';
17
18
  import { BaseObject, BaseObjectProperties } from './components/BaseObject';
18
19
  import { Proxy } from './components/types/ProxyConstructor';
19
- import { InjectMetaMiddleware } from './backends/middlewares/InjectMetaMiddleware';
20
- import { InjectKeywordsMiddleware } from './backends/middlewares/InjectKeywordsMiddleware';
21
- import RepositoryClass from './components/types/RepositoryClass';
22
- import BaseRepository from './components/BaseRepository';
23
- import { BackendAction, BackendParameters, BackendParametersKeys, BackendRecordType } from './Backend';
24
- import Middleware from './backends/middlewares/Middleware';
25
20
  import { UserType, User } from './components/User';
26
- import UserRepository from './components/UserRepository';
27
21
  import { EntityType, Entity } from './components/Entity';
28
- import EntityRepository from './components/EntityRepository';
29
- import { AuthAction, AuthParameters, AuthParametersKeys } from './Auth';
30
- import { AuthInterface, AbstractAuthAdapter, AuthenticationError } from './authentication';
31
- import { AbstractAdapter, MockAdapter, BackendError, Query, QueryMetaType, QueryResultType, Filter, Filters, Limits, Sorting, SortAndLimit } from './backends';
32
22
  import { BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, GoneError } from './common/ResourcesErrors';
33
- import { DatabaseTriggerType } from './wrappers/cloud/types/DatabaseTriggerType';
34
- import { AbstractCloudWrapper } from './wrappers/cloud/AbstractCloudWrapper';
35
- export { statuses, utils, Core, Property, BaseProperty, BasePropertyType, BooleanProperty, BooleanPropertyType, DateTimeProperty, DateTimePropertyType, EnumProperty, EnumPropertyType, HashProperty, HashPropertyType, ObjectProperty, ObjectPropertyType, StringProperty, StringPropertyType, AbstractAdapter, RepositoryClass, MockAdapter, ObjectUri, DataObjectClass, DataObject, AbstractObject, BaseObject, BaseObjectCore, BaseObjectProperties, AuthAction, AuthParameters, AuthParametersKeys, AuthInterface, AbstractAuthAdapter, AuthenticationError, BackendParameters, BackendParametersKeys, BackendRecordType, BackendAction, BaseRepository, BackendError, Query, QueryMetaType, QueryResultType, Filter, Filters, Limits, Sorting, SortAndLimit, Middleware, InjectMetaMiddleware, InjectKeywordsMiddleware, User, UserType, Proxy, UserRepository, Entity, EntityType, EntityRepository, BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, GoneError, DatabaseTriggerType, AbstractCloudWrapper, };
23
+ export { statuses, Core, Property, BaseProperty, BasePropertyType, BooleanProperty, BooleanPropertyType, DateTimeProperty, DateTimePropertyType, EnumProperty, EnumPropertyType, HashProperty, HashPropertyType, CollectionProperty, CollectionPropertyType, ArrayProperty, ArrayPropertyType, ObjectProperty, ObjectPropertyType, returnAs, StringProperty, StringPropertyType, ObjectUri, DataObjectClass, DataObject, AbstractObject, BaseObject, BaseObjectCore, BaseObjectProperties, User, UserType, Proxy, Entity, EntityType, BadRequestError, UnauthorizedError, ForbiddenError, NotFoundError, GoneError, };