@smapiot/piral-cloud-node 0.13.3 → 0.14.1-pre.20230210.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.
Files changed (3) hide show
  1. package/lib/index.d.ts +88 -86
  2. package/lib/index.js +180 -196
  3. package/package.json +2 -2
package/lib/index.d.ts CHANGED
@@ -15,81 +15,82 @@ declare module "@smapiot/piral-cloud-node" {
15
15
  constructor(private http: FetchClient, host?: string);
16
16
  getUrl(path: string): string;
17
17
  getEvents(): string;
18
- getPilets(): Promise<Array<PiletMetadataDTO>>;
19
18
  doAny<T>(path: string, init?: RequestInit): Promise<T>;
20
19
  doGet<T>(path: string, init?: RequestInit): Promise<T>;
21
20
  doPost<T>(path: string, content: any, init?: RequestInit): Promise<T>;
22
21
  doPut<T>(path: string, content: any, init?: RequestInit): Promise<T>;
23
22
  doDelete<T>(path: string, init?: RequestInit): Promise<T>;
24
- doQueryFeeds(): Promise<FeedsDTO>;
25
- doQueryFeed(feed: string): Promise<FeedDTO>;
26
- doQueryPages(feed: string): Promise<PagesDTO>;
27
- doPublishPage(feed: string, content: PagePublishDetails): Promise<unknown>;
28
- doQueryAllPilets(feed: string, tag?: string, view?: "all" | "selected"): Promise<SelectedPiletsDTO>;
29
- doQueryUploadedPilets(feed: string, name: string, offset?: string, count?: string): Promise<UploadedPiletsDTO>;
30
- doPublishPilet(feed: string, tag: string, file: File): Promise<unknown>;
31
- doQueryCurrentPilets(feed: string): Promise<Array<PiletMetadataDTO>>;
32
- doQueryFeedExists(feed: string): Promise<FeedCheckDTO>;
33
- doQueryApiKeyScopes(): Promise<ApiKeyScopesDTO>;
34
- doQueryApiKeys(feed: string): Promise<ApiKeysDTO>;
35
- doQueryFeedApiKeys(feed: string): Promise<ApiKeysDTO>;
36
- doQueryGeneralApiKeys(): Promise<ApiKeysDTO>;
37
- doQueryRules(feed: string): Promise<RulesDTO>;
38
- doCreateFeed(content: FeedCreateDetails): Promise<unknown>;
39
- doAddRule(feed: string, content: RuleCreateDetails): Promise<unknown>;
40
- doGenerateApiKey(feed: string, content: ApiKeyCreateDetails): Promise<GeneratedApiKeyDTO>;
41
- doGenerateFeedApiKey(feed: string, content: ApiKeyCreateDetails): Promise<GeneratedApiKeyDTO>;
42
- doGenerateGeneralApiKey(content: ApiKeyCreateDetails): Promise<GeneratedApiKeyDTO>;
43
- doDeleteFeed(feed: string): Promise<unknown>;
44
- doRevokeGeneralApiKey(id: string): Promise<unknown>;
45
- doRevokeApiKey(feed: string, id: string): Promise<unknown>;
46
- doRevokeFeedApiKey(feed: string, id: string): Promise<unknown>;
47
- doDeletePilet(feed: string, id: string, all?: boolean): Promise<unknown>;
48
- doDeleteRule(feed: string, id: string): Promise<unknown>;
49
- doUpdateRule(feed: string, id: string, content: RuleUpdateDetails): Promise<unknown>;
50
- doUpdatePilet(feed: string, id: string, content: PiletUpdateDetails): Promise<unknown>;
51
- doUpdateFeed(feed: string, content: FeedUpdateDetails): Promise<unknown>;
52
- doUpdateApiKey(feed: string, id: string, content: ApiKeyUpdateDetails): Promise<unknown>;
53
- doUpdateFeedApiKey(feed: string, id: string, content: ApiKeyUpdateDetails): Promise<unknown>;
54
- doUpdateGeneralApiKey(id: string, content: ApiKeyUpdateDetails): Promise<unknown>;
55
- doQueryAudits(offset?: string, count?: string, areaName?: string, areaId?: string, objectId?: string, userId?: string): Promise<AuditsDTO>;
56
- doQueryAudit(id: string): Promise<AuditDTO>;
57
- doQueryAllUsers(q: string, offset?: number, count?: number): Promise<AllUsersDTO>;
58
- doQueryFeedContributors(feed: string): Promise<FeedContributorsDTO>;
59
- doPutFeedContributors(feed: string, content: ContributorUpdateDetails): Promise<unknown>;
60
- doQueryConfigs(feed: string, pilet: string): Promise<ConfigsDTO>;
61
- doQueryConfig(feed: string, pilet: string, config: string): Promise<ConfigDTO>;
62
- doAddConfig(feed: string, pilet: string, content: ConfigCreateDetails): Promise<unknown>;
63
- doDeleteConfig(feed: string, pilet: string, config: string): Promise<unknown>;
64
- doUpdateConfig(feed: string, pilet: string, config: string, content: ConfigUpdateDetails): Promise<unknown>;
65
- doQueryAllFeedConfigs(feed: string): Promise<AllFeedConfigsDTO>;
66
- doQueryFeedConfigs(feed: string, configId: string): Promise<FeedConfigsDTO>;
67
- doQueryFeedConfig(feed: string, configId: string, config: string): Promise<FeedConfigDTO>;
68
- doAddFeedConfig(feed: string, configId: string, content: ConfigCreateDetails): Promise<unknown>;
69
- doDeleteFeedConfig(feed: string, configId: string, config: string): Promise<unknown>;
70
- doUpdateFeedConfig(feed: string, configId: string, config: string, content: ConfigUpdateDetails): Promise<unknown>;
71
- doQueryEntities(feed: string): Promise<EntitiesDTO>;
72
- doQueryEntity(feed: string, id: string): Promise<EntityDTO>;
73
- doAddEntity(feed: string, content: EntityCreateDetails): Promise<unknown>;
74
- doDeleteEntity(feed: string, id: string): Promise<EntityDTO>;
75
- doUpdateEntity(feed: string, id: string, content: EntityUpdateDetails): Promise<unknown>;
76
- doQueryUsers(): Promise<UsersDTO>;
77
- doQueryUser(id: string): Promise<UserDTO>;
78
- doAddUser(content: UserCreateDetails): Promise<ChangedUserDTO>;
79
- doDeleteUser(id: string): Promise<DeletedUserDTO>;
80
- doUpdateUser(id: string, content: UserUpdateDetails): Promise<ChangedUserDTO>;
81
- doQueryCustomRules(): Promise<CustomRuleModulesDTO>;
82
- doQueryGroups(): Promise<GroupsDTO>;
83
- doQueryGroup(id: string): Promise<GroupDetailsDTO>;
84
- doAddGroup(content: GroupCreateDetails): Promise<GroupDetailsDTO>;
85
- doUpdateGroup(id: string, content: GroupUpdateDetails): Promise<GroupDetailsDTO>;
86
- doDeleteGroup(id: string): Promise<DeletedGroupDTO>;
87
- doAddCustomRules(file: string, content: string): Promise<ChangedCustomRuleModuleDTO>;
88
- doDeleteCustomRule(file: string): Promise<ChangedCustomRuleModuleDTO>;
89
- doQueryCustomRuleDetails(file: string): Promise<CustomRuleDetailsDTO>;
90
- doTestRule(feed: string, rule: string, content: TestRuleDetails): Promise<TestRuleResultDTO>;
91
- doQueryCurrentUser(): Promise<CurrentUserDTO>;
92
- doUpdateCurrentUser(content: CurrentUserUpdateDetails): Promise<ChangedUserDTO>;
23
+ getPilets(ac?: AbortController): Promise<Array<PiletMetadataDTO>>;
24
+ doQueryFeeds(ac?: AbortController): Promise<FeedsDTO>;
25
+ doQueryFeed(feed: string, ac?: AbortController): Promise<FeedDTO>;
26
+ doQueryPages(feed: string, ac?: AbortController): Promise<PagesDTO>;
27
+ doPublishPage(feed: string, content: PagePublishDetails, ac?: AbortController): Promise<unknown>;
28
+ doQueryAllPilets(feed: string, tag?: string, view?: "all" | "selected", ac?: AbortController): Promise<SelectedPiletsDTO>;
29
+ doQueryUploadedPilets(feed: string, name: string, offset?: string, count?: string, ac?: AbortController): Promise<UploadedPiletsDTO>;
30
+ doPublishPilet(feed: string, tag: string, file: File, ac?: AbortController): Promise<unknown>;
31
+ doQueryCurrentPilets(feed: string, ac?: AbortController): Promise<Array<PiletMetadataDTO>>;
32
+ doQueryPiletDetails(feed: string, pilet: string, ac?: AbortController): Promise<PiletDTO>;
33
+ doQueryFeedExists(feed: string, ac?: AbortController): Promise<FeedCheckDTO>;
34
+ doQueryApiKeyScopes(ac?: AbortController): Promise<ApiKeyScopesDTO>;
35
+ doQueryApiKeys(feed: string, ac?: AbortController): Promise<ApiKeysDTO>;
36
+ doQueryFeedApiKeys(feed: string, ac?: AbortController): Promise<ApiKeysDTO>;
37
+ doQueryGeneralApiKeys(ac?: AbortController): Promise<ApiKeysDTO>;
38
+ doQueryRules(feed: string, ac?: AbortController): Promise<RulesDTO>;
39
+ doCreateFeed(content: FeedCreateDetails, ac?: AbortController): Promise<unknown>;
40
+ doAddRule(feed: string, content: RuleCreateDetails, ac?: AbortController): Promise<unknown>;
41
+ doGenerateApiKey(feed: string, content: ApiKeyCreateDetails, ac?: AbortController): Promise<GeneratedApiKeyDTO>;
42
+ doGenerateFeedApiKey(feed: string, content: ApiKeyCreateDetails, ac?: AbortController): Promise<GeneratedApiKeyDTO>;
43
+ doGenerateGeneralApiKey(content: ApiKeyCreateDetails, ac?: AbortController): Promise<GeneratedApiKeyDTO>;
44
+ doDeleteFeed(feed: string, ac?: AbortController): Promise<unknown>;
45
+ doRevokeGeneralApiKey(id: string, ac?: AbortController): Promise<unknown>;
46
+ doRevokeApiKey(feed: string, id: string, ac?: AbortController): Promise<unknown>;
47
+ doRevokeFeedApiKey(feed: string, id: string, ac?: AbortController): Promise<unknown>;
48
+ doDeletePilet(feed: string, id: string, all?: boolean, ac?: AbortController): Promise<unknown>;
49
+ doDeleteRule(feed: string, id: string, ac?: AbortController): Promise<unknown>;
50
+ doUpdateRule(feed: string, id: string, content: RuleUpdateDetails, ac?: AbortController): Promise<unknown>;
51
+ doUpdatePilet(feed: string, id: string, content: PiletUpdateDetails, ac?: AbortController): Promise<unknown>;
52
+ doUpdateFeed(feed: string, content: FeedUpdateDetails, ac?: AbortController): Promise<unknown>;
53
+ doUpdateApiKey(feed: string, id: string, content: ApiKeyUpdateDetails, ac?: AbortController): Promise<unknown>;
54
+ doUpdateFeedApiKey(feed: string, id: string, content: ApiKeyUpdateDetails, ac?: AbortController): Promise<unknown>;
55
+ doUpdateGeneralApiKey(id: string, content: ApiKeyUpdateDetails, ac?: AbortController): Promise<unknown>;
56
+ doQueryAudits(offset?: string, count?: string, areaName?: string, areaId?: string, objectId?: string, userId?: string, ac?: AbortController): Promise<AuditsDTO>;
57
+ doQueryAudit(id: string, ac?: AbortController): Promise<AuditDTO>;
58
+ doQueryAllUsers(q: string, offset?: number, count?: number, ac?: AbortController): Promise<AllUsersDTO>;
59
+ doQueryFeedContributors(feed: string, ac?: AbortController): Promise<FeedContributorsDTO>;
60
+ doPutFeedContributors(feed: string, content: ContributorUpdateDetails, ac?: AbortController): Promise<unknown>;
61
+ doQueryConfigs(feed: string, pilet: string, ac?: AbortController): Promise<ConfigsDTO>;
62
+ doQueryConfig(feed: string, pilet: string, config: string, ac?: AbortController): Promise<ConfigDTO>;
63
+ doAddConfig(feed: string, pilet: string, content: ConfigCreateDetails, ac?: AbortController): Promise<unknown>;
64
+ doDeleteConfig(feed: string, pilet: string, config: string, ac?: AbortController): Promise<unknown>;
65
+ doUpdateConfig(feed: string, pilet: string, config: string, content: ConfigUpdateDetails, ac?: AbortController): Promise<unknown>;
66
+ doQueryAllFeedConfigs(feed: string, ac?: AbortController): Promise<AllFeedConfigsDTO>;
67
+ doQueryFeedConfigs(feed: string, configId: string, ac?: AbortController): Promise<FeedConfigsDTO>;
68
+ doQueryFeedConfig(feed: string, configId: string, config: string, ac?: AbortController): Promise<FeedConfigDTO>;
69
+ doAddFeedConfig(feed: string, configId: string, content: ConfigCreateDetails, ac?: AbortController): Promise<unknown>;
70
+ doDeleteFeedConfig(feed: string, configId: string, config: string, ac?: AbortController): Promise<unknown>;
71
+ doUpdateFeedConfig(feed: string, configId: string, config: string, content: ConfigUpdateDetails, ac?: AbortController): Promise<unknown>;
72
+ doQueryEntities(feed: string, ac?: AbortController): Promise<EntitiesDTO>;
73
+ doQueryEntity(feed: string, id: string, ac?: AbortController): Promise<EntityDTO>;
74
+ doAddEntity(feed: string, content: EntityCreateDetails, ac?: AbortController): Promise<unknown>;
75
+ doDeleteEntity(feed: string, id: string, ac?: AbortController): Promise<EntityDTO>;
76
+ doUpdateEntity(feed: string, id: string, content: EntityUpdateDetails, ac?: AbortController): Promise<unknown>;
77
+ doQueryUsers(ac?: AbortController): Promise<UsersDTO>;
78
+ doQueryUser(id: string, ac?: AbortController): Promise<UserDTO>;
79
+ doAddUser(content: UserCreateDetails, ac?: AbortController): Promise<ChangedUserDTO>;
80
+ doDeleteUser(id: string, ac?: AbortController): Promise<DeletedUserDTO>;
81
+ doUpdateUser(id: string, content: UserUpdateDetails, ac?: AbortController): Promise<ChangedUserDTO>;
82
+ doQueryCustomRules(ac?: AbortController): Promise<CustomRuleModulesDTO>;
83
+ doQueryGroups(ac?: AbortController): Promise<GroupsDTO>;
84
+ doQueryGroup(id: string, ac?: AbortController): Promise<GroupDetailsDTO>;
85
+ doAddGroup(content: GroupCreateDetails, ac?: AbortController): Promise<GroupDetailsDTO>;
86
+ doUpdateGroup(id: string, content: GroupUpdateDetails, ac?: AbortController): Promise<GroupDetailsDTO>;
87
+ doDeleteGroup(id: string, ac?: AbortController): Promise<DeletedGroupDTO>;
88
+ doAddCustomRules(file: string, content: string, ac?: AbortController): Promise<ChangedCustomRuleModuleDTO>;
89
+ doDeleteCustomRule(file: string, ac?: AbortController): Promise<ChangedCustomRuleModuleDTO>;
90
+ doQueryCustomRuleDetails(file: string, ac?: AbortController): Promise<CustomRuleDetailsDTO>;
91
+ doTestRule(feed: string, rule: string, content: TestRuleDetails, ac?: AbortController): Promise<TestRuleResultDTO>;
92
+ doQueryCurrentUser(ac?: AbortController): Promise<CurrentUserDTO>;
93
+ doUpdateCurrentUser(content: CurrentUserUpdateDetails, ac?: AbortController): Promise<ChangedUserDTO>;
93
94
  doQueryStatus(ac?: AbortController): Promise<StatusDTO>;
94
95
  doQueryStatistics(ac?: AbortController): Promise<StatisticsDTO>;
95
96
  doQueryRulesSchema(ac?: AbortController): Promise<any>;
@@ -218,6 +219,20 @@ declare module "@smapiot/piral-cloud-node" {
218
219
 
219
220
  export interface UploadedPiletsDTO extends ApiPaginatedData<PiletDTO> {}
220
221
 
222
+ export interface PiletDTO {
223
+ id: string;
224
+ name: string;
225
+ version: string;
226
+ hash: string;
227
+ tag: string;
228
+ selected: boolean;
229
+ schema: PiletType;
230
+ configRefs: Array<string>;
231
+ canSetTag: boolean;
232
+ canBundle: boolean;
233
+ canDelete: boolean;
234
+ }
235
+
221
236
  export interface FeedCheckDTO {
222
237
  exists: boolean;
223
238
  restore?: boolean;
@@ -283,6 +298,7 @@ declare module "@smapiot/piral-cloud-node" {
283
298
  selected?: boolean;
284
299
  enabled?: boolean;
285
300
  bundled?: boolean;
301
+ tag?: string;
286
302
  configRefs?: Array<string>;
287
303
  }
288
304
 
@@ -658,25 +674,13 @@ declare module "@smapiot/piral-cloud-node" {
658
674
  active: boolean;
659
675
  }
660
676
 
661
- export interface PiletDTO {
662
- id: string;
663
- name: string;
664
- version: string;
665
- hash: string;
666
- tag: string;
667
- selected: boolean;
668
- schema: PiletType;
669
- configRefs: Array<string>;
670
- canSetTag: boolean;
671
- canBundle: boolean;
672
- canDelete: boolean;
673
- }
674
-
675
677
  export interface ApiPaginatedData<T> {
676
678
  items: Array<T>;
677
679
  continuation: string;
678
680
  }
679
681
 
682
+ export type PiletType = "v0" | "v1" | "v2" | "oc" | "sspa" | "wmf" | "nf";
683
+
680
684
  export interface ApiKeyDTO {
681
685
  id: string;
682
686
  name: string;
@@ -786,6 +790,4 @@ declare module "@smapiot/piral-cloud-node" {
786
790
  canDelete: boolean;
787
791
  plan: string;
788
792
  }
789
-
790
- export type PiletType = "v0" | "v1" | "v2" | "oc" | "sspa" | "wmf" | "nf";
791
793
  }
package/lib/index.js CHANGED
@@ -4453,6 +4453,12 @@ function getDefaultHost() {
4453
4453
  }
4454
4454
  return "";
4455
4455
  }
4456
+ function mac() {
4457
+ return new AbortController();
4458
+ }
4459
+ function mri(ac) {
4460
+ return { signal: ac.signal };
4461
+ }
4456
4462
  var FeedServiceApiClient = class {
4457
4463
  constructor(http3, host = getDefaultHost()) {
4458
4464
  this.http = http3;
@@ -4466,9 +4472,6 @@ var FeedServiceApiClient = class {
4466
4472
  const url = this.getUrl("events");
4467
4473
  return url.replace("http", "ws");
4468
4474
  }
4469
- getPilets() {
4470
- return this.doQueryCurrentPilets("cloud");
4471
- }
4472
4475
  doAny(path, init) {
4473
4476
  return fetchWithToken(this.http, this.getUrl(path), init).then(getJsonResponse);
4474
4477
  }
@@ -4488,16 +4491,19 @@ var FeedServiceApiClient = class {
4488
4491
  doDelete(path, init = {}) {
4489
4492
  return this.doAny(path, { ...init, method: "DELETE" });
4490
4493
  }
4491
- doQueryFeeds() {
4492
- return this.doGet(`feed`);
4494
+ getPilets(ac = mac()) {
4495
+ return this.doQueryCurrentPilets("cloud", ac);
4496
+ }
4497
+ doQueryFeeds(ac = mac()) {
4498
+ return this.doGet(`feed`, mri(ac));
4493
4499
  }
4494
- doQueryFeed(feed) {
4495
- return this.doGet(`feed/${feed}`);
4500
+ doQueryFeed(feed, ac = mac()) {
4501
+ return this.doGet(`feed/${feed}`, mri(ac));
4496
4502
  }
4497
- doQueryPages(feed) {
4498
- return this.doGet(`feed/${feed}/page`);
4503
+ doQueryPages(feed, ac = mac()) {
4504
+ return this.doGet(`feed/${feed}/page`, mri(ac));
4499
4505
  }
4500
- doPublishPage(feed, content) {
4506
+ doPublishPage(feed, content, ac = mac()) {
4501
4507
  const { FormData: FormData2 } = this.http;
4502
4508
  const form = new FormData2();
4503
4509
  form.append("version", content.version);
@@ -4511,112 +4517,117 @@ var FeedServiceApiClient = class {
4511
4517
  form.append(path, file);
4512
4518
  }
4513
4519
  }
4514
- return this.doPost(`feed/${feed}/page`, form);
4520
+ return this.doPost(`feed/${feed}/page`, form, mri(ac));
4515
4521
  }
4516
- doQueryAllPilets(feed, tag = "latest", view = "all") {
4522
+ doQueryAllPilets(feed, tag = "latest", view = "all", ac = mac()) {
4517
4523
  const queryString = makeQueryString({ tag, view });
4518
- return this.doGet(`feed/${feed}/pilets?${queryString}`);
4524
+ return this.doGet(`feed/${feed}/pilets?${queryString}`, mri(ac));
4519
4525
  }
4520
- doQueryUploadedPilets(feed, name, offset = "", count = "20") {
4526
+ doQueryUploadedPilets(feed, name, offset = "", count = "20", ac = mac()) {
4521
4527
  const queryString = makeQueryString({ offset, count });
4522
- return this.doGet(`feed/${feed}/pilets/${name}/versions?${queryString}`);
4528
+ return this.doGet(`feed/${feed}/pilets/${name}/versions?${queryString}`, mri(ac));
4523
4529
  }
4524
- doPublishPilet(feed, tag, file) {
4530
+ doPublishPilet(feed, tag, file, ac = mac()) {
4525
4531
  const { FormData: FormData2 } = this.http;
4526
4532
  const form = new FormData2();
4527
4533
  form.append("file", file);
4528
4534
  form.append("tag", tag);
4529
- return this.doPost(`pilet/${feed}`, form);
4535
+ return this.doPost(`pilet/${feed}`, form, mri(ac));
4530
4536
  }
4531
- doQueryCurrentPilets(feed) {
4532
- return this.doGet(`pilet/${feed}`).then((res) => res.items);
4537
+ doQueryCurrentPilets(feed, ac = mac()) {
4538
+ return this.doGet(`pilet/${feed}`, mri(ac)).then(
4539
+ (res) => res.items
4540
+ );
4541
+ }
4542
+ doQueryPiletDetails(feed, pilet, ac = mac()) {
4543
+ return this.doGet(`feed/${feed}/pilets/${pilet}`, mri(ac));
4533
4544
  }
4534
- doQueryFeedExists(feed) {
4535
- return this.doGet(`feed/${feed}/check`);
4545
+ doQueryFeedExists(feed, ac = mac()) {
4546
+ return this.doGet(`feed/${feed}/check`, mri(ac));
4536
4547
  }
4537
- doQueryApiKeyScopes() {
4538
- return this.doGet(`api-key-scope`);
4548
+ doQueryApiKeyScopes(ac = mac()) {
4549
+ return this.doGet(`api-key-scope`, mri(ac));
4539
4550
  }
4540
- doQueryApiKeys(feed) {
4551
+ doQueryApiKeys(feed, ac = mac()) {
4541
4552
  if (feed === "*") {
4542
- return this.doQueryGeneralApiKeys();
4553
+ return this.doQueryGeneralApiKeys(ac);
4543
4554
  } else {
4544
- return this.doQueryFeedApiKeys(feed);
4555
+ return this.doQueryFeedApiKeys(feed, ac);
4545
4556
  }
4546
4557
  }
4547
- doQueryFeedApiKeys(feed) {
4548
- return this.doGet(`feed/${feed}/api-keys`);
4558
+ doQueryFeedApiKeys(feed, ac = mac()) {
4559
+ return this.doGet(`feed/${feed}/api-keys`, mri(ac));
4549
4560
  }
4550
- doQueryGeneralApiKeys() {
4551
- return this.doGet(`api-key`);
4561
+ doQueryGeneralApiKeys(ac = mac()) {
4562
+ return this.doGet(`api-key`, mri(ac));
4552
4563
  }
4553
- doQueryRules(feed) {
4554
- return this.doGet(`feed/${feed}/rules`);
4564
+ doQueryRules(feed, ac = mac()) {
4565
+ return this.doGet(`feed/${feed}/rules`, mri(ac));
4555
4566
  }
4556
- doCreateFeed(content) {
4557
- return this.doPost(`feed`, content);
4567
+ doCreateFeed(content, ac = mac()) {
4568
+ return this.doPost(`feed`, content, mri(ac));
4558
4569
  }
4559
- doAddRule(feed, content) {
4560
- return this.doPost(`feed/${feed}/rules`, content);
4570
+ doAddRule(feed, content, ac = mac()) {
4571
+ return this.doPost(`feed/${feed}/rules`, content, mri(ac));
4561
4572
  }
4562
- doGenerateApiKey(feed, content) {
4573
+ doGenerateApiKey(feed, content, ac = mac()) {
4563
4574
  if (feed === "*") {
4564
- return this.doGenerateGeneralApiKey(content);
4575
+ return this.doGenerateGeneralApiKey(content, ac);
4565
4576
  } else {
4566
- return this.doGenerateFeedApiKey(feed, content);
4577
+ return this.doGenerateFeedApiKey(feed, content, ac);
4567
4578
  }
4568
4579
  }
4569
- doGenerateFeedApiKey(feed, content) {
4570
- return this.doPost(`feed/${feed}/api-keys`, content);
4580
+ doGenerateFeedApiKey(feed, content, ac = mac()) {
4581
+ return this.doPost(`feed/${feed}/api-keys`, content, mri(ac));
4571
4582
  }
4572
- doGenerateGeneralApiKey(content) {
4573
- return this.doPost(`api-key`, content);
4583
+ doGenerateGeneralApiKey(content, ac = mac()) {
4584
+ return this.doPost(`api-key`, content, mri(ac));
4574
4585
  }
4575
- doDeleteFeed(feed) {
4576
- return this.doDelete(`feed/${feed}`);
4586
+ doDeleteFeed(feed, ac = mac()) {
4587
+ return this.doDelete(`feed/${feed}`, mri(ac));
4577
4588
  }
4578
- doRevokeGeneralApiKey(id) {
4579
- return this.doDelete(`api-key/${id}`);
4589
+ doRevokeGeneralApiKey(id, ac = mac()) {
4590
+ return this.doDelete(`api-key/${id}`, mri(ac));
4580
4591
  }
4581
- doRevokeApiKey(feed, id) {
4592
+ doRevokeApiKey(feed, id, ac = mac()) {
4582
4593
  if (feed === "*") {
4583
- return this.doRevokeGeneralApiKey(id);
4594
+ return this.doRevokeGeneralApiKey(id, ac);
4584
4595
  } else {
4585
- return this.doRevokeFeedApiKey(feed, id);
4596
+ return this.doRevokeFeedApiKey(feed, id, ac);
4586
4597
  }
4587
4598
  }
4588
- doRevokeFeedApiKey(feed, id) {
4589
- return this.doDelete(`feed/${feed}/api-keys/${id}`);
4599
+ doRevokeFeedApiKey(feed, id, ac = mac()) {
4600
+ return this.doDelete(`feed/${feed}/api-keys/${id}`, mri(ac));
4590
4601
  }
4591
- doDeletePilet(feed, id, all = false) {
4592
- return this.doDelete(`feed/${feed}/pilets/${id}?all=${all}`);
4602
+ doDeletePilet(feed, id, all = false, ac = mac()) {
4603
+ return this.doDelete(`feed/${feed}/pilets/${id}?all=${all}`, mri(ac));
4593
4604
  }
4594
- doDeleteRule(feed, id) {
4595
- return this.doDelete(`feed/${feed}/rules/${id}`);
4605
+ doDeleteRule(feed, id, ac = mac()) {
4606
+ return this.doDelete(`feed/${feed}/rules/${id}`, mri(ac));
4596
4607
  }
4597
- doUpdateRule(feed, id, content) {
4598
- return this.doPut(`feed/${feed}/rules/${id}`, content);
4608
+ doUpdateRule(feed, id, content, ac = mac()) {
4609
+ return this.doPut(`feed/${feed}/rules/${id}`, content, mri(ac));
4599
4610
  }
4600
- doUpdatePilet(feed, id, content) {
4601
- return this.doPut(`feed/${feed}/pilets/${id}`, content);
4611
+ doUpdatePilet(feed, id, content, ac = mac()) {
4612
+ return this.doPut(`feed/${feed}/pilets/${id}`, content, mri(ac));
4602
4613
  }
4603
- doUpdateFeed(feed, content) {
4604
- return this.doPut(`feed/${feed}`, content);
4614
+ doUpdateFeed(feed, content, ac = mac()) {
4615
+ return this.doPut(`feed/${feed}`, content, mri(ac));
4605
4616
  }
4606
- doUpdateApiKey(feed, id, content) {
4617
+ doUpdateApiKey(feed, id, content, ac = mac()) {
4607
4618
  if (feed === "*") {
4608
- return this.doUpdateGeneralApiKey(id, content);
4619
+ return this.doUpdateGeneralApiKey(id, content, ac);
4609
4620
  } else {
4610
- return this.doUpdateFeedApiKey(feed, id, content);
4621
+ return this.doUpdateFeedApiKey(feed, id, content, ac);
4611
4622
  }
4612
4623
  }
4613
- doUpdateFeedApiKey(feed, id, content) {
4614
- return this.doPut(`feed/${feed}/api-keys/${id}`, content);
4624
+ doUpdateFeedApiKey(feed, id, content, ac = mac()) {
4625
+ return this.doPut(`feed/${feed}/api-keys/${id}`, content, mri(ac));
4615
4626
  }
4616
- doUpdateGeneralApiKey(id, content) {
4617
- return this.doPut(`api-key/${id}`, content);
4627
+ doUpdateGeneralApiKey(id, content, ac = mac()) {
4628
+ return this.doPut(`api-key/${id}`, content, mri(ac));
4618
4629
  }
4619
- doQueryAudits(offset = "", count = "20", areaName = "", areaId = "", objectId = "", userId = "") {
4630
+ doQueryAudits(offset = "", count = "20", areaName = "", areaId = "", objectId = "", userId = "", ac = mac()) {
4620
4631
  const queryString = makeQueryString({
4621
4632
  offset,
4622
4633
  count,
@@ -4625,193 +4636,166 @@ var FeedServiceApiClient = class {
4625
4636
  objectId,
4626
4637
  userId
4627
4638
  });
4628
- return this.doGet(`audit?${queryString}`);
4639
+ return this.doGet(`audit?${queryString}`, mri(ac));
4629
4640
  }
4630
- doQueryAudit(id) {
4631
- return this.doGet(`audit/${id}`);
4641
+ doQueryAudit(id, ac = mac()) {
4642
+ return this.doGet(`audit/${id}`, mri(ac));
4632
4643
  }
4633
- doQueryAllUsers(q, offset, count) {
4644
+ doQueryAllUsers(q, offset, count, ac = mac()) {
4634
4645
  const queryString = makeQueryString({
4635
4646
  q,
4636
4647
  offset,
4637
4648
  count
4638
4649
  });
4639
- return this.doGet(`query-users?${queryString}`);
4650
+ return this.doGet(`query-users?${queryString}`, mri(ac));
4640
4651
  }
4641
- doQueryFeedContributors(feed) {
4642
- return this.doGet(`feed/${feed}/contributors`);
4652
+ doQueryFeedContributors(feed, ac = mac()) {
4653
+ return this.doGet(`feed/${feed}/contributors`, mri(ac));
4643
4654
  }
4644
- doPutFeedContributors(feed, content) {
4645
- return this.doPut(`feed/${feed}/contributors`, content);
4655
+ doPutFeedContributors(feed, content, ac = mac()) {
4656
+ return this.doPut(`feed/${feed}/contributors`, content, mri(ac));
4646
4657
  }
4647
- doQueryConfigs(feed, pilet) {
4648
- return this.doGet(`feed/${feed}/pilets/${pilet}/configs`);
4658
+ doQueryConfigs(feed, pilet, ac = mac()) {
4659
+ return this.doGet(`feed/${feed}/pilets/${pilet}/configs`, mri(ac));
4649
4660
  }
4650
- doQueryConfig(feed, pilet, config) {
4651
- return this.doGet(`feed/${feed}/pilets/${pilet}/configs/${config}`);
4661
+ doQueryConfig(feed, pilet, config, ac = mac()) {
4662
+ return this.doGet(`feed/${feed}/pilets/${pilet}/configs/${config}`, mri(ac));
4652
4663
  }
4653
- doAddConfig(feed, pilet, content) {
4654
- return this.doPost(`feed/${feed}/pilets/${pilet}/configs`, content);
4664
+ doAddConfig(feed, pilet, content, ac = mac()) {
4665
+ return this.doPost(`feed/${feed}/pilets/${pilet}/configs`, content, mri(ac));
4655
4666
  }
4656
- doDeleteConfig(feed, pilet, config) {
4657
- return this.doDelete(`feed/${feed}/pilets/${pilet}/configs/${config}`);
4667
+ doDeleteConfig(feed, pilet, config, ac = mac()) {
4668
+ return this.doDelete(`feed/${feed}/pilets/${pilet}/configs/${config}`, mri(ac));
4658
4669
  }
4659
- doUpdateConfig(feed, pilet, config, content) {
4660
- return this.doPut(`feed/${feed}/pilets/${pilet}/configs/${config}`, content);
4670
+ doUpdateConfig(feed, pilet, config, content, ac = mac()) {
4671
+ return this.doPut(`feed/${feed}/pilets/${pilet}/configs/${config}`, content, mri(ac));
4661
4672
  }
4662
- doQueryAllFeedConfigs(feed) {
4663
- return this.doGet(`feed/${feed}/configs`);
4673
+ doQueryAllFeedConfigs(feed, ac = mac()) {
4674
+ return this.doGet(`feed/${feed}/configs`, mri(ac));
4664
4675
  }
4665
- doQueryFeedConfigs(feed, configId) {
4666
- return this.doGet(`feed/${feed}/configs/${configId}`);
4676
+ doQueryFeedConfigs(feed, configId, ac = mac()) {
4677
+ return this.doGet(`feed/${feed}/configs/${configId}`, mri(ac));
4667
4678
  }
4668
- doQueryFeedConfig(feed, configId, config) {
4669
- return this.doGet(`feed/${feed}/configs/${configId}/${config}`);
4679
+ doQueryFeedConfig(feed, configId, config, ac = mac()) {
4680
+ return this.doGet(`feed/${feed}/configs/${configId}/${config}`, mri(ac));
4670
4681
  }
4671
- doAddFeedConfig(feed, configId, content) {
4672
- return this.doPost(`feed/${feed}/configs/${configId}`, content);
4682
+ doAddFeedConfig(feed, configId, content, ac = mac()) {
4683
+ return this.doPost(`feed/${feed}/configs/${configId}`, content, mri(ac));
4673
4684
  }
4674
- doDeleteFeedConfig(feed, configId, config) {
4675
- return this.doDelete(`feed/${feed}/configs/${configId}/${config}`);
4685
+ doDeleteFeedConfig(feed, configId, config, ac = mac()) {
4686
+ return this.doDelete(`feed/${feed}/configs/${configId}/${config}`, mri(ac));
4676
4687
  }
4677
- doUpdateFeedConfig(feed, configId, config, content) {
4678
- return this.doPut(`feed/${feed}/configs/${configId}/${config}`, content);
4688
+ doUpdateFeedConfig(feed, configId, config, content, ac = mac()) {
4689
+ return this.doPut(`feed/${feed}/configs/${configId}/${config}`, content, mri(ac));
4679
4690
  }
4680
- doQueryEntities(feed) {
4681
- return this.doGet(`feed/${feed}/entities`);
4691
+ doQueryEntities(feed, ac = mac()) {
4692
+ return this.doGet(`feed/${feed}/entities`, mri(ac));
4682
4693
  }
4683
- doQueryEntity(feed, id) {
4684
- return this.doGet(`feed/${feed}/entities/${id}`);
4694
+ doQueryEntity(feed, id, ac = mac()) {
4695
+ return this.doGet(`feed/${feed}/entities/${id}`, mri(ac));
4685
4696
  }
4686
- doAddEntity(feed, content) {
4687
- return this.doPost(`feed/${feed}/entities`, content);
4697
+ doAddEntity(feed, content, ac = mac()) {
4698
+ return this.doPost(`feed/${feed}/entities`, content, mri(ac));
4688
4699
  }
4689
- doDeleteEntity(feed, id) {
4690
- return this.doDelete(`feed/${feed}/entities/${id}`);
4700
+ doDeleteEntity(feed, id, ac = mac()) {
4701
+ return this.doDelete(`feed/${feed}/entities/${id}`, mri(ac));
4691
4702
  }
4692
- doUpdateEntity(feed, id, content) {
4693
- return this.doPut(`feed/${feed}/entities/${id}`, content);
4703
+ doUpdateEntity(feed, id, content, ac = mac()) {
4704
+ return this.doPut(`feed/${feed}/entities/${id}`, content, mri(ac));
4694
4705
  }
4695
- doQueryUsers() {
4696
- return this.doGet(`user`);
4706
+ doQueryUsers(ac = mac()) {
4707
+ return this.doGet(`user`, mri(ac));
4697
4708
  }
4698
- doQueryUser(id) {
4699
- return this.doGet(`user/${id}`);
4709
+ doQueryUser(id, ac = mac()) {
4710
+ return this.doGet(`user/${id}`, mri(ac));
4700
4711
  }
4701
- doAddUser(content) {
4702
- return this.doPost(`user`, content);
4712
+ doAddUser(content, ac = mac()) {
4713
+ return this.doPost(`user`, content, mri(ac));
4703
4714
  }
4704
- doDeleteUser(id) {
4705
- return this.doDelete(`user/${id}`);
4715
+ doDeleteUser(id, ac = mac()) {
4716
+ return this.doDelete(`user/${id}`, mri(ac));
4706
4717
  }
4707
- doUpdateUser(id, content) {
4708
- return this.doPut(`user/${id}`, content);
4718
+ doUpdateUser(id, content, ac = mac()) {
4719
+ return this.doPut(`user/${id}`, content, mri(ac));
4709
4720
  }
4710
- doQueryCustomRules() {
4711
- return this.doGet(`customrule`);
4721
+ doQueryCustomRules(ac = mac()) {
4722
+ return this.doGet(`customrule`, mri(ac));
4712
4723
  }
4713
- doQueryGroups() {
4714
- return this.doGet(`group`);
4724
+ doQueryGroups(ac = mac()) {
4725
+ return this.doGet(`group`, mri(ac));
4715
4726
  }
4716
- doQueryGroup(id) {
4717
- return this.doGet(`group/${id}`);
4727
+ doQueryGroup(id, ac = mac()) {
4728
+ return this.doGet(`group/${id}`, mri(ac));
4718
4729
  }
4719
- doAddGroup(content) {
4720
- return this.doPost(`group`, content);
4730
+ doAddGroup(content, ac = mac()) {
4731
+ return this.doPost(`group`, content, mri(ac));
4721
4732
  }
4722
- doUpdateGroup(id, content) {
4723
- return this.doPut(`group/${id}`, content);
4733
+ doUpdateGroup(id, content, ac = mac()) {
4734
+ return this.doPut(`group/${id}`, content, mri(ac));
4724
4735
  }
4725
- doDeleteGroup(id) {
4726
- return this.doDelete(`group/${id}`);
4736
+ doDeleteGroup(id, ac = mac()) {
4737
+ return this.doDelete(`group/${id}`, mri(ac));
4727
4738
  }
4728
- doAddCustomRules(file, content) {
4729
- return this.doPost(`customrule`, {
4730
- file,
4731
- content
4732
- });
4739
+ doAddCustomRules(file, content, ac = mac()) {
4740
+ return this.doPost(`customrule`, { file, content }, mri(ac));
4733
4741
  }
4734
- doDeleteCustomRule(file) {
4735
- return this.doDelete(`customrule/${file}`);
4742
+ doDeleteCustomRule(file, ac = mac()) {
4743
+ return this.doDelete(`customrule/${file}`, mri(ac));
4736
4744
  }
4737
- doQueryCustomRuleDetails(file) {
4738
- return this.doGet(`customrule/${file}`);
4745
+ doQueryCustomRuleDetails(file, ac = mac()) {
4746
+ return this.doGet(`customrule/${file}`, mri(ac));
4739
4747
  }
4740
- doTestRule(feed, rule, content) {
4741
- return this.doPost(`feed/${feed}/rules/${rule}/test`, content);
4748
+ doTestRule(feed, rule, content, ac = mac()) {
4749
+ return this.doPost(`feed/${feed}/rules/${rule}/test`, content, mri(ac));
4742
4750
  }
4743
- doQueryCurrentUser() {
4744
- return this.doGet(`current-user`);
4751
+ doQueryCurrentUser(ac = mac()) {
4752
+ return this.doGet(`current-user`, mri(ac));
4745
4753
  }
4746
- doUpdateCurrentUser(content) {
4747
- return this.doPut(`current-user`, content);
4754
+ doUpdateCurrentUser(content, ac = mac()) {
4755
+ return this.doPut(`current-user`, content, mri(ac));
4748
4756
  }
4749
- doQueryStatus(ac = new AbortController()) {
4750
- return fetchWithoutToken(this.http, this.getUrl("status"), {
4751
- signal: ac.signal
4752
- }).then((res) => res.json());
4757
+ doQueryStatus(ac = mac()) {
4758
+ return fetchWithoutToken(this.http, this.getUrl("status"), mri(ac)).then((res) => res.json());
4753
4759
  }
4754
- doQueryStatistics(ac = new AbortController()) {
4755
- return fetchWithoutToken(this.http, this.getUrl("statistics"), {
4756
- signal: ac.signal
4757
- }).then((res) => res.json());
4760
+ doQueryStatistics(ac = mac()) {
4761
+ return fetchWithoutToken(this.http, this.getUrl("statistics"), mri(ac)).then((res) => res.json());
4758
4762
  }
4759
- doQueryRulesSchema(ac = new AbortController()) {
4760
- return fetchWithoutToken(this.http, this.getUrl("schema/rule"), {
4761
- signal: ac.signal
4762
- }).then((res) => res.json());
4763
+ doQueryRulesSchema(ac = mac()) {
4764
+ return fetchWithoutToken(this.http, this.getUrl("schema/rule"), mri(ac)).then((res) => res.json());
4763
4765
  }
4764
- doQueryFeedAnalysis(feed, ac = new AbortController()) {
4765
- return this.doGet(`feed/${feed}/analysis`, {
4766
- signal: ac.signal
4767
- });
4766
+ doQueryFeedAnalysis(feed, ac = mac()) {
4767
+ return this.doGet(`feed/${feed}/analysis`, mri(ac));
4768
4768
  }
4769
- doRecheckDomains(feed, domains, ac = new AbortController()) {
4769
+ doRecheckDomains(feed, domains, ac = mac()) {
4770
4770
  return this.doPut(
4771
4771
  `feed/${feed}/domains`,
4772
4772
  { domains },
4773
- {
4774
- signal: ac.signal
4775
- }
4773
+ mri(ac)
4776
4774
  );
4777
4775
  }
4778
- doQueryFeedStatistics(feed, from, to, ac = new AbortController()) {
4776
+ doQueryFeedStatistics(feed, from, to, ac = mac()) {
4779
4777
  const queryString = makeQueryString({ from, to });
4780
- return this.doGet(`feed/${feed}/statistics?${queryString}`, {
4781
- signal: ac.signal
4782
- });
4778
+ return this.doGet(`feed/${feed}/statistics?${queryString}`, mri(ac));
4783
4779
  }
4784
- doQueryAdminFeedStatistics(offset = "", count = "40", ac = new AbortController()) {
4780
+ doQueryAdminFeedStatistics(offset = "", count = "40", ac = mac()) {
4785
4781
  const queryString = makeQueryString({ offset, count });
4786
- return this.doGet(`statistics/feed?${queryString}`, {
4787
- signal: ac.signal
4788
- });
4782
+ return this.doGet(`statistics/feed?${queryString}`, mri(ac));
4789
4783
  }
4790
- doQueryAdminFeedStatisticsDetails(feed, from, to, ac = new AbortController()) {
4784
+ doQueryAdminFeedStatisticsDetails(feed, from, to, ac = mac()) {
4791
4785
  const queryString = makeQueryString({ from, to });
4792
- return this.doGet(`statistics/feed/${feed}?${queryString}`, {
4793
- signal: ac.signal
4794
- });
4786
+ return this.doGet(`statistics/feed/${feed}?${queryString}`, mri(ac));
4795
4787
  }
4796
- doQueryNpmRegistry(feed, ac = new AbortController()) {
4797
- return this.doGet(`registry/${feed}`, {
4798
- signal: ac.signal
4799
- });
4788
+ doQueryNpmRegistry(feed, ac = mac()) {
4789
+ return this.doGet(`registry/${feed}`, mri(ac));
4800
4790
  }
4801
- doQueryNpmPackage(feed, name, ac = new AbortController()) {
4802
- return this.doGet(`registry/${feed}/${name}`, {
4803
- signal: ac.signal
4804
- });
4791
+ doQueryNpmPackage(feed, name, ac = mac()) {
4792
+ return this.doGet(`registry/${feed}/${name}`, mri(ac));
4805
4793
  }
4806
- doUploadNpmPackage(feed, name, body, ac = new AbortController()) {
4807
- return this.doPut(`registry/${feed}/${name}`, body, {
4808
- signal: ac.signal
4809
- });
4794
+ doUploadNpmPackage(feed, name, body, ac = mac()) {
4795
+ return this.doPut(`registry/${feed}/${name}`, body, mri(ac));
4810
4796
  }
4811
- doDownloadFile(fileUrl, ac = new AbortController()) {
4812
- return fetchWithToken(this.http, fileUrl, {
4813
- signal: ac.signal
4814
- }).then((res) => res.blob());
4797
+ doDownloadFile(fileUrl, ac = mac()) {
4798
+ return fetchWithToken(this.http, fileUrl, mri(ac)).then((res) => res.blob());
4815
4799
  }
4816
4800
  };
4817
4801
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smapiot/piral-cloud-node",
3
- "version": "0.13.3",
3
+ "version": "0.14.1-pre.20230210.1",
4
4
  "description": "Piral Cloud: Node-usable API Client for the Piral Feed Service.",
5
5
  "author": {
6
6
  "name": "smapiot",
@@ -40,7 +40,7 @@
40
40
  "node"
41
41
  ],
42
42
  "devDependencies": {
43
- "@piral/feed-client": "^0.13.3",
43
+ "@piral/feed-client": "^0.14.1",
44
44
  "dets": "^0.12.0",
45
45
  "esbuild": "^0.14.51",
46
46
  "node-fetch": "^3.2.10"