@webority/mobile-core 0.155.1 → 0.157.0
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/lib/commonjs/api/contractCaller.js +1 -1
- package/lib/commonjs/query/contractQuery.js +1 -0
- package/lib/commonjs/query/index.js +1 -1
- package/lib/module/api/contractCaller.js +1 -1
- package/lib/module/query/contractQuery.js +1 -0
- package/lib/module/query/index.js +1 -1
- package/lib/typescript/commonjs/api/contractCaller.d.ts +4 -2
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/query/contractQuery.d.ts +18 -0
- package/lib/typescript/commonjs/query/index.d.ts +2 -0
- package/lib/typescript/module/api/contractCaller.d.ts +4 -2
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/query/contractQuery.d.ts +18 -0
- package/lib/typescript/module/query/index.d.ts +2 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createContractCaller=void 0;var _call=require("@webority/api-contract/call");const createContractCaller=(e,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createContractCaller=void 0;var _call=require("@webority/api-contract/call");const createContractCaller=(e,t)=>async(r,a,o)=>{const l=(0,_call.buildContractRequest)(t[r],a);return(await e.request({method:l.method,url:l.url,...void 0===l.headers?{}:{headers:l.headers},data:l.data,responseType:l.responseType,...void 0===o?.signal?{}:{signal:o.signal},...void 0===o?.timeout?{}:{timeout:o.timeout},...void 0===o?.retry?{}:{retry:o.retry}})).data};exports.createContractCaller=createContractCaller;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.createContractQuery=void 0;var _call=require("@webority/api-contract/call");const createContractQuery=e=>(t,r,a)=>{const o=e[t],l=(0,_call.buildContractRequest)(o,r);if("blob"===o.replyKind)throw new _call.ContractCallError(`${o.method} ${o.path} replies with a file; a file download goes through the contract caller, not a store query`);if("QUERY"===l.method)throw new _call.ContractCallError(`${o.method} ${o.path} uses the QUERY method, which the base query does not send`);return{...a,url:l.url,method:l.method,...void 0===l.data?{}:{data:l.data},...void 0===l.headers?{}:{headers:l.headers}}};exports.createContractQuery=createContractQuery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"APP_API_DEFAULTS",{enumerable:!0,get:function(){return _createAppApi.APP_API_DEFAULTS}}),Object.defineProperty(exports,"LIST_TAG_ID",{enumerable:!0,get:function(){return _tags.LIST_TAG_ID}}),Object.defineProperty(exports,"PERSISTED_QUERIES_RESTORED",{enumerable:!0,get:function(){return _persistedQueries.PERSISTED_QUERIES_RESTORED}}),Object.defineProperty(exports,"buildListQuery",{enumerable:!0,get:function(){return _paging.buildListQuery}}),Object.defineProperty(exports,"createApiBaseQuery",{enumerable:!0,get:function(){return _apiBaseQuery.createApiBaseQuery}}),Object.defineProperty(exports,"createAppApi",{enumerable:!0,get:function(){return _createAppApi.createAppApi}}),Object.defineProperty(exports,"createPersistedQueries",{enumerable:!0,get:function(){return _persistedQueries.createPersistedQueries}}),Object.defineProperty(exports,"entityTagOf",{enumerable:!0,get:function(){return _entityVersion.entityTagOf}}),Object.defineProperty(exports,"getNextPageParam",{enumerable:!0,get:function(){return _paging.getNextPageParam}}),Object.defineProperty(exports,"getPreviousPageParam",{enumerable:!0,get:function(){return _paging.getPreviousPageParam}}),Object.defineProperty(exports,"hasNextPage",{enumerable:!0,get:function(){return _paging.hasNextPage}}),Object.defineProperty(exports,"hasPreviousPage",{enumerable:!0,get:function(){return _paging.hasPreviousPage}}),Object.defineProperty(exports,"itemTag",{enumerable:!0,get:function(){return _tags.itemTag}}),Object.defineProperty(exports,"listTag",{enumerable:!0,get:function(){return _tags.listTag}}),Object.defineProperty(exports,"providesList",{enumerable:!0,get:function(){return _tags.providesList}}),Object.defineProperty(exports,"providesPagedList",{enumerable:!0,get:function(){return _tags.providesPagedList}}),Object.defineProperty(exports,"saveWithVersion",{enumerable:!0,get:function(){return _entityVersion.saveWithVersion}}),Object.defineProperty(exports,"setupApiListeners",{enumerable:!0,get:function(){return _listeners.setupApiListeners}}),Object.defineProperty(exports,"useDataState",{enumerable:!0,get:function(){return _dataState.useDataState}}),Object.defineProperty(exports,"useInfiniteDataState",{enumerable:!0,get:function(){return _dataState.useInfiniteDataState}}),Object.defineProperty(exports,"usePagedList",{enumerable:!0,get:function(){return _usePagedList.usePagedList}}),Object.defineProperty(exports,"versionOf",{enumerable:!0,get:function(){return _entityVersion.versionOf}}),Object.defineProperty(exports,"withIfMatch",{enumerable:!0,get:function(){return _entityVersion.withIfMatch}});var _apiBaseQuery=require("./apiBaseQuery.js"),_createAppApi=require("./createAppApi.js"),_dataState=require("./dataState.js"),_entityVersion=require("./entityVersion.js"),_listeners=require("./listeners.js"),_paging=require("./paging.js"),_persistedQueries=require("./persistedQueries.js"),_tags=require("./tags.js"),_usePagedList=require("./usePagedList.js");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"APP_API_DEFAULTS",{enumerable:!0,get:function(){return _createAppApi.APP_API_DEFAULTS}}),Object.defineProperty(exports,"LIST_TAG_ID",{enumerable:!0,get:function(){return _tags.LIST_TAG_ID}}),Object.defineProperty(exports,"PERSISTED_QUERIES_RESTORED",{enumerable:!0,get:function(){return _persistedQueries.PERSISTED_QUERIES_RESTORED}}),Object.defineProperty(exports,"buildListQuery",{enumerable:!0,get:function(){return _paging.buildListQuery}}),Object.defineProperty(exports,"createApiBaseQuery",{enumerable:!0,get:function(){return _apiBaseQuery.createApiBaseQuery}}),Object.defineProperty(exports,"createAppApi",{enumerable:!0,get:function(){return _createAppApi.createAppApi}}),Object.defineProperty(exports,"createContractQuery",{enumerable:!0,get:function(){return _contractQuery.createContractQuery}}),Object.defineProperty(exports,"createPersistedQueries",{enumerable:!0,get:function(){return _persistedQueries.createPersistedQueries}}),Object.defineProperty(exports,"entityTagOf",{enumerable:!0,get:function(){return _entityVersion.entityTagOf}}),Object.defineProperty(exports,"getNextPageParam",{enumerable:!0,get:function(){return _paging.getNextPageParam}}),Object.defineProperty(exports,"getPreviousPageParam",{enumerable:!0,get:function(){return _paging.getPreviousPageParam}}),Object.defineProperty(exports,"hasNextPage",{enumerable:!0,get:function(){return _paging.hasNextPage}}),Object.defineProperty(exports,"hasPreviousPage",{enumerable:!0,get:function(){return _paging.hasPreviousPage}}),Object.defineProperty(exports,"itemTag",{enumerable:!0,get:function(){return _tags.itemTag}}),Object.defineProperty(exports,"listTag",{enumerable:!0,get:function(){return _tags.listTag}}),Object.defineProperty(exports,"providesList",{enumerable:!0,get:function(){return _tags.providesList}}),Object.defineProperty(exports,"providesPagedList",{enumerable:!0,get:function(){return _tags.providesPagedList}}),Object.defineProperty(exports,"saveWithVersion",{enumerable:!0,get:function(){return _entityVersion.saveWithVersion}}),Object.defineProperty(exports,"setupApiListeners",{enumerable:!0,get:function(){return _listeners.setupApiListeners}}),Object.defineProperty(exports,"useDataState",{enumerable:!0,get:function(){return _dataState.useDataState}}),Object.defineProperty(exports,"useInfiniteDataState",{enumerable:!0,get:function(){return _dataState.useInfiniteDataState}}),Object.defineProperty(exports,"usePagedList",{enumerable:!0,get:function(){return _usePagedList.usePagedList}}),Object.defineProperty(exports,"versionOf",{enumerable:!0,get:function(){return _entityVersion.versionOf}}),Object.defineProperty(exports,"withIfMatch",{enumerable:!0,get:function(){return _entityVersion.withIfMatch}});var _apiBaseQuery=require("./apiBaseQuery.js"),_contractQuery=require("./contractQuery.js"),_createAppApi=require("./createAppApi.js"),_dataState=require("./dataState.js"),_entityVersion=require("./entityVersion.js"),_listeners=require("./listeners.js"),_paging=require("./paging.js"),_persistedQueries=require("./persistedQueries.js"),_tags=require("./tags.js"),_usePagedList=require("./usePagedList.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";import{buildContractRequest}from"@webority/api-contract/call";export const createContractCaller=(t,e)=>async(a,
|
|
1
|
+
"use strict";import{buildContractRequest}from"@webority/api-contract/call";export const createContractCaller=(t,e)=>async(r,a,o)=>{const s=buildContractRequest(e[r],a);return(await t.request({method:s.method,url:s.url,...void 0===s.headers?{}:{headers:s.headers},data:s.data,responseType:s.responseType,...void 0===o?.signal?{}:{signal:o.signal},...void 0===o?.timeout?{}:{timeout:o.timeout},...void 0===o?.retry?{}:{retry:o.retry}})).data};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{buildContractRequest,ContractCallError}from"@webority/api-contract/call";export const createContractQuery=t=>(e,r,o)=>{const a=t[e],d=buildContractRequest(a,r);if("blob"===a.replyKind)throw new ContractCallError(`${a.method} ${a.path} replies with a file; a file download goes through the contract caller, not a store query`);if("QUERY"===d.method)throw new ContractCallError(`${a.method} ${a.path} uses the QUERY method, which the base query does not send`);return{...o,url:d.url,method:d.method,...void 0===d.data?{}:{data:d.data},...void 0===d.headers?{}:{headers:d.headers}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";export{createApiBaseQuery}from"./apiBaseQuery.js";export{APP_API_DEFAULTS,createAppApi}from"./createAppApi.js";export{useDataState,useInfiniteDataState}from"./dataState.js";export{entityTagOf,saveWithVersion,versionOf,withIfMatch}from"./entityVersion.js";export{setupApiListeners}from"./listeners.js";export{buildListQuery,getNextPageParam,getPreviousPageParam,hasNextPage,hasPreviousPage}from"./paging.js";export{createPersistedQueries,PERSISTED_QUERIES_RESTORED}from"./persistedQueries.js";export{itemTag,LIST_TAG_ID,listTag,providesList,providesPagedList}from"./tags.js";export{usePagedList}from"./usePagedList.js";
|
|
1
|
+
"use strict";export{createApiBaseQuery}from"./apiBaseQuery.js";export{createContractQuery}from"./contractQuery.js";export{APP_API_DEFAULTS,createAppApi}from"./createAppApi.js";export{useDataState,useInfiniteDataState}from"./dataState.js";export{entityTagOf,saveWithVersion,versionOf,withIfMatch}from"./entityVersion.js";export{setupApiListeners}from"./listeners.js";export{buildListQuery,getNextPageParam,getPreviousPageParam,hasNextPage,hasPreviousPage}from"./paging.js";export{createPersistedQueries,PERSISTED_QUERIES_RESTORED}from"./persistedQueries.js";export{itemTag,LIST_TAG_ID,listTag,providesList,providesPagedList}from"./tags.js";export{usePagedList}from"./usePagedList.js";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type OperationEntry, type OperationShape } from "@webority/api-contract/call";
|
|
2
2
|
import type { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
3
|
+
/** Per-call options: an abort signal, a timeout, and the client's retry override (`false`, or a policy such as `{ retries: 1 }`). */
|
|
4
|
+
export type ContractCallConfig = Pick<AxiosRequestConfig, "signal" | "timeout" | "retry">;
|
|
3
5
|
export type ContractCaller<TOperations extends {
|
|
4
6
|
readonly [K in keyof TOperations]: OperationShape;
|
|
5
|
-
}> = <TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?:
|
|
6
|
-
export declare const createContractCaller: <TOperations extends { readonly [K in keyof TOperations]: OperationShape; }>(client: AxiosInstance, operations: { readonly [K in keyof TOperations & string]: OperationEntry; }) => ContractCaller<TOperations>;
|
|
7
|
+
}> = <TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?: ContractCallConfig) => Promise<TOperations[TId]["response"]>;
|
|
8
|
+
export declare const createContractCaller: <TOperations extends { readonly [K in keyof TOperations]: OperationShape; }>(client: Pick<AxiosInstance, "request">, operations: { readonly [K in keyof TOperations & string]: OperationEntry; }) => ContractCaller<TOperations>;
|
|
7
9
|
//# sourceMappingURL=contractCaller.d.ts.map
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
export type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
|
|
40
40
|
export type { AccountIdProvider, ClientKind } from "./api/clientHeaders";
|
|
41
41
|
export { ACCOUNT_ID_HEADER, CLIENT_BUILD_HEADER, CLIENT_KIND, CLIENT_KIND_HEADER, getClientBuild, } from "./api/clientHeaders";
|
|
42
|
-
export type { ContractCaller } from "./api/contractCaller";
|
|
42
|
+
export type { ContractCallConfig, ContractCaller } from "./api/contractCaller";
|
|
43
43
|
export { createContractCaller } from "./api/contractCaller";
|
|
44
44
|
export { buildCurl, logCurl } from "./api/curl";
|
|
45
45
|
export type { FetchRetryPolicy } from "./api/fetchRetry";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type OperationEntry, type OperationShape } from "@webority/api-contract/call";
|
|
2
|
+
import type { ApiRequest } from "./apiBaseQuery";
|
|
3
|
+
/** Base query options a contract call keeps: every ApiRequest field the contract does not decide. */
|
|
4
|
+
export type ContractQueryOptions = Omit<ApiRequest, "url" | "method" | "data" | "headers" | "responseType" | "params" | "paramsFormat">;
|
|
5
|
+
/** The reply type of one contract operation, for an endpoint's result type. */
|
|
6
|
+
export type ContractResponse<TOperations extends {
|
|
7
|
+
readonly [K in keyof TOperations]: OperationShape;
|
|
8
|
+
}, TId extends keyof TOperations> = TOperations[TId]["response"];
|
|
9
|
+
/** Builds the base query's request for one operation of a generated contract, by its id. */
|
|
10
|
+
export type ContractQuery<TOperations extends {
|
|
11
|
+
readonly [K in keyof TOperations]: OperationShape;
|
|
12
|
+
}> = <TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], options?: ContractQueryOptions) => ApiRequest;
|
|
13
|
+
/**
|
|
14
|
+
* Builds `contractQuery` for one generated contract: an endpoint's `query` returns `contractQuery(id, request)`,
|
|
15
|
+
* and the shared base query sends it, so toasts, retry, silent and ETag meta work as for a hand-written endpoint.
|
|
16
|
+
*/
|
|
17
|
+
export declare const createContractQuery: <TOperations extends { readonly [K in keyof TOperations]: OperationShape; }>(operations: { readonly [K in keyof TOperations & string]: OperationEntry; }) => ContractQuery<TOperations>;
|
|
18
|
+
//# sourceMappingURL=contractQuery.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type { ApiBaseQuery, ApiBaseQueryMeta, ApiBaseQueryOptions, ApiExtraOptions, ApiQueryArgs, ApiRequest, } from "./apiBaseQuery";
|
|
2
2
|
export { createApiBaseQuery } from "./apiBaseQuery";
|
|
3
|
+
export type { ContractQuery, ContractQueryOptions, ContractResponse } from "./contractQuery";
|
|
4
|
+
export { createContractQuery } from "./contractQuery";
|
|
3
5
|
export { APP_API_DEFAULTS, createAppApi } from "./createAppApi";
|
|
4
6
|
export type { DataState, DataStateOptions, InfiniteDataStateOptions, InfiniteListPaging, InfiniteQueryResultLike, QueryResultLike, } from "./dataState";
|
|
5
7
|
export { useDataState, useInfiniteDataState } from "./dataState";
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type OperationEntry, type OperationShape } from "@webority/api-contract/call";
|
|
2
2
|
import type { AxiosInstance, AxiosRequestConfig } from "axios";
|
|
3
|
+
/** Per-call options: an abort signal, a timeout, and the client's retry override (`false`, or a policy such as `{ retries: 1 }`). */
|
|
4
|
+
export type ContractCallConfig = Pick<AxiosRequestConfig, "signal" | "timeout" | "retry">;
|
|
3
5
|
export type ContractCaller<TOperations extends {
|
|
4
6
|
readonly [K in keyof TOperations]: OperationShape;
|
|
5
|
-
}> = <TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?:
|
|
6
|
-
export declare const createContractCaller: <TOperations extends { readonly [K in keyof TOperations]: OperationShape; }>(client: AxiosInstance, operations: { readonly [K in keyof TOperations & string]: OperationEntry; }) => ContractCaller<TOperations>;
|
|
7
|
+
}> = <TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], config?: ContractCallConfig) => Promise<TOperations[TId]["response"]>;
|
|
8
|
+
export declare const createContractCaller: <TOperations extends { readonly [K in keyof TOperations]: OperationShape; }>(client: Pick<AxiosInstance, "request">, operations: { readonly [K in keyof TOperations & string]: OperationEntry; }) => ContractCaller<TOperations>;
|
|
7
9
|
//# sourceMappingURL=contractCaller.d.ts.map
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
export type { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from "axios";
|
|
40
40
|
export type { AccountIdProvider, ClientKind } from "./api/clientHeaders.js";
|
|
41
41
|
export { ACCOUNT_ID_HEADER, CLIENT_BUILD_HEADER, CLIENT_KIND, CLIENT_KIND_HEADER, getClientBuild, } from "./api/clientHeaders.js";
|
|
42
|
-
export type { ContractCaller } from "./api/contractCaller.js";
|
|
42
|
+
export type { ContractCallConfig, ContractCaller } from "./api/contractCaller.js";
|
|
43
43
|
export { createContractCaller } from "./api/contractCaller.js";
|
|
44
44
|
export { buildCurl, logCurl } from "./api/curl.js";
|
|
45
45
|
export type { FetchRetryPolicy } from "./api/fetchRetry.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type OperationEntry, type OperationShape } from "@webority/api-contract/call";
|
|
2
|
+
import type { ApiRequest } from "./apiBaseQuery.js";
|
|
3
|
+
/** Base query options a contract call keeps: every ApiRequest field the contract does not decide. */
|
|
4
|
+
export type ContractQueryOptions = Omit<ApiRequest, "url" | "method" | "data" | "headers" | "responseType" | "params" | "paramsFormat">;
|
|
5
|
+
/** The reply type of one contract operation, for an endpoint's result type. */
|
|
6
|
+
export type ContractResponse<TOperations extends {
|
|
7
|
+
readonly [K in keyof TOperations]: OperationShape;
|
|
8
|
+
}, TId extends keyof TOperations> = TOperations[TId]["response"];
|
|
9
|
+
/** Builds the base query's request for one operation of a generated contract, by its id. */
|
|
10
|
+
export type ContractQuery<TOperations extends {
|
|
11
|
+
readonly [K in keyof TOperations]: OperationShape;
|
|
12
|
+
}> = <TId extends keyof TOperations & string>(id: TId, request: TOperations[TId]["request"], options?: ContractQueryOptions) => ApiRequest;
|
|
13
|
+
/**
|
|
14
|
+
* Builds `contractQuery` for one generated contract: an endpoint's `query` returns `contractQuery(id, request)`,
|
|
15
|
+
* and the shared base query sends it, so toasts, retry, silent and ETag meta work as for a hand-written endpoint.
|
|
16
|
+
*/
|
|
17
|
+
export declare const createContractQuery: <TOperations extends { readonly [K in keyof TOperations]: OperationShape; }>(operations: { readonly [K in keyof TOperations & string]: OperationEntry; }) => ContractQuery<TOperations>;
|
|
18
|
+
//# sourceMappingURL=contractQuery.d.ts.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export type { ApiBaseQuery, ApiBaseQueryMeta, ApiBaseQueryOptions, ApiExtraOptions, ApiQueryArgs, ApiRequest, } from "./apiBaseQuery.js";
|
|
2
2
|
export { createApiBaseQuery } from "./apiBaseQuery.js";
|
|
3
|
+
export type { ContractQuery, ContractQueryOptions, ContractResponse } from "./contractQuery.js";
|
|
4
|
+
export { createContractQuery } from "./contractQuery.js";
|
|
3
5
|
export { APP_API_DEFAULTS, createAppApi } from "./createAppApi.js";
|
|
4
6
|
export type { DataState, DataStateOptions, InfiniteDataStateOptions, InfiniteListPaging, InfiniteQueryResultLike, QueryResultLike, } from "./dataState.js";
|
|
5
7
|
export { useDataState, useInfiniteDataState } from "./dataState.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/mobile-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.157.0",
|
|
4
4
|
"description": "Platform layer for Webority React Native apps: HTTP clients, auth/token storage, config, logging, formatters, validators, network status, permissions, storage, version checks and over-the-air updates. No UI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -399,7 +399,7 @@
|
|
|
399
399
|
}
|
|
400
400
|
},
|
|
401
401
|
"dependencies": {
|
|
402
|
-
"@webority/api-contract": "0.
|
|
402
|
+
"@webority/api-contract": "0.157.0",
|
|
403
403
|
"axios": "^1.19.0",
|
|
404
404
|
"libphonenumber-js": "^1.12.41"
|
|
405
405
|
},
|