@aeriajs/core 0.0.116 → 0.0.117

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/dist/assets.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { Context, Collection, Token } from '@aeriajs/types';
1
+ import type { AssetType, Context, Collection, Token } from '@aeriajs/types';
2
2
  import { ACError } from '@aeriajs/types';
3
- export declare const internalGetCollectionAsset: <TCollectionName extends string, TAssetName extends "item" | "description" | "security" | "functions" | "contracts" | "exposedFunctions">(collectionName: TCollectionName, assetName: TAssetName) => Promise<{
3
+ export declare const internalGetCollectionAsset: <TCollectionName extends string, TAssetName extends keyof Collections[TCollectionName] & AssetType>(collectionName: TCollectionName, assetName: TAssetName) => Promise<{
4
4
  readonly _tag: "Error";
5
5
  readonly error: ACError.ResourceNotFound;
6
6
  readonly result: undefined;
@@ -9,7 +9,7 @@ export declare const internalGetCollectionAsset: <TCollectionName extends string
9
9
  readonly error: undefined;
10
10
  readonly result: NonNullable<Collection[TAssetName]>;
11
11
  }>;
12
- export declare const getCollectionAsset: <TCollectionName extends string, TAssetName extends "item" | "description" | "security" | "functions" | "contracts" | "exposedFunctions">(collectionName: TCollectionName, assetName: TAssetName) => Promise<{
12
+ export declare const getCollectionAsset: <TCollectionName extends string, TAssetName extends keyof Collections[TCollectionName] & AssetType>(collectionName: TCollectionName, assetName: TAssetName) => Promise<{
13
13
  readonly _tag: "Error";
14
14
  readonly error: ACError.ResourceNotFound;
15
15
  readonly result: undefined;
@@ -2,7 +2,7 @@ import type { SchemaWithId, Collection, StrictContext, Contract, ContractToFunct
2
2
  export type ExtendCollection<TLeftCollection extends Collection, TRightCollection> = Omit<TLeftCollection & TRightCollection, 'item'> & {
3
3
  item: SchemaWithId<(TLeftCollection & TRightCollection)['description']>;
4
4
  };
5
- export declare const defineCollection: <TCollection extends Omit<Collection<TCollection extends Collection ? TCollection : never>, "item" | "description" | "security" | "functions" | "exposedFunctions">, const TDescription extends Description<TDescription>, const TContracts extends { [P in keyof TFunctions]?: Contract | undefined; }, const TExposedFunctions extends Partial<Record<keyof TFunctions, AccessCondition>>, const TFunctions extends Record<string, (payload: any, context: StrictContext<any>) => any> & { [P_1 in keyof TContracts | keyof TExposedFunctions]: ContractToFunction<P_1 extends keyof TContracts ? NonNullable<TContracts[P_1]> : any, StrictContext<P_1 extends keyof TExposedFunctions ? RoleFromAccessCondition<TExposedFunctions[P_1]> : never, TDescription>>; }>(collection: TCollection & {
5
+ export declare const defineCollection: <TCollection extends Collection<TCollection extends Collection ? TCollection : never> extends infer Coll ? Omit<Coll, "item" | "description" | "functions" | "exposedFunctions" | "security"> : never, const TDescription extends Description<TDescription>, const TContracts extends { [P in keyof TFunctions]?: Contract; }, const TExposedFunctions extends Partial<Record<keyof TFunctions, AccessCondition>>, const TFunctions extends Record<string, (payload: any, context: StrictContext<any>) => any> & { [P in keyof TContracts | keyof TExposedFunctions]: ContractToFunction<P extends keyof TContracts ? NonNullable<TContracts[P]> : any, StrictContext<P extends keyof TExposedFunctions ? RoleFromAccessCondition<TExposedFunctions[P]> : never, TDescription>>; }>(collection: TCollection & {
6
6
  description: TDescription;
7
7
  functions?: TFunctions;
8
8
  contracts?: TContracts;
@@ -16,11 +16,4 @@ export declare const defineCollection: <TCollection extends Omit<Collection<TCol
16
16
  functions: TFunctions;
17
17
  contracts: TContracts;
18
18
  };
19
- export declare const extendCollection: <const TLeftCollection extends Collection, const TRightCollection extends {
20
- description?: Partial<Description> | undefined;
21
- item?: Partial<any> | undefined;
22
- security?: Partial<CollectionSecurityPolicy<any> | undefined>;
23
- functions?: Partial<Record<string, (payload: any, context: import("@aeriajs/types").Context<any>, ...args: any[]) => any> | undefined>;
24
- contracts?: Partial<Record<string, Contract> | undefined>;
25
- exposedFunctions?: Partial<Record<string, AccessCondition> | undefined>;
26
- }>(left: TLeftCollection, right: TRightCollection) => ExtendCollection<TLeftCollection, TRightCollection>;
19
+ export declare const extendCollection: <const TLeftCollection extends Collection, const TRightCollection extends { [P in keyof Collection]?: Partial<Collection[P]>; }>(left: TLeftCollection, right: TRightCollection) => ExtendCollection<TLeftCollection, TRightCollection>;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import type { Description, Property } from '@aeriajs/types';
3
2
  import * as presets from '../presets/index.js';
4
3
  export type PreloadOptions = {
@@ -6,7 +5,7 @@ export type PreloadOptions = {
6
5
  memoize?: boolean;
7
6
  timestamps?: boolean;
8
7
  };
9
- export declare const applyPreset: (entry: Partial<Description> | Description['properties'], presetName: keyof typeof presets, parentName?: string) => (Record<string, Property> | Partial<Description>) & ({
8
+ export declare const applyPreset: (entry: Partial<Description> | Description["properties"], presetName: keyof typeof presets, parentName?: string) => (Record<string, Property> | Partial<Description>) & ({
10
9
  readonly actions: {
11
10
  readonly removeAll: {
12
11
  readonly label: "action.removeAll";
@@ -19,6 +19,6 @@ export type BuildLookupOptions = {
19
19
  memoize?: string;
20
20
  project?: string[];
21
21
  };
22
- export declare const getReferences: (properties: FixedObjectProperty['properties'], options?: GetReferenceOptions) => Promise<{}>;
22
+ export declare const getReferences: (properties: FixedObjectProperty["properties"], options?: GetReferenceOptions) => Promise<{}>;
23
23
  export declare const buildLookupPipeline: (referenceMap: ReferenceMap | {}, options: BuildLookupOptions) => Promise<any[]>;
24
- export declare const getLookupPipeline: (description: Description, _options?: Omit<BuildLookupOptions, 'properties'>) => Promise<any[]>;
24
+ export declare const getLookupPipeline: (description: Description, _options?: Omit<BuildLookupOptions, "properties">) => Promise<any[]>;
@@ -3,7 +3,7 @@ import { MongoClient } from 'mongodb';
3
3
  export { ObjectId, } from 'mongodb';
4
4
  export declare const getDatabase: () => Promise<{
5
5
  client: MongoClient;
6
- db: ReturnType<MongoClient['db']> | undefined;
6
+ db: ReturnType<MongoClient["db"]> | undefined;
7
7
  }>;
8
8
  export declare const getDatabaseSync: () => import("mongodb").Db;
9
9
  export declare const prepareCollectionName: (collectionName: string) => string;
@@ -1,5 +1,5 @@
1
1
  import type { Context, SchemaWithId, CountPayload } from '@aeriajs/types';
2
- export declare const count: <TContext extends Context>(payload: CountPayload<SchemaWithId<TContext['description']>>, context: TContext extends Context<any> ? TContext : never) => Promise<{
2
+ export declare const count: <TContext extends Context>(payload: CountPayload<SchemaWithId<TContext["description"]>>, context: TContext extends Context<any> ? TContext : never) => Promise<{
3
3
  readonly _tag: "Result";
4
4
  readonly error: undefined;
5
5
  readonly result: any;
@@ -2,4 +2,4 @@ import type { Context, SchemaWithId, GetPayload, GetReturnType } from '@aeriajs/
2
2
  export type GetOptions = {
3
3
  bypassSecurity?: boolean;
4
4
  };
5
- export declare const get: <TContext extends Context>(payload: GetPayload<SchemaWithId<TContext['description']>>, context: TContext extends Context<any> ? TContext : never, options?: GetOptions) => Promise<GetReturnType<TContext['description']>>;
5
+ export declare const get: <TContext extends Context>(payload: GetPayload<SchemaWithId<TContext["description"]>>, context: TContext extends Context<any> ? TContext : never, options?: GetOptions) => Promise<GetReturnType<TContext["description"]>>;
@@ -2,7 +2,7 @@ import type { Context, SchemaWithId, GetAllPayload } from '@aeriajs/types';
2
2
  export type GetAllOptions = {
3
3
  bypassSecurity?: boolean;
4
4
  };
5
- export declare const getAll: <TContext extends Context>(_payload: GetAllPayload<SchemaWithId<TContext['description']>> | undefined, context: TContext, options?: GetAllOptions) => Promise<{
5
+ export declare const getAll: <TContext extends Context>(_payload: GetAllPayload<SchemaWithId<TContext["description"]>> | undefined, context: TContext, options?: GetAllOptions) => Promise<{
6
6
  readonly _tag: "Result";
7
7
  readonly error: undefined;
8
8
  readonly result: SchemaWithId<TContext["description"]>[];
@@ -33,4 +33,4 @@ export declare const insertErrorSchema: () => {
33
33
  };
34
34
  };
35
35
  };
36
- export declare const insert: <TContext extends Context>(payload: InsertPayload<SchemaWithId<TContext['description']>>, context: TContext, options?: InsertOptions) => Promise<InsertReturnType<SchemaWithId<TContext['description']>>>;
36
+ export declare const insert: <TContext extends Context>(payload: InsertPayload<SchemaWithId<TContext["description"]>>, context: TContext, options?: InsertOptions) => Promise<InsertReturnType<SchemaWithId<TContext["description"]>>>;
@@ -1,6 +1,6 @@
1
1
  import type { Context, SchemaWithId, RemovePayload } from '@aeriajs/types';
2
2
  import { Result, HTTPStatus, ACError } from '@aeriajs/types';
3
- export declare const remove: <TContext extends Context>(payload: RemovePayload<SchemaWithId<TContext['description']>>, context: TContext) => Promise<Result.Error<{
3
+ export declare const remove: <TContext extends Context>(payload: RemovePayload<SchemaWithId<TContext["description"]>>, context: TContext) => Promise<Result.Error<{
4
4
  readonly code: ACError.ResourceNotFound;
5
5
  } & {
6
6
  httpStatus: HTTPStatus.NotFound;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/core",
3
- "version": "0.0.116",
3
+ "version": "0.0.117",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -41,11 +41,11 @@
41
41
  "mongodb-memory-server": "^9.2.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@aeriajs/builtins": "^0.0.116",
44
+ "@aeriajs/builtins": "^0.0.117",
45
45
  "@aeriajs/common": "^0.0.74",
46
46
  "@aeriajs/entrypoint": "^0.0.76",
47
47
  "@aeriajs/http": "^0.0.85",
48
- "@aeriajs/security": "^0.0.116",
48
+ "@aeriajs/security": "^0.0.117",
49
49
  "@aeriajs/types": "^0.0.64",
50
50
  "@aeriajs/validation": "^0.0.77"
51
51
  },