@ogcio/building-blocks-sdk 0.1.1 → 0.1.3
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/.azure/pipeline.yaml +122 -0
- package/.azure/templates/pnpm-install.yaml +21 -0
- package/.gitleaksignore +3 -0
- package/.husky/pre-commit +6 -2
- package/.husky/pre-push +1 -1
- package/README.md +12 -7
- package/dist/__tests__/index.test.js +9 -1
- package/dist/__tests__/index.test.js.map +1 -1
- package/dist/client/clients/journey/index.d.ts +2105 -0
- package/dist/client/clients/journey/index.d.ts.map +1 -0
- package/dist/client/clients/journey/index.js +210 -0
- package/dist/client/clients/journey/index.js.map +1 -0
- package/dist/client/clients/journey/schema.d.ts +2418 -0
- package/dist/client/clients/journey/schema.d.ts.map +1 -0
- package/dist/client/clients/journey/schema.js +2 -0
- package/dist/client/clients/journey/schema.js.map +1 -0
- package/dist/client/clients/payments/index.d.ts +5 -0
- package/dist/client/clients/payments/index.d.ts.map +1 -1
- package/dist/client/clients/payments/schema.d.ts +4 -0
- package/dist/client/clients/payments/schema.d.ts.map +1 -1
- package/dist/client/clients/upload/index.d.ts +1 -1
- package/dist/clients-configurations/clients-configuration.json +16 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +9 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -1
- package/dist/types/index.js.map +1 -1
- package/kics-config.json +8 -0
- package/package.json +14 -11
- package/src/__tests__/index.test.ts +10 -1
- package/src/client/clients/journey/index.ts +340 -0
- package/src/client/clients/journey/open-api-definition.json +5756 -0
- package/src/client/clients/journey/schema.ts +2417 -0
- package/src/client/clients/payments/open-api-definition.json +12 -0
- package/src/client/clients/payments/schema.ts +4 -0
- package/src/clients-configurations/clients-configuration.json +16 -0
- package/src/index.ts +2 -0
- package/src/types/index.ts +10 -1
- package/vitest.config.mts +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EACV,sBAAsB,EACtB,iBAAiB,EAGlB,MAAM,kBAAkB,CAAC;AAG1B,KAAK,eAAe,CAAC,CAAC,SAAS,sBAAsB,IAAI;KACtD,CAAC,IAAI,MAAM,iBAAiB,IAAI,CAAC,SAAS,MAAM,CAAC,CAAC,UAAU,CAAC,GAC1D,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,SAAS,SAAS,GAChC,KAAK,GACL,CAAC,GACH,KAAK,GAAG,iBAAiB,CAAC,CAAC,CAAC;CACjC,CAAC;AAaF,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,sBAAsB,UAC1D,CAAC,KACR,eAAe,CAAC,CAAC,CAsBnB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Payments } from "./client/clients/payments/index.js";
|
|
|
5
5
|
import { Profile } from "./client/clients/profile/index.js";
|
|
6
6
|
import { Scheduler } from "./client/clients/scheduler/index.js";
|
|
7
7
|
import { Upload } from "./client/clients/upload/index.js";
|
|
8
|
+
import { Journey } from "./client/clients/journey/index.js";
|
|
8
9
|
export { getM2MTokenFn } from "./client/auth/index.js";
|
|
9
10
|
const createService = (ServiceClass, config, getTokenFn) => {
|
|
10
11
|
if (!config)
|
|
@@ -21,6 +22,7 @@ export const getBuildingBlockSDK = (params) => {
|
|
|
21
22
|
scheduler: createService(Scheduler, services.scheduler, getTokenFn),
|
|
22
23
|
upload: createService(Upload, services.upload, getTokenFn),
|
|
23
24
|
featureFlags: createService(FeatureFlags, services.featureFlags, getTokenFn),
|
|
25
|
+
journey: createService(Journey, services.journey, getTokenFn),
|
|
24
26
|
};
|
|
25
27
|
// Remove undefined services
|
|
26
28
|
return Object.fromEntries(Object.entries(sdk).filter(([_, value]) => value !== undefined));
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,wCAAwC,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAkBvD,MAAM,aAAa,GAAG,CACpB,YAEyB,EACzB,MAA+B,EAC/B,UAAyB,EACS,EAAE;IACpC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,OAAO,IAAI,YAAY,CAAC,EAAE,GAAG,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,MAAS,EACW,EAAE;IACtB,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAExC,MAAM,GAAG,GAAG;QACV,SAAS,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;QACnE,SAAS,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;QACnE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;QA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AE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;QACnE,SAAS,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;QACnE,QAAQ,EAAE,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC;QAChE,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;QAC7D,SAAS,EAAE,aAAa,CAAC,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;QACnE,MAAM,EAAE,aAAa,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;QAC1D,YAAY,EAAE,aAAa,CACzB,YAAY,EACZ,QAAQ,CAAC,YAAY,EACrB,UAAU,CACX;QACD,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;KAC9D,CAAC;IAEF,4BAA4B;IAC5B,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAC1C,CAAC;AAC1B,CAAC,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { Payments } from "../client/clients/payments/index.js";
|
|
|
5
5
|
import type { Profile } from "../client/clients/profile/index.js";
|
|
6
6
|
import type { Scheduler } from "../client/clients/scheduler/index.js";
|
|
7
7
|
import type { Upload } from "../client/clients/upload/index.js";
|
|
8
|
+
import type { Journey } from "../client/clients/journey/index.js";
|
|
8
9
|
declare const ANALYTICS: "analytics";
|
|
9
10
|
declare const MESSAGING: "messaging";
|
|
10
11
|
declare const PAYMENTS: "payments";
|
|
@@ -12,7 +13,8 @@ declare const PROFILE: "profile";
|
|
|
12
13
|
declare const SCHEDULER: "scheduler";
|
|
13
14
|
declare const UPLOAD: "upload";
|
|
14
15
|
declare const FEATURE_FLAGS: "featureFlags";
|
|
15
|
-
|
|
16
|
+
declare const JOURNEY: "journey";
|
|
17
|
+
type SERVICE_NAME = typeof ANALYTICS | typeof MESSAGING | typeof PAYMENTS | typeof PROFILE | typeof SCHEDULER | typeof UPLOAD | typeof FEATURE_FLAGS | typeof JOURNEY;
|
|
16
18
|
interface AnalyticsConfig extends AnalyticsOptions {
|
|
17
19
|
}
|
|
18
20
|
interface ServiceBaseConfig {
|
|
@@ -30,6 +32,8 @@ interface UploadConfig extends ServiceBaseConfig {
|
|
|
30
32
|
}
|
|
31
33
|
interface FeatureFlagsConfig extends ServiceBaseConfig {
|
|
32
34
|
}
|
|
35
|
+
interface JourneyConfig extends ServiceBaseConfig {
|
|
36
|
+
}
|
|
33
37
|
interface Services {
|
|
34
38
|
analytics?: AnalyticsConfig;
|
|
35
39
|
messaging?: MessagingConfig;
|
|
@@ -38,6 +42,7 @@ interface Services {
|
|
|
38
42
|
scheduler?: SchedulerConfig;
|
|
39
43
|
upload?: UploadConfig;
|
|
40
44
|
featureFlags?: FeatureFlagsConfig;
|
|
45
|
+
journey?: JourneyConfig;
|
|
41
46
|
}
|
|
42
47
|
type TokenFunction = (serviceName: SERVICE_NAME) => Promise<string>;
|
|
43
48
|
interface TokenResponseBody {
|
|
@@ -79,7 +84,8 @@ interface BuildingBlocksSDK {
|
|
|
79
84
|
scheduler: Scheduler;
|
|
80
85
|
upload: Upload;
|
|
81
86
|
featureFlags: FeatureFlags;
|
|
87
|
+
journey: Journey;
|
|
82
88
|
}
|
|
83
|
-
export { ANALYTICS, MESSAGING, PAYMENTS, PROFILE, SCHEDULER, UPLOAD, FEATURE_FLAGS, };
|
|
84
|
-
export type { BuildingBlockSDKParams, BuildingBlocksSDK, Analytics, AnalyticsConfig, Messaging, MessagingConfig, Payments, PaymentsConfig, Profile, ProfileConfig, Scheduler, SchedulerConfig, Upload, UploadConfig, FeatureFlags, FeatureFlagsConfig, Services, TokenFunction, SERVICE_NAME, TokenResponseBody, GetTokenBaseParams, GetAccessTokenParams, GetOrganizationTokenParams, M2MParams, M2MTokenFnConfig, };
|
|
89
|
+
export { ANALYTICS, MESSAGING, PAYMENTS, PROFILE, SCHEDULER, UPLOAD, FEATURE_FLAGS, JOURNEY, };
|
|
90
|
+
export type { BuildingBlockSDKParams, BuildingBlocksSDK, Analytics, AnalyticsConfig, Messaging, MessagingConfig, Payments, PaymentsConfig, Profile, ProfileConfig, Scheduler, SchedulerConfig, Upload, UploadConfig, FeatureFlags, FeatureFlagsConfig, Journey, JourneyConfig, Services, TokenFunction, SERVICE_NAME, TokenResponseBody, GetTokenBaseParams, GetAccessTokenParams, GetOrganizationTokenParams, M2MParams, M2MTokenFnConfig, };
|
|
85
91
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAC5E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,KA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B;AAED,UAAU,iBAAiB;IACzB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,OAAO,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,aAAa,EACb,OAAO,GACR,CAAC;AAEF,YAAY,EACV,sBAAsB,EACtB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,SAAS,EACT,eAAe,EACf,QAAQ,EACR,cAAc,EACd,OAAO,EACP,aAAa,EACb,SAAS,EACT,eAAe,EACf,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,QAAQ,EACR,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,0BAA0B,EAC1B,SAAS,EACT,gBAAgB,GACjB,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -5,5 +5,6 @@ const PROFILE = "profile";
|
|
|
5
5
|
const SCHEDULER = "scheduler";
|
|
6
6
|
const UPLOAD = "upload";
|
|
7
7
|
const FEATURE_FLAGS = "featureFlags";
|
|
8
|
-
|
|
8
|
+
const JOURNEY = "journey";
|
|
9
|
+
export { ANALYTICS, MESSAGING, PAYMENTS, PROFILE, SCHEDULER, UPLOAD, FEATURE_FLAGS, JOURNEY, };
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAUA,MAAM,SAAS,GAAG,WAAoB,CAAC;AACvC,MAAM,SAAS,GAAG,WAAoB,CAAC;AACvC,MAAM,QAAQ,GAAG,UAAmB,CAAC;AACrC,MAAM,OAAO,GAAG,SAAkB,CAAC;AACnC,MAAM,SAAS,GAAG,WAAoB,CAAC;AACvC,MAAM,MAAM,GAAG,QAAiB,CAAC;AACjC,MAAM,aAAa,GAAG,cAAuB,CAAC;AAC9C,MAAM,OAAO,GAAG,SAAkB,CAAC;AAwFnC,OAAO,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,aAAa,EACb,OAAO,GACR,CAAC"}
|
package/kics-config.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogcio/building-blocks-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -16,30 +16,32 @@
|
|
|
16
16
|
"fix:formatting": "biome format --write",
|
|
17
17
|
"check:linting": "biome lint",
|
|
18
18
|
"fix:linting": "biome lint --write",
|
|
19
|
-
"prepublishOnly": "
|
|
19
|
+
"prepublishOnly": "pnpm i && pnpm build && pnpm test",
|
|
20
|
+
"preinstall": "npx only-allow pnpm",
|
|
20
21
|
"prepare": "husky || true"
|
|
21
22
|
},
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"@ogcio/analytics-sdk": "0.1.0-beta.5",
|
|
24
|
-
"@sinclair/typebox": "^0.34.
|
|
25
|
+
"@sinclair/typebox": "^0.34.9",
|
|
25
26
|
"commander": "^12.1.0",
|
|
26
27
|
"http-errors": "^2.0.0",
|
|
27
28
|
"openapi-fetch": "^0.13.0",
|
|
28
|
-
"openapi-typescript": "^7.4.
|
|
29
|
+
"openapi-typescript": "^7.4.3",
|
|
29
30
|
"openapi-typescript-helpers": "^0.0.15",
|
|
30
31
|
"safe-stable-stringify": "^2.5.0",
|
|
31
|
-
"yaml": "^2.6.
|
|
32
|
+
"yaml": "^2.6.1"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@biomejs/biome": "1.9.4",
|
|
35
|
-
"@commitlint/config-conventional": "^19.
|
|
36
|
+
"@commitlint/config-conventional": "^19.6.0",
|
|
36
37
|
"@types/http-errors": "^2.0.4",
|
|
37
|
-
"@
|
|
38
|
-
"
|
|
39
|
-
"
|
|
38
|
+
"@types/node": "^22.10.1",
|
|
39
|
+
"@vitest/coverage-istanbul": "^2.1.6",
|
|
40
|
+
"commitlint": "^19.6.0",
|
|
41
|
+
"husky": "^9.1.7",
|
|
40
42
|
"tsx": "^4.19.2",
|
|
41
|
-
"typescript": "^5.
|
|
42
|
-
"vitest": "^2.1.
|
|
43
|
+
"typescript": "^5.7.2",
|
|
44
|
+
"vitest": "^2.1.6"
|
|
43
45
|
},
|
|
44
46
|
"peerDependencies": {
|
|
45
47
|
"@logto/node": "2.5.5",
|
|
@@ -53,6 +55,7 @@
|
|
|
53
55
|
"optional": true
|
|
54
56
|
}
|
|
55
57
|
},
|
|
58
|
+
"packageManager": "pnpm@9.0.0",
|
|
56
59
|
"keywords": [],
|
|
57
60
|
"author": "",
|
|
58
61
|
"license": "ISC",
|
|
@@ -6,6 +6,7 @@ import { Payments } from "../client/clients/payments/index.js";
|
|
|
6
6
|
import { Profile } from "../client/clients/profile/index.js";
|
|
7
7
|
import { Scheduler } from "../client/clients/scheduler/index.js";
|
|
8
8
|
import { Upload } from "../client/clients/upload/index.js";
|
|
9
|
+
import { Journey } from "../client/clients/journey/index.js";
|
|
9
10
|
import { getBuildingBlockSDK } from "../index.js";
|
|
10
11
|
import type { BuildingBlockSDKParams } from "../types/index.js";
|
|
11
12
|
|
|
@@ -37,6 +38,10 @@ vi.mock("../client/clients/upload/index.js", () => ({
|
|
|
37
38
|
Upload: vi.fn(),
|
|
38
39
|
}));
|
|
39
40
|
|
|
41
|
+
vi.mock("../client/clients/journey/index.js", () => ({
|
|
42
|
+
Journey: vi.fn(),
|
|
43
|
+
}));
|
|
44
|
+
|
|
40
45
|
describe("getBuildingBlockSDK", () => {
|
|
41
46
|
const getTokenFn = vi.fn().mockResolvedValue("test-token");
|
|
42
47
|
const baseUrl = "http://test.com";
|
|
@@ -59,6 +64,7 @@ describe("getBuildingBlockSDK", () => {
|
|
|
59
64
|
profile: { baseUrl },
|
|
60
65
|
scheduler: { baseUrl },
|
|
61
66
|
upload: { baseUrl },
|
|
67
|
+
journey: { baseUrl },
|
|
62
68
|
},
|
|
63
69
|
getTokenFn,
|
|
64
70
|
};
|
|
@@ -80,8 +86,9 @@ describe("getBuildingBlockSDK", () => {
|
|
|
80
86
|
expect(Profile).toHaveBeenCalledWith({ baseUrl, getTokenFn });
|
|
81
87
|
expect(Scheduler).toHaveBeenCalledWith({ baseUrl, getTokenFn });
|
|
82
88
|
expect(Upload).toHaveBeenCalledWith({ baseUrl, getTokenFn });
|
|
89
|
+
expect(Journey).toHaveBeenCalledWith({ baseUrl, getTokenFn });
|
|
83
90
|
|
|
84
|
-
expect(Object.keys(sdk)).toHaveLength(
|
|
91
|
+
expect(Object.keys(sdk)).toHaveLength(8);
|
|
85
92
|
});
|
|
86
93
|
|
|
87
94
|
it("should create SDK with only specified services", () => {
|
|
@@ -111,6 +118,7 @@ describe("getBuildingBlockSDK", () => {
|
|
|
111
118
|
expect(Profile).not.toHaveBeenCalled();
|
|
112
119
|
expect(Scheduler).not.toHaveBeenCalled();
|
|
113
120
|
expect(Upload).not.toHaveBeenCalled();
|
|
121
|
+
expect(Journey).not.toHaveBeenCalled();
|
|
114
122
|
|
|
115
123
|
expect(Object.keys(sdk)).toHaveLength(2);
|
|
116
124
|
expect(sdk).toHaveProperty("analytics");
|
|
@@ -155,6 +163,7 @@ describe("getBuildingBlockSDK", () => {
|
|
|
155
163
|
expect(Profile).not.toHaveBeenCalled();
|
|
156
164
|
expect(Scheduler).not.toHaveBeenCalled();
|
|
157
165
|
expect(Upload).not.toHaveBeenCalled();
|
|
166
|
+
expect(Journey).not.toHaveBeenCalled();
|
|
158
167
|
});
|
|
159
168
|
});
|
|
160
169
|
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import type createClient from "openapi-fetch";
|
|
2
|
+
import { JOURNEY } from "../../../types/index.js";
|
|
3
|
+
import { BaseClient } from "../../base-client.js";
|
|
4
|
+
import { formatError, formatResponse } from "../../utils/client-utils.js";
|
|
5
|
+
import type { paths } from "./schema.js";
|
|
6
|
+
|
|
7
|
+
export class Journey extends BaseClient<paths> {
|
|
8
|
+
protected declare client: ReturnType<typeof createClient<paths>>;
|
|
9
|
+
protected serviceName = JOURNEY;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* JOURNEY STEP CONNECTIONS
|
|
13
|
+
*/
|
|
14
|
+
async getConnectionById(
|
|
15
|
+
connectionId: paths["/api/v1/journey_step_connections/{connectionId}"]["get"]["parameters"]["path"]["connectionId"],
|
|
16
|
+
) {
|
|
17
|
+
return this.client
|
|
18
|
+
.GET("/api/v1/journey_step_connections/{connectionId}", {
|
|
19
|
+
params: {
|
|
20
|
+
path: {
|
|
21
|
+
connectionId,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
})
|
|
25
|
+
.then(
|
|
26
|
+
(response) => formatResponse(response),
|
|
27
|
+
(reason) => formatError(reason),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async createConnection(
|
|
32
|
+
data: paths["/api/v1/journey_step_connections/"]["post"]["requestBody"]["content"]["application/json"],
|
|
33
|
+
) {
|
|
34
|
+
return this.client
|
|
35
|
+
.POST("/api/v1/journey_step_connections/", {
|
|
36
|
+
body: data,
|
|
37
|
+
})
|
|
38
|
+
.then(
|
|
39
|
+
(response) => formatResponse(response),
|
|
40
|
+
(reason) => formatError(reason),
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async deleteConnection(
|
|
45
|
+
connectionId: paths["/api/v1/journey_step_connections/{connectionId}"]["delete"]["parameters"]["path"]["connectionId"],
|
|
46
|
+
) {
|
|
47
|
+
return this.client
|
|
48
|
+
.DELETE("/api/v1/journey_step_connections/{connectionId}", {
|
|
49
|
+
params: {
|
|
50
|
+
path: {
|
|
51
|
+
connectionId,
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
})
|
|
55
|
+
.then(
|
|
56
|
+
(response) => formatResponse(response),
|
|
57
|
+
(reason) => formatError(reason),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* JOURNEY STEPs
|
|
63
|
+
*/
|
|
64
|
+
async getStepById(
|
|
65
|
+
stepId: paths["/api/v1/journey_steps/{stepId}"]["get"]["parameters"]["path"]["stepId"],
|
|
66
|
+
) {
|
|
67
|
+
return this.client
|
|
68
|
+
.GET("/api/v1/journey_steps/{stepId}", {
|
|
69
|
+
params: {
|
|
70
|
+
path: {
|
|
71
|
+
stepId,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
.then(
|
|
76
|
+
(response) => formatResponse(response),
|
|
77
|
+
(reason) => formatError(reason),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async createStep(
|
|
82
|
+
data: paths["/api/v1/journey_steps/"]["post"]["requestBody"]["content"]["application/json"],
|
|
83
|
+
) {
|
|
84
|
+
return this.client
|
|
85
|
+
.POST("/api/v1/journey_steps/", {
|
|
86
|
+
body: data,
|
|
87
|
+
})
|
|
88
|
+
.then(
|
|
89
|
+
(response) => formatResponse(response),
|
|
90
|
+
(reason) => formatError(reason),
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async deleteStep(
|
|
95
|
+
stepId: paths["/api/v1/journey_steps/{stepId}"]["delete"]["parameters"]["path"]["stepId"],
|
|
96
|
+
) {
|
|
97
|
+
return this.client
|
|
98
|
+
.DELETE("/api/v1/journey_steps/{stepId}", {
|
|
99
|
+
params: {
|
|
100
|
+
path: {
|
|
101
|
+
stepId,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
.then(
|
|
106
|
+
(response) => formatResponse(response),
|
|
107
|
+
(reason) => formatError(reason),
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async updateStep(
|
|
112
|
+
stepId: paths["/api/v1/journey_steps/{stepId}"]["put"]["parameters"]["path"]["stepId"],
|
|
113
|
+
data: paths["/api/v1/journey_steps/{stepId}"]["put"]["requestBody"]["content"]["application/json"],
|
|
114
|
+
) {
|
|
115
|
+
return this.client
|
|
116
|
+
.PUT("/api/v1/journey_steps/{stepId}", {
|
|
117
|
+
params: {
|
|
118
|
+
path: {
|
|
119
|
+
stepId,
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
body: data,
|
|
123
|
+
})
|
|
124
|
+
.then(
|
|
125
|
+
(response) => formatResponse(response),
|
|
126
|
+
(reason) => formatError(reason),
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* JOURNEYS
|
|
132
|
+
*/
|
|
133
|
+
async getJourneyPublicInfo(
|
|
134
|
+
journeyId: paths["/api/v1/journeys/{journeyId}/public-info"]["get"]["parameters"]["path"]["journeyId"],
|
|
135
|
+
) {
|
|
136
|
+
return this.client
|
|
137
|
+
.GET("/api/v1/journeys/{journeyId}/public-info", {
|
|
138
|
+
params: {
|
|
139
|
+
path: {
|
|
140
|
+
journeyId,
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
})
|
|
144
|
+
.then(
|
|
145
|
+
(response) => formatResponse(response),
|
|
146
|
+
(reason) => formatError(reason),
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async getJourneyById(
|
|
151
|
+
journeyId: paths["/api/v1/journeys/{journeyId}"]["get"]["parameters"]["path"]["journeyId"],
|
|
152
|
+
) {
|
|
153
|
+
return this.client
|
|
154
|
+
.GET("/api/v1/journeys/{journeyId}", {
|
|
155
|
+
params: {
|
|
156
|
+
path: {
|
|
157
|
+
journeyId,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
})
|
|
161
|
+
.then(
|
|
162
|
+
(response) => formatResponse(response),
|
|
163
|
+
(reason) => formatError(reason),
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async getJourneys(
|
|
168
|
+
query: paths["/api/v1/journeys/"]["get"]["parameters"]["query"],
|
|
169
|
+
) {
|
|
170
|
+
return this.client
|
|
171
|
+
.GET("/api/v1/journeys/", {
|
|
172
|
+
params: {
|
|
173
|
+
query,
|
|
174
|
+
},
|
|
175
|
+
})
|
|
176
|
+
.then(
|
|
177
|
+
(response) => formatResponse(response),
|
|
178
|
+
(reason) => formatError(reason),
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async createJourney(
|
|
183
|
+
data: paths["/api/v1/journeys/"]["post"]["requestBody"]["content"]["application/json"],
|
|
184
|
+
) {
|
|
185
|
+
return this.client
|
|
186
|
+
.POST("/api/v1/journeys/", {
|
|
187
|
+
body: data,
|
|
188
|
+
})
|
|
189
|
+
.then(
|
|
190
|
+
(response) => formatResponse(response),
|
|
191
|
+
(reason) => formatError(reason),
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async updateJourney(
|
|
196
|
+
journeyId: paths["/api/v1/journeys/{journeyId}"]["put"]["parameters"]["path"]["journeyId"],
|
|
197
|
+
data: paths["/api/v1/journeys/{journeyId}"]["put"]["requestBody"]["content"]["application/json"],
|
|
198
|
+
) {
|
|
199
|
+
return this.client
|
|
200
|
+
.PUT("/api/v1/journeys/{journeyId}", {
|
|
201
|
+
params: {
|
|
202
|
+
path: { journeyId },
|
|
203
|
+
},
|
|
204
|
+
body: data,
|
|
205
|
+
})
|
|
206
|
+
.then(
|
|
207
|
+
(response) => formatResponse(response),
|
|
208
|
+
(reason) => formatError(reason),
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* RUNS
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
async getUserRunById(
|
|
217
|
+
runId: paths["/api/v1/executor/runs/self/{runId}"]["get"]["parameters"]["path"]["runId"],
|
|
218
|
+
) {
|
|
219
|
+
return this.client
|
|
220
|
+
.GET("/api/v1/executor/runs/self/{runId}", {
|
|
221
|
+
params: {
|
|
222
|
+
path: {
|
|
223
|
+
runId,
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
})
|
|
227
|
+
.then(
|
|
228
|
+
(response) => formatResponse(response),
|
|
229
|
+
(reason) => formatError(reason),
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
async getUserRuns() {
|
|
234
|
+
return this.client.GET("/api/v1/executor/runs/self", {}).then(
|
|
235
|
+
(response) => formatResponse(response),
|
|
236
|
+
(reason) => formatError(reason),
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
async getRunsByJourneyId(
|
|
241
|
+
journeyId: paths["/api/v1/executor/runs/journeys/{journeyId}"]["get"]["parameters"]["path"]["journeyId"],
|
|
242
|
+
) {
|
|
243
|
+
return this.client
|
|
244
|
+
.GET("/api/v1/executor/runs/journeys/{journeyId}", {
|
|
245
|
+
params: {
|
|
246
|
+
path: {
|
|
247
|
+
journeyId,
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
})
|
|
251
|
+
.then(
|
|
252
|
+
(response) => formatResponse(response),
|
|
253
|
+
(reason) => formatError(reason),
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async getRunById(
|
|
258
|
+
runId: paths["/api/v1/executor/runs/{runId}"]["get"]["parameters"]["path"]["runId"],
|
|
259
|
+
) {
|
|
260
|
+
return this.client
|
|
261
|
+
.GET("/api/v1/executor/runs/{runId}", {
|
|
262
|
+
params: {
|
|
263
|
+
path: {
|
|
264
|
+
runId,
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
})
|
|
268
|
+
.then(
|
|
269
|
+
(response) => formatResponse(response),
|
|
270
|
+
(reason) => formatError(reason),
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
async getAllRuns(
|
|
275
|
+
query: paths["/api/v1/executor/runs"]["get"]["parameters"]["query"],
|
|
276
|
+
) {
|
|
277
|
+
return this.client
|
|
278
|
+
.GET("/api/v1/executor/runs", {
|
|
279
|
+
params: {
|
|
280
|
+
query,
|
|
281
|
+
},
|
|
282
|
+
})
|
|
283
|
+
.then(
|
|
284
|
+
(response) => formatResponse(response),
|
|
285
|
+
(reason) => formatError(reason),
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
async createRun(
|
|
290
|
+
data: paths["/api/v1/executor/run"]["post"]["requestBody"]["content"]["application/json"],
|
|
291
|
+
) {
|
|
292
|
+
return this.client
|
|
293
|
+
.POST("/api/v1/executor/run", {
|
|
294
|
+
body: data,
|
|
295
|
+
})
|
|
296
|
+
.then(
|
|
297
|
+
(response) => formatResponse(response),
|
|
298
|
+
(reason) => formatError(reason),
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
async executeStep(
|
|
303
|
+
data: paths["/api/v1/executor/execute"]["post"]["requestBody"]["content"]["application/json"],
|
|
304
|
+
) {
|
|
305
|
+
return this.client
|
|
306
|
+
.POST("/api/v1/executor/execute", {
|
|
307
|
+
body: data,
|
|
308
|
+
})
|
|
309
|
+
.then(
|
|
310
|
+
(response) => formatResponse(response),
|
|
311
|
+
(reason) => formatError(reason),
|
|
312
|
+
);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
async transitionStep(
|
|
316
|
+
data: paths["/api/v1/executor/transition"]["post"]["requestBody"]["content"]["application/json"],
|
|
317
|
+
) {
|
|
318
|
+
return this.client
|
|
319
|
+
.POST("/api/v1/executor/transition", {
|
|
320
|
+
body: data,
|
|
321
|
+
})
|
|
322
|
+
.then(
|
|
323
|
+
(response) => formatResponse(response),
|
|
324
|
+
(reason) => formatError(reason),
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
async getJourneySummary(
|
|
329
|
+
data: paths["/api/v1/executor/get-summary"]["post"]["requestBody"]["content"]["application/json"],
|
|
330
|
+
) {
|
|
331
|
+
return this.client
|
|
332
|
+
.POST("/api/v1/executor/get-summary", {
|
|
333
|
+
body: data,
|
|
334
|
+
})
|
|
335
|
+
.then(
|
|
336
|
+
(response) => formatResponse(response),
|
|
337
|
+
(reason) => formatError(reason),
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
}
|