prostgles-server 2.0.136 → 2.0.137

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 (88) hide show
  1. package/dist/AuthHandler.d.ts.map +1 -1
  2. package/dist/AuthHandler.js +5 -1
  3. package/dist/AuthHandler.js.map +1 -1
  4. package/examples/client/react-typescript/README.md +44 -0
  5. package/examples/client/react-typescript/package-lock.json +13909 -0
  6. package/examples/client/react-typescript/package.json +39 -0
  7. package/examples/client/react-typescript/public/favicon.ico +0 -0
  8. package/examples/client/react-typescript/public/index.html +43 -0
  9. package/examples/client/react-typescript/public/logo192.png +0 -0
  10. package/examples/client/react-typescript/public/logo512.png +0 -0
  11. package/examples/client/react-typescript/public/manifest.json +25 -0
  12. package/examples/client/react-typescript/public/robots.txt +3 -0
  13. package/examples/client/react-typescript/src/App.css +38 -0
  14. package/examples/client/react-typescript/src/App.test.tsx +9 -0
  15. package/examples/client/react-typescript/src/App.tsx +26 -0
  16. package/examples/client/react-typescript/src/index.css +13 -0
  17. package/examples/client/react-typescript/src/index.tsx +17 -0
  18. package/examples/client/react-typescript/src/logo.svg +7 -0
  19. package/examples/client/react-typescript/src/react-app-env.d.ts +1 -0
  20. package/examples/client/react-typescript/src/serviceWorker.ts +149 -0
  21. package/examples/client/react-typescript/src/setupTests.ts +5 -0
  22. package/examples/client/react-typescript/tsconfig.json +25 -0
  23. package/examples/client/vanilla-js/index.html +21 -0
  24. package/examples/full-example-react/client/README.md +68 -0
  25. package/examples/full-example-react/client/package-lock.json +14134 -0
  26. package/examples/full-example-react/client/package.json +36 -0
  27. package/examples/full-example-react/client/public/favicon.ico +0 -0
  28. package/examples/full-example-react/client/public/index.html +43 -0
  29. package/examples/full-example-react/client/public/logo192.png +0 -0
  30. package/examples/full-example-react/client/public/logo512.png +0 -0
  31. package/examples/full-example-react/client/public/manifest.json +25 -0
  32. package/examples/full-example-react/client/public/robots.txt +3 -0
  33. package/examples/full-example-react/client/src/App.css +14 -0
  34. package/examples/full-example-react/client/src/App.js +58 -0
  35. package/examples/full-example-react/client/src/App.test.js +9 -0
  36. package/examples/full-example-react/client/src/index.css +13 -0
  37. package/examples/full-example-react/client/src/index.js +17 -0
  38. package/examples/full-example-react/client/src/logo.svg +7 -0
  39. package/examples/full-example-react/client/src/serviceWorker.js +141 -0
  40. package/examples/full-example-react/client/src/setupTests.js +5 -0
  41. package/examples/full-example-react/client/src/sssetupProxy.js +6 -0
  42. package/examples/full-example-react/server/index.js +42 -0
  43. package/examples/full-example-react/server/init.sql +7 -0
  44. package/examples/full-example-react/server/package.json +18 -0
  45. package/examples/full-example-typescript/DBoGenerated.d.ts +74 -0
  46. package/examples/full-example-typescript/DBoGenerated.d.ts.map +1 -0
  47. package/examples/full-example-typescript/DBoGenerated.js +6 -0
  48. package/examples/full-example-typescript/DBoGenerated.js.map +1 -0
  49. package/examples/full-example-typescript/DBoGenerated.ts +67 -0
  50. package/examples/full-example-typescript/home.html +30 -0
  51. package/examples/full-example-typescript/index.d.ts +2 -0
  52. package/examples/full-example-typescript/index.d.ts.map +1 -0
  53. package/examples/full-example-typescript/index.js +66 -0
  54. package/examples/full-example-typescript/index.js.map +1 -0
  55. package/examples/full-example-typescript/index.ts +74 -0
  56. package/examples/full-example-typescript/init.sql +17 -0
  57. package/examples/full-example-typescript/package copy.json +16 -0
  58. package/examples/full-example-typescript/package.json +19 -0
  59. package/examples/full-example-typescript/tsconfig.json +24 -0
  60. package/examples/full-example-vanilla/home.html +131 -0
  61. package/examples/full-example-vanilla/index.js +108 -0
  62. package/examples/full-example-vanilla/init.sql +69 -0
  63. package/examples/full-example-vanilla/package.json +18 -0
  64. package/examples/server/javascript/index.js +27 -0
  65. package/examples/server/javascript/init.sql +5 -0
  66. package/examples/server/javascript/package.json +16 -0
  67. package/examples/server/typescript/DBoGenerated.d.ts +168 -0
  68. package/examples/server/typescript/DBoGenerated.d.ts.map +1 -0
  69. package/examples/server/typescript/DBoGenerated.js +5 -0
  70. package/examples/server/typescript/DBoGenerated.js.map +1 -0
  71. package/examples/server/typescript/DBoGenerated.ts +125 -0
  72. package/examples/server/typescript/index.d.ts +2 -0
  73. package/examples/server/typescript/index.d.ts.map +1 -0
  74. package/examples/server/typescript/index.js +54 -0
  75. package/examples/server/typescript/index.js.map +1 -0
  76. package/examples/server/typescript/index.ts +52 -0
  77. package/examples/server/typescript/init.sql +20 -0
  78. package/examples/server/typescript/package.json +17 -0
  79. package/examples/server/typescript/tsconfig.json +17 -0
  80. package/lib/AuthHandler.ts +5 -2
  81. package/package.json +2 -2
  82. package/tests/client/PID.txt +1 -1
  83. package/tests/server/DBoGenerated.d.ts +0 -190
  84. package/tests/server/package-lock.json +2 -2
  85. package/tests/server/media/7b46d3c8-67f7-457c-b194-50bc815a1fa9.txt +0 -1
  86. package/tests/server/media/807b5037-8b8a-4871-bf68-4c0bf6cfcf19.txt +0 -1
  87. package/tests/server/media/e474c32f-8cf2-4678-9049-1bce3a17c2e5.txt +0 -1
  88. package/tests/server/media/fa20ecbf-935a-4ca2-b48d-a4aebc00fff8.txt +0 -1
@@ -0,0 +1,168 @@
1
+ export declare type Filter = object | {} | undefined;
2
+ export declare type GroupFilter = {
3
+ $and: Filter;
4
+ } | {
5
+ $or: Filter;
6
+ };
7
+ export declare type FieldFilter = object | string[] | "*" | "";
8
+ export declare type OrderBy = {
9
+ key: string;
10
+ asc: boolean;
11
+ }[] | {
12
+ [key: string]: boolean;
13
+ }[] | string | string[];
14
+ export declare type SelectParams = {
15
+ select?: FieldFilter;
16
+ limit?: number;
17
+ offset?: number;
18
+ orderBy?: OrderBy;
19
+ expectOne?: boolean;
20
+ };
21
+ export declare type UpdateParams = {
22
+ returning?: FieldFilter;
23
+ onConflictDoNothing?: boolean;
24
+ TxHandler: any;
25
+ fixIssues?: boolean;
26
+ multi?: boolean;
27
+ };
28
+ export declare type InsertParams = {
29
+ returning?: FieldFilter;
30
+ onConflictDoNothing?: boolean;
31
+ fixIssues?: boolean;
32
+ };
33
+ export declare type DeleteParams = {
34
+ returning?: FieldFilter;
35
+ };
36
+ export declare type TxCB = {
37
+ (t: DBObj): (any | void | Promise<(any | void)>);
38
+ };
39
+ export declare type Items = {
40
+ name?: string;
41
+ h?: Array<string>;
42
+ id?: number;
43
+ };
44
+ export declare type Items_Filter = Items | object | {
45
+ $and: (Items | object)[];
46
+ } | {
47
+ $or: (Items | object)[];
48
+ };
49
+ export declare type Items2 = {
50
+ id?: number;
51
+ h?: Array<string>;
52
+ name?: string;
53
+ };
54
+ export declare type Items2_Filter = Items2 | object | {
55
+ $and: (Items2 | object)[];
56
+ } | {
57
+ $or: (Items2 | object)[];
58
+ };
59
+ export declare type Items3 = {
60
+ h?: Array<string>;
61
+ name?: string;
62
+ id?: number;
63
+ };
64
+ export declare type Items3_Filter = Items3 | object | {
65
+ $and: (Items3 | object)[];
66
+ } | {
67
+ $or: (Items3 | object)[];
68
+ };
69
+ export declare type Table = {
70
+ id?: string;
71
+ };
72
+ export declare type Table_Filter = Table | object | {
73
+ $and: (Table | object)[];
74
+ } | {
75
+ $or: (Table | object)[];
76
+ };
77
+ export declare type Transaction = {
78
+ id?: string;
79
+ };
80
+ export declare type Transaction_Filter = Transaction | object | {
81
+ $and: (Transaction | object)[];
82
+ } | {
83
+ $or: (Transaction | object)[];
84
+ };
85
+ export declare type DBO_items = {
86
+ find: (filter?: Items_Filter, selectParams?: SelectParams) => Promise<Items[] | object[]>;
87
+ findOne: (filter?: Items_Filter, selectParams?: SelectParams) => Promise<Items | object>;
88
+ subscribe: (filter: Items_Filter, params: SelectParams, onData: (items: Items[]) => any) => Promise<{
89
+ unsubscribe: () => any;
90
+ }>;
91
+ subscribeOne: (filter: Items_Filter, params: SelectParams, onData: (item: Items) => any) => Promise<{
92
+ unsubscribe: () => any;
93
+ }>;
94
+ count: (filter?: Items_Filter) => Promise<number>;
95
+ update: (filter: Items_Filter, newData: Items, params?: UpdateParams) => Promise<void | Items>;
96
+ upsert: (filter: Items_Filter, newData: Items, params?: UpdateParams) => Promise<void | Items>;
97
+ insert: (data: (Items | Items[]), params?: InsertParams) => Promise<void | Items>;
98
+ delete: (filter: Items_Filter, params?: DeleteParams) => Promise<void | Items>;
99
+ };
100
+ export declare type DBO_items2 = {
101
+ find: (filter?: Items2_Filter, selectParams?: SelectParams) => Promise<Items2[] | object[]>;
102
+ findOne: (filter?: Items2_Filter, selectParams?: SelectParams) => Promise<Items2 | object>;
103
+ subscribe: (filter: Items2_Filter, params: SelectParams, onData: (items: Items2[]) => any) => Promise<{
104
+ unsubscribe: () => any;
105
+ }>;
106
+ subscribeOne: (filter: Items2_Filter, params: SelectParams, onData: (item: Items2) => any) => Promise<{
107
+ unsubscribe: () => any;
108
+ }>;
109
+ count: (filter?: Items2_Filter) => Promise<number>;
110
+ update: (filter: Items2_Filter, newData: Items2, params?: UpdateParams) => Promise<void | Items2>;
111
+ upsert: (filter: Items2_Filter, newData: Items2, params?: UpdateParams) => Promise<void | Items2>;
112
+ insert: (data: (Items2 | Items2[]), params?: InsertParams) => Promise<void | Items2>;
113
+ delete: (filter: Items2_Filter, params?: DeleteParams) => Promise<void | Items2>;
114
+ };
115
+ export declare type DBO_items3 = {
116
+ find: (filter?: Items3_Filter, selectParams?: SelectParams) => Promise<Items3[] | object[]>;
117
+ findOne: (filter?: Items3_Filter, selectParams?: SelectParams) => Promise<Items3 | object>;
118
+ subscribe: (filter: Items3_Filter, params: SelectParams, onData: (items: Items3[]) => any) => Promise<{
119
+ unsubscribe: () => any;
120
+ }>;
121
+ subscribeOne: (filter: Items3_Filter, params: SelectParams, onData: (item: Items3) => any) => Promise<{
122
+ unsubscribe: () => any;
123
+ }>;
124
+ count: (filter?: Items3_Filter) => Promise<number>;
125
+ update: (filter: Items3_Filter, newData: Items3, params?: UpdateParams) => Promise<void | Items3>;
126
+ upsert: (filter: Items3_Filter, newData: Items3, params?: UpdateParams) => Promise<void | Items3>;
127
+ insert: (data: (Items3 | Items3[]), params?: InsertParams) => Promise<void | Items3>;
128
+ delete: (filter: Items3_Filter, params?: DeleteParams) => Promise<void | Items3>;
129
+ };
130
+ export declare type DBO_table = {
131
+ find: (filter?: Table_Filter, selectParams?: SelectParams) => Promise<Table[] | object[]>;
132
+ findOne: (filter?: Table_Filter, selectParams?: SelectParams) => Promise<Table | object>;
133
+ subscribe: (filter: Table_Filter, params: SelectParams, onData: (items: Table[]) => any) => Promise<{
134
+ unsubscribe: () => any;
135
+ }>;
136
+ subscribeOne: (filter: Table_Filter, params: SelectParams, onData: (item: Table) => any) => Promise<{
137
+ unsubscribe: () => any;
138
+ }>;
139
+ count: (filter?: Table_Filter) => Promise<number>;
140
+ update: (filter: Table_Filter, newData: Table, params?: UpdateParams) => Promise<void | Table>;
141
+ upsert: (filter: Table_Filter, newData: Table, params?: UpdateParams) => Promise<void | Table>;
142
+ insert: (data: (Table | Table[]), params?: InsertParams) => Promise<void | Table>;
143
+ delete: (filter: Table_Filter, params?: DeleteParams) => Promise<void | Table>;
144
+ };
145
+ export declare type DBO_transaction = {
146
+ find: (filter?: Transaction_Filter, selectParams?: SelectParams) => Promise<Transaction[] | object[]>;
147
+ findOne: (filter?: Transaction_Filter, selectParams?: SelectParams) => Promise<Transaction | object>;
148
+ subscribe: (filter: Transaction_Filter, params: SelectParams, onData: (items: Transaction[]) => any) => Promise<{
149
+ unsubscribe: () => any;
150
+ }>;
151
+ subscribeOne: (filter: Transaction_Filter, params: SelectParams, onData: (item: Transaction) => any) => Promise<{
152
+ unsubscribe: () => any;
153
+ }>;
154
+ count: (filter?: Transaction_Filter) => Promise<number>;
155
+ update: (filter: Transaction_Filter, newData: Transaction, params?: UpdateParams) => Promise<void | Transaction>;
156
+ upsert: (filter: Transaction_Filter, newData: Transaction, params?: UpdateParams) => Promise<void | Transaction>;
157
+ insert: (data: (Transaction | Transaction[]), params?: InsertParams) => Promise<void | Transaction>;
158
+ delete: (filter: Transaction_Filter, params?: DeleteParams) => Promise<void | Transaction>;
159
+ };
160
+ export declare type DBObj = {
161
+ items: DBO_items;
162
+ items2: DBO_items2;
163
+ items3: DBO_items3;
164
+ table: DBO_table;
165
+ transaction: DBO_transaction;
166
+ tt: (t: TxCB) => Promise<any | void>;
167
+ };
168
+ //# sourceMappingURL=DBoGenerated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DBoGenerated.d.ts","sourceRoot":"","sources":["DBoGenerated.ts"],"names":[],"mappings":"AAIA,oBAAY,MAAM,GAAG,MAAM,GAAG,EAAE,GAAG,SAAS,CAAC;AAC7C,oBAAY,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAC7D,oBAAY,WAAW,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;AACvD,oBAAY,OAAO,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,OAAO,CAAA;CAAE,EAAE,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,EAAE,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAEzG,oBAAY,YAAY,GAAG;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB,CAAA;AACD,oBAAY,YAAY,GAAG;IACvB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAAA,SAAS,MAAA;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB,CAAA;AACD,oBAAY,YAAY,GAAG;IACvB,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,SAAS,CAAC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SAAS,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,EAAE,eAAe,CAAC;IAC7B,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAAE;CACtC,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /* This file was generated by Prostgles
3
+ */
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=DBoGenerated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DBoGenerated.js","sourceRoot":"","sources":["DBoGenerated.ts"],"names":[],"mappings":";AAAA;EACE"}
@@ -0,0 +1,125 @@
1
+ /* This file was generated by Prostgles
2
+ */
3
+
4
+
5
+ export type Filter = object | {} | undefined;
6
+ export type GroupFilter = { $and: Filter } | { $or: Filter };
7
+ export type FieldFilter = object | string[] | "*" | "";
8
+ export type OrderBy = { key: string, asc: boolean }[] | { [key: string]: boolean }[] | string | string[];
9
+
10
+ export type SelectParams = {
11
+ select?: FieldFilter;
12
+ limit?: number;
13
+ offset?: number;
14
+ orderBy?: OrderBy;
15
+ expectOne?: boolean;
16
+ }
17
+ export type UpdateParams = {
18
+ returning?: FieldFilter;
19
+ onConflictDoNothing?: boolean;TxHandler
20
+ fixIssues?: boolean;
21
+ multi?: boolean;
22
+ }
23
+ export type InsertParams = {
24
+ returning?: FieldFilter;
25
+ onConflictDoNothing?: boolean;
26
+ fixIssues?: boolean;
27
+ }
28
+ export type DeleteParams = {
29
+ returning?: FieldFilter;
30
+ };
31
+ export type TxCB = {
32
+ (t: DBObj): (any | void | Promise<(any | void)>)
33
+ };
34
+
35
+ export type Items = {
36
+ name?: string;
37
+ h?: Array<string>;
38
+ id?: number;
39
+ };
40
+ export type Items_Filter = Items | object | { $and: (Items | object)[] } | { $or: (Items | object)[] }
41
+ export type Items2 = {
42
+ id?: number;
43
+ h?: Array<string>;
44
+ name?: string;
45
+ };
46
+ export type Items2_Filter = Items2 | object | { $and: (Items2 | object)[] } | { $or: (Items2 | object)[] }
47
+ export type Items3 = {
48
+ h?: Array<string>;
49
+ name?: string;
50
+ id?: number;
51
+ };
52
+ export type Items3_Filter = Items3 | object | { $and: (Items3 | object)[] } | { $or: (Items3 | object)[] }
53
+ export type Table = {
54
+ id?: string;
55
+ };
56
+ export type Table_Filter = Table | object | { $and: (Table | object)[] } | { $or: (Table | object)[] }
57
+ export type Transaction = {
58
+ id?: string;
59
+ };
60
+ export type Transaction_Filter = Transaction | object | { $and: (Transaction | object)[] } | { $or: (Transaction | object)[] }
61
+
62
+ export type DBO_items = {
63
+ find: (filter?: Items_Filter , selectParams?: SelectParams) => Promise<Items[] | object[]>;
64
+ findOne: (filter?: Items_Filter , selectParams?: SelectParams) => Promise<Items | object>;
65
+ subscribe: (filter: Items_Filter , params: SelectParams, onData: (items: Items[]) => any) => Promise<{ unsubscribe: () => any }>;
66
+ subscribeOne: (filter: Items_Filter , params: SelectParams, onData: (item: Items) => any) => Promise<{ unsubscribe: () => any }>;
67
+ count: (filter?: Items_Filter ) => Promise<number>;
68
+ update: (filter: Items_Filter , newData: Items, params?: UpdateParams) => Promise<void | Items>;
69
+ upsert: (filter: Items_Filter , newData: Items, params?: UpdateParams) => Promise<void | Items>;
70
+ insert: (data: (Items | Items[]), params?: InsertParams) => Promise<void | Items>;
71
+ delete: (filter: Items_Filter , params?: DeleteParams) => Promise<void | Items>;
72
+ };
73
+ export type DBO_items2 = {
74
+ find: (filter?: Items2_Filter , selectParams?: SelectParams) => Promise<Items2[] | object[]>;
75
+ findOne: (filter?: Items2_Filter , selectParams?: SelectParams) => Promise<Items2 | object>;
76
+ subscribe: (filter: Items2_Filter , params: SelectParams, onData: (items: Items2[]) => any) => Promise<{ unsubscribe: () => any }>;
77
+ subscribeOne: (filter: Items2_Filter , params: SelectParams, onData: (item: Items2) => any) => Promise<{ unsubscribe: () => any }>;
78
+ count: (filter?: Items2_Filter ) => Promise<number>;
79
+ update: (filter: Items2_Filter , newData: Items2, params?: UpdateParams) => Promise<void | Items2>;
80
+ upsert: (filter: Items2_Filter , newData: Items2, params?: UpdateParams) => Promise<void | Items2>;
81
+ insert: (data: (Items2 | Items2[]), params?: InsertParams) => Promise<void | Items2>;
82
+ delete: (filter: Items2_Filter , params?: DeleteParams) => Promise<void | Items2>;
83
+ };
84
+ export type DBO_items3 = {
85
+ find: (filter?: Items3_Filter , selectParams?: SelectParams) => Promise<Items3[] | object[]>;
86
+ findOne: (filter?: Items3_Filter , selectParams?: SelectParams) => Promise<Items3 | object>;
87
+ subscribe: (filter: Items3_Filter , params: SelectParams, onData: (items: Items3[]) => any) => Promise<{ unsubscribe: () => any }>;
88
+ subscribeOne: (filter: Items3_Filter , params: SelectParams, onData: (item: Items3) => any) => Promise<{ unsubscribe: () => any }>;
89
+ count: (filter?: Items3_Filter ) => Promise<number>;
90
+ update: (filter: Items3_Filter , newData: Items3, params?: UpdateParams) => Promise<void | Items3>;
91
+ upsert: (filter: Items3_Filter , newData: Items3, params?: UpdateParams) => Promise<void | Items3>;
92
+ insert: (data: (Items3 | Items3[]), params?: InsertParams) => Promise<void | Items3>;
93
+ delete: (filter: Items3_Filter , params?: DeleteParams) => Promise<void | Items3>;
94
+ };
95
+ export type DBO_table = {
96
+ find: (filter?: Table_Filter , selectParams?: SelectParams) => Promise<Table[] | object[]>;
97
+ findOne: (filter?: Table_Filter , selectParams?: SelectParams) => Promise<Table | object>;
98
+ subscribe: (filter: Table_Filter , params: SelectParams, onData: (items: Table[]) => any) => Promise<{ unsubscribe: () => any }>;
99
+ subscribeOne: (filter: Table_Filter , params: SelectParams, onData: (item: Table) => any) => Promise<{ unsubscribe: () => any }>;
100
+ count: (filter?: Table_Filter ) => Promise<number>;
101
+ update: (filter: Table_Filter , newData: Table, params?: UpdateParams) => Promise<void | Table>;
102
+ upsert: (filter: Table_Filter , newData: Table, params?: UpdateParams) => Promise<void | Table>;
103
+ insert: (data: (Table | Table[]), params?: InsertParams) => Promise<void | Table>;
104
+ delete: (filter: Table_Filter , params?: DeleteParams) => Promise<void | Table>;
105
+ };
106
+ export type DBO_transaction = {
107
+ find: (filter?: Transaction_Filter , selectParams?: SelectParams) => Promise<Transaction[] | object[]>;
108
+ findOne: (filter?: Transaction_Filter , selectParams?: SelectParams) => Promise<Transaction | object>;
109
+ subscribe: (filter: Transaction_Filter , params: SelectParams, onData: (items: Transaction[]) => any) => Promise<{ unsubscribe: () => any }>;
110
+ subscribeOne: (filter: Transaction_Filter , params: SelectParams, onData: (item: Transaction) => any) => Promise<{ unsubscribe: () => any }>;
111
+ count: (filter?: Transaction_Filter ) => Promise<number>;
112
+ update: (filter: Transaction_Filter , newData: Transaction, params?: UpdateParams) => Promise<void | Transaction>;
113
+ upsert: (filter: Transaction_Filter , newData: Transaction, params?: UpdateParams) => Promise<void | Transaction>;
114
+ insert: (data: (Transaction | Transaction[]), params?: InsertParams) => Promise<void | Transaction>;
115
+ delete: (filter: Transaction_Filter , params?: DeleteParams) => Promise<void | Transaction>;
116
+ };
117
+
118
+ export type DBObj = {
119
+ items: DBO_items;
120
+ items2: DBO_items2;
121
+ items3: DBO_items3;
122
+ table: DBO_table;
123
+ transaction: DBO_transaction;
124
+ tt: (t: TxCB) => Promise<any | void> ;
125
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const path_1 = __importDefault(require("path"));
7
+ const express_1 = __importDefault(require("express"));
8
+ // const prostgles = require("prostgles-server");
9
+ const index_1 = __importDefault(require("../../../dist/index"));
10
+ const app = express_1.default();
11
+ const http = require('http').createServer(app);
12
+ const io = require("socket.io")(http);
13
+ http.listen(3001);
14
+ index_1.default({
15
+ dbConnection: {
16
+ host: "localhost",
17
+ port: 5432,
18
+ database: "postgres",
19
+ user: process.env.PRGL_USER,
20
+ password: process.env.PRGL_PWD
21
+ },
22
+ sqlFilePath: path_1.default.join(__dirname + '/init.sql'),
23
+ io,
24
+ tsGeneratedTypesDir: path_1.default.join(__dirname + '/'),
25
+ transactions: "tt",
26
+ publish: (socket, dbo) => {
27
+ return "*";
28
+ },
29
+ joins: [
30
+ {
31
+ tables: ["items", "items2"],
32
+ on: { name: "name" },
33
+ type: "many-many"
34
+ },
35
+ {
36
+ tables: ["items2", "items3"],
37
+ on: { name: "name" },
38
+ type: "many-many"
39
+ }
40
+ ],
41
+ onReady: async (dbo, db) => {
42
+ app.get("*", (req, res) => {
43
+ console.log(req.originalUrl);
44
+ });
45
+ try {
46
+ await dbo.items.insert([{ name: "a" }, { name: "a" }]);
47
+ console.log(await dbo.items.find());
48
+ }
49
+ catch (err) {
50
+ console.error(err);
51
+ }
52
+ },
53
+ });
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;AAAA,gDAAwB;AACxB,sDAA8B;AAC9B,iDAAiD;AACjD,gEAA4C;AAC5C,MAAM,GAAG,GAAG,iBAAO,EAAE,CAAC;AACtB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC;AACtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAIlB,eAAS,CAAC;IACT,YAAY,EAAE;QACb,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,IAAI;QACV,QAAQ,EAAE,UAAU;QACpB,IAAI,EAAE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1
+ import path from 'path';
2
+ import express from 'express';
3
+ // const prostgles = require("prostgles-server");
4
+ import prostgles from "../../../dist/index";
5
+ const app = express();
6
+ const http = require('http').createServer(app);
7
+ const io = require("socket.io")(http);
8
+ http.listen(3001);
9
+
10
+ import { DBObj } from "./DBoGenerated";
11
+
12
+ prostgles({
13
+ dbConnection: {
14
+ host: "localhost",
15
+ port: 5432,
16
+ database: "postgres",
17
+ user: process.env.PRGL_USER,
18
+ password: process.env.PRGL_PWD
19
+ },
20
+ sqlFilePath: path.join(__dirname+'/init.sql'),
21
+ io,
22
+ tsGeneratedTypesDir: path.join(__dirname + '/'),
23
+ transactions: "tt",
24
+ publish: (socket, dbo: DBObj) => {
25
+
26
+ return "*";
27
+ },
28
+ joins: [
29
+ {
30
+ tables: ["items", "items2"],
31
+ on: { name: "name" },
32
+ type: "many-many"
33
+ },
34
+ {
35
+ tables: ["items2", "items3"],
36
+ on: { name: "name" },
37
+ type: "many-many"
38
+ }
39
+ ],
40
+ onReady: async (dbo: DBObj, db) => {
41
+
42
+ try {
43
+
44
+ await dbo.items.insert([{ name: "a" }, { name: "a" }]);
45
+ console.log(await dbo.items.find());
46
+
47
+
48
+ } catch(err) {
49
+ console.error(err)
50
+ }
51
+ },
52
+ });
@@ -0,0 +1,20 @@
1
+ DROP TABLE IF EXISTS items CASCADE;
2
+ CREATE TABLE IF NOT EXISTS items (
3
+ id SERIAL PRIMARY KEY,
4
+ h TEXT[],
5
+ name TEXT
6
+ );
7
+
8
+ DROP TABLE IF EXISTS items2 CASCADE;
9
+ CREATE TABLE IF NOT EXISTS items2 (
10
+ id SERIAL PRIMARY KEY,
11
+ h TEXT[],
12
+ name TEXT
13
+ );
14
+
15
+ DROP TABLE IF EXISTS items3 CASCADE;
16
+ CREATE TABLE IF NOT EXISTS items3 (
17
+ id SERIAL PRIMARY KEY,
18
+ h TEXT[],
19
+ name TEXT
20
+ );
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "typescript",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "start": "tsc && node index.js"
8
+ },
9
+ "author": "",
10
+ "license": "ISC",
11
+ "dependencies": {
12
+ "@types/socket.io": "^2.1.12",
13
+ "express": "^4.17.1",
14
+ "prostgles-server": "^1.5.39",
15
+ "socket.io": "^4.0.1"
16
+ }
17
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "files": ["./index.ts"],
3
+ "compilerOptions": {
4
+ "target": "es2019",
5
+ "lib": [ "es2019" ],
6
+ "esModuleInterop" : true,
7
+ "module": "commonjs",
8
+ "sourceMap": true,
9
+ "rootDir": ".",
10
+ "declaration": true,
11
+ "declarationMap": true
12
+ },
13
+ "exclude": [
14
+ "dist",
15
+ "DBoGenerated.ts"
16
+ ]
17
+ }
@@ -179,9 +179,12 @@ export default class AuthHandler {
179
179
  const { sid, expires } = cookie;
180
180
  const { res, req } = r;
181
181
  if (sid) {
182
-
182
+ let maxAge = 1000 * 60 * 60 * 24; // 24 hours
183
+ if(expires && Number.isFinite(expires) && !isNaN(+ new Date(expires))){
184
+ maxAge = (+ new Date(expires) - Date.now())
185
+ }
183
186
  let options = {
184
- maxAge: expires || 1000 * 60 * 60 * 24, // would expire after 24 hours
187
+ maxAge,
185
188
  httpOnly: true, // The cookie only accessible by the web server
186
189
  //signed: true // Indicates if the cookie should be signed
187
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prostgles-server",
3
- "version": "2.0.136",
3
+ "version": "2.0.137",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -32,7 +32,7 @@
32
32
  "npm": "^8.1.4",
33
33
  "pg-promise": "^10.9.5",
34
34
  "prostgles-types": "^1.5.123",
35
- "sharp": "^0.29.3"
35
+ "sharp": "^0.30.4"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@aws-sdk/types": "^3.34.0",
@@ -1 +1 @@
1
- 22025
1
+ 8779