@conduit-client/bindings-utils 3.17.0 → 3.17.1
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/types/v1/utils.d.ts +5 -12
- package/dist/v1/index.js +3 -4
- package/dist/v1/index.js.map +1 -1
- package/package.json +4 -4
package/dist/types/v1/utils.d.ts
CHANGED
|
@@ -11,20 +11,13 @@ export declare function throwUserlandError(error: unknown): never;
|
|
|
11
11
|
export declare function emitError(callback: Callback<any>, error: unknown): void;
|
|
12
12
|
export declare function buildUserlandError(error: unknown): Error;
|
|
13
13
|
export declare function logError(error: unknown): void;
|
|
14
|
-
export type InitBindingsExportsArgs<Req extends ServicesRequest<any
|
|
14
|
+
export type InitBindingsExportsArgs<Req extends ServicesRequest<any>> = {
|
|
15
15
|
serviceRequirements: Req;
|
|
16
|
-
|
|
17
|
-
init: (services: RequestedServices<Req>, exports: TExports) => void;
|
|
16
|
+
init: (services: RequestedServices<Req>) => void;
|
|
18
17
|
timeout?: number;
|
|
19
18
|
};
|
|
20
19
|
/**
|
|
21
|
-
* Bootstraps
|
|
22
|
-
* invoking
|
|
23
|
-
*
|
|
24
|
-
* This is intended to make generated code extensible: custom modules can compose exports and
|
|
25
|
-
* then call this function once, without needing to enumerate every generated export.
|
|
20
|
+
* Bootstraps adapter bindings by requesting services from the service provisioner and
|
|
21
|
+
* invoking the initializer once all services are available.
|
|
26
22
|
*/
|
|
27
|
-
export declare function initBindingsExports<Req extends ServicesRequest<any
|
|
28
|
-
exports: TExports;
|
|
29
|
-
ready: PromiseLike<void>;
|
|
30
|
-
};
|
|
23
|
+
export declare function initBindingsExports<Req extends ServicesRequest<any>>(args: InitBindingsExportsArgs<Req>): void;
|
package/dist/v1/index.js
CHANGED
|
@@ -31,11 +31,10 @@ function logError(error) {
|
|
|
31
31
|
console.error("OneStore Command threw an error that we did not expect", error);
|
|
32
32
|
}
|
|
33
33
|
function initBindingsExports(args) {
|
|
34
|
-
const { serviceRequirements,
|
|
35
|
-
|
|
36
|
-
init(services
|
|
34
|
+
const { serviceRequirements, init, timeout } = args;
|
|
35
|
+
getServices(serviceRequirements, timeout).then((services) => {
|
|
36
|
+
init(services);
|
|
37
37
|
});
|
|
38
|
-
return { exports: exports$1, ready };
|
|
39
38
|
}
|
|
40
39
|
export {
|
|
41
40
|
buildUserlandError,
|
package/dist/v1/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/v1/utils.ts"],"sourcesContent":["import getServices, {\n type RequestedServices,\n type ServicesRequest,\n} from '@conduit-client/service-provisioner/v1';\nimport type { Command } from '@conduit-client/command-base/v1';\nimport type {\n Result,\n SyncOrAsync,\n SubscribableResult,\n Callback,\n IInternalError,\n IUserVisibleError,\n} from '@conduit-client/utils';\n\nexport type ResultOrSubscribableResult<Data, Error = unknown> =\n | Result<Data, Error>\n | SubscribableResult<Data, Error>;\n\nexport type MaybeSubscribableResultCommand<Data, Error = unknown> = Command<\n SyncOrAsync<ResultOrSubscribableResult<Data, Error>>\n>;\n\nexport type SubscribableResultCommand<\n Data,\n Error = unknown,\n Params extends Array<any> = [],\n> = Command<SyncOrAsync<SubscribableResult<Data, Error>>, Params>;\n\nexport type ResultCommand<Data, Error = unknown> = Command<SyncOrAsync<Result<Data, Error>>>;\n\nexport function isInternalError<Data = undefined>(error: unknown): error is IInternalError<Data> {\n return error instanceof Error && 'type' in error && error.type === 'internal';\n}\n\nexport function isUserVisibleError<Data = undefined>(\n error: unknown\n): error is IUserVisibleError<Data> {\n return error instanceof Error && 'type' in error && error.type === 'user-visible';\n}\n\nexport function throwUserlandError(error: unknown): never {\n logError(error);\n throw buildUserlandError(error);\n}\n\nexport function emitError(callback: Callback<any>, error: unknown): void {\n logError(error);\n callback({ data: undefined, error: buildUserlandError(error) });\n}\n\nexport function buildUserlandError(error: unknown): Error {\n if (isUserVisibleError<Error>(error)) {\n return error.data;\n }\n\n return new Error('Internal error in Lightning Data Service adapter occurred.');\n}\n\nexport function logError(error: unknown): void {\n if (isUserVisibleError(error)) {\n return;\n }\n\n console.error('OneStore Command threw an error that we did not expect', error);\n}\n\nexport type InitBindingsExportsArgs<Req extends ServicesRequest<any
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/v1/utils.ts"],"sourcesContent":["import getServices, {\n type RequestedServices,\n type ServicesRequest,\n} from '@conduit-client/service-provisioner/v1';\nimport type { Command } from '@conduit-client/command-base/v1';\nimport type {\n Result,\n SyncOrAsync,\n SubscribableResult,\n Callback,\n IInternalError,\n IUserVisibleError,\n} from '@conduit-client/utils';\n\nexport type ResultOrSubscribableResult<Data, Error = unknown> =\n | Result<Data, Error>\n | SubscribableResult<Data, Error>;\n\nexport type MaybeSubscribableResultCommand<Data, Error = unknown> = Command<\n SyncOrAsync<ResultOrSubscribableResult<Data, Error>>\n>;\n\nexport type SubscribableResultCommand<\n Data,\n Error = unknown,\n Params extends Array<any> = [],\n> = Command<SyncOrAsync<SubscribableResult<Data, Error>>, Params>;\n\nexport type ResultCommand<Data, Error = unknown> = Command<SyncOrAsync<Result<Data, Error>>>;\n\nexport function isInternalError<Data = undefined>(error: unknown): error is IInternalError<Data> {\n return error instanceof Error && 'type' in error && error.type === 'internal';\n}\n\nexport function isUserVisibleError<Data = undefined>(\n error: unknown\n): error is IUserVisibleError<Data> {\n return error instanceof Error && 'type' in error && error.type === 'user-visible';\n}\n\nexport function throwUserlandError(error: unknown): never {\n logError(error);\n throw buildUserlandError(error);\n}\n\nexport function emitError(callback: Callback<any>, error: unknown): void {\n logError(error);\n callback({ data: undefined, error: buildUserlandError(error) });\n}\n\nexport function buildUserlandError(error: unknown): Error {\n if (isUserVisibleError<Error>(error)) {\n return error.data;\n }\n\n return new Error('Internal error in Lightning Data Service adapter occurred.');\n}\n\nexport function logError(error: unknown): void {\n if (isUserVisibleError(error)) {\n return;\n }\n\n console.error('OneStore Command threw an error that we did not expect', error);\n}\n\nexport type InitBindingsExportsArgs<Req extends ServicesRequest<any>> = {\n serviceRequirements: Req;\n init: (services: RequestedServices<Req>) => void;\n timeout?: number;\n};\n\n/**\n * Bootstraps adapter bindings by requesting services from the service provisioner and\n * invoking the initializer once all services are available.\n */\nexport function initBindingsExports<Req extends ServicesRequest<any>>(\n args: InitBindingsExportsArgs<Req>\n): void {\n const { serviceRequirements, init, timeout } = args;\n\n getServices(serviceRequirements, timeout).then((services) => {\n init(services);\n });\n}\n"],"names":[],"mappings":";;;;;;AA8BO,SAAS,gBAAkC,OAA+C;AAC7F,SAAO,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS;AACvE;AAEO,SAAS,mBACZ,OACgC;AAChC,SAAO,iBAAiB,SAAS,UAAU,SAAS,MAAM,SAAS;AACvE;AAEO,SAAS,mBAAmB,OAAuB;AACtD,WAAS,KAAK;AACd,QAAM,mBAAmB,KAAK;AAClC;AAEO,SAAS,UAAU,UAAyB,OAAsB;AACrE,WAAS,KAAK;AACd,WAAS,EAAE,MAAM,QAAW,OAAO,mBAAmB,KAAK,GAAG;AAClE;AAEO,SAAS,mBAAmB,OAAuB;AACtD,MAAI,mBAA0B,KAAK,GAAG;AAClC,WAAO,MAAM;AAAA,EACjB;AAEA,SAAO,IAAI,MAAM,4DAA4D;AACjF;AAEO,SAAS,SAAS,OAAsB;AAC3C,MAAI,mBAAmB,KAAK,GAAG;AAC3B;AAAA,EACJ;AAEA,UAAQ,MAAM,0DAA0D,KAAK;AACjF;AAYO,SAAS,oBACZ,MACI;AACJ,QAAM,EAAE,qBAAqB,MAAM,QAAA,IAAY;AAE/C,cAAY,qBAAqB,OAAO,EAAE,KAAK,CAAC,aAAa;AACzD,SAAK,QAAQ;AAAA,EACjB,CAAC;AACL;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conduit-client/bindings-utils",
|
|
3
|
-
"version": "3.17.
|
|
3
|
+
"version": "3.17.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Conduit utils for building bindings consistently",
|
|
6
6
|
"type": "module",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"watch": "npm run build --watch"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@conduit-client/command-base": "3.17.
|
|
35
|
-
"@conduit-client/service-provisioner": "3.17.
|
|
36
|
-
"@conduit-client/utils": "3.17.
|
|
34
|
+
"@conduit-client/command-base": "3.17.1",
|
|
35
|
+
"@conduit-client/service-provisioner": "3.17.1",
|
|
36
|
+
"@conduit-client/utils": "3.17.1"
|
|
37
37
|
},
|
|
38
38
|
"volta": {
|
|
39
39
|
"extends": "../../../package.json"
|