@ogcio/building-blocks-sdk 0.0.6 → 0.0.7

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 (47) hide show
  1. package/README.md +2 -24
  2. package/dist/client/auth/index.d.ts +2 -1
  3. package/dist/client/auth/index.d.ts.map +1 -1
  4. package/dist/client/auth/index.js +2 -1
  5. package/dist/client/auth/index.js.map +1 -1
  6. package/dist/client/base-client.d.ts +2 -3
  7. package/dist/client/base-client.d.ts.map +1 -1
  8. package/dist/client/base-client.js +0 -3
  9. package/dist/client/base-client.js.map +1 -1
  10. package/dist/client/clients/messaging/index.d.ts +1 -1
  11. package/dist/client/clients/messaging/index.d.ts.map +1 -1
  12. package/dist/client/clients/payments/index.d.ts +59 -41
  13. package/dist/client/clients/payments/index.d.ts.map +1 -1
  14. package/dist/client/clients/payments/schema.d.ts +519 -47
  15. package/dist/client/clients/payments/schema.d.ts.map +1 -1
  16. package/dist/client/clients/profile/index.d.ts +1 -1
  17. package/dist/client/clients/profile/index.d.ts.map +1 -1
  18. package/dist/client/clients/scheduler/index.d.ts +1 -1
  19. package/dist/client/clients/scheduler/index.d.ts.map +1 -1
  20. package/dist/client/clients/upload/index.d.ts +70 -136
  21. package/dist/client/clients/upload/index.d.ts.map +1 -1
  22. package/dist/client/clients/upload/index.js +15 -27
  23. package/dist/client/clients/upload/index.js.map +1 -1
  24. package/dist/clients-configurations/clients-configuration.json +0 -8
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +2 -7
  28. package/dist/index.js.map +1 -1
  29. package/dist/types/index.d.ts +9 -12
  30. package/dist/types/index.d.ts.map +1 -1
  31. package/dist/types/index.js +0 -1
  32. package/dist/types/index.js.map +1 -1
  33. package/package.json +7 -13
  34. package/src/client/auth/index.ts +3 -3
  35. package/src/client/base-client.ts +2 -6
  36. package/src/client/clients/messaging/index.ts +1 -1
  37. package/src/client/clients/payments/index.ts +1 -1
  38. package/src/client/clients/payments/open-api-definition.json +983 -179
  39. package/src/client/clients/payments/schema.ts +519 -47
  40. package/src/client/clients/profile/index.ts +1 -1
  41. package/src/client/clients/scheduler/index.ts +1 -1
  42. package/src/client/clients/upload/index.ts +24 -46
  43. package/src/clients-configurations/clients-configuration.json +0 -8
  44. package/src/index.ts +3 -9
  45. package/src/types/index.ts +8 -14
  46. package/.github/dependabot.yaml +0 -12
  47. package/.husky/pre-commit +0 -2
@@ -4,22 +4,15 @@ import BaseClient from "../../base-client.js";
4
4
  import type { paths } from "./schema.js";
5
5
 
6
6
  class Upload extends BaseClient<paths> {
7
- protected declare client: ReturnType<typeof createClient<paths>>;
7
+ declare client: ReturnType<typeof createClient<paths>>;
8
8
  protected serviceName = UPLOAD;
9
9
 
10
- getFilesMetadata({
11
- organizationId,
12
- userId,
13
- }: {
14
- organizationId?: string;
15
- userId?: string;
16
- }) {
10
+ getFilesMetadata(organizationId: string) {
17
11
  return this.client
18
12
  .GET("/api/v1/metadata/", {
19
13
  params: {
20
14
  query: {
21
15
  organizationId,
22
- userId,
23
16
  },
24
17
  },
25
18
  })
@@ -29,6 +22,28 @@ class Upload extends BaseClient<paths> {
29
22
  );
30
23
  }
31
24
 
25
+ shareFile(fileId: string, userId: string) {
26
+ return this.client
27
+ .POST("/api/v1/permissions/", {
28
+ body: { fileId, userId },
29
+ })
30
+ .then(
31
+ (response) => this.formatResponse(response),
32
+ (reason) => this.formatError(reason),
33
+ );
34
+ }
35
+
36
+ removeFileSharing(fileId: string, userId: string) {
37
+ return this.client
38
+ .DELETE("/api/v1/permissions/", {
39
+ body: { fileId, userId },
40
+ })
41
+ .then(
42
+ (response) => this.formatResponse(response),
43
+ (reason) => this.formatError(reason),
44
+ );
45
+ }
46
+
32
47
  async getFile(id: string) {
33
48
  try {
34
49
  const {
@@ -89,43 +104,6 @@ class Upload extends BaseClient<paths> {
89
104
  );
90
105
  }
91
106
 
92
- getFileSharings(id: string) {
93
- return this.client
94
- .GET("/api/v1/permissions/", {
95
- params: {
96
- query: {
97
- fileId: id,
98
- },
99
- },
100
- })
101
- .then(
102
- (response) => this.formatResponse(response),
103
- (reason) => this.formatError(reason),
104
- );
105
- }
106
-
107
- shareFile(fileId: string, userId: string) {
108
- return this.client
109
- .POST("/api/v1/permissions/", {
110
- body: { fileId, userId },
111
- })
112
- .then(
113
- (response) => this.formatResponse(response),
114
- (reason) => this.formatError(reason),
115
- );
116
- }
117
-
118
- removeFileSharing(fileId: string, userId: string) {
119
- return this.client
120
- .DELETE("/api/v1/permissions/", {
121
- body: { fileId, userId },
122
- })
123
- .then(
124
- (response) => this.formatResponse(response),
125
- (reason) => this.formatError(reason),
126
- );
127
- }
128
-
129
107
  async uploadFile(file: File, expirationDate?: string) {
130
108
  const { error } = await this.client.POST("/api/v1/files/", {
131
109
  body: {
@@ -1,13 +1,5 @@
1
1
  {
2
2
  "buildingBlocks": [
3
- {
4
- "name": "analytics",
5
- "openApiDefinitionUrl": "",
6
- "openApiDefinitionFormat": "yaml",
7
- "updateDefinitions": false,
8
- "citizenPermissions": [],
9
- "publicServantPermissions": []
10
- },
11
3
  {
12
4
  "name": "messaging",
13
5
  "openApiDefinitionUrl": "https://raw.githubusercontent.com/ogcio/life-events/refs/heads/dev/apps/messaging-api/openapi-definition.yml",
package/src/index.ts CHANGED
@@ -1,17 +1,15 @@
1
- import { Analytics } from "@ogcio/analytics-sdk";
2
-
3
1
  import Messaging from "./client/clients/messaging/index.js";
4
2
  import Payments from "./client/clients/payments/index.js";
5
3
  import Profile from "./client/clients/profile/index.js";
6
4
  import Scheduler from "./client/clients/scheduler/index.js";
7
5
  import Upload from "./client/clients/upload/index.js";
6
+
8
7
  export type { BuildingBlocksSDK } from "./types/index.js";
9
- export { getM2MTokenFn } from "./client/auth/index.js";
8
+ export { default as getM2MTokenFn } from "./client/auth/index.js";
10
9
 
11
10
  import type {
12
11
  BuildingBlockSDKParams,
13
12
  BuildingBlocksSDK,
14
- TokenFunction,
15
13
  } from "./types/index.js";
16
14
 
17
15
  const getBuildingBlockSDK = (
@@ -19,10 +17,6 @@ const getBuildingBlockSDK = (
19
17
  ): BuildingBlocksSDK => {
20
18
  const { services, getTokenFn } = params;
21
19
  return {
22
- analytics: new Analytics({
23
- ...services.analytics,
24
- getTokenFn,
25
- }),
26
20
  messaging: new Messaging({
27
21
  ...services.messaging,
28
22
  getTokenFn,
@@ -32,7 +26,7 @@ const getBuildingBlockSDK = (
32
26
  getTokenFn,
33
27
  }),
34
28
  profile: new Profile({
35
- ...services.profile,
29
+ ...services.payments,
36
30
  getTokenFn,
37
31
  }),
38
32
  scheduler: new Scheduler({
@@ -1,11 +1,9 @@
1
- import type { Analytics } from "@ogcio/analytics-sdk";
2
1
  import type Messaging from "../client/clients/messaging/index.js";
3
2
  import type Payments from "../client/clients/payments/index.js";
4
3
  import type Profile from "../client/clients/profile/index.js";
5
4
  import type Scheduler from "../client/clients/scheduler/index.js";
6
5
  import type Upload from "../client/clients/upload/index.js";
7
6
 
8
- export const ANALYTICS = "analytics" as const;
9
7
  export const MESSAGING = "messaging" as const;
10
8
  export const PAYMENTS = "payments" as const;
11
9
  export const PROFILE = "profile" as const;
@@ -13,7 +11,6 @@ export const SCHEDULER = "scheduler" as const;
13
11
  export const UPLOAD = "upload" as const;
14
12
 
15
13
  export type SERVICE_NAME =
16
- | typeof ANALYTICS
17
14
  | typeof MESSAGING
18
15
  | typeof PAYMENTS
19
16
  | typeof PROFILE
@@ -39,28 +36,25 @@ export type SDKClientParams = {
39
36
  baseUrl?: string;
40
37
  };
41
38
 
42
- export type BaseApiClientParams = SDKClientParams & {
39
+ export type ApiClientParams = SDKClientParams & {
43
40
  getTokenFn?: TokenFunction;
44
41
  };
45
42
 
46
43
  type ServiceClients = {
47
- analytics: typeof Analytics;
48
- messaging: typeof Messaging;
49
- payments: typeof Payments;
50
- profile: typeof Profile;
51
- scheduler: typeof Scheduler;
52
- upload: typeof Upload;
44
+ messaging: Messaging;
45
+ payments: Payments;
46
+ profile: Profile;
47
+ scheduler: Scheduler;
48
+ upload: Upload;
53
49
  };
54
50
 
55
51
  export type BuildingBlocksSDK = {
56
- [key in keyof ServiceClients]: InstanceType<ServiceClients[key]>;
52
+ [key in keyof ServiceClients]: ServiceClients[key];
57
53
  };
58
54
 
59
55
  export type BuildingBlockSDKParams = {
60
56
  services: {
61
- [key in keyof ServiceClients]?: ConstructorParameters<
62
- ServiceClients[key]
63
- >[0];
57
+ [key in keyof ServiceClients]?: SDKClientParams;
64
58
  };
65
59
  getTokenFn?: TokenFunction;
66
60
  };
@@ -1,12 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: "npm"
4
- directory: "/"
5
- schedule:
6
- interval: "weekly"
7
- time: "23:00" # UTC time
8
- open-pull-requests-limit: 1
9
- groups:
10
- all-dependencies:
11
- patterns:
12
- - "*"
package/.husky/pre-commit DELETED
@@ -1,2 +0,0 @@
1
- npm run check:formatting
2
- npm run check:linting