@adobe/data 0.9.6 → 0.9.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/data",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "description": "Adobe data oriented programming library",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -2,3 +2,4 @@ export { type Service } from './service.js';
2
2
  export { isService } from './is-service.js';
3
3
  export { type WithObservableActions, type ServiceActionMessages, type ServiceActionMessagesWithPrefix, addObservableActions } from './add-observable-actions.js';
4
4
  export { type ErrorResult, type IntermediateResult, type SuccessResult, type FinalResult, type ProgressiveResult, isErrorResult, isIntermediateResult, isSuccessResult, ErrorResultSchema, IntermediateResultSchema, SuccessResultSchema, ProgressiveResultSchema } from './progressive-result.js';
5
+ export { type IsDataService } from './is-data-service.js';
@@ -0,0 +1,11 @@
1
+ import { Data } from "../data.js";
2
+ import { Observe } from "../observe/index.js";
3
+ import { Service } from "./service.js";
4
+ type ValidReturnType<R> = R extends Observe<infer T> ? T extends Data ? true : false : R extends void ? true : R extends Promise<infer P> ? P extends Data | void ? true : false : R extends AsyncGenerator<infer G, any, any> ? G extends Data ? true : false : false;
5
+ type AllArgsAreData<Args extends readonly any[]> = Args extends readonly [] ? true : Args extends readonly [infer First, ...infer Rest] ? First extends Data ? AllArgsAreData<Rest> : false : Args extends readonly (infer Element)[] ? Element extends Data ? true : false : false;
6
+ type IsValidProperty<P> = P extends Observe<infer T> ? T extends Data ? true : false : P extends (...args: infer Args) => infer R ? AllArgsAreData<Args> extends true ? ValidReturnType<R> : false : false;
7
+ type AllPropertiesValid<T extends Service> = {
8
+ [K in Exclude<keyof T, keyof Service>]: IsValidProperty<T[K]>;
9
+ } extends Record<Exclude<keyof T, keyof Service>, true> ? true : false;
10
+ export type IsDataService<T extends Service> = AllPropertiesValid<T>;
11
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=is-data-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-data-service.js","sourceRoot":"","sources":["../../src/service/is-data-service.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"is-service.js","sourceRoot":"","sources":["../../src/service/is-service.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAKvD,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,aAAa,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ,CAAC;AACxH,CAAC"}
1
+ {"version":3,"file":"is-service.js","sourceRoot":"","sources":["../../src/service/is-service.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAIvD,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,aAAa,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ,CAAC;AACxH,CAAC"}