corebasic 1.0.256 → 1.0.258

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.
@@ -96,7 +96,7 @@ export const send = async (meta, feature, data, params) => {
96
96
  if (url.includes(':'))
97
97
  throw new Error(`Error: Internal feature call send on feature: ${feature} when api/params/substitution`);
98
98
  }
99
- const payload = { ...meta, data, feature, txn: Utils.uid() };
99
+ const payload = { ...meta, data, feature, txn: Utils.uid(), params: params ?? {} };
100
100
  service = service.replace('http://slyp.app', 'https://slyp.app');
101
101
  // return (await axios[method](`${service}${url}`, { data: payload, headers: {jwt: headers.jwt}, timeout: 1000 })).data
102
102
  // Used to work. But request to 127.0.0.1 fails to send the specified headers along with the request.
@@ -185,7 +185,7 @@ const apiHandler = async (req, res) => {
185
185
  const message = {
186
186
  meta,
187
187
  data: req.body.data,
188
- params: req.params,
188
+ params: featureless ? req.params : req.body.params,
189
189
  };
190
190
  const appReq = {
191
191
  meta: message.meta,
package/libs/features.ts CHANGED
@@ -121,6 +121,7 @@ type ExpressApplication = { [Method in HttpMethod]: (path: string, handler: Expr
121
121
 
122
122
  declare global {
123
123
  type Handler<I, O, T extends keyof Schema> = (input: FeatureMessage<I, T>, req?: Req, res?: Res) => Promise<O>
124
+ type ListData<T> = { items: T[] }
124
125
 
125
126
  interface FeatureTypes {
126
127
  // "privileges.query.check": Handler<{feature: string}, {data: {granted: boolean} }>
@@ -207,7 +208,7 @@ export const send = async <K extends keyof FeatureTypes> (meta: Partial<FeatureM
207
208
  throw new Error(`Error: Internal feature call send on feature: ${feature} when api/params/substitution`)
208
209
  }
209
210
 
210
- const payload: PayloadMessage = { ...meta, data, feature, txn: Utils.uid() } as PayloadMessage
211
+ const payload: PayloadMessage = { ...meta, data, feature, txn: Utils.uid(), params: params ?? {} } as PayloadMessage
211
212
  service = service.replace('http://slyp.app', 'https://slyp.app')
212
213
 
213
214
  // return (await axios[method](`${service}${url}`, { data: payload, headers: {jwt: headers.jwt}, timeout: 1000 })).data
@@ -311,7 +312,7 @@ const apiHandler = async (req: ExpressRequest, res: ExpressResponse) => {
311
312
  const message: FeatureMessage = {
312
313
  meta,
313
314
  data: req.body.data,
314
- params: req.params,
315
+ params: featureless ? req.params : req.body.params!,
315
316
  }
316
317
 
317
318
  const appReq: Req = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "corebasic",
3
3
  "type": "module",
4
- "version": "1.0.256",
4
+ "version": "1.0.258",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "./index.ts",