@magda/registry-client 2.0.0-alpha.0 → 2.0.0-alpha.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/index.d.ts CHANGED
@@ -472,6 +472,17 @@ declare class RecordsApi {
472
472
  response: http.IncomingMessage;
473
473
  body: Record_2;
474
474
  }>;
475
+ /**
476
+ * Get a record in full by ID
477
+ * Get a record with all attached aspects data by the record ID.
478
+ * @param id ID of the record to be fetched.
479
+ * @param xMagdaTenantId 0
480
+ * @param xMagdaSession Magda internal session id
481
+ */
482
+ getByIdInFull(id: string, xMagdaTenantId: number, xMagdaSession?: string): Promise<{
483
+ response: http.IncomingMessage;
484
+ body: Record_2;
485
+ }>;
475
486
  /**
476
487
  * Get a summary record by ID
477
488
  * Gets a summary record, including all the aspect ids for which this record has data.
@@ -601,6 +612,7 @@ export declare class RegistryClient {
601
612
  getAspectDefinitions(): Promise<AspectDefinition[] | Error>;
602
613
  getAspectDefinition(aspectId: string, jwtToken?: string): Promise<AspectDefinition>;
603
614
  getRecord(id: string, aspect?: Array<string>, optionalAspect?: Array<string>, dereference?: boolean): Promise<Record_2 | Error>;
615
+ getRecordInFull(id: string): Promise<Record_2>;
604
616
  getRecords<I extends Record_2>(aspect?: Array<string>, optionalAspect?: Array<string>, pageToken?: string, dereference?: boolean, limit?: number, aspectQueries?: string[], aspectOrQuery?: string[], orderBy?: string, orderByDir?: string, orderNullFirst?: boolean): Promise<RecordsPage<I> | Error>;
605
617
  getRecordsPageTokens(aspect?: Array<string>, limit?: number): Promise<string[] | Error>;
606
618
  }
package/dist/index.js CHANGED
@@ -11354,6 +11354,20 @@ class RegistryClient {
11354
11354
  .then((result) => result.body)
11355
11355
  .catch(createServiceError_1.default);
11356
11356
  }
11357
+ getRecordInFull(id) {
11358
+ return __awaiter(this, void 0, void 0, function* () {
11359
+ try {
11360
+ const res = yield this.recordsApi.getByIdInFull(encodeURIComponent(id), this.tenantId, this.jwt);
11361
+ if (typeof res.body === "string") {
11362
+ throw new Error("Invalid non-json response: " + res.body);
11363
+ }
11364
+ return res.body;
11365
+ }
11366
+ catch (e) {
11367
+ throw this.toServerError(e);
11368
+ }
11369
+ });
11370
+ }
11357
11371
  getRecords(aspect, optionalAspect, pageToken, dereference, limit, aspectQueries, aspectOrQuery, orderBy, orderByDir, orderNullFirst) {
11358
11372
  const operation = (pageToken) => () => this.recordsApi.getAll(this.tenantId, aspect, optionalAspect, pageToken, undefined, limit, dereference, aspectQueries, aspectOrQuery, orderBy, orderByDir, orderNullFirst, this.jwt);
11359
11373
  return retry_1.default(operation(pageToken), this.secondsBetweenRetries, this.maxRetries, (e, retriesLeft) => console.log(formatServiceError_1.default("Failed to GET records.", e, retriesLeft)))
@@ -12820,6 +12834,63 @@ class RecordsApi {
12820
12834
  });
12821
12835
  });
12822
12836
  }
12837
+ /**
12838
+ * Get a record in full by ID
12839
+ * Get a record with all attached aspects data by the record ID.
12840
+ * @param id ID of the record to be fetched.
12841
+ * @param xMagdaTenantId 0
12842
+ * @param xMagdaSession Magda internal session id
12843
+ */
12844
+ getByIdInFull(id, xMagdaTenantId, xMagdaSession) {
12845
+ const localVarPath = this.basePath + '/records/inFull/{id}'
12846
+ .replace('{' + 'id' + '}', String(id));
12847
+ let queryParameters = {};
12848
+ let headerParams = Object.assign({}, this.defaultHeaders);
12849
+ let formParams = {};
12850
+ // verify required parameter 'id' is not null or undefined
12851
+ if (id === null || id === undefined) {
12852
+ throw new Error('Required parameter id was null or undefined when calling getByIdInFull.');
12853
+ }
12854
+ // verify required parameter 'xMagdaTenantId' is not null or undefined
12855
+ if (xMagdaTenantId === null || xMagdaTenantId === undefined) {
12856
+ throw new Error('Required parameter xMagdaTenantId was null or undefined when calling getByIdInFull.');
12857
+ }
12858
+ headerParams['X-Magda-Tenant-Id'] = xMagdaTenantId;
12859
+ headerParams['X-Magda-Session'] = xMagdaSession;
12860
+ let useFormData = false;
12861
+ let requestOptions = {
12862
+ method: 'GET',
12863
+ qs: queryParameters,
12864
+ headers: headerParams,
12865
+ uri: localVarPath,
12866
+ useQuerystring: this._useQuerystring,
12867
+ json: true,
12868
+ };
12869
+ this.authentications.default.applyToRequest(requestOptions);
12870
+ if (Object.keys(formParams).length) {
12871
+ if (useFormData) {
12872
+ requestOptions.formData = formParams;
12873
+ }
12874
+ else {
12875
+ requestOptions.form = formParams;
12876
+ }
12877
+ }
12878
+ return new Promise((resolve, reject) => {
12879
+ request(requestOptions, (error, response, body) => {
12880
+ if (error) {
12881
+ reject(error);
12882
+ }
12883
+ else {
12884
+ if (response.statusCode >= 200 && response.statusCode <= 299) {
12885
+ resolve({ response: response, body: body });
12886
+ }
12887
+ else {
12888
+ reject({ response: response, body: body });
12889
+ }
12890
+ }
12891
+ });
12892
+ });
12893
+ }
12823
12894
  /**
12824
12895
  * Get a summary record by ID
12825
12896
  * Gets a summary record, including all the aspect ids for which this record has data.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@magda/registry-client",
3
3
  "description": "MAGDA Registry Client",
4
- "version": "2.0.0-alpha.0",
4
+ "version": "2.0.0-alpha.1",
5
5
  "scripts": {
6
6
  "prebuild": "rimraf dist tsconfig.tsbuildinfo",
7
7
  "build": "webpack && api-extractor run -l",
@@ -12,7 +12,7 @@
12
12
  "main": "dist/index.js",
13
13
  "types": "dist/index.d.ts",
14
14
  "devDependencies": {
15
- "@magda/typescript-common": "^2.0.0-alpha.0",
15
+ "@magda/typescript-common": "^2.0.0-alpha.1",
16
16
  "@microsoft/api-extractor": "^7.7.8",
17
17
  "ts-loader": "^6.2.1",
18
18
  "typescript": "^3.7.2",