@magda/connector-sdk 2.3.3 → 3.0.0-alpha.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/dist/index-web.d.ts +7 -185
- package/dist/index.d.ts +60 -62
- package/dist/index.js +90378 -92912
- package/package.json +20 -15
- package/dist/index-web.js +0 -33304
package/dist/index-web.d.ts
CHANGED
|
@@ -1,185 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* A type of aspect in the registry, unique for a tenant.
|
|
11
|
-
*/
|
|
12
|
-
export declare class AspectDefinition {
|
|
13
|
-
/**
|
|
14
|
-
* The identifier for the aspect type.
|
|
15
|
-
*/
|
|
16
|
-
'id': string;
|
|
17
|
-
/**
|
|
18
|
-
* The name of the aspect.
|
|
19
|
-
*/
|
|
20
|
-
'name': string;
|
|
21
|
-
/**
|
|
22
|
-
* The JSON Schema of this aspect.
|
|
23
|
-
*/
|
|
24
|
-
'jsonSchema': any;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export declare abstract class BuilderFunctionParameters {
|
|
28
|
-
/**
|
|
29
|
-
* The result of invoking the {@link AspectBuilder#setupFunctionString}, or undefined if there is no
|
|
30
|
-
* {@link AspectBuilder#setupFunctionString} defined for this builder.
|
|
31
|
-
*
|
|
32
|
-
* @type {*}
|
|
33
|
-
* @memberOf BuilderFunctionParameters
|
|
34
|
-
*/
|
|
35
|
-
setup: any;
|
|
36
|
-
/**
|
|
37
|
-
* The transformer that is building aspects.
|
|
38
|
-
*
|
|
39
|
-
* @type {JsonTransformer}
|
|
40
|
-
* @memberof BuilderFunctionParameters
|
|
41
|
-
*/
|
|
42
|
-
transformer: JsonTransformer;
|
|
43
|
-
/**
|
|
44
|
-
* Reports a non-fatal problem creating an aspect.
|
|
45
|
-
*
|
|
46
|
-
* @type {ReportProblem}
|
|
47
|
-
* @memberOf BuilderFunctionParameters
|
|
48
|
-
*/
|
|
49
|
-
reportProblem: ReportProblem;
|
|
50
|
-
/**
|
|
51
|
-
* Provides access to utility libraries that may be helpful in building aspects.
|
|
52
|
-
*
|
|
53
|
-
* @type {BuilderFunctionLibraries}
|
|
54
|
-
* @memberOf BuilderFunctionParameters
|
|
55
|
-
*/
|
|
56
|
-
libraries: object;
|
|
57
|
-
[propName: string]: any;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export declare interface BuilderSetupFunctionParameters {
|
|
61
|
-
/**
|
|
62
|
-
* The transformer that is building aspects.
|
|
63
|
-
*
|
|
64
|
-
* @type {JsonTransformer}
|
|
65
|
-
* @memberof BuilderFunctionParameters
|
|
66
|
-
*/
|
|
67
|
-
transformer: JsonTransformer;
|
|
68
|
-
/**
|
|
69
|
-
* Provides access to utility libraries that may be helpful in setting up the builder.
|
|
70
|
-
*
|
|
71
|
-
* @type {BuilderFunctionLibraries}
|
|
72
|
-
* @memberOf BuilderFunctionParameters
|
|
73
|
-
*/
|
|
74
|
-
libraries: object;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export declare function buildersToCompiledAspects(builders: AspectBuilder[], setupParameters: BuilderSetupFunctionParameters, buildParameters: BuilderFunctionParameters): CompiledAspects;
|
|
78
|
-
|
|
79
|
-
export declare function cleanOrgTitle(title: string): string;
|
|
80
|
-
|
|
81
|
-
declare interface CompiledAspect {
|
|
82
|
-
id: string;
|
|
83
|
-
builderFunction: Function;
|
|
84
|
-
setupResult: any;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export declare interface CompiledAspects {
|
|
88
|
-
parameterNames: string[];
|
|
89
|
-
parameters: BuilderFunctionParameters;
|
|
90
|
-
aspects: CompiledAspect[];
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export declare class ConnectorRecordId {
|
|
94
|
-
readonly id: string;
|
|
95
|
-
readonly type: RecordType;
|
|
96
|
-
readonly sourceId: string;
|
|
97
|
-
constructor(id: string, type: RecordType, sourceId: string);
|
|
98
|
-
toString(): string;
|
|
99
|
-
private get typeId();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* A base class for transformers for most any JSON-based catalog source.
|
|
104
|
-
* A transformer takes source data and transforms it to registry records and aspects.
|
|
105
|
-
*/
|
|
106
|
-
export declare abstract class JsonTransformer {
|
|
107
|
-
readonly sourceId: string;
|
|
108
|
-
private datasetAspectBuilders;
|
|
109
|
-
private distributionAspectBuilders;
|
|
110
|
-
private organizationAspectBuilders;
|
|
111
|
-
private organizationAspects;
|
|
112
|
-
private datasetAspects;
|
|
113
|
-
private distributionAspects;
|
|
114
|
-
private tenantId;
|
|
115
|
-
constructor({ sourceId, libraries, datasetAspectBuilders, distributionAspectBuilders, organizationAspectBuilders }: JsonTransformerOptions);
|
|
116
|
-
/**
|
|
117
|
-
* Create a {@link Record} from JSON data representing an organization.
|
|
118
|
-
*
|
|
119
|
-
* @param {string} id The ID of the record.
|
|
120
|
-
* @param {string} name The name of the record.
|
|
121
|
-
* @param {object} jsonOrganization The JSON data representing the organization.
|
|
122
|
-
* @returns {Record} The record.
|
|
123
|
-
*
|
|
124
|
-
* @memberof JsonConnector
|
|
125
|
-
*/
|
|
126
|
-
organizationJsonToRecord(jsonOrganization: object): Record_2;
|
|
127
|
-
datasetJsonToRecord(jsonDataset: object): Record_2;
|
|
128
|
-
distributionJsonToRecord(jsonDistribution: object, jsonDataset: object): Record_2;
|
|
129
|
-
getRequiredAspectDefinitions(): AspectDefinition[];
|
|
130
|
-
abstract getIdFromJsonOrganization(jsonOrganization: any, sourceId: string): ConnectorRecordId;
|
|
131
|
-
abstract getIdFromJsonDataset(jsonDataset: any, sourceId: string): ConnectorRecordId;
|
|
132
|
-
abstract getIdFromJsonDistribution(jsonDistribution: any, jsonDataset: any, sourceId: string): ConnectorRecordId;
|
|
133
|
-
abstract getNameFromJsonOrganization(jsonOrganization: any): string;
|
|
134
|
-
abstract getNameFromJsonDataset(jsonDataset: any): string;
|
|
135
|
-
abstract getNameFromJsonDistribution(jsonDistribution: any, jsonDataset: any): string;
|
|
136
|
-
reviseOrganizationRecord(record: Record_2): Record_2;
|
|
137
|
-
jsonToRecord(id: ConnectorRecordId, name: string, json: any, aspects: CompiledAspects): Record_2;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export declare interface JsonTransformerOptions {
|
|
141
|
-
sourceId: string;
|
|
142
|
-
libraries?: object;
|
|
143
|
-
datasetAspectBuilders?: AspectBuilder[];
|
|
144
|
-
distributionAspectBuilders?: AspectBuilder[];
|
|
145
|
-
organizationAspectBuilders?: AspectBuilder[];
|
|
146
|
-
maxConcurrency?: number;
|
|
147
|
-
tenantId: number;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* A record in the registry, usually including data for one or more aspects, unique for a tenant.
|
|
152
|
-
*/
|
|
153
|
-
declare class Record_2 {
|
|
154
|
-
/**
|
|
155
|
-
* The identifier of the record
|
|
156
|
-
*/
|
|
157
|
-
'id': string;
|
|
158
|
-
/**
|
|
159
|
-
* The name of the record
|
|
160
|
-
*/
|
|
161
|
-
'name': string;
|
|
162
|
-
/**
|
|
163
|
-
* The aspects included in this record
|
|
164
|
-
*/
|
|
165
|
-
'aspects': any;
|
|
166
|
-
/**
|
|
167
|
-
* A tag representing the action by the source of this record (e.g. an id for a individual crawl of a data portal).
|
|
168
|
-
*/
|
|
169
|
-
'sourceTag': string;
|
|
170
|
-
/**
|
|
171
|
-
* The identifier of a tenant
|
|
172
|
-
*/
|
|
173
|
-
'tenantId': number;
|
|
174
|
-
}
|
|
175
|
-
export { Record_2 as Record }
|
|
176
|
-
|
|
177
|
-
declare type RecordType = "Organization" | "Dataset" | "Distribution" | "Group";
|
|
178
|
-
|
|
179
|
-
declare interface ReportProblem {
|
|
180
|
-
(title: string, message?: string, additionalInfo?: any): void;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
export declare const TenantConsts: any;
|
|
184
|
-
|
|
185
|
-
export { }
|
|
1
|
+
export { Record, AspectDefinition } from "@magda/typescript-common/dist/generated/registry/api.js";
|
|
2
|
+
export { default as ConnectorRecordId } from "@magda/typescript-common/dist/ConnectorRecordId.js";
|
|
3
|
+
export { default as cleanOrgTitle } from "@magda/typescript-common/dist/util/cleanOrgTitle.js";
|
|
4
|
+
export { default as JsonTransformer, buildersToCompiledAspects, JsonTransformerOptions, CompiledAspects, BuilderSetupFunctionParameters, BuilderFunctionParameters } from "@magda/typescript-common/dist/JsonTransformer.js";
|
|
5
|
+
import AspectBuilder from "@magda/typescript-common/dist/AspectBuilder.js";
|
|
6
|
+
export { AspectBuilder };
|
|
7
|
+
export declare const TenantConsts: any;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import http from 'node:http';
|
|
3
4
|
import { default as URI_2 } from 'urijs';
|
|
4
5
|
|
|
5
6
|
export declare interface AspectBuilder {
|
|
@@ -15,20 +16,20 @@ declare class AspectCreationFailure {
|
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
|
-
* A type of aspect in the registry, unique for a tenant.
|
|
19
|
-
*/
|
|
19
|
+
* A type of aspect in the registry, unique for a tenant.
|
|
20
|
+
*/
|
|
20
21
|
export declare class AspectDefinition {
|
|
21
22
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
* The identifier for the aspect type.
|
|
24
|
+
*/
|
|
24
25
|
'id': string;
|
|
25
26
|
/**
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
* The name of the aspect.
|
|
28
|
+
*/
|
|
28
29
|
'name': string;
|
|
29
30
|
/**
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
* The JSON Schema of this aspect.
|
|
32
|
+
*/
|
|
32
33
|
'jsonSchema': any;
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -362,26 +363,26 @@ declare interface Eq<T> {
|
|
|
362
363
|
}
|
|
363
364
|
|
|
364
365
|
/**
|
|
365
|
-
* A page of events.
|
|
366
|
-
*/
|
|
366
|
+
* A page of events.
|
|
367
|
+
*/
|
|
367
368
|
declare class EventsPage {
|
|
368
369
|
/**
|
|
369
|
-
|
|
370
|
-
|
|
370
|
+
* Whether there are more events available.
|
|
371
|
+
*/
|
|
371
372
|
'hasMore': boolean;
|
|
372
373
|
/**
|
|
373
|
-
|
|
374
|
-
|
|
374
|
+
* A token to be used to get the next page of events.
|
|
375
|
+
*/
|
|
375
376
|
'nextPageToken': string;
|
|
376
377
|
/**
|
|
377
|
-
|
|
378
|
-
|
|
378
|
+
* The events in this page.
|
|
379
|
+
*/
|
|
379
380
|
'events': Array<RegistryEvent>;
|
|
380
381
|
}
|
|
381
382
|
|
|
382
383
|
/**
|
|
383
|
-
* The type of a registry modification event.
|
|
384
|
-
*/
|
|
384
|
+
* The type of a registry modification event.
|
|
385
|
+
*/
|
|
385
386
|
declare type EventType = 'CreateRecord' | 'CreateAspectDefinition' | 'CreateRecordAspect' | 'PatchRecord' | 'PatchAspectDefinition' | 'PatchRecordAspect' | 'DeleteRecord' | 'DeleteAspectDefinition' | 'DeleteRecordAspect';
|
|
386
387
|
|
|
387
388
|
declare interface Functor<T> {
|
|
@@ -564,7 +565,7 @@ declare class JsValue {
|
|
|
564
565
|
|
|
565
566
|
declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
|
|
566
567
|
private type;
|
|
567
|
-
private value
|
|
568
|
+
private value?;
|
|
568
569
|
constructor(type: MaybeType, value?: T);
|
|
569
570
|
static sequence<T>(t: {
|
|
570
571
|
[k: string]: Maybe<T>;
|
|
@@ -576,9 +577,11 @@ declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
|
|
|
576
577
|
}) => Maybe<{
|
|
577
578
|
[k: string]: any;
|
|
578
579
|
}>;
|
|
579
|
-
static maybe<T>(t
|
|
580
|
+
static maybe<T>(t?: T | null): Maybe<T>;
|
|
580
581
|
static just<T>(t: T): Maybe<T>;
|
|
581
582
|
static nothing<T>(): Maybe<T>;
|
|
583
|
+
static isJust<T>(t: Maybe<T>): boolean;
|
|
584
|
+
static isNothing<T>(t: Maybe<T>): boolean;
|
|
582
585
|
unit<U>(u: U): Maybe<U>;
|
|
583
586
|
bind<U>(f: (t: T) => Maybe<U>): Maybe<U>;
|
|
584
587
|
of: <U>(u: U) => Maybe<U>;
|
|
@@ -592,7 +595,7 @@ declare class Maybe<T> implements Monad<T>, Functor<T>, Eq<Maybe<T>> {
|
|
|
592
595
|
valueOr<U extends T>(defaultValue: U): T | U;
|
|
593
596
|
valueOrCompute<U extends T>(defaultValueFunction: () => U): T | U;
|
|
594
597
|
valueOrThrow(error?: Error): T;
|
|
595
|
-
do(patterns?:
|
|
598
|
+
do(patterns?: Partial<MaybePatterns<T, void>>): Maybe<T>;
|
|
596
599
|
}
|
|
597
600
|
|
|
598
601
|
declare interface MaybePatterns<T, U> {
|
|
@@ -602,7 +605,7 @@ declare interface MaybePatterns<T, U> {
|
|
|
602
605
|
|
|
603
606
|
declare enum MaybeType {
|
|
604
607
|
Nothing = 0,
|
|
605
|
-
Just = 1
|
|
608
|
+
Just = 1
|
|
606
609
|
}
|
|
607
610
|
|
|
608
611
|
declare interface Monad<T> {
|
|
@@ -619,11 +622,6 @@ declare class MultipleDeleteResult {
|
|
|
619
622
|
declare class Operation {
|
|
620
623
|
}
|
|
621
624
|
|
|
622
|
-
declare interface OptionalMaybePatterns<T, U> {
|
|
623
|
-
just?: (t: T) => U;
|
|
624
|
-
nothing?: () => U;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
625
|
declare class PatchRecordsRequest {
|
|
628
626
|
'recordIds': Array<string>;
|
|
629
627
|
'jsonPath': JsonPatch;
|
|
@@ -635,28 +633,28 @@ declare class PutRecordsAspectRequest {
|
|
|
635
633
|
}
|
|
636
634
|
|
|
637
635
|
/**
|
|
638
|
-
* A record in the registry, usually including data for one or more aspects, unique for a tenant.
|
|
639
|
-
*/
|
|
636
|
+
* A record in the registry, usually including data for one or more aspects, unique for a tenant.
|
|
637
|
+
*/
|
|
640
638
|
declare class Record_2 {
|
|
641
639
|
/**
|
|
642
|
-
|
|
643
|
-
|
|
640
|
+
* The identifier of the record
|
|
641
|
+
*/
|
|
644
642
|
'id': string;
|
|
645
643
|
/**
|
|
646
|
-
|
|
647
|
-
|
|
644
|
+
* The name of the record
|
|
645
|
+
*/
|
|
648
646
|
'name': string;
|
|
649
647
|
/**
|
|
650
|
-
|
|
651
|
-
|
|
648
|
+
* The aspects included in this record
|
|
649
|
+
*/
|
|
652
650
|
'aspects': any;
|
|
653
651
|
/**
|
|
654
|
-
|
|
655
|
-
|
|
652
|
+
* A tag representing the action by the source of this record (e.g. an id for a individual crawl of a data portal).
|
|
653
|
+
*/
|
|
656
654
|
'sourceTag': string;
|
|
657
655
|
/**
|
|
658
|
-
|
|
659
|
-
|
|
656
|
+
* The identifier of a tenant
|
|
657
|
+
*/
|
|
660
658
|
'tenantId': number;
|
|
661
659
|
}
|
|
662
660
|
export { Record_2 as Record }
|
|
@@ -1018,24 +1016,24 @@ declare interface RecordsPage<I extends Record_2> {
|
|
|
1018
1016
|
}
|
|
1019
1017
|
|
|
1020
1018
|
/**
|
|
1021
|
-
* A summary of a record in the registry. Summaries specify which aspects are available, but do not include data for any aspects.
|
|
1022
|
-
*/
|
|
1019
|
+
* A summary of a record in the registry. Summaries specify which aspects are available, but do not include data for any aspects.
|
|
1020
|
+
*/
|
|
1023
1021
|
declare class RecordSummary {
|
|
1024
1022
|
/**
|
|
1025
|
-
|
|
1026
|
-
|
|
1023
|
+
* The identifier of the record
|
|
1024
|
+
*/
|
|
1027
1025
|
'id': string;
|
|
1028
1026
|
/**
|
|
1029
|
-
|
|
1030
|
-
|
|
1027
|
+
* The name of the record
|
|
1028
|
+
*/
|
|
1031
1029
|
'name': string;
|
|
1032
1030
|
/**
|
|
1033
|
-
|
|
1034
|
-
|
|
1031
|
+
* The list of aspect IDs for which this record has data
|
|
1032
|
+
*/
|
|
1035
1033
|
'aspects': Array<string>;
|
|
1036
1034
|
/**
|
|
1037
|
-
|
|
1038
|
-
|
|
1035
|
+
* The identifier of the tenant
|
|
1036
|
+
*/
|
|
1039
1037
|
'tenantId': number;
|
|
1040
1038
|
}
|
|
1041
1039
|
|
|
@@ -1117,30 +1115,30 @@ declare class WebHook {
|
|
|
1117
1115
|
}
|
|
1118
1116
|
|
|
1119
1117
|
/**
|
|
1120
|
-
* Asynchronously acknowledges receipt of a web hook notification.
|
|
1121
|
-
*/
|
|
1118
|
+
* Asynchronously acknowledges receipt of a web hook notification.
|
|
1119
|
+
*/
|
|
1122
1120
|
declare class WebHookAcknowledgement {
|
|
1123
1121
|
/**
|
|
1124
|
-
|
|
1125
|
-
|
|
1122
|
+
* True if the web hook was received successfully and the listener is ready for further notifications. False if the web hook was not received and the same notification should be repeated.
|
|
1123
|
+
*/
|
|
1126
1124
|
'succeeded': boolean;
|
|
1127
1125
|
/**
|
|
1128
|
-
|
|
1129
|
-
|
|
1126
|
+
* The ID of the last event received by the listener. This should be the value of the `lastEventId` property of the web hook payload that is being acknowledged. This value is ignored if `succeeded` is false.
|
|
1127
|
+
*/
|
|
1130
1128
|
'lastEventIdReceived': any;
|
|
1131
1129
|
/**
|
|
1132
|
-
|
|
1133
|
-
|
|
1130
|
+
* Should the webhook be active or inactive?
|
|
1131
|
+
*/
|
|
1134
1132
|
'active': any;
|
|
1135
1133
|
}
|
|
1136
1134
|
|
|
1137
1135
|
/**
|
|
1138
|
-
* The response to an asynchronous web hook acknowledgement.
|
|
1139
|
-
*/
|
|
1136
|
+
* The response to an asynchronous web hook acknowledgement.
|
|
1137
|
+
*/
|
|
1140
1138
|
declare class WebHookAcknowledgementResponse {
|
|
1141
1139
|
/**
|
|
1142
|
-
|
|
1143
|
-
|
|
1140
|
+
* The ID of the last event successfully received by the listener. Further notifications will start after this event.
|
|
1141
|
+
*/
|
|
1144
1142
|
'lastEventIdReceived': number;
|
|
1145
1143
|
}
|
|
1146
1144
|
|