@c8y/client 1018.503.23 → 1018.503.37

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.
Files changed (33) hide show
  1. package/lib/bundles/client.umd.js +329 -229
  2. package/lib/bundles/client.umd.js.map +1 -1
  3. package/lib/bundles/client.umd.min.js +1 -1
  4. package/lib/bundles/client.umd.min.js.map +1 -1
  5. package/lib/cjs/src/services.d.ts +1 -1
  6. package/lib/cjs/src/services.js +2 -1
  7. package/lib/cjs/src/services.js.map +1 -1
  8. package/lib/cjs/src/trusted-certificates/CrlService.d.ts +71 -0
  9. package/lib/cjs/src/trusted-certificates/CrlService.js +93 -0
  10. package/lib/cjs/src/trusted-certificates/CrlService.js.map +1 -0
  11. package/lib/cjs/src/trusted-certificates/ICertificateRevocation.d.ts +12 -0
  12. package/lib/cjs/src/trusted-certificates/ICertificateRevocation.js +3 -0
  13. package/lib/cjs/src/trusted-certificates/ICertificateRevocation.js.map +1 -0
  14. package/lib/cjs/src/trusted-certificates/index.d.ts +2 -0
  15. package/lib/cjs/src/trusted-certificates/index.js +2 -0
  16. package/lib/cjs/src/trusted-certificates/index.js.map +1 -1
  17. package/lib/esm2015/src/services.d.ts +1 -1
  18. package/lib/esm2015/src/services.js +1 -1
  19. package/lib/esm2015/src/services.js.map +1 -1
  20. package/lib/esm2015/src/trusted-certificates/CrlService.d.ts +71 -0
  21. package/lib/esm2015/src/trusted-certificates/CrlService.js +101 -0
  22. package/lib/esm2015/src/trusted-certificates/CrlService.js.map +1 -0
  23. package/lib/esm2015/src/trusted-certificates/ICertificateRevocation.d.ts +12 -0
  24. package/lib/esm2015/src/trusted-certificates/ICertificateRevocation.js +2 -0
  25. package/lib/esm2015/src/trusted-certificates/ICertificateRevocation.js.map +1 -0
  26. package/lib/esm2015/src/trusted-certificates/index.d.ts +2 -0
  27. package/lib/esm2015/src/trusted-certificates/index.js +2 -0
  28. package/lib/esm2015/src/trusted-certificates/index.js.map +1 -1
  29. package/lib/src/services.d.ts +1 -1
  30. package/lib/src/trusted-certificates/CrlService.d.ts +71 -0
  31. package/lib/src/trusted-certificates/ICertificateRevocation.d.ts +12 -0
  32. package/lib/src/trusted-certificates/index.d.ts +2 -0
  33. package/package.json +1 -1
@@ -18,7 +18,7 @@ export { UserRoleService } from './user-role';
18
18
  export { UserGroupService } from './user-group';
19
19
  export { Realtime } from './realtime';
20
20
  export { IdentityService } from './identity';
21
- export { TrustedCertificateService } from './trusted-certificates';
21
+ export { TrustedCertificateService, CrlService } from './trusted-certificates';
22
22
  export { SmartGroupsService } from './smart-groups';
23
23
  export { SmartRulesService } from './smart-rules';
24
24
  //# sourceMappingURL=services.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SmartRulesService = exports.SmartGroupsService = exports.TrustedCertificateService = exports.IdentityService = exports.Realtime = exports.UserGroupService = exports.UserRoleService = exports.DeviceRegistrationBulkService = exports.DeviceRegistrationService = exports.InventoryRoleService = exports.AuditService = exports.TenantLoginOptionsService = exports.TenantSecurityOptionsService = exports.TenantOptionsService = exports.SystemOptionsService = exports.TenantService = exports.UserService = exports.ApplicationService = exports.OperationService = exports.OperationBulkService = exports.AlarmService = exports.MeasurementService = exports.InventoryBinaryService = exports.InventoryService = exports.EventBinaryService = exports.EventService = exports.BasicAuth = exports.FetchClient = void 0;
3
+ exports.SmartRulesService = exports.SmartGroupsService = exports.CrlService = exports.TrustedCertificateService = exports.IdentityService = exports.Realtime = exports.UserGroupService = exports.UserRoleService = exports.DeviceRegistrationBulkService = exports.DeviceRegistrationService = exports.InventoryRoleService = exports.AuditService = exports.TenantLoginOptionsService = exports.TenantSecurityOptionsService = exports.TenantOptionsService = exports.SystemOptionsService = exports.TenantService = exports.UserService = exports.ApplicationService = exports.OperationService = exports.OperationBulkService = exports.AlarmService = exports.MeasurementService = exports.InventoryBinaryService = exports.InventoryService = exports.EventBinaryService = exports.EventService = exports.BasicAuth = exports.FetchClient = void 0;
4
4
  var core_1 = require("./core");
5
5
  Object.defineProperty(exports, "FetchClient", { enumerable: true, get: function () { return core_1.FetchClient; } });
6
6
  Object.defineProperty(exports, "BasicAuth", { enumerable: true, get: function () { return core_1.BasicAuth; } });
@@ -48,6 +48,7 @@ var identity_1 = require("./identity");
48
48
  Object.defineProperty(exports, "IdentityService", { enumerable: true, get: function () { return identity_1.IdentityService; } });
49
49
  var trusted_certificates_1 = require("./trusted-certificates");
50
50
  Object.defineProperty(exports, "TrustedCertificateService", { enumerable: true, get: function () { return trusted_certificates_1.TrustedCertificateService; } });
51
+ Object.defineProperty(exports, "CrlService", { enumerable: true, get: function () { return trusted_certificates_1.CrlService; } });
51
52
  var smart_groups_1 = require("./smart-groups");
52
53
  Object.defineProperty(exports, "SmartGroupsService", { enumerable: true, get: function () { return smart_groups_1.SmartGroupsService; } });
53
54
  var smart_rules_1 = require("./smart-rules");
@@ -1 +1 @@
1
- {"version":3,"file":"services.js","sourceRoot":"","sources":["../../../src/services.ts"],"names":[],"mappings":";;;AAAA,+BAAgD;AAAvC,mGAAA,WAAW,OAAA;AAAE,iGAAA,SAAS,OAAA;AAC/B,iCAA2D;AAAlD,qGAAA,YAAY,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AACzC,yCAAuE;AAA9D,6GAAA,gBAAgB,OAAA;AAAE,mHAAA,sBAAsB,OAAA;AACjD,6CAAmD;AAA1C,iHAAA,kBAAkB,OAAA;AAC3B,iCAAuC;AAA9B,qGAAA,YAAY,OAAA;AACrB,yCAAqE;AAA5D,iHAAA,oBAAoB,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAC/C,6CAAmD;AAA1C,iHAAA,kBAAkB,OAAA;AAC3B,+BAAqC;AAA5B,mGAAA,WAAW,OAAA;AACpB,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AACtB,mDAAwD;AAA/C,sHAAA,oBAAoB,OAAA;AAC7B,mDAAwD;AAA/C,sHAAA,oBAAoB,OAAA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;AACrC,+DAAmE;AAA1D,iIAAA,yBAAyB,OAAA;AAClC,iCAAuC;AAA9B,qGAAA,YAAY,OAAA;AACrB,mDAAwD;AAA/C,sHAAA,oBAAoB,OAAA;AAC7B,6DAAiG;AAAxF,gIAAA,yBAAyB,OAAA;AAAE,oIAAA,6BAA6B,OAAA;AACjE,yCAA8C;AAArC,4GAAA,eAAe,OAAA;AACxB,2CAAgD;AAAvC,8GAAA,gBAAgB,OAAA;AACzB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,uCAA6C;AAApC,2GAAA,eAAe,OAAA;AACxB,+DAA+E;AAAtE,iIAAA,yBAAyB,OAAA;AAAE,kHAAA,UAAU,OAAA;AAC9C,+CAAoD;AAA3C,kHAAA,kBAAkB,OAAA;AAC3B,6CAAkD;AAAzC,gHAAA,iBAAiB,OAAA"}
@@ -0,0 +1,71 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { IFetchOptions, IFetchResponse, IResult, Service } from '../core';
4
+ import { ICertificateRevocation } from './ICertificateRevocation';
5
+ import { Stream } from 'stream';
6
+ /**
7
+ * This class allows for managing a list of certificate revocations.
8
+ */
9
+ export declare class CrlService extends Service<ICertificateRevocation> {
10
+ protected get baseUrl(): string;
11
+ protected readonly listUrl: string;
12
+ /**
13
+ * Uploads a list of certificate revocations.
14
+ * Adds new entries to the certificate revocation list,
15
+ * the ones that already exist are updated.
16
+ * No entries are removed from the certificate revocation list.
17
+ *
18
+ * @returns Returns a status object.
19
+ *
20
+ * **Example**
21
+ * ```typescript
22
+ *
23
+ * const crls: ICertificateRevocation[] = [
24
+ * { serialNumberInHex: '24234', revocationDate: '2023-01-13T23:00:00.000Z' }
25
+ * ];
26
+ *
27
+ * (async () => {
28
+ * const { res } = await crlService.uploadCrls(crls);
29
+ * })();
30
+ * ```
31
+ */
32
+ uploadCrls(crls: ICertificateRevocation[]): Promise<IResult<null>>;
33
+ /**
34
+ * Uploads a csv file containing a list of certificate revocations.
35
+ * Adds new entries to the certificate revocation list,
36
+ * the ones that already exist are updated.
37
+ * No entries are removed from the certificate revocation list.
38
+ *
39
+ * File format:
40
+ * SERIALNO,DATE
41
+ * 1234567890abcdef,2023-01-01T00:00:00.000Z
42
+ *
43
+ * @returns Returns a status object.
44
+ *
45
+ * **Example**
46
+ * ```typescript
47
+ *
48
+ * (async () => {
49
+ * const { res } = await crlService.uploadCrlFile( file );
50
+ * })();
51
+ * ```
52
+ */
53
+ uploadCrlFile(file: Stream | Buffer | File | Blob): Promise<IResult<null>>;
54
+ /**
55
+ * Downloads a certificate revocation list file.
56
+ * To open the downloaded file please use command: openssl crl -inform DER -text -noout -in fileName.crl
57
+ *
58
+ * @returns Returns a arrayBuffer wrapped in [[IFetchResponse]].
59
+ *
60
+ * **Example**
61
+ * ```typescript
62
+ *
63
+ * (async () => {
64
+ * const res = await this.crlService.downloadCrlFile();
65
+ * const arrayBuffer = await res.arrayBuffer();
66
+ * })();
67
+ * ```
68
+ */
69
+ downloadCrlFile(init?: IFetchOptions): Promise<IFetchResponse>;
70
+ }
71
+ //# sourceMappingURL=CrlService.d.ts.map
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CrlService = void 0;
7
+ const form_data_1 = __importDefault(require("form-data"));
8
+ const core_1 = require("../core");
9
+ /**
10
+ * This class allows for managing a list of certificate revocations.
11
+ */
12
+ class CrlService extends core_1.Service {
13
+ get baseUrl() {
14
+ return `/tenant/trusted-certificates/settings/crl`;
15
+ }
16
+ /**
17
+ * Uploads a list of certificate revocations.
18
+ * Adds new entries to the certificate revocation list,
19
+ * the ones that already exist are updated.
20
+ * No entries are removed from the certificate revocation list.
21
+ *
22
+ * @returns Returns a status object.
23
+ *
24
+ * **Example**
25
+ * ```typescript
26
+ *
27
+ * const crls: ICertificateRevocation[] = [
28
+ * { serialNumberInHex: '24234', revocationDate: '2023-01-13T23:00:00.000Z' }
29
+ * ];
30
+ *
31
+ * (async () => {
32
+ * const { res } = await crlService.uploadCrls(crls);
33
+ * })();
34
+ * ```
35
+ */
36
+ async uploadCrls(crls) {
37
+ const method = 'PUT';
38
+ const headers = { 'content-type': 'application/json', Accept: 'application/json' };
39
+ const body = JSON.stringify({ crls });
40
+ const res = await this.fetch('', { method, body, headers });
41
+ return { res, data: null };
42
+ }
43
+ /**
44
+ * Uploads a csv file containing a list of certificate revocations.
45
+ * Adds new entries to the certificate revocation list,
46
+ * the ones that already exist are updated.
47
+ * No entries are removed from the certificate revocation list.
48
+ *
49
+ * File format:
50
+ * SERIALNO,DATE
51
+ * 1234567890abcdef,2023-01-01T00:00:00.000Z
52
+ *
53
+ * @returns Returns a status object.
54
+ *
55
+ * **Example**
56
+ * ```typescript
57
+ *
58
+ * (async () => {
59
+ * const { res } = await crlService.uploadCrlFile( file );
60
+ * })();
61
+ * ```
62
+ */
63
+ async uploadCrlFile(file) {
64
+ const method = 'PUT';
65
+ const body = new form_data_1.default();
66
+ body.append('file', file);
67
+ const headers = {
68
+ accept: 'application/json'
69
+ };
70
+ const res = await this.fetch('', { method, body, headers });
71
+ return { res, data: null };
72
+ }
73
+ /**
74
+ * Downloads a certificate revocation list file.
75
+ * To open the downloaded file please use command: openssl crl -inform DER -text -noout -in fileName.crl
76
+ *
77
+ * @returns Returns a arrayBuffer wrapped in [[IFetchResponse]].
78
+ *
79
+ * **Example**
80
+ * ```typescript
81
+ *
82
+ * (async () => {
83
+ * const res = await this.crlService.downloadCrlFile();
84
+ * const arrayBuffer = await res.arrayBuffer();
85
+ * })();
86
+ * ```
87
+ */
88
+ async downloadCrlFile(init) {
89
+ return await this.fetch('', init);
90
+ }
91
+ }
92
+ exports.CrlService = CrlService;
93
+ //# sourceMappingURL=CrlService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CrlService.js","sourceRoot":"","sources":["../../../../src/trusted-certific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,CAAC,CAAC;IACpC,CAAC;CACF;AApFD,gCAoFC"}
@@ -0,0 +1,12 @@
1
+ export interface ICertificateRevocation {
2
+ /**
3
+ * Unique number issued by the certificate issuer.
4
+ */
5
+ serialNumberInHex: string;
6
+ /**
7
+ * Certificate revocation date. Date of invalidating a certificate before its scheduled expiration date.
8
+ * If not provided, the revocationDate will be set to the current date.
9
+ */
10
+ revocationDate?: string;
11
+ }
12
+ //# sourceMappingURL=ICertificateRevocation.d.ts.map
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=ICertificateRevocation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICertificateRevocation.js","sourceRoot":"","sources":["../../../../src/trusted-certificates/ICertificateRevocation.ts"],"names":[],"mappings":""}
@@ -1,3 +1,5 @@
1
1
  export * from './TrustedCertificateService';
2
2
  export * from './ITrustedCertificate';
3
+ export * from './ICertificateRevocation';
4
+ export * from './CrlService';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -16,4 +16,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./TrustedCertificateService"), exports);
18
18
  __exportStar(require("./ITrustedCertificate"), exports);
19
+ __exportStar(require("./ICertificateRevocation"), exports);
20
+ __exportStar(require("./CrlService"), exports);
19
21
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/trusted-certificates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,wDAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/trusted-certificates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,wDAAsC;AACtC,2DAAyC;AACzC,+CAA6B"}
@@ -18,7 +18,7 @@ export { UserRoleService } from './user-role';
18
18
  export { UserGroupService } from './user-group';
19
19
  export { Realtime } from './realtime';
20
20
  export { IdentityService } from './identity';
21
- export { TrustedCertificateService } from './trusted-certificates';
21
+ export { TrustedCertificateService, CrlService } from './trusted-certificates';
22
22
  export { SmartGroupsService } from './smart-groups';
23
23
  export { SmartRulesService } from './smart-rules';
24
24
  //# sourceMappingURL=services.d.ts.map
@@ -18,7 +18,7 @@ export { UserRoleService } from './user-role';
18
18
  export { UserGroupService } from './user-group';
19
19
  export { Realtime } from './realtime';
20
20
  export { IdentityService } from './identity';
21
- export { TrustedCertificateService } from './trusted-certificates';
21
+ export { TrustedCertificateService, CrlService } from './trusted-certificates';
22
22
  export { SmartGroupsService } from './smart-groups';
23
23
  export { SmartRulesService } from './smart-rules';
24
24
  //# sourceMappingURL=services.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"services.js","sourceRoot":"","sources":["../../../src/services.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE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BAAkB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,yBAAyB,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,71 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { IFetchOptions, IFetchResponse, IResult, Service } from '../core';
4
+ import { ICertificateRevocation } from './ICertificateRevocation';
5
+ import { Stream } from 'stream';
6
+ /**
7
+ * This class allows for managing a list of certificate revocations.
8
+ */
9
+ export declare class CrlService extends Service<ICertificateRevocation> {
10
+ protected get baseUrl(): string;
11
+ protected readonly listUrl: string;
12
+ /**
13
+ * Uploads a list of certificate revocations.
14
+ * Adds new entries to the certificate revocation list,
15
+ * the ones that already exist are updated.
16
+ * No entries are removed from the certificate revocation list.
17
+ *
18
+ * @returns Returns a status object.
19
+ *
20
+ * **Example**
21
+ * ```typescript
22
+ *
23
+ * const crls: ICertificateRevocation[] = [
24
+ * { serialNumberInHex: '24234', revocationDate: '2023-01-13T23:00:00.000Z' }
25
+ * ];
26
+ *
27
+ * (async () => {
28
+ * const { res } = await crlService.uploadCrls(crls);
29
+ * })();
30
+ * ```
31
+ */
32
+ uploadCrls(crls: ICertificateRevocation[]): Promise<IResult<null>>;
33
+ /**
34
+ * Uploads a csv file containing a list of certificate revocations.
35
+ * Adds new entries to the certificate revocation list,
36
+ * the ones that already exist are updated.
37
+ * No entries are removed from the certificate revocation list.
38
+ *
39
+ * File format:
40
+ * SERIALNO,DATE
41
+ * 1234567890abcdef,2023-01-01T00:00:00.000Z
42
+ *
43
+ * @returns Returns a status object.
44
+ *
45
+ * **Example**
46
+ * ```typescript
47
+ *
48
+ * (async () => {
49
+ * const { res } = await crlService.uploadCrlFile( file );
50
+ * })();
51
+ * ```
52
+ */
53
+ uploadCrlFile(file: Stream | Buffer | File | Blob): Promise<IResult<null>>;
54
+ /**
55
+ * Downloads a certificate revocation list file.
56
+ * To open the downloaded file please use command: openssl crl -inform DER -text -noout -in fileName.crl
57
+ *
58
+ * @returns Returns a arrayBuffer wrapped in [[IFetchResponse]].
59
+ *
60
+ * **Example**
61
+ * ```typescript
62
+ *
63
+ * (async () => {
64
+ * const res = await this.crlService.downloadCrlFile();
65
+ * const arrayBuffer = await res.arrayBuffer();
66
+ * })();
67
+ * ```
68
+ */
69
+ downloadCrlFile(init?: IFetchOptions): Promise<IFetchResponse>;
70
+ }
71
+ //# sourceMappingURL=CrlService.d.ts.map
@@ -0,0 +1,101 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import FormData from 'form-data';
11
+ import { Service } from '../core';
12
+ /**
13
+ * This class allows for managing a list of certificate revocations.
14
+ */
15
+ export class CrlService extends Service {
16
+ get baseUrl() {
17
+ return `/tenant/trusted-certificates/settings/crl`;
18
+ }
19
+ /**
20
+ * Uploads a list of certificate revocations.
21
+ * Adds new entries to the certificate revocation list,
22
+ * the ones that already exist are updated.
23
+ * No entries are removed from the certificate revocation list.
24
+ *
25
+ * @returns Returns a status object.
26
+ *
27
+ * **Example**
28
+ * ```typescript
29
+ *
30
+ * const crls: ICertificateRevocation[] = [
31
+ * { serialNumberInHex: '24234', revocationDate: '2023-01-13T23:00:00.000Z' }
32
+ * ];
33
+ *
34
+ * (async () => {
35
+ * const { res } = await crlService.uploadCrls(crls);
36
+ * })();
37
+ * ```
38
+ */
39
+ uploadCrls(crls) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const method = 'PUT';
42
+ const headers = { 'content-type': 'application/json', Accept: 'application/json' };
43
+ const body = JSON.stringify({ crls });
44
+ const res = yield this.fetch('', { method, body, headers });
45
+ return { res, data: null };
46
+ });
47
+ }
48
+ /**
49
+ * Uploads a csv file containing a list of certificate revocations.
50
+ * Adds new entries to the certificate revocation list,
51
+ * the ones that already exist are updated.
52
+ * No entries are removed from the certificate revocation list.
53
+ *
54
+ * File format:
55
+ * SERIALNO,DATE
56
+ * 1234567890abcdef,2023-01-01T00:00:00.000Z
57
+ *
58
+ * @returns Returns a status object.
59
+ *
60
+ * **Example**
61
+ * ```typescript
62
+ *
63
+ * (async () => {
64
+ * const { res } = await crlService.uploadCrlFile( file );
65
+ * })();
66
+ * ```
67
+ */
68
+ uploadCrlFile(file) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ const method = 'PUT';
71
+ const body = new FormData();
72
+ body.append('file', file);
73
+ const headers = {
74
+ accept: 'application/json'
75
+ };
76
+ const res = yield this.fetch('', { method, body, headers });
77
+ return { res, data: null };
78
+ });
79
+ }
80
+ /**
81
+ * Downloads a certificate revocation list file.
82
+ * To open the downloaded file please use command: openssl crl -inform DER -text -noout -in fileName.crl
83
+ *
84
+ * @returns Returns a arrayBuffer wrapped in [[IFetchResponse]].
85
+ *
86
+ * **Example**
87
+ * ```typescript
88
+ *
89
+ * (async () => {
90
+ * const res = await this.crlService.downloadCrlFile();
91
+ * const arrayBuffer = await res.arrayBuffer();
92
+ * })();
93
+ * ```
94
+ */
95
+ downloadCrlFile(init) {
96
+ return __awaiter(this, void 0, void 0, function* () {
97
+ return yield this.fetch('', init);
98
+ });
99
+ }
100
+ }
101
+ //# sourceMappingURL=CrlService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CrlService.js","sourceRoot":"","sources":["../../../../src/trusted-certificates/CrlService.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,QAAQ,MAAM,WAAW,CAAC;AACjC,OAAO,EAA0C,OAAO,EAAE,MAAM,SAAS,CAAC;AAI1E;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,OAA+B;IAC7D,IAAc,OAAO;QACnB,OAAO,2CAA2C,CAAC;IACrD,CAAC;IAGD;;;;;;;;;;;;;;;;;;;OAmBG;IACG,UAAU,CAAC,IAA8B;;YAC7C,MAAM,MAAM,GAAG,KAAK,CAAC;YACrB,MAAM,OAAO,GAAG,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;YACnF,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;YACtC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC5D,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC7B,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACG,aAAa,CAAC,IAAmC;;YACrD,MAAM,MAAM,GAAG,KAAK,CAAC;YACrB,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;YAE5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC1B,MAAM,OAAO,GAAG;gBACd,MAAM,EAAE,kBAAkB;aAC3B,CAAC;YACF,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YAC5D,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAC7B,CAAC;KAAA;IAED;;;;;;;;;;;;;;OAcG;IACG,eAAe,CAAC,IAAoB;;YACxC,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QACpC,CAAC;KAAA;CACF"}
@@ -0,0 +1,12 @@
1
+ export interface ICertificateRevocation {
2
+ /**
3
+ * Unique number issued by the certificate issuer.
4
+ */
5
+ serialNumberInHex: string;
6
+ /**
7
+ * Certificate revocation date. Date of invalidating a certificate before its scheduled expiration date.
8
+ * If not provided, the revocationDate will be set to the current date.
9
+ */
10
+ revocationDate?: string;
11
+ }
12
+ //# sourceMappingURL=ICertificateRevocation.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ICertificateRevocation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ICertificateRevocation.js","sourceRoot":"","sources":["../../../../src/trusted-certificates/ICertificateRevocation.ts"],"names":[],"mappings":""}
@@ -1,3 +1,5 @@
1
1
  export * from './TrustedCertificateService';
2
2
  export * from './ITrustedCertificate';
3
+ export * from './ICertificateRevocation';
4
+ export * from './CrlService';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,5 @@
1
1
  export * from './TrustedCertificateService';
2
2
  export * from './ITrustedCertificate';
3
+ export * from './ICertificateRevocation';
4
+ export * from './CrlService';
3
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/trusted-certificates/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/trusted-certificates/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,cAAc,CAAC"}
@@ -18,7 +18,7 @@ export { UserRoleService } from './user-role';
18
18
  export { UserGroupService } from './user-group';
19
19
  export { Realtime } from './realtime';
20
20
  export { IdentityService } from './identity';
21
- export { TrustedCertificateService } from './trusted-certificates';
21
+ export { TrustedCertificateService, CrlService } from './trusted-certificates';
22
22
  export { SmartGroupsService } from './smart-groups';
23
23
  export { SmartRulesService } from './smart-rules';
24
24
  //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1,71 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { IFetchOptions, IFetchResponse, IResult, Service } from '../core';
4
+ import { ICertificateRevocation } from './ICertificateRevocation';
5
+ import { Stream } from 'stream';
6
+ /**
7
+ * This class allows for managing a list of certificate revocations.
8
+ */
9
+ export declare class CrlService extends Service<ICertificateRevocation> {
10
+ protected get baseUrl(): string;
11
+ protected readonly listUrl: string;
12
+ /**
13
+ * Uploads a list of certificate revocations.
14
+ * Adds new entries to the certificate revocation list,
15
+ * the ones that already exist are updated.
16
+ * No entries are removed from the certificate revocation list.
17
+ *
18
+ * @returns Returns a status object.
19
+ *
20
+ * **Example**
21
+ * ```typescript
22
+ *
23
+ * const crls: ICertificateRevocation[] = [
24
+ * { serialNumberInHex: '24234', revocationDate: '2023-01-13T23:00:00.000Z' }
25
+ * ];
26
+ *
27
+ * (async () => {
28
+ * const { res } = await crlService.uploadCrls(crls);
29
+ * })();
30
+ * ```
31
+ */
32
+ uploadCrls(crls: ICertificateRevocation[]): Promise<IResult<null>>;
33
+ /**
34
+ * Uploads a csv file containing a list of certificate revocations.
35
+ * Adds new entries to the certificate revocation list,
36
+ * the ones that already exist are updated.
37
+ * No entries are removed from the certificate revocation list.
38
+ *
39
+ * File format:
40
+ * SERIALNO,DATE
41
+ * 1234567890abcdef,2023-01-01T00:00:00.000Z
42
+ *
43
+ * @returns Returns a status object.
44
+ *
45
+ * **Example**
46
+ * ```typescript
47
+ *
48
+ * (async () => {
49
+ * const { res } = await crlService.uploadCrlFile( file );
50
+ * })();
51
+ * ```
52
+ */
53
+ uploadCrlFile(file: Stream | Buffer | File | Blob): Promise<IResult<null>>;
54
+ /**
55
+ * Downloads a certificate revocation list file.
56
+ * To open the downloaded file please use command: openssl crl -inform DER -text -noout -in fileName.crl
57
+ *
58
+ * @returns Returns a arrayBuffer wrapped in [[IFetchResponse]].
59
+ *
60
+ * **Example**
61
+ * ```typescript
62
+ *
63
+ * (async () => {
64
+ * const res = await this.crlService.downloadCrlFile();
65
+ * const arrayBuffer = await res.arrayBuffer();
66
+ * })();
67
+ * ```
68
+ */
69
+ downloadCrlFile(init?: IFetchOptions): Promise<IFetchResponse>;
70
+ }
71
+ //# sourceMappingURL=CrlService.d.ts.map
@@ -0,0 +1,12 @@
1
+ export interface ICertificateRevocation {
2
+ /**
3
+ * Unique number issued by the certificate issuer.
4
+ */
5
+ serialNumberInHex: string;
6
+ /**
7
+ * Certificate revocation date. Date of invalidating a certificate before its scheduled expiration date.
8
+ * If not provided, the revocationDate will be set to the current date.
9
+ */
10
+ revocationDate?: string;
11
+ }
12
+ //# sourceMappingURL=ICertificateRevocation.d.ts.map
@@ -1,3 +1,5 @@
1
1
  export * from './TrustedCertificateService';
2
2
  export * from './ITrustedCertificate';
3
+ export * from './ICertificateRevocation';
4
+ export * from './CrlService';
3
5
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/client",
3
- "version": "1018.503.23",
3
+ "version": "1018.503.37",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "Client application programming interface to access the Cumulocity IoT-Platform REST services.",