aeria-sdk 0.0.199 → 0.0.201

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/auth.d.ts CHANGED
@@ -11,6 +11,10 @@ export type AuthenticationPayload = {
11
11
  password: string;
12
12
  };
13
13
  export declare const authenticate: (config: InstanceConfig) => (payload: AuthenticationPayload) => Promise<{
14
+ readonly _tag: "Result";
15
+ readonly error: undefined;
16
+ readonly result: AuthenticationResult;
17
+ } | {
14
18
  readonly _tag: "Error";
15
19
  readonly error: unknown;
16
20
  readonly result: undefined;
package/dist/auth.js CHANGED
@@ -10,6 +10,7 @@ const authenticate = (config) => async (payload) => {
10
10
  const { error, result } = response.data;
11
11
  if (result) {
12
12
  (0, storage_js_1.getStorage)(config).set('auth', result);
13
+ return types_1.Result.result(result);
13
14
  }
14
15
  return types_1.Result.error(error);
15
16
  };
package/dist/auth.mjs CHANGED
@@ -8,6 +8,7 @@ export const authenticate = (config) => async (payload) => {
8
8
  const { error, result } = response.data;
9
9
  if (result) {
10
10
  getStorage(config).set("auth", result);
11
+ return Result.result(result);
11
12
  }
12
13
  return Result.error(error);
13
14
  };
@@ -1,10 +1,13 @@
1
1
  import type { InstanceConfig, InstanceContext, ApiPrototype, ApiSchema, InferEndpointFromContract } from './types.js';
2
+ import { type CollectionFunctionsSDK, type Description, type JsonSchema } from '@aeriajs/types';
2
3
  export declare const interceptors: InstanceContext['interceptors'];
3
- export declare const call: <TApiSchema extends ApiSchema>() => <TRoute extends keyof TApiSchema, TRouteMethod extends keyof TApiSchema[TRoute]>(method: TRouteMethod & string, route: TRoute & string, params: {
4
+ export declare const call: <TApiSchema extends ApiSchema, TDescriptions extends Record<string, Description> = Record<string, Description>>() => <TRoute extends keyof TApiSchema, TRouteMethod extends keyof TApiSchema[TRoute]>(method: TRouteMethod & string, route: TRoute & string, params: {
4
5
  config: InstanceConfig;
5
6
  context?: InstanceContext;
6
7
  bearerToken?: string;
7
- }) => InferEndpointFromContract<TApiSchema[TRoute][TRouteMethod]>;
8
+ }) => TApiSchema[TRoute][TRouteMethod] extends {
9
+ builtin: true;
10
+ } ? TRoute extends `/${infer InferredCollection}/${infer InferredEndpoint}` ? InferredEndpoint extends keyof CollectionFunctionsSDK<JsonSchema> ? CollectionFunctionsSDK<TDescriptions[InferredCollection]>[InferredEndpoint] : never : never : InferEndpointFromContract<TApiSchema[TRoute][TRouteMethod]>;
8
11
  export declare const createInstance: <TApiPrototype extends ApiPrototype>(config: InstanceConfig, instanceContext?: {
9
12
  interceptors: {
10
13
  request?: import("@aeriajs/common").RequestTransformer;
package/dist/instance.js CHANGED
@@ -14,7 +14,7 @@ const proxify = (config, _target, context, bearerToken, segment) => {
14
14
  ? `/${segment}`
15
15
  : `/${key}`;
16
16
  const nextSegment = segment
17
- ? `${uri}/${key}`
17
+ ? `${segment}/${key}`
18
18
  : key;
19
19
  const fn = (0, exports.call)()(key, uri, {
20
20
  config,
package/dist/instance.mjs CHANGED
@@ -9,7 +9,7 @@ const proxify = (config, _target, context, bearerToken, segment) => {
9
9
  return target[key];
10
10
  }
11
11
  const uri = segment ? `/${segment}` : `/${key}`;
12
- const nextSegment = segment ? `${uri}/${key}` : key;
12
+ const nextSegment = segment ? `${segment}/${key}` : key;
13
13
  const fn = call()(key, uri, {
14
14
  config,
15
15
  context,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aeria-sdk",
3
- "version": "0.0.199",
3
+ "version": "0.0.201",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -52,8 +52,8 @@
52
52
  "@aeriajs/types": "link:../types"
53
53
  },
54
54
  "peerDependencies": {
55
- "@aeriajs/common": "^0.0.150",
56
- "@aeriajs/types": "^0.0.128"
55
+ "@aeriajs/common": "^0.0.151",
56
+ "@aeriajs/types": "^0.0.129"
57
57
  },
58
58
  "scripts": {
59
59
  "test": "echo skipping",