@adobe/data 0.5.3 → 0.5.4
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/lit/elements/application-element.d.ts +9 -0
- package/dist/lit/elements/application-element.js +62 -0
- package/dist/lit/elements/application-element.js.map +1 -0
- package/dist/lit/elements/service-application.js +4 -1
- package/dist/lit/elements/service-application.js.map +1 -1
- package/dist/lit/functions/index.d.ts +1 -0
- package/dist/lit/functions/index.js +23 -0
- package/dist/lit/functions/index.js.map +1 -0
- package/dist/lit/functions/iterate-self-and-ancestors.d.ts +1 -0
- package/dist/lit/functions/iterate-self-and-ancestors.js +44 -0
- package/dist/lit/functions/iterate-self-and-ancestors.js.map +1 -0
- package/dist/lit/hooks/attach-decorator.d.ts +4 -0
- package/dist/lit/hooks/attach-decorator.js +46 -0
- package/dist/lit/hooks/attach-decorator.js.map +1 -0
- package/dist/lit/hooks/index.d.ts +1 -0
- package/dist/lit/hooks/index.js +1 -0
- package/dist/lit/hooks/index.js.map +1 -1
- package/dist/lit/hooks/use-drag-observe.d.ts +22 -0
- package/dist/lit/hooks/use-drag-observe.js +55 -0
- package/dist/lit/hooks/use-drag-observe.js.map +1 -0
- package/dist/lit/hooks/use-drag-transaction.d.ts +8 -0
- package/dist/lit/hooks/use-drag-transaction.js +56 -0
- package/dist/lit/hooks/use-drag-transaction.js.map +1 -0
- package/dist/lit/hooks/use-draggable.d.ts +16 -0
- package/dist/lit/hooks/use-draggable.js +122 -0
- package/dist/lit/hooks/use-draggable.js.map +1 -0
- package/dist/service/disposable.d.ts +4 -0
- package/dist/service/disposable.js +25 -0
- package/dist/service/disposable.js.map +1 -0
- package/dist/service/progressive-result.d.ts +7 -10
- package/dist/service/progressive-result.js +0 -6
- package/dist/service/progressive-result.js.map +1 -1
- package/dist/service/service.d.ts +11 -1
- package/dist/service/to-frontend-service.d.ts +12 -0
- package/dist/service/to-frontend-service.js +5 -0
- package/dist/service/to-frontend-service.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Schema } from "../schema/schema.js";
|
|
2
|
-
export type ErrorResult<
|
|
2
|
+
export type ErrorResult<Error> = {
|
|
3
3
|
readonly error: Error;
|
|
4
4
|
readonly progress?: number;
|
|
5
5
|
};
|
|
6
|
-
export type IntermediateResult<Result> =
|
|
6
|
+
export type IntermediateResult<Result> = Result & {
|
|
7
7
|
readonly error?: never;
|
|
8
8
|
readonly progress: number;
|
|
9
9
|
};
|
|
@@ -11,7 +11,8 @@ export type SuccessResult<Result> = Result & {
|
|
|
11
11
|
readonly error?: never;
|
|
12
12
|
readonly progress: 1.0;
|
|
13
13
|
};
|
|
14
|
-
export type
|
|
14
|
+
export type FinalResult<Result, Error> = SuccessResult<Result> | ErrorResult<Error>;
|
|
15
|
+
export type ProgressiveResult<Result, Error, Intermediate = Partial<Result>> = IntermediateResult<Intermediate> | FinalResult<Result, Error>;
|
|
15
16
|
/**
|
|
16
17
|
* Results must be objects as we are going to add error and progress properties to them.
|
|
17
18
|
*/
|
|
@@ -80,17 +81,13 @@ export declare function ProgressiveResultSchema<T extends ResultSchema, E extend
|
|
|
80
81
|
/**
|
|
81
82
|
* Checks if the result is an error result.
|
|
82
83
|
*/
|
|
83
|
-
export declare function isErrorResult<
|
|
84
|
-
/**
|
|
85
|
-
* Checks if the result is not started. We check progress < 0.0 to mean not started.
|
|
86
|
-
*/
|
|
87
|
-
export declare function isNotStarted<FinalValue, ErrorValue>(result: ProgressiveResult<FinalValue, ErrorValue>): result is IntermediateResult<FinalValue>;
|
|
84
|
+
export declare function isErrorResult<ErrorValue>(result: ProgressiveResult<any, ErrorValue> | FinalResult<any, ErrorValue>): result is ErrorResult<ErrorValue>;
|
|
88
85
|
/**
|
|
89
86
|
* Checks if the result is an intermediate result.
|
|
90
87
|
*/
|
|
91
|
-
export declare function isIntermediateResult<
|
|
88
|
+
export declare function isIntermediateResult<IntermediateValue>(result: ProgressiveResult<any, any, IntermediateValue>): result is IntermediateResult<IntermediateValue>;
|
|
92
89
|
/**
|
|
93
90
|
* Checks if the result is a final result.
|
|
94
91
|
*/
|
|
95
|
-
export declare function isSuccessResult<FinalValue
|
|
92
|
+
export declare function isSuccessResult<FinalValue>(result: ProgressiveResult<FinalValue, any, any> | FinalResult<FinalValue, any>): result is SuccessResult<FinalValue>;
|
|
96
93
|
export {};
|
|
@@ -78,12 +78,6 @@ export function ProgressiveResultSchema(successSchema, errorSchema) {
|
|
|
78
78
|
export function isErrorResult(result) {
|
|
79
79
|
return result.error !== null && result.error !== undefined;
|
|
80
80
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Checks if the result is not started. We check progress < 0.0 to mean not started.
|
|
83
|
-
*/
|
|
84
|
-
export function isNotStarted(result) {
|
|
85
|
-
return !isErrorResult(result) && result.progress < 0.0;
|
|
86
|
-
}
|
|
87
81
|
/**
|
|
88
82
|
* Checks if the result is an intermediate result.
|
|
89
83
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progressive-result.js","sourceRoot":"","sources":["../../src/service/progressive-result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;
|
|
1
|
+
{"version":3,"file":"progressive-result.js","sourceRoot":"","sources":["../../src/service/progressive-result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;WAoBW;AA2BX;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAyB,WAAc;IACxE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,WAAW,CAAC;IACtD,OAAO;QACL,GAAG,IAAI;QACP,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,GAAG,UAAU;YACb,QAAQ,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE;SACzB;QACD,QAAQ,EAAE,CAAC,GAAG,QAAQ,EAAE,UAAU,CAAC;KAC3B,CAAC;AACb,CA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C,MAAM,CAAC,IAAI,MAAM,CAAC,QAAQ,KAAK,GAAG,CAAC;AAC3D,CAAC"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A service is an object that provides functionality to an application.
|
|
3
|
+
* Services are never dependent upon user interface components.
|
|
4
|
+
* Services come in several varieties:
|
|
5
|
+
* - Frontend Services
|
|
6
|
+
* - Only contain void actions and observe functions.
|
|
7
|
+
* - Async nature enforces unidirectional control flow and decouples the service from the UI.
|
|
8
|
+
* - Backend Services
|
|
9
|
+
* - Usually consumed by other services.
|
|
10
|
+
* - May also contain Promise<Data> or AsyncGenerator<Data> functions.
|
|
11
|
+
*/
|
|
1
12
|
export interface Service {
|
|
2
13
|
readonly serviceName: string;
|
|
3
|
-
dispose?(): void;
|
|
4
14
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Service } from "./service.js";
|
|
2
|
+
import { Observe } from "../observe/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Converts a service to a frontend service by removing all non-observe and non-void action functions recursively.
|
|
5
|
+
* For each child property value type
|
|
6
|
+
* - if it is a service, recursively convert it to a frontend service.
|
|
7
|
+
* - if it is a function which returns a function or a service, leave it as is.
|
|
8
|
+
* - if it is a non-void action function, convert it's return type to void.
|
|
9
|
+
*/
|
|
10
|
+
export type ToFrontEndService<T extends Service> = {
|
|
11
|
+
readonly [K in keyof T]: T[K] extends Observe<any> ? T[K] : T[K] extends Service ? ToFrontEndService<T[K]> : T[K] extends (...args: any[]) => (...args: any[]) => any ? T[K] : T[K] extends (...args: any[]) => Service ? T[K] : T[K] extends (...args: any[]) => void | Promise<void> ? T[K] : T[K] extends (...args: infer P) => any ? (...args: P) => void : T[K];
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-frontend-service.js","sourceRoot":"","sources":["../../src/service/to-frontend-service.ts"],"names":[],"mappings":"AA2BA,+BAA+B;AAC/B,CAAC;AAyED,CAAC"}
|