remult 0.23.0-exp.24 → 0.23.0-exp.26
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/README.md +1 -0
- package/esm/postgres/schema-builder.d.ts +1 -0
- package/esm/postgres/schema-builder.js +12 -1
- package/esm/src/context.js +1 -0
- package/esm/src/data-api.js +4 -1
- package/esm/src/remult-proxy.js +3 -2
- package/esm/src/remult3/remult3.d.ts +20 -0
- package/esm/src/remult3/remult3.js +25 -0
- package/package.json +1 -1
- package/postgres/schema-builder.d.ts +1 -0
- package/postgres/schema-builder.js +11 -1
- package/src/context.js +1 -0
- package/src/data-api.js +4 -1
- package/src/remult-proxy.js +9 -4
- package/src/remult3/remult3.d.ts +20 -0
- package/src/remult3/remult3.js +25 -0
package/README.md
CHANGED
|
@@ -277,6 +277,7 @@ with a Node.js Express backend.
|
|
|
277
277
|
- [Tutorial with Angular](https://remult.dev/tutorials/angular/)
|
|
278
278
|
- [Tutorial with Vue](https://remult.dev/tutorials/vue/)
|
|
279
279
|
- [Tutorial with Next.js](https://remult.dev/tutorials/react-next/)
|
|
280
|
+
- [Tutorial with Sveltekit](https://remult.dev/tutorials/sveltekit/)
|
|
280
281
|
|
|
281
282
|
## Documentation
|
|
282
283
|
|
|
@@ -9,6 +9,7 @@ export declare class PostgresSchemaBuilder {
|
|
|
9
9
|
private removeQuotes;
|
|
10
10
|
private whereTableAndSchema;
|
|
11
11
|
private schemaAndName;
|
|
12
|
+
private schemaOnly;
|
|
12
13
|
verifyStructureOfAllEntities(remult?: Remult): Promise<void>;
|
|
13
14
|
ensureSchema(entities: EntityMetadata<any>[]): Promise<void>;
|
|
14
15
|
createIfNotExist(entity: EntityMetadata): Promise<void>;
|
|
@@ -79,6 +79,16 @@ export class PostgresSchemaBuilder {
|
|
|
79
79
|
}
|
|
80
80
|
return e.$entityName;
|
|
81
81
|
}
|
|
82
|
+
schemaOnly(e) {
|
|
83
|
+
if (e.$entityName.includes('.')) {
|
|
84
|
+
return e.$entityName.split('.')[0];
|
|
85
|
+
}
|
|
86
|
+
if (this.specifiedSchema) {
|
|
87
|
+
return this.specifiedSchema;
|
|
88
|
+
}
|
|
89
|
+
// Should default to `public`
|
|
90
|
+
return 'public';
|
|
91
|
+
}
|
|
82
92
|
async verifyStructureOfAllEntities(remult) {
|
|
83
93
|
if (!remult) {
|
|
84
94
|
remult = defaultRemult;
|
|
@@ -134,7 +144,8 @@ export class PostgresSchemaBuilder {
|
|
|
134
144
|
result += ' primary key';
|
|
135
145
|
}
|
|
136
146
|
}
|
|
137
|
-
let sql = `CREATE
|
|
147
|
+
let sql = `CREATE SCHEMA IF NOT EXISTS ${this.schemaOnly(e)};
|
|
148
|
+
CREATE table ${this.schemaAndName(e)} (${result}\r\n)`;
|
|
138
149
|
if (PostgresSchemaBuilder.logToConsole)
|
|
139
150
|
console.info(sql);
|
|
140
151
|
await this.pool.execute(sql);
|
package/esm/src/context.js
CHANGED
|
@@ -289,3 +289,4 @@ class transactionLiveQueryPublisher {
|
|
|
289
289
|
//p1 - seems that after backend methods relations are loaded for some reason - see trempim - intake doRequest backend method
|
|
290
290
|
//p1 - reconsider the case in tremping where create user id was updated with some user and not the actual user
|
|
291
291
|
//[ ] - when value changes for field with error, clear error - so the user will feel comfortable
|
|
292
|
+
//y1 - require filter argument - and perform validation checks for it - site, id etc.. changelog, status changes etc...,
|
package/esm/src/data-api.js
CHANGED
|
@@ -89,7 +89,10 @@ export class DataApi {
|
|
|
89
89
|
databaseCustom: () => { },
|
|
90
90
|
isGreaterOrEqualTo: () => { },
|
|
91
91
|
isGreaterThan: () => { },
|
|
92
|
-
isIn: () => {
|
|
92
|
+
isIn: (col) => {
|
|
93
|
+
if (this.repository.metadata.idMetadata.isIdField(col))
|
|
94
|
+
hasId = true;
|
|
95
|
+
},
|
|
93
96
|
isLessOrEqualTo: () => { },
|
|
94
97
|
isLessThan: () => { },
|
|
95
98
|
isNotNull: () => { },
|
package/esm/src/remult-proxy.js
CHANGED
|
@@ -91,10 +91,11 @@ export class RemultProxy {
|
|
|
91
91
|
.remultFactory()
|
|
92
92
|
.repo(...args)
|
|
93
93
|
.relations(args2),
|
|
94
|
-
validate: (a, b) => self
|
|
94
|
+
validate: (a, ...b) => self
|
|
95
95
|
.remultFactory()
|
|
96
96
|
.repo(...args)
|
|
97
|
-
|
|
97
|
+
//@ts-ignore
|
|
98
|
+
.validate(a, ...b),
|
|
98
99
|
addEventListener: (...args2) => self
|
|
99
100
|
.remultFactory()
|
|
100
101
|
.repo(...args)
|
|
@@ -550,3 +550,23 @@ export interface ClassDecoratorContextStub<Class extends new (...args: any) => a
|
|
|
550
550
|
addInitializer(initializer: (this: Class) => void): void;
|
|
551
551
|
}
|
|
552
552
|
export type ClassFieldDecorator<entityType, valueType> = (target: any, context: string | ClassFieldDecoratorContextStub<entityType, valueType | undefined>, c?: any) => void;
|
|
553
|
+
/**
|
|
554
|
+
* //p1 - doc this
|
|
555
|
+
remult.apiClient.httpClient = (
|
|
556
|
+
input: RequestInfo | URL,
|
|
557
|
+
init?: RequestInit
|
|
558
|
+
) => {
|
|
559
|
+
return fetch(input, {
|
|
560
|
+
...init,
|
|
561
|
+
headers: {
|
|
562
|
+
authorization: 'Bearer ' + sessionStorage.sessionId,
|
|
563
|
+
},
|
|
564
|
+
cache: 'no-store',
|
|
565
|
+
})
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
&&
|
|
569
|
+
remult.apiClient.url='localhost:3007/api
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
*/
|
|
@@ -30,3 +30,28 @@ export {};
|
|
|
30
30
|
//y1 - discuss a default date formatter
|
|
31
31
|
//p1 - consider using this in saving etc...
|
|
32
32
|
//p1 - when subscribe is forbidden - the query still runs after the renew process
|
|
33
|
+
//p1 - JSON FIELD LOST JSON STORAGE WHEN SET INPUT VALUE
|
|
34
|
+
//p1 - doc this:
|
|
35
|
+
/**
|
|
36
|
+
* //p1 - doc this
|
|
37
|
+
remult.apiClient.httpClient = (
|
|
38
|
+
input: RequestInfo | URL,
|
|
39
|
+
init?: RequestInit
|
|
40
|
+
) => {
|
|
41
|
+
return fetch(input, {
|
|
42
|
+
...init,
|
|
43
|
+
headers: {
|
|
44
|
+
authorization: 'Bearer ' + sessionStorage.sessionId,
|
|
45
|
+
},
|
|
46
|
+
cache: 'no-store',
|
|
47
|
+
})
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&&
|
|
51
|
+
remult.apiClient.url='localhost:3007/api
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
*/
|
|
55
|
+
//p1 - with remult promise for remultexpress
|
|
56
|
+
//p1 - 'update tasks set where id = $1
|
|
57
|
+
//p1 - live query refresh of view on table update
|
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ export declare class PostgresSchemaBuilder {
|
|
|
9
9
|
private removeQuotes;
|
|
10
10
|
private whereTableAndSchema;
|
|
11
11
|
private schemaAndName;
|
|
12
|
+
private schemaOnly;
|
|
12
13
|
verifyStructureOfAllEntities(remult?: Remult): Promise<void>;
|
|
13
14
|
ensureSchema(entities: EntityMetadata<any>[]): Promise<void>;
|
|
14
15
|
createIfNotExist(entity: EntityMetadata): Promise<void>;
|
|
@@ -96,6 +96,16 @@ var PostgresSchemaBuilder = /** @class */ (function () {
|
|
|
96
96
|
}
|
|
97
97
|
return e.$entityName;
|
|
98
98
|
};
|
|
99
|
+
PostgresSchemaBuilder.prototype.schemaOnly = function (e) {
|
|
100
|
+
if (e.$entityName.includes('.')) {
|
|
101
|
+
return e.$entityName.split('.')[0];
|
|
102
|
+
}
|
|
103
|
+
if (this.specifiedSchema) {
|
|
104
|
+
return this.specifiedSchema;
|
|
105
|
+
}
|
|
106
|
+
// Should default to `public`
|
|
107
|
+
return 'public';
|
|
108
|
+
};
|
|
99
109
|
PostgresSchemaBuilder.prototype.verifyStructureOfAllEntities = function (remult) {
|
|
100
110
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
101
111
|
var completed, entities, _a, _b, entityClass, entity, e, e_1_1;
|
|
@@ -245,7 +255,7 @@ var PostgresSchemaBuilder = /** @class */ (function () {
|
|
|
245
255
|
}
|
|
246
256
|
finally { if (e_3) throw e_3.error; }
|
|
247
257
|
}
|
|
248
|
-
sql = "CREATE table ".concat(this.schemaAndName(e), " (").concat(result, "\r\n)");
|
|
258
|
+
sql = "CREATE SCHEMA IF NOT EXISTS ".concat(this.schemaOnly(e), ";\nCREATE table ").concat(this.schemaAndName(e), " (").concat(result, "\r\n)");
|
|
249
259
|
if (PostgresSchemaBuilder.logToConsole)
|
|
250
260
|
console.info(sql);
|
|
251
261
|
return [4 /*yield*/, this.pool.execute(sql)];
|
package/src/context.js
CHANGED
|
@@ -453,3 +453,4 @@ var transactionLiveQueryPublisher = /** @class */ (function () {
|
|
|
453
453
|
//p1 - seems that after backend methods relations are loaded for some reason - see trempim - intake doRequest backend method
|
|
454
454
|
//p1 - reconsider the case in tremping where create user id was updated with some user and not the actual user
|
|
455
455
|
//[ ] - when value changes for field with error, clear error - so the user will feel comfortable
|
|
456
|
+
//y1 - require filter argument - and perform validation checks for it - site, id etc.. changelog, status changes etc...,
|
package/src/data-api.js
CHANGED
|
@@ -143,7 +143,10 @@ var DataApi = /** @class */ (function () {
|
|
|
143
143
|
databaseCustom: function () { },
|
|
144
144
|
isGreaterOrEqualTo: function () { },
|
|
145
145
|
isGreaterThan: function () { },
|
|
146
|
-
isIn: function () {
|
|
146
|
+
isIn: function (col) {
|
|
147
|
+
if (_this.repository.metadata.idMetadata.isIdField(col))
|
|
148
|
+
hasId_1 = true;
|
|
149
|
+
},
|
|
147
150
|
isLessOrEqualTo: function () { },
|
|
148
151
|
isLessThan: function () { },
|
|
149
152
|
isNotNull: function () { },
|
package/src/remult-proxy.js
CHANGED
|
@@ -50,11 +50,16 @@ var RemultProxy = /** @class */ (function () {
|
|
|
50
50
|
.remultFactory())
|
|
51
51
|
.repo.apply(_a, tslib_1.__spreadArray([], tslib_1.__read(args), false)).relations(args2);
|
|
52
52
|
},
|
|
53
|
-
_a.validate = function (a
|
|
54
|
-
var _a;
|
|
55
|
-
|
|
53
|
+
_a.validate = function (a) {
|
|
54
|
+
var _a, _b;
|
|
55
|
+
var b = [];
|
|
56
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
57
|
+
b[_i - 1] = arguments[_i];
|
|
58
|
+
}
|
|
59
|
+
return (_a = (_b = self
|
|
56
60
|
.remultFactory())
|
|
57
|
-
.repo.apply(
|
|
61
|
+
.repo.apply(_b, tslib_1.__spreadArray([], tslib_1.__read(args), false)))
|
|
62
|
+
.validate.apply(_a, tslib_1.__spreadArray([a], tslib_1.__read(b), false));
|
|
58
63
|
},
|
|
59
64
|
_a.addEventListener = function () {
|
|
60
65
|
var _a, _b;
|
package/src/remult3/remult3.d.ts
CHANGED
|
@@ -550,3 +550,23 @@ export interface ClassDecoratorContextStub<Class extends new (...args: any) => a
|
|
|
550
550
|
addInitializer(initializer: (this: Class) => void): void;
|
|
551
551
|
}
|
|
552
552
|
export type ClassFieldDecorator<entityType, valueType> = (target: any, context: string | ClassFieldDecoratorContextStub<entityType, valueType | undefined>, c?: any) => void;
|
|
553
|
+
/**
|
|
554
|
+
* //p1 - doc this
|
|
555
|
+
remult.apiClient.httpClient = (
|
|
556
|
+
input: RequestInfo | URL,
|
|
557
|
+
init?: RequestInit
|
|
558
|
+
) => {
|
|
559
|
+
return fetch(input, {
|
|
560
|
+
...init,
|
|
561
|
+
headers: {
|
|
562
|
+
authorization: 'Bearer ' + sessionStorage.sessionId,
|
|
563
|
+
},
|
|
564
|
+
cache: 'no-store',
|
|
565
|
+
})
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
&&
|
|
569
|
+
remult.apiClient.url='localhost:3007/api
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
*/
|
package/src/remult3/remult3.js
CHANGED
|
@@ -31,3 +31,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
//y1 - discuss a default date formatter
|
|
32
32
|
//p1 - consider using this in saving etc...
|
|
33
33
|
//p1 - when subscribe is forbidden - the query still runs after the renew process
|
|
34
|
+
//p1 - JSON FIELD LOST JSON STORAGE WHEN SET INPUT VALUE
|
|
35
|
+
//p1 - doc this:
|
|
36
|
+
/**
|
|
37
|
+
* //p1 - doc this
|
|
38
|
+
remult.apiClient.httpClient = (
|
|
39
|
+
input: RequestInfo | URL,
|
|
40
|
+
init?: RequestInit
|
|
41
|
+
) => {
|
|
42
|
+
return fetch(input, {
|
|
43
|
+
...init,
|
|
44
|
+
headers: {
|
|
45
|
+
authorization: 'Bearer ' + sessionStorage.sessionId,
|
|
46
|
+
},
|
|
47
|
+
cache: 'no-store',
|
|
48
|
+
})
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&&
|
|
52
|
+
remult.apiClient.url='localhost:3007/api
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
*/
|
|
56
|
+
//p1 - with remult promise for remultexpress
|
|
57
|
+
//p1 - 'update tasks set where id = $1
|
|
58
|
+
//p1 - live query refresh of view on table update
|