@activepieces/piece-linkupapi 0.0.2 → 0.0.4

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 (61) hide show
  1. package/package.json +7 -12
  2. package/src/index.js +13 -56
  3. package/src/index.d.ts +0 -2
  4. package/src/index.d.ts.map +0 -1
  5. package/src/index.js.map +0 -1
  6. package/src/lib/actions/check-invitation-status.d.ts +0 -5
  7. package/src/lib/actions/check-invitation-status.d.ts.map +0 -1
  8. package/src/lib/actions/check-invitation-status.js +0 -29
  9. package/src/lib/actions/check-invitation-status.js.map +0 -1
  10. package/src/lib/actions/get-account.d.ts +0 -4
  11. package/src/lib/actions/get-account.d.ts.map +0 -1
  12. package/src/lib/actions/get-account.js +0 -26
  13. package/src/lib/actions/get-account.js.map +0 -1
  14. package/src/lib/actions/get-company.d.ts +0 -5
  15. package/src/lib/actions/get-company.d.ts.map +0 -1
  16. package/src/lib/actions/get-company.js +0 -29
  17. package/src/lib/actions/get-company.js.map +0 -1
  18. package/src/lib/actions/get-conversation.d.ts +0 -8
  19. package/src/lib/actions/get-conversation.d.ts.map +0 -1
  20. package/src/lib/actions/get-conversation.js +0 -47
  21. package/src/lib/actions/get-conversation.js.map +0 -1
  22. package/src/lib/actions/get-my-profile.d.ts +0 -4
  23. package/src/lib/actions/get-my-profile.d.ts.map +0 -1
  24. package/src/lib/actions/get-my-profile.js +0 -21
  25. package/src/lib/actions/get-my-profile.js.map +0 -1
  26. package/src/lib/actions/get-profile.d.ts +0 -7
  27. package/src/lib/actions/get-profile.d.ts.map +0 -1
  28. package/src/lib/actions/get-profile.js +0 -41
  29. package/src/lib/actions/get-profile.js.map +0 -1
  30. package/src/lib/actions/list-accounts.d.ts +0 -5
  31. package/src/lib/actions/list-accounts.d.ts.map +0 -1
  32. package/src/lib/actions/list-accounts.js +0 -36
  33. package/src/lib/actions/list-accounts.js.map +0 -1
  34. package/src/lib/actions/search-companies.d.ts +0 -12
  35. package/src/lib/actions/search-companies.d.ts.map +0 -1
  36. package/src/lib/actions/search-companies.js +0 -47
  37. package/src/lib/actions/search-companies.js.map +0 -1
  38. package/src/lib/actions/search-people.d.ts +0 -21
  39. package/src/lib/actions/search-people.d.ts.map +0 -1
  40. package/src/lib/actions/search-people.js +0 -94
  41. package/src/lib/actions/search-people.js.map +0 -1
  42. package/src/lib/actions/send-connection-request.d.ts +0 -7
  43. package/src/lib/actions/send-connection-request.d.ts.map +0 -1
  44. package/src/lib/actions/send-connection-request.js +0 -41
  45. package/src/lib/actions/send-connection-request.js.map +0 -1
  46. package/src/lib/actions/send-message.d.ts +0 -7
  47. package/src/lib/actions/send-message.d.ts.map +0 -1
  48. package/src/lib/actions/send-message.js +0 -41
  49. package/src/lib/actions/send-message.js.map +0 -1
  50. package/src/lib/common/index.d.ts +0 -16
  51. package/src/lib/common/index.d.ts.map +0 -1
  52. package/src/lib/common/index.js +0 -110
  53. package/src/lib/common/index.js.map +0 -1
  54. package/src/lib/triggers/invitation-accepted.d.ts +0 -11
  55. package/src/lib/triggers/invitation-accepted.d.ts.map +0 -1
  56. package/src/lib/triggers/invitation-accepted.js +0 -57
  57. package/src/lib/triggers/invitation-accepted.js.map +0 -1
  58. package/src/lib/triggers/new-message-received.d.ts +0 -11
  59. package/src/lib/triggers/new-message-received.d.ts.map +0 -1
  60. package/src/lib/triggers/new-message-received.js +0 -57
  61. package/src/lib/triggers/new-message-received.js.map +0 -1
@@ -1,110 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.accountIdProp = exports.linkupAuth = exports.LINKUPAPI_BASE_URL = void 0;
4
- exports.linkupAction = linkupAction;
5
- exports.linkupPost = linkupPost;
6
- exports.linkupGet = linkupGet;
7
- exports.linkupDelete = linkupDelete;
8
- exports.cleanParams = cleanParams;
9
- const tslib_1 = require("tslib");
10
- const pieces_framework_1 = require("@activepieces/pieces-framework");
11
- const pieces_common_1 = require("@activepieces/pieces-common");
12
- exports.LINKUPAPI_BASE_URL = 'https://api.linkupapi.com/v2';
13
- // ─── Authentication ──────────────────────────────────────────────────────────
14
- exports.linkupAuth = pieces_framework_1.PieceAuth.SecretText({
15
- displayName: 'API Key',
16
- required: true,
17
- description: 'Your LinkupAPI key, sent as the `x-api-key` header. Get it from https://app.linkupapi.com',
18
- validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
19
- var _b;
20
- try {
21
- // GET /accounts is free (0 credits) — ideal for validating the key.
22
- yield pieces_common_1.httpClient.sendRequest({
23
- method: pieces_common_1.HttpMethod.GET,
24
- url: `${exports.LINKUPAPI_BASE_URL}/accounts`,
25
- headers: { 'x-api-key': auth },
26
- queryParams: { limit: '1' },
27
- });
28
- return { valid: true };
29
- }
30
- catch (e) {
31
- const status = (_b = e === null || e === void 0 ? void 0 : e.response) === null || _b === void 0 ? void 0 : _b.status;
32
- if (status === 401 || status === 403) {
33
- return {
34
- valid: false,
35
- error: 'Invalid API key. Check it at https://app.linkupapi.com',
36
- };
37
- }
38
- return {
39
- valid: false,
40
- error: `Could not reach LinkupAPI to validate the key (status ${status !== null && status !== void 0 ? status : 'network error'}). Please try again.`,
41
- };
42
- }
43
- }),
44
- });
45
- // ─── Shared props ────────────────────────────────────────────────────────────
46
- exports.accountIdProp = pieces_framework_1.Property.ShortText({
47
- displayName: 'Account ID',
48
- description: 'The connected LinkedIn account to act as. Get it from the "List Accounts" action.',
49
- required: true,
50
- });
51
- // ─── Request helpers ─────────────────────────────────────────────────────────
52
- /**
53
- * V2 action-based endpoint: POST /v2/<category> with body { account_id, action, params }.
54
- * `params` is cleaned of empty/undefined values before sending.
55
- */
56
- function linkupAction(apiKey_1, category_1, action_1, accountId_1) {
57
- return tslib_1.__awaiter(this, arguments, void 0, function* (apiKey, category, action, accountId, params = {}) {
58
- const response = yield pieces_common_1.httpClient.sendRequest({
59
- method: pieces_common_1.HttpMethod.POST,
60
- url: `${exports.LINKUPAPI_BASE_URL}/${category}`,
61
- headers: { 'x-api-key': apiKey, 'Content-Type': 'application/json' },
62
- body: { account_id: accountId, action, params: cleanParams(params) },
63
- });
64
- return response.body;
65
- });
66
- }
67
- /** Raw POST to a V2 path (used for endpoints that don't follow the action/params shape, e.g. /webhooks). */
68
- function linkupPost(apiKey, path, body) {
69
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
70
- const response = yield pieces_common_1.httpClient.sendRequest({
71
- method: pieces_common_1.HttpMethod.POST,
72
- url: `${exports.LINKUPAPI_BASE_URL}${path}`,
73
- headers: { 'x-api-key': apiKey, 'Content-Type': 'application/json' },
74
- body,
75
- });
76
- return response.body;
77
- });
78
- }
79
- function linkupGet(apiKey_1, path_1) {
80
- return tslib_1.__awaiter(this, arguments, void 0, function* (apiKey, path, queryParams = {}) {
81
- const response = yield pieces_common_1.httpClient.sendRequest({
82
- method: pieces_common_1.HttpMethod.GET,
83
- url: `${exports.LINKUPAPI_BASE_URL}${path}`,
84
- headers: { 'x-api-key': apiKey },
85
- queryParams,
86
- });
87
- return response.body;
88
- });
89
- }
90
- function linkupDelete(apiKey, path) {
91
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
92
- const response = yield pieces_common_1.httpClient.sendRequest({
93
- method: pieces_common_1.HttpMethod.DELETE,
94
- url: `${exports.LINKUPAPI_BASE_URL}${path}`,
95
- headers: { 'x-api-key': apiKey },
96
- });
97
- return response.body;
98
- });
99
- }
100
- /** Drop null / undefined / empty-string values so optional props aren't sent. */
101
- function cleanParams(params) {
102
- const out = {};
103
- for (const [k, v] of Object.entries(params)) {
104
- if (v !== undefined && v !== null && v !== '') {
105
- out[k] = v;
106
- }
107
- }
108
- return out;
109
- }
110
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/lib/common/index.ts"],"names":[],"mappings":";;;AAsDA,oCAcC;AAGD,gCAYC;AAED,8BAYC;AAED,oCAUC;AAGD,kCAUC;;AA1HD,qEAAqE;AACrE,+DAAkF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AAM,QAAQ,GAAG,MAAM,0BAAU,CAAC,WAAW,CAAI;YAC/C,MAAM,EAAE,0BAAU,CAAC,MAAM;YACzB,GAAG,EAAE,GAAG,0BAAkB,GAAG,IAAI,EAAE;YACnC,OAAO,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE;SACjC,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC;IACvB,CAAC;CAAA;AAED,iFAAiF;AACjF,SAAgB,WAAW,CACzB,MAA+B;IAE/B,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5C,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,EAAE,CAAC;YAC9C,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -1,11 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const invitationAccepted: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
- accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
- accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
- accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
- accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
- }>;
11
- //# sourceMappingURL=invitation-accepted.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invitation-accepted.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/invitation-accepted.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAChB,MAAM,gCAAgC,CAAC;AAKxC,eAAO,MAAM,kBAAkB;;;;;;;;EA8C7B,CAAC"}
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.invitationAccepted = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const common_1 = require("../common");
7
- const STORE_KEY = '_linkup_invitation_accepted_webhook_id';
8
- exports.invitationAccepted = (0, pieces_framework_1.createTrigger)({
9
- auth: common_1.linkupAuth,
10
- name: 'invitation_accepted',
11
- displayName: 'Invitation Accepted',
12
- description: 'Fires in real time when a connection request sent from the connected LinkedIn account is accepted. Registers a LinkupAPI webhook (≈10 credits/day per monitored account while active).',
13
- type: pieces_framework_1.TriggerStrategy.WEBHOOK,
14
- props: {
15
- accountId: common_1.accountIdProp,
16
- },
17
- sampleData: {
18
- timestamp: '2026-06-17T12:00:00Z',
19
- event: {
20
- type: 'accepted_invitation',
21
- account_id: 'your-account-id',
22
- data: {
23
- profile_url: 'https://www.linkedin.com/in/janedoe',
24
- first_name: 'Jane',
25
- last_name: 'Doe',
26
- },
27
- timestamp: '2026-06-17T11:59:58Z',
28
- },
29
- },
30
- onEnable(context) {
31
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
- var _a;
33
- const res = yield (0, common_1.linkupPost)(context.auth.secret_text, '/webhooks', {
34
- account_id: context.propsValue.accountId,
35
- url: context.webhookUrl,
36
- events: ['accepted_invitation'],
37
- });
38
- if ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.webhook_id) {
39
- yield context.store.put(STORE_KEY, res.data.webhook_id);
40
- }
41
- });
42
- },
43
- onDisable(context) {
44
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
- const webhookId = yield context.store.get(STORE_KEY);
46
- if (webhookId) {
47
- yield (0, common_1.linkupDelete)(context.auth.secret_text, `/webhooks/${webhookId}`);
48
- }
49
- });
50
- },
51
- run(context) {
52
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
- return [context.payload.body];
54
- });
55
- },
56
- });
57
- //# sourceMappingURL=invitation-accepted.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"invitation-accepted.js","sourceRoot":"","sources":["../../../../src/lib/triggers/invitation-accepted.ts"],"names":[],"mappings":";;;;AAAA,qEAGwC;AACxC,sCAAgF;AAEhF,MAAM,SAAS,GAAG,wCAAwC,CAAC;AAE9C,QAAA,kBAAkB,GAAG,IAAA,gCAAa,EAAC;IAC9C,IAAI,EAAE,mBAAU;IAChB,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EACT,wLAAwL;IAC1L,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE;QACL,SAAS,EAAE,sBAAa;KACzB;IACD,UAAU,EAAE;QACV,SAAS,EAAE,sBAAsB;QACjC,KAAK,EAAE;YACL,IAAI,EAAE,qBAAqB;YAC3B,UAAU,EAAE,iBAAiB;YAC7B,IAAI,EAAE;gBACJ,WAAW,EAAE,qCAAqC;gBAClD,UAAU,EAAE,MAAM;gBAClB,SAAS,EAAE,KAAK;aACjB;YACD,SAAS,EAAE,sBAAsB;SAClC;KACF;IACK,QAAQ,CAAC,OAAO;;;YACpB,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAU,EAC1B,OAAO,CAAC,IAAI,CAAC,WAAW,EACxB,WAAW,EACX;gBACE,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS;gBACxC,GAAG,EAAE,OAAO,CAAC,UAAU;gBACvB,MAAM,EAAE,CAAC,qBAAqB,CAAC;aAChC,CACF,CAAC;YACF,IAAI,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,0CAAE,UAAU,EAAE,CAAC;gBAC1B,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAS,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;KAAA;IACK,SAAS,CAAC,OAAO;;YACrB,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,KAAK,CAAC,GAAG,CAAS,SAAS,CAAC,CAAC;YAC7D,IAAI,SAAS,EAAE,CAAC;gBACd,MAAM,IAAA,qBAAY,EAAC,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,SAAS,EAAE,CAAC,CAAC;YACzE,CAAC;QACH,CAAC;KAAA;IACK,GAAG,CAAC,OAAO;;YACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAChC,CAAC;KAAA;CACF,CAAC,CAAC"}
@@ -1,11 +0,0 @@
1
- import { TriggerStrategy } from '@activepieces/pieces-framework';
2
- export declare const newMessageReceived: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
3
- accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
5
- accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
6
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
7
- accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
- }> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").SecretTextProperty<true>, {
9
- accountId: import("@activepieces/pieces-framework").ShortTextProperty<true>;
10
- }>;
11
- //# sourceMappingURL=new-message-received.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-message-received.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-message-received.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAChB,MAAM,gCAAgC,CAAC;AAKxC,eAAO,MAAM,kBAAkB;;;;;;;;EA8C7B,CAAC"}
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.newMessageReceived = void 0;
4
- const tslib_1 = require("tslib");
5
- const pieces_framework_1 = require("@activepieces/pieces-framework");
6
- const common_1 = require("../common");
7
- const STORE_KEY = '_linkup_new_message_webhook_id';
8
- exports.newMessageReceived = (0, pieces_framework_1.createTrigger)({
9
- auth: common_1.linkupAuth,
10
- name: 'new_message_received',
11
- displayName: 'New Message Received',
12
- description: 'Fires in real time when the connected LinkedIn account receives a new message. Registers a LinkupAPI webhook (≈10 credits/day per monitored account while active).',
13
- type: pieces_framework_1.TriggerStrategy.WEBHOOK,
14
- props: {
15
- accountId: common_1.accountIdProp,
16
- },
17
- sampleData: {
18
- timestamp: '2026-06-17T12:00:00Z',
19
- event: {
20
- type: 'message',
21
- account_id: 'your-account-id',
22
- data: {
23
- conversation_id: '2-abc123',
24
- sender_profile_url: 'https://www.linkedin.com/in/janedoe',
25
- message_text: 'Hi, thanks for connecting!',
26
- },
27
- timestamp: '2026-06-17T11:59:58Z',
28
- },
29
- },
30
- onEnable(context) {
31
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
32
- var _a;
33
- const res = yield (0, common_1.linkupPost)(context.auth.secret_text, '/webhooks', {
34
- account_id: context.propsValue.accountId,
35
- url: context.webhookUrl,
36
- events: ['message_received'],
37
- });
38
- if ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.webhook_id) {
39
- yield context.store.put(STORE_KEY, res.data.webhook_id);
40
- }
41
- });
42
- },
43
- onDisable(context) {
44
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
45
- const webhookId = yield context.store.get(STORE_KEY);
46
- if (webhookId) {
47
- yield (0, common_1.linkupDelete)(context.auth.secret_text, `/webhooks/${webhookId}`);
48
- }
49
- });
50
- },
51
- run(context) {
52
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
53
- return [context.payload.body];
54
- });
55
- },
56
- });
57
- //# sourceMappingURL=new-message-received.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new-message-received.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-message-received.ts"],"names":[],"mappings":";;;;AAAA,qEAGwC;AACxC,sCAAgF;AAEhF,MAAM,SAAS,GAAG,gCAAgC,CAAC;AAEtC,QAAA,kBAAkB,GAAG,IAAA,gCAAa,EAAC;IAC9C,IAAI,EAAE,mBAAU;IAChB,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,sBAAsB;IACnC,WAAW,EACT,oKAAoK;IACtK,IAAI,EAAE,kCAAe,CAAC,OAAO;IAC7B,KAAK,EAAE;QACL,SAAS,EAAE,sBAAa;KACzB;IACD,UAAU,EAAE;QACV,SAAS,EAAE,sBAAsB;QACjC,KAAK,EAAE;YACL,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,iBAAiB;YAC7B,IAAI,EAAE;gBACJ,eAAe,EAAE,UAAU;gBAC3B,kBAAkB,EAAE,qCAAqC;gBACzD,YAAY,EAAE,4BAA4B;aAC3C;YACD,SAAS,EAAE,sBAAsB;SAClC;KACF;IACK,QAAQ,CAAC,OAAO;;;YACpB,MAAM,GAAG,GAAG,MAAM,IAAA,mBAAU,EAC1B,OAAO,CAAC,IAAI,CAAC,WAAW,EACxB,WAAW,EACX;gBACE,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,SAAS;gBACxC,GAAG,EAAE,OAAO,CAAC,UAAU;gBACvB,MAAM,EAAE,CAAC,kBAAkB,CAAC;aAC7B,CACF,CAAC;YACF,IAAI,MAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,0CAAE,UAAU,EAAE,CAAC;gBAC1B,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