@kubun/connector 0.12.1 → 0.13.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/index.d.ts +1 -1
- package/lib/models/external-entity.d.ts +5 -1
- package/lib/types.d.ts +25 -4
- package/package.json +2 -2
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { clusterModelURNs, resolveModelID } from './cluster-utils.js';
|
|
2
2
|
export { connectorClusters, connectorModelIDs } from './models/cluster.js';
|
|
3
3
|
export { externalEntityDefinition } from './models/external-entity.js';
|
|
4
|
-
export type { ActionDefinition, ActionHandler, ActionHandlerFactory, ActionResult, ClientDataProvider, ClientProviderFactory, ConnectorAuth, ConnectorDefinition, ConnectorSyncEventPayload, Credential, CredentialProvider, DataProvider, DeviceConnectorAuth, DevicePermission, EntityBatch, EntityRecord, FetchChangesParams, FetchParams, OAuthConnectorAuth, OAuthProviderDefinition, OAuthState, ServerDataProvider, ServerProviderFactory, SyncBoundary, SyncCompleteEvent, SyncErrorEvent, SyncEvent, SyncFailureSample, SyncProgressEvent, SyncState, SyncStateEntry, SyncStateStore, SyncStatus, TokenResponse, UserSyncPreferences, WebhookParams, WebhookRegistration, } from './types.js';
|
|
4
|
+
export type { ActionDefinition, ActionHandler, ActionHandlerFactory, ActionResult, ClientDataProvider, ClientProviderFactory, ConnectorAuth, ConnectorDefinition, ConnectorSyncEventPayload, Credential, CredentialProvider, DataProvider, DeviceConnectorAuth, DevicePermission, EntityBatch, EntityRecord, FetchChangesParams, FetchParams, OAuthConnectorAuth, OAuthProviderDefinition, OAuthState, ServerDataProvider, ServerProviderFactory, SyncBoundary, SyncCompleteEvent, SyncErrorEvent, SyncEvent, SyncFailureSample, SyncProgressEvent, SyncState, SyncStateEntry, SyncStateStore, SyncStatus, TokenResponse, UserSyncPreferences, WebhookParams, WebhookRegistration, WriteAttachment, } from './types.js';
|
|
@@ -41,7 +41,11 @@ export declare const externalEntityDefinition: {
|
|
|
41
41
|
readonly minLength: 1;
|
|
42
42
|
readonly maxLength: 500;
|
|
43
43
|
};
|
|
44
|
-
readonly SourceURL:
|
|
44
|
+
readonly SourceURL: {
|
|
45
|
+
readonly type: "string";
|
|
46
|
+
readonly format: "uri";
|
|
47
|
+
readonly title: "URL";
|
|
48
|
+
};
|
|
45
49
|
readonly DateTime: import("json-schema-typed").JSONSchema.String;
|
|
46
50
|
};
|
|
47
51
|
};
|
package/lib/types.d.ts
CHANGED
|
@@ -18,7 +18,24 @@ export type Credential = {
|
|
|
18
18
|
};
|
|
19
19
|
export type CredentialProvider = {
|
|
20
20
|
get(providerName: string, ownerDID: string): Promise<Credential | null>;
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* `ownerWrappableDID` is the owner's DID in a form that can be encrypted to,
|
|
23
|
+
* and is required only when no credential is stored yet.
|
|
24
|
+
*
|
|
25
|
+
* It is separate from `ownerDID` because that one is a join key and is
|
|
26
|
+
* normalized, and a normalized `did:peer:4` is its short form, which carries
|
|
27
|
+
* no document and so no agreement key. The two coincide for `did:key`. A
|
|
28
|
+
* caller that cannot supply it can still refresh an existing credential but
|
|
29
|
+
* cannot create one — which is the intended asymmetry: minting is the step
|
|
30
|
+
* that decides who will be able to read.
|
|
31
|
+
*/
|
|
32
|
+
set(params: {
|
|
33
|
+
providerName: string;
|
|
34
|
+
ownerDID: string;
|
|
35
|
+
credential: Credential;
|
|
36
|
+
ownerWrappableDID?: string;
|
|
37
|
+
controllerWrappableDID?: string;
|
|
38
|
+
}): Promise<void>;
|
|
22
39
|
delete(providerName: string, ownerDID: string): Promise<void>;
|
|
23
40
|
};
|
|
24
41
|
export type OAuthState = {
|
|
@@ -53,8 +70,6 @@ export type SyncStateStore = {
|
|
|
53
70
|
set(connectorName: string, ownerDID: string, state: SyncState): Promise<void>;
|
|
54
71
|
delete(connectorName: string, ownerDID: string): Promise<void>;
|
|
55
72
|
listForConnector(connectorName: string): Promise<Array<SyncStateEntry>>;
|
|
56
|
-
claimSync(connectorName: string, ownerDID: string, leaseMs: number): Promise<boolean>;
|
|
57
|
-
renewSync(connectorName: string, ownerDID: string, leaseMs: number): Promise<void>;
|
|
58
73
|
};
|
|
59
74
|
export type SyncBoundary = {
|
|
60
75
|
maxAge?: string;
|
|
@@ -137,12 +152,18 @@ export type ActionResult = {
|
|
|
137
152
|
documentID?: string;
|
|
138
153
|
deletedDocumentID?: string;
|
|
139
154
|
};
|
|
155
|
+
export type WriteAttachment = (input: ReadableStream<Uint8Array>, options?: {
|
|
156
|
+
mimeType?: string;
|
|
157
|
+
encrypted?: boolean;
|
|
158
|
+
keyID?: string;
|
|
159
|
+
}) => Promise<string>;
|
|
140
160
|
export type ActionHandler = {
|
|
141
161
|
create(model: string, params: Record<string, unknown>): Promise<EntityRecord>;
|
|
142
|
-
update(model: string, sourceID: string, params: Record<string, unknown>): Promise<EntityRecord>;
|
|
162
|
+
update(model: string, sourceID: string, params: Record<string, unknown>, existing?: Record<string, unknown>): Promise<EntityRecord>;
|
|
143
163
|
};
|
|
144
164
|
export type ActionHandlerFactory = (config: {
|
|
145
165
|
credential: Credential;
|
|
166
|
+
writeAttachment?: WriteAttachment;
|
|
146
167
|
}) => ActionHandler;
|
|
147
168
|
export type ServerProviderFactory = (config: {
|
|
148
169
|
credential: unknown;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubun/connector",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"license": "see LICENSE.md",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"json-schema-typed": "^8.0.2",
|
|
19
19
|
"@kubun/protocol": "^0.13.0",
|
|
20
|
-
"@kubun/scalars": "^0.
|
|
20
|
+
"@kubun/scalars": "^0.13.0"
|
|
21
21
|
},
|
|
22
22
|
"publishConfig": {
|
|
23
23
|
"access": "public"
|