@plasmicapp/data-sources 0.1.126 → 0.1.127
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/components/Fetcher.d.ts +15 -15
- package/dist/executor.d.ts +17 -17
- package/dist/helpers.d.ts +18 -18
- package/dist/hooks/useDependencyAwareQuery.d.ts +11 -11
- package/dist/hooks/usePlasmicDataOp.d.ts +20 -20
- package/dist/index.d.ts +10 -8
- package/dist/index.esm.js +600 -0
- package/dist/index.esm.js.map +7 -0
- package/dist/index.js +622 -5
- package/dist/index.js.map +7 -0
- package/dist/types.d.ts +31 -31
- package/dist/utils.d.ts +31 -31
- package/package.json +22 -34
- package/dist/data-sources.cjs.development.js +0 -1171
- package/dist/data-sources.cjs.development.js.map +0 -1
- package/dist/data-sources.cjs.production.min.js +0 -2
- package/dist/data-sources.cjs.production.min.js.map +0 -1
- package/dist/data-sources.esm.js +0 -1151
- package/dist/data-sources.esm.js.map +0 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { ComponentMeta } from '@plasmicapp/host';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { DataOp } from '../executor';
|
|
4
|
-
export interface DataOpConfig {
|
|
5
|
-
name?: string;
|
|
6
|
-
pageIndex?: number;
|
|
7
|
-
pageSize?: number;
|
|
8
|
-
}
|
|
9
|
-
export interface FetcherProps extends DataOpConfig {
|
|
10
|
-
dataOp?: DataOp;
|
|
11
|
-
children?: ($queries: Record<string, any>) => React.ReactElement | null;
|
|
12
|
-
queries?: Record<string, any>;
|
|
13
|
-
}
|
|
14
|
-
export declare function Fetcher(props: FetcherProps): React.ReactElement | null;
|
|
15
|
-
export declare const FetcherMeta: ComponentMeta<FetcherProps>;
|
|
1
|
+
import { ComponentMeta } from '@plasmicapp/host';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { DataOp } from '../executor';
|
|
4
|
+
export interface DataOpConfig {
|
|
5
|
+
name?: string;
|
|
6
|
+
pageIndex?: number;
|
|
7
|
+
pageSize?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface FetcherProps extends DataOpConfig {
|
|
10
|
+
dataOp?: DataOp;
|
|
11
|
+
children?: ($queries: Record<string, any>) => React.ReactElement | null;
|
|
12
|
+
queries?: Record<string, any>;
|
|
13
|
+
}
|
|
14
|
+
export declare function Fetcher(props: FetcherProps): React.ReactElement | null;
|
|
15
|
+
export declare const FetcherMeta: ComponentMeta<FetcherProps>;
|
package/dist/executor.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { PlasmicDataSourceContextValue } from '@plasmicapp/data-sources-context';
|
|
2
|
-
import { ManyRowsResult, Pagination, SingleRowResult } from './types';
|
|
3
|
-
export interface DataOp {
|
|
4
|
-
sourceId: string;
|
|
5
|
-
opId: string;
|
|
6
|
-
userArgs?: Record<string, any>;
|
|
7
|
-
cacheKey?: string;
|
|
8
|
-
invalidatedKeys?: string[] | null;
|
|
9
|
-
roleId?: string | null;
|
|
10
|
-
}
|
|
11
|
-
interface ExecuteOpts {
|
|
12
|
-
userAuthToken?: string;
|
|
13
|
-
user?: PlasmicDataSourceContextValue['user'];
|
|
14
|
-
paginate?: Pagination;
|
|
15
|
-
}
|
|
16
|
-
export declare function executePlasmicDataOp<T extends SingleRowResult | ManyRowsResult>(op: DataOp, opts?: ExecuteOpts): Promise<T>;
|
|
17
|
-
export {};
|
|
1
|
+
import { PlasmicDataSourceContextValue } from '@plasmicapp/data-sources-context';
|
|
2
|
+
import { ManyRowsResult, Pagination, SingleRowResult } from './types';
|
|
3
|
+
export interface DataOp {
|
|
4
|
+
sourceId: string;
|
|
5
|
+
opId: string;
|
|
6
|
+
userArgs?: Record<string, any>;
|
|
7
|
+
cacheKey?: string;
|
|
8
|
+
invalidatedKeys?: string[] | null;
|
|
9
|
+
roleId?: string | null;
|
|
10
|
+
}
|
|
11
|
+
interface ExecuteOpts {
|
|
12
|
+
userAuthToken?: string;
|
|
13
|
+
user?: PlasmicDataSourceContextValue['user'];
|
|
14
|
+
paginate?: Pagination;
|
|
15
|
+
}
|
|
16
|
+
export declare function executePlasmicDataOp<T extends SingleRowResult | ManyRowsResult>(op: DataOp, opts?: ExecuteOpts): Promise<T>;
|
|
17
|
+
export {};
|
package/dist/helpers.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ManyRowsResult, TableFieldSchema, TableSchema } from './types';
|
|
2
|
-
export
|
|
3
|
-
error?: any;
|
|
4
|
-
isLoading?: boolean;
|
|
5
|
-
};
|
|
6
|
-
export interface NormalizedData {
|
|
7
|
-
data: Record<string, unknown>[];
|
|
8
|
-
schema?: TableSchema;
|
|
9
|
-
}
|
|
10
|
-
export declare function normalizeData(rawData: unknown): NormalizedData | undefined;
|
|
11
|
-
export
|
|
12
|
-
key?: string;
|
|
13
|
-
fieldId?: string;
|
|
14
|
-
};
|
|
15
|
-
export declare function deriveFieldConfigs<T extends BaseFieldConfig>(specifiedFieldsPartial: Partial<T>[], schema: TableSchema | undefined, makeDefaultConfig: (field: TableFieldSchema | undefined) => T): {
|
|
16
|
-
mergedFields: T[];
|
|
17
|
-
minimalFullLengthFields: Partial<T>[];
|
|
18
|
-
};
|
|
1
|
+
import { ManyRowsResult, TableFieldSchema, TableSchema } from './types';
|
|
2
|
+
export type QueryResult = Partial<ManyRowsResult<any>> & {
|
|
3
|
+
error?: any;
|
|
4
|
+
isLoading?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export interface NormalizedData {
|
|
7
|
+
data: Record<string, unknown>[];
|
|
8
|
+
schema?: TableSchema;
|
|
9
|
+
}
|
|
10
|
+
export declare function normalizeData(rawData: unknown): NormalizedData | undefined;
|
|
11
|
+
export type BaseFieldConfig = {
|
|
12
|
+
key?: string;
|
|
13
|
+
fieldId?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function deriveFieldConfigs<T extends BaseFieldConfig>(specifiedFieldsPartial: Partial<T>[], schema: TableSchema | undefined, makeDefaultConfig: (field: TableFieldSchema | undefined) => T): {
|
|
16
|
+
mergedFields: T[];
|
|
17
|
+
minimalFullLengthFields: Partial<T>[];
|
|
18
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DataOpConfig } from '../components/Fetcher';
|
|
2
|
-
import { DataOp } from '../executor';
|
|
3
|
-
export interface DependencyAwareQueryConfig extends DataOpConfig {
|
|
4
|
-
$queries: Record<string, any>;
|
|
5
|
-
setDollarQueries: ($queries: Record<string, any>) => void;
|
|
6
|
-
getDataOp: () => DataOp;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Prefer using `usePlasmicDataOp` directly instead.
|
|
10
|
-
*/
|
|
11
|
-
export declare function useDependencyAwareQuery({ $queries, getDataOp, setDollarQueries, name, pageIndex, pageSize, }: DependencyAwareQueryConfig): void;
|
|
1
|
+
import { DataOpConfig } from '../components/Fetcher';
|
|
2
|
+
import { DataOp } from '../executor';
|
|
3
|
+
export interface DependencyAwareQueryConfig extends DataOpConfig {
|
|
4
|
+
$queries: Record<string, any>;
|
|
5
|
+
setDollarQueries: ($queries: Record<string, any>) => void;
|
|
6
|
+
getDataOp: () => DataOp;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Prefer using `usePlasmicDataOp` directly instead.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useDependencyAwareQuery({ $queries, getDataOp, setDollarQueries, name, pageIndex, pageSize, }: DependencyAwareQueryConfig): void;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { DataOp } from '../executor';
|
|
2
|
-
import { ManyRowsResult, Pagination, SingleRowResult } from '../types';
|
|
3
|
-
export declare function makeCacheKey(dataOp: DataOp, opts?: {
|
|
4
|
-
paginate?: Pagination;
|
|
5
|
-
userAuthToken?: string | null;
|
|
6
|
-
}): string;
|
|
7
|
-
/**
|
|
8
|
-
* Returns a function that can be used to invalidate Plasmic query groups.
|
|
9
|
-
*/
|
|
10
|
-
export declare function usePlasmicInvalidate(): (invalidatedKeys: string[] | null | undefined) => Promise<any[] | undefined>;
|
|
11
|
-
|
|
12
|
-
export declare function usePlasmicDataOp<T extends SingleRowResult | ManyRowsResult, E = any>(dataOp: ResolvableDataOp, opts?: {
|
|
13
|
-
paginate?: Pagination;
|
|
14
|
-
noUndefinedDataProxy?: boolean;
|
|
15
|
-
}): Partial<T> & {
|
|
16
|
-
error?: E;
|
|
17
|
-
isLoading?: boolean;
|
|
18
|
-
};
|
|
19
|
-
export declare function usePlasmicDataMutationOp<T extends SingleRowResult | ManyRowsResult>(dataOp: ResolvableDataOp): () => Promise<T | undefined>;
|
|
20
|
-
export {};
|
|
1
|
+
import { DataOp } from '../executor';
|
|
2
|
+
import { ManyRowsResult, Pagination, SingleRowResult } from '../types';
|
|
3
|
+
export declare function makeCacheKey(dataOp: DataOp, opts?: {
|
|
4
|
+
paginate?: Pagination;
|
|
5
|
+
userAuthToken?: string | null;
|
|
6
|
+
}): string;
|
|
7
|
+
/**
|
|
8
|
+
* Returns a function that can be used to invalidate Plasmic query groups.
|
|
9
|
+
*/
|
|
10
|
+
export declare function usePlasmicInvalidate(): (invalidatedKeys: string[] | null | undefined) => Promise<any[] | undefined>;
|
|
11
|
+
type ResolvableDataOp = DataOp | undefined | null | (() => DataOp | undefined | null);
|
|
12
|
+
export declare function usePlasmicDataOp<T extends SingleRowResult | ManyRowsResult, E = any>(dataOp: ResolvableDataOp, opts?: {
|
|
13
|
+
paginate?: Pagination;
|
|
14
|
+
noUndefinedDataProxy?: boolean;
|
|
15
|
+
}): Partial<T> & {
|
|
16
|
+
error?: E;
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
};
|
|
19
|
+
export declare function usePlasmicDataMutationOp<T extends SingleRowResult | ManyRowsResult>(dataOp: ResolvableDataOp): () => Promise<T | undefined>;
|
|
20
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export { usePlasmicDataConfig } from
|
|
2
|
-
export { Fetcher, FetcherMeta
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export type {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export
|
|
1
|
+
export { usePlasmicDataConfig } from "@plasmicapp/query";
|
|
2
|
+
export { Fetcher, FetcherMeta } from "./components/Fetcher";
|
|
3
|
+
export type { FetcherProps } from "./components/Fetcher";
|
|
4
|
+
export { executePlasmicDataOp } from "./executor";
|
|
5
|
+
export type { DataOp } from "./executor";
|
|
6
|
+
export { deriveFieldConfigs, normalizeData } from "./helpers";
|
|
7
|
+
export type { BaseFieldConfig, NormalizedData, QueryResult } from "./helpers";
|
|
8
|
+
export { useDependencyAwareQuery } from "./hooks/useDependencyAwareQuery";
|
|
9
|
+
export { makeCacheKey, usePlasmicDataMutationOp, usePlasmicDataOp, usePlasmicInvalidate, } from "./hooks/usePlasmicDataOp";
|
|
10
|
+
export type { DataSourceSchema, ManyRowsResult, Pagination, SingleRowResult, TableFieldSchema, TableFieldType, TableSchema, } from "./types";
|