@aeriajs/builtins 0.0.99 → 0.0.101

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.
@@ -1099,7 +1099,16 @@ export declare const user: {
1099
1099
  };
1100
1100
  };
1101
1101
  };
1102
- }>) => Promise<any>;
1102
+ }>) => Promise<import("../../../../types/dist/result.js").Result.Error<{
1103
+ readonly code: import("@aeriajs/types").ACError.MalformedInput;
1104
+ readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
1105
+ } & {
1106
+ httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
1107
+ }> | {
1108
+ readonly _tag: "Result";
1109
+ readonly error: undefined;
1110
+ readonly result: any;
1111
+ }>;
1103
1112
  readonly getInfo: (payload: {
1104
1113
  userId: string;
1105
1114
  token: string;
@@ -1215,8 +1224,12 @@ export declare const user: {
1215
1224
  } & {
1216
1225
  httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
1217
1226
  }> | {
1218
- name: any;
1219
- email: any;
1227
+ readonly _tag: "Result";
1228
+ readonly error: undefined;
1229
+ readonly result: {
1230
+ readonly name: any;
1231
+ readonly email: any;
1232
+ };
1220
1233
  }>;
1221
1234
  readonly getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<{
1222
1235
  readonly $id: "user";
@@ -1317,107 +1330,115 @@ export declare const user: {
1317
1330
  };
1318
1331
  };
1319
1332
  };
1320
- }>) => Promise<import("@aeriajs/types").SchemaWithId<{
1321
- readonly $id: "user";
1322
- readonly required: readonly ["name", "roles", "email"];
1323
- readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
1324
- readonly indexes: readonly ["name"];
1325
- readonly freshItem: {
1326
- readonly active: true;
1327
- };
1328
- readonly properties: {
1329
- readonly name: {
1330
- readonly type: "string";
1331
- };
1332
- readonly given_name: {
1333
- readonly getter: (document: any) => string;
1334
- };
1335
- readonly family_name: {
1336
- readonly getter: (document: any) => string;
1337
- };
1338
- readonly active: {
1339
- readonly type: "boolean";
1333
+ }>) => Promise<{
1334
+ readonly _tag: "Result";
1335
+ readonly error: undefined;
1336
+ readonly result: import("@aeriajs/types").SchemaWithId<{
1337
+ readonly $id: "user";
1338
+ readonly required: readonly ["name", "roles", "email"];
1339
+ readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
1340
+ readonly indexes: readonly ["name"];
1341
+ readonly freshItem: {
1342
+ readonly active: true;
1340
1343
  };
1341
- readonly roles: {
1342
- readonly type: "array";
1343
- readonly items: {
1344
+ readonly properties: {
1345
+ readonly name: {
1344
1346
  readonly type: "string";
1345
1347
  };
1346
- readonly uniqueItems: true;
1347
- };
1348
- readonly email: {
1349
- readonly type: "string";
1350
- readonly inputType: "email";
1351
- readonly unique: true;
1352
- };
1353
- readonly password: {
1354
- readonly type: "string";
1355
- readonly inputType: "password";
1356
- readonly hidden: true;
1357
- };
1358
- readonly phone_number: {
1359
- readonly type: "string";
1360
- readonly mask: "(##) #####-####";
1361
- };
1362
- readonly picture_file: {
1363
- readonly $ref: "file";
1364
- readonly accept: readonly ["image/*"];
1365
- };
1366
- readonly picture: {
1367
- readonly getter: (value: any) => any;
1368
- };
1369
- readonly group: {
1370
- readonly type: "string";
1371
- };
1372
- readonly self_registered: {
1373
- readonly type: "boolean";
1374
- readonly readOnly: true;
1375
- };
1376
- readonly updated_at: {
1377
- readonly type: "string";
1378
- readonly format: "date-time";
1379
- };
1380
- };
1381
- readonly presets: readonly ["crud", "view", "duplicate"];
1382
- readonly layout: {
1383
- readonly name: "grid";
1384
- readonly options: {
1385
- readonly title: "name";
1386
- readonly badge: "roles";
1387
- readonly picture: "picture_file";
1388
- readonly information: "email";
1389
- readonly active: "active";
1390
- };
1391
- };
1392
- readonly individualActions: {
1393
- readonly 'ui:spawnEdit': {
1394
- readonly label: "action.edit";
1395
- readonly icon: "pencil";
1396
- readonly translate: true;
1397
- };
1398
- readonly 'route:/dashboard/user/changepass': {
1399
- readonly label: "change_password";
1400
- readonly icon: "key";
1401
- readonly fetchItem: true;
1402
- readonly translate: true;
1403
- };
1404
- };
1405
- readonly icon: "users";
1406
- readonly filters: readonly ["name", "roles", "email", "phone_number"];
1407
- readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
1408
- readonly tableMeta: readonly ["email"];
1409
- readonly formLayout: {
1410
- readonly fields: {
1411
1348
  readonly given_name: {
1412
- readonly span: 3;
1349
+ readonly getter: (document: any) => string;
1413
1350
  };
1414
1351
  readonly family_name: {
1415
- readonly span: 3;
1352
+ readonly getter: (document: any) => string;
1353
+ };
1354
+ readonly active: {
1355
+ readonly type: "boolean";
1356
+ };
1357
+ readonly roles: {
1358
+ readonly type: "array";
1359
+ readonly items: {
1360
+ readonly type: "string";
1361
+ };
1362
+ readonly uniqueItems: true;
1363
+ };
1364
+ readonly email: {
1365
+ readonly type: "string";
1366
+ readonly inputType: "email";
1367
+ readonly unique: true;
1368
+ };
1369
+ readonly password: {
1370
+ readonly type: "string";
1371
+ readonly inputType: "password";
1372
+ readonly hidden: true;
1373
+ };
1374
+ readonly phone_number: {
1375
+ readonly type: "string";
1376
+ readonly mask: "(##) #####-####";
1377
+ };
1378
+ readonly picture_file: {
1379
+ readonly $ref: "file";
1380
+ readonly accept: readonly ["image/*"];
1381
+ };
1382
+ readonly picture: {
1383
+ readonly getter: (value: any) => any;
1384
+ };
1385
+ readonly group: {
1386
+ readonly type: "string";
1387
+ };
1388
+ readonly self_registered: {
1389
+ readonly type: "boolean";
1390
+ readonly readOnly: true;
1391
+ };
1392
+ readonly updated_at: {
1393
+ readonly type: "string";
1394
+ readonly format: "date-time";
1416
1395
  };
1417
1396
  };
1418
- };
1419
- }>>;
1420
- readonly getActivationLink: (userId: import("@aeriajs/core").ObjectId) => Promise<string>;
1397
+ readonly presets: readonly ["crud", "view", "duplicate"];
1398
+ readonly layout: {
1399
+ readonly name: "grid";
1400
+ readonly options: {
1401
+ readonly title: "name";
1402
+ readonly badge: "roles";
1403
+ readonly picture: "picture_file";
1404
+ readonly information: "email";
1405
+ readonly active: "active";
1406
+ };
1407
+ };
1408
+ readonly individualActions: {
1409
+ readonly 'ui:spawnEdit': {
1410
+ readonly label: "action.edit";
1411
+ readonly icon: "pencil";
1412
+ readonly translate: true;
1413
+ };
1414
+ readonly 'route:/dashboard/user/changepass': {
1415
+ readonly label: "change_password";
1416
+ readonly icon: "key";
1417
+ readonly fetchItem: true;
1418
+ readonly translate: true;
1419
+ };
1420
+ };
1421
+ readonly icon: "users";
1422
+ readonly filters: readonly ["name", "roles", "email", "phone_number"];
1423
+ readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
1424
+ readonly tableMeta: readonly ["email"];
1425
+ readonly formLayout: {
1426
+ readonly fields: {
1427
+ readonly given_name: {
1428
+ readonly span: 3;
1429
+ };
1430
+ readonly family_name: {
1431
+ readonly span: 3;
1432
+ };
1433
+ };
1434
+ };
1435
+ }>;
1436
+ }>;
1437
+ readonly getActivationLink: (userId: import("@aeriajs/core").ObjectId) => Promise<{
1438
+ readonly _tag: "Result";
1439
+ readonly error: undefined;
1440
+ readonly result: string;
1441
+ }>;
1421
1442
  };
1422
1443
  contracts: {
1423
1444
  readonly getCurrentUser: {
@@ -2628,7 +2649,16 @@ export declare const user: {
2628
2649
  };
2629
2650
  };
2630
2651
  };
2631
- }>) => Promise<any>;
2652
+ }>) => Promise<import("../../../../types/dist/result.js").Result.Error<{
2653
+ readonly code: import("@aeriajs/types").ACError.MalformedInput;
2654
+ readonly details: import("@aeriajs/types").PropertyValidationError | import("@aeriajs/types").ValidationError;
2655
+ } & {
2656
+ httpStatus: import("@aeriajs/types").HTTPStatus.BadRequest;
2657
+ }> | {
2658
+ readonly _tag: "Result";
2659
+ readonly error: undefined;
2660
+ readonly result: any;
2661
+ }>;
2632
2662
  readonly getInfo: (payload: {
2633
2663
  userId: string;
2634
2664
  token: string;
@@ -2744,8 +2774,12 @@ export declare const user: {
2744
2774
  } & {
2745
2775
  httpStatus: import("@aeriajs/types").HTTPStatus.Forbidden;
2746
2776
  }> | {
2747
- name: any;
2748
- email: any;
2777
+ readonly _tag: "Result";
2778
+ readonly error: undefined;
2779
+ readonly result: {
2780
+ readonly name: any;
2781
+ readonly email: any;
2782
+ };
2749
2783
  }>;
2750
2784
  readonly getCurrentUser: (_payload: undefined, context: import("@aeriajs/types").Context<{
2751
2785
  readonly $id: "user";
@@ -2846,107 +2880,115 @@ export declare const user: {
2846
2880
  };
2847
2881
  };
2848
2882
  };
2849
- }>) => Promise<import("@aeriajs/types").SchemaWithId<{
2850
- readonly $id: "user";
2851
- readonly required: readonly ["name", "roles", "email"];
2852
- readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
2853
- readonly indexes: readonly ["name"];
2854
- readonly freshItem: {
2855
- readonly active: true;
2856
- };
2857
- readonly properties: {
2858
- readonly name: {
2859
- readonly type: "string";
2860
- };
2861
- readonly given_name: {
2862
- readonly getter: (document: any) => string;
2863
- };
2864
- readonly family_name: {
2865
- readonly getter: (document: any) => string;
2866
- };
2867
- readonly active: {
2868
- readonly type: "boolean";
2883
+ }>) => Promise<{
2884
+ readonly _tag: "Result";
2885
+ readonly error: undefined;
2886
+ readonly result: import("@aeriajs/types").SchemaWithId<{
2887
+ readonly $id: "user";
2888
+ readonly required: readonly ["name", "roles", "email"];
2889
+ readonly form: readonly ["name", "active", "roles", "email", "phone_number", "picture_file"];
2890
+ readonly indexes: readonly ["name"];
2891
+ readonly freshItem: {
2892
+ readonly active: true;
2869
2893
  };
2870
- readonly roles: {
2871
- readonly type: "array";
2872
- readonly items: {
2894
+ readonly properties: {
2895
+ readonly name: {
2873
2896
  readonly type: "string";
2874
2897
  };
2875
- readonly uniqueItems: true;
2876
- };
2877
- readonly email: {
2878
- readonly type: "string";
2879
- readonly inputType: "email";
2880
- readonly unique: true;
2881
- };
2882
- readonly password: {
2883
- readonly type: "string";
2884
- readonly inputType: "password";
2885
- readonly hidden: true;
2886
- };
2887
- readonly phone_number: {
2888
- readonly type: "string";
2889
- readonly mask: "(##) #####-####";
2890
- };
2891
- readonly picture_file: {
2892
- readonly $ref: "file";
2893
- readonly accept: readonly ["image/*"];
2894
- };
2895
- readonly picture: {
2896
- readonly getter: (value: any) => any;
2897
- };
2898
- readonly group: {
2899
- readonly type: "string";
2900
- };
2901
- readonly self_registered: {
2902
- readonly type: "boolean";
2903
- readonly readOnly: true;
2904
- };
2905
- readonly updated_at: {
2906
- readonly type: "string";
2907
- readonly format: "date-time";
2908
- };
2909
- };
2910
- readonly presets: readonly ["crud", "view", "duplicate"];
2911
- readonly layout: {
2912
- readonly name: "grid";
2913
- readonly options: {
2914
- readonly title: "name";
2915
- readonly badge: "roles";
2916
- readonly picture: "picture_file";
2917
- readonly information: "email";
2918
- readonly active: "active";
2919
- };
2920
- };
2921
- readonly individualActions: {
2922
- readonly 'ui:spawnEdit': {
2923
- readonly label: "action.edit";
2924
- readonly icon: "pencil";
2925
- readonly translate: true;
2926
- };
2927
- readonly 'route:/dashboard/user/changepass': {
2928
- readonly label: "change_password";
2929
- readonly icon: "key";
2930
- readonly fetchItem: true;
2931
- readonly translate: true;
2932
- };
2933
- };
2934
- readonly icon: "users";
2935
- readonly filters: readonly ["name", "roles", "email", "phone_number"];
2936
- readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
2937
- readonly tableMeta: readonly ["email"];
2938
- readonly formLayout: {
2939
- readonly fields: {
2940
2898
  readonly given_name: {
2941
- readonly span: 3;
2899
+ readonly getter: (document: any) => string;
2942
2900
  };
2943
2901
  readonly family_name: {
2944
- readonly span: 3;
2902
+ readonly getter: (document: any) => string;
2903
+ };
2904
+ readonly active: {
2905
+ readonly type: "boolean";
2906
+ };
2907
+ readonly roles: {
2908
+ readonly type: "array";
2909
+ readonly items: {
2910
+ readonly type: "string";
2911
+ };
2912
+ readonly uniqueItems: true;
2913
+ };
2914
+ readonly email: {
2915
+ readonly type: "string";
2916
+ readonly inputType: "email";
2917
+ readonly unique: true;
2918
+ };
2919
+ readonly password: {
2920
+ readonly type: "string";
2921
+ readonly inputType: "password";
2922
+ readonly hidden: true;
2923
+ };
2924
+ readonly phone_number: {
2925
+ readonly type: "string";
2926
+ readonly mask: "(##) #####-####";
2927
+ };
2928
+ readonly picture_file: {
2929
+ readonly $ref: "file";
2930
+ readonly accept: readonly ["image/*"];
2931
+ };
2932
+ readonly picture: {
2933
+ readonly getter: (value: any) => any;
2934
+ };
2935
+ readonly group: {
2936
+ readonly type: "string";
2937
+ };
2938
+ readonly self_registered: {
2939
+ readonly type: "boolean";
2940
+ readonly readOnly: true;
2941
+ };
2942
+ readonly updated_at: {
2943
+ readonly type: "string";
2944
+ readonly format: "date-time";
2945
2945
  };
2946
2946
  };
2947
- };
2948
- }>>;
2949
- readonly getActivationLink: (userId: import("@aeriajs/core").ObjectId) => Promise<string>;
2947
+ readonly presets: readonly ["crud", "view", "duplicate"];
2948
+ readonly layout: {
2949
+ readonly name: "grid";
2950
+ readonly options: {
2951
+ readonly title: "name";
2952
+ readonly badge: "roles";
2953
+ readonly picture: "picture_file";
2954
+ readonly information: "email";
2955
+ readonly active: "active";
2956
+ };
2957
+ };
2958
+ readonly individualActions: {
2959
+ readonly 'ui:spawnEdit': {
2960
+ readonly label: "action.edit";
2961
+ readonly icon: "pencil";
2962
+ readonly translate: true;
2963
+ };
2964
+ readonly 'route:/dashboard/user/changepass': {
2965
+ readonly label: "change_password";
2966
+ readonly icon: "key";
2967
+ readonly fetchItem: true;
2968
+ readonly translate: true;
2969
+ };
2970
+ };
2971
+ readonly icon: "users";
2972
+ readonly filters: readonly ["name", "roles", "email", "phone_number"];
2973
+ readonly table: readonly ["name", "roles", "picture_file", "active", "updated_at"];
2974
+ readonly tableMeta: readonly ["email"];
2975
+ readonly formLayout: {
2976
+ readonly fields: {
2977
+ readonly given_name: {
2978
+ readonly span: 3;
2979
+ };
2980
+ readonly family_name: {
2981
+ readonly span: 3;
2982
+ };
2983
+ };
2984
+ };
2985
+ }>;
2986
+ }>;
2987
+ readonly getActivationLink: (userId: import("@aeriajs/core").ObjectId) => Promise<{
2988
+ readonly _tag: "Result";
2989
+ readonly error: undefined;
2990
+ readonly result: string;
2991
+ }>;
2950
2992
  };
2951
2993
  contracts: {
2952
2994
  readonly getCurrentUser: {
@@ -23,9 +23,13 @@ export declare const describe: (contextOrPayload: RouteContext | Payload) => Pro
23
23
  });
24
24
  readonly result: undefined;
25
25
  } | {
26
- descriptions: Record<string, Description>;
27
- roles?: string[] | undefined;
28
- auth?: Partial<unknown> | undefined;
29
- router?: any;
26
+ readonly _tag: "Result";
27
+ readonly error: undefined;
28
+ readonly result: {
29
+ descriptions: Record<string, Description>;
30
+ roles?: string[] | undefined;
31
+ auth?: Partial<unknown> | undefined;
32
+ router?: any;
33
+ };
30
34
  }>;
31
35
  export {};
@@ -52,7 +52,7 @@ const describe = async (contextOrPayload) => {
52
52
  result.router = await (0, core_1.getEndpoints)();
53
53
  }
54
54
  if (props.noSerialize || !('response' in contextOrPayload)) {
55
- return result;
55
+ return common_1.Result.result(result);
56
56
  }
57
57
  contextOrPayload.response.setHeader('content-type', 'application/bson');
58
58
  return contextOrPayload.response.end((0, common_1.serialize)(result));
@@ -40,7 +40,7 @@ export const describe = async (contextOrPayload) => {
40
40
  result.router = await getEndpoints();
41
41
  }
42
42
  if (props.noSerialize || !("response" in contextOrPayload)) {
43
- return result;
43
+ return Result.result(result);
44
44
  }
45
45
  contextOrPayload.response.setHeader("content-type", "application/bson");
46
46
  return contextOrPayload.response.end(serialize(result));