@activepieces/piece-google-drive 0.7.7 → 0.7.9
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/package.json +7 -20
- package/src/index.js +108 -79
- package/src/index.d.ts +0 -6
- package/src/index.d.ts.map +0 -1
- package/src/index.js.map +0 -1
- package/src/lib/action/add-permission.action.d.ts +0 -11
- package/src/lib/action/add-permission.action.d.ts.map +0 -1
- package/src/lib/action/add-permission.action.js +0 -77
- package/src/lib/action/add-permission.action.js.map +0 -1
- package/src/lib/action/create-new-folder.d.ts +0 -12
- package/src/lib/action/create-new-folder.d.ts.map +0 -1
- package/src/lib/action/create-new-folder.js +0 -37
- package/src/lib/action/create-new-folder.js.map +0 -1
- package/src/lib/action/create-new-text-file.d.ts +0 -14
- package/src/lib/action/create-new-text-file.d.ts.map +0 -1
- package/src/lib/action/create-new-text-file.js +0 -81
- package/src/lib/action/create-new-text-file.js.map +0 -1
- package/src/lib/action/delete-file.d.ts +0 -8
- package/src/lib/action/delete-file.d.ts.map +0 -1
- package/src/lib/action/delete-file.js +0 -34
- package/src/lib/action/delete-file.js.map +0 -1
- package/src/lib/action/delete-permission.action.d.ts +0 -9
- package/src/lib/action/delete-permission.action.d.ts.map +0 -1
- package/src/lib/action/delete-permission.action.js +0 -78
- package/src/lib/action/delete-permission.action.js.map +0 -1
- package/src/lib/action/duplicate-file.action.d.ts +0 -11
- package/src/lib/action/duplicate-file.action.d.ts.map +0 -1
- package/src/lib/action/duplicate-file.action.js +0 -77
- package/src/lib/action/duplicate-file.action.js.map +0 -1
- package/src/lib/action/get-file-by-id.d.ts +0 -8
- package/src/lib/action/get-file-by-id.d.ts.map +0 -1
- package/src/lib/action/get-file-by-id.js +0 -40
- package/src/lib/action/get-file-by-id.js.map +0 -1
- package/src/lib/action/list-files.action.d.ts +0 -11
- package/src/lib/action/list-files.action.d.ts.map +0 -1
- package/src/lib/action/list-files.action.js +0 -159
- package/src/lib/action/list-files.action.js.map +0 -1
- package/src/lib/action/move-file.d.ts +0 -12
- package/src/lib/action/move-file.d.ts.map +0 -1
- package/src/lib/action/move-file.js +0 -46
- package/src/lib/action/move-file.js.map +0 -1
- package/src/lib/action/read-file.d.ts +0 -8
- package/src/lib/action/read-file.d.ts.map +0 -1
- package/src/lib/action/read-file.js +0 -28
- package/src/lib/action/read-file.js.map +0 -1
- package/src/lib/action/save-file-as-pdf.action.d.ts +0 -10
- package/src/lib/action/save-file-as-pdf.action.d.ts.map +0 -1
- package/src/lib/action/save-file-as-pdf.action.js +0 -66
- package/src/lib/action/save-file-as-pdf.action.js.map +0 -1
- package/src/lib/action/search-folder-or-file.action.d.ts +0 -15
- package/src/lib/action/search-folder-or-file.action.d.ts.map +0 -1
- package/src/lib/action/search-folder-or-file.action.js +0 -114
- package/src/lib/action/search-folder-or-file.action.js.map +0 -1
- package/src/lib/action/send-to-trash.d.ts +0 -8
- package/src/lib/action/send-to-trash.d.ts.map +0 -1
- package/src/lib/action/send-to-trash.js +0 -38
- package/src/lib/action/send-to-trash.js.map +0 -1
- package/src/lib/action/set-public-access.d.ts +0 -8
- package/src/lib/action/set-public-access.d.ts.map +0 -1
- package/src/lib/action/set-public-access.js +0 -60
- package/src/lib/action/set-public-access.js.map +0 -1
- package/src/lib/action/upload-file.d.ts +0 -13
- package/src/lib/action/upload-file.d.ts.map +0 -1
- package/src/lib/action/upload-file.js +0 -61
- package/src/lib/action/upload-file.js.map +0 -1
- package/src/lib/auth.d.ts +0 -11
- package/src/lib/auth.d.ts.map +0 -1
- package/src/lib/auth.js +0 -86
- package/src/lib/auth.js.map +0 -1
- package/src/lib/common/get-file-content.d.ts +0 -4
- package/src/lib/common/get-file-content.d.ts.map +0 -1
- package/src/lib/common/get-file-content.js +0 -69
- package/src/lib/common/get-file-content.js.map +0 -1
- package/src/lib/common/index.d.ts +0 -23
- package/src/lib/common/index.d.ts.map +0 -1
- package/src/lib/common/index.js +0 -150
- package/src/lib/common/index.js.map +0 -1
- package/src/lib/triggers/new-file.d.ts +0 -43
- package/src/lib/triggers/new-file.d.ts.map +0 -1
- package/src/lib/triggers/new-file.js +0 -100
- package/src/lib/triggers/new-file.js.map +0 -1
- package/src/lib/triggers/new-folder.d.ts +0 -39
- package/src/lib/triggers/new-folder.d.ts.map +0 -1
- package/src/lib/triggers/new-folder.js +0 -64
- package/src/lib/triggers/new-folder.js.map +0 -1
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newFile = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_framework_2 = require("@activepieces/pieces-framework");
|
|
7
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
-
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
9
|
-
const auth_1 = require("../auth");
|
|
10
|
-
const common_1 = require("../common");
|
|
11
|
-
const get_file_content_1 = require("../common/get-file-content");
|
|
12
|
-
const polling = {
|
|
13
|
-
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
14
|
-
items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
|
|
15
|
-
var _b;
|
|
16
|
-
const currentValues = (_b = (yield common_1.common.getFiles(auth, {
|
|
17
|
-
parent: propsValue.parentFolder,
|
|
18
|
-
createdTime: lastFetchEpochMS,
|
|
19
|
-
includeTeamDrive: propsValue.include_team_drives,
|
|
20
|
-
}))) !== null && _b !== void 0 ? _b : [];
|
|
21
|
-
const items = currentValues.map((item) => ({
|
|
22
|
-
epochMilliSeconds: (0, dayjs_1.default)(item.createdTime).valueOf(),
|
|
23
|
-
data: item,
|
|
24
|
-
}));
|
|
25
|
-
return items;
|
|
26
|
-
}),
|
|
27
|
-
};
|
|
28
|
-
exports.newFile = (0, pieces_framework_1.createTrigger)({
|
|
29
|
-
auth: auth_1.googleDriveAuth,
|
|
30
|
-
name: 'new_file',
|
|
31
|
-
displayName: 'New File',
|
|
32
|
-
description: 'Trigger when a new file is uploaded.',
|
|
33
|
-
props: {
|
|
34
|
-
parentFolder: common_1.common.properties.parentFolder,
|
|
35
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
36
|
-
include_file_content: pieces_framework_1.Property.Checkbox({
|
|
37
|
-
displayName: 'Include File Content',
|
|
38
|
-
description: 'Include the file content in the output. This will increase the time taken to fetch the files and might cause issues with large files.',
|
|
39
|
-
required: false,
|
|
40
|
-
defaultValue: false
|
|
41
|
-
}),
|
|
42
|
-
},
|
|
43
|
-
type: pieces_framework_2.TriggerStrategy.POLLING,
|
|
44
|
-
onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
yield pieces_common_1.pollingHelper.onEnable(polling, {
|
|
46
|
-
auth: context.auth,
|
|
47
|
-
store: context.store,
|
|
48
|
-
propsValue: context.propsValue,
|
|
49
|
-
});
|
|
50
|
-
}),
|
|
51
|
-
onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
-
yield pieces_common_1.pollingHelper.onDisable(polling, {
|
|
53
|
-
auth: context.auth,
|
|
54
|
-
store: context.store,
|
|
55
|
-
propsValue: context.propsValue,
|
|
56
|
-
});
|
|
57
|
-
}),
|
|
58
|
-
run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
const newFiles = yield pieces_common_1.pollingHelper.poll(polling, {
|
|
60
|
-
auth: context.auth,
|
|
61
|
-
store: context.store,
|
|
62
|
-
propsValue: context.propsValue,
|
|
63
|
-
files: context.files,
|
|
64
|
-
});
|
|
65
|
-
return yield handleFileContent(newFiles, context);
|
|
66
|
-
}),
|
|
67
|
-
test: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
68
|
-
const newFiles = yield pieces_common_1.pollingHelper.test(polling, {
|
|
69
|
-
auth: context.auth,
|
|
70
|
-
store: context.store,
|
|
71
|
-
propsValue: context.propsValue,
|
|
72
|
-
files: context.files,
|
|
73
|
-
});
|
|
74
|
-
return yield handleFileContent(newFiles, context);
|
|
75
|
-
}),
|
|
76
|
-
sampleData: {
|
|
77
|
-
kind: 'drive#file',
|
|
78
|
-
mimeType: 'image/png',
|
|
79
|
-
id: '1dpv4-sKJfKRwI9qx1vWqQhEGEn3EpbI5',
|
|
80
|
-
name: 'google-drive.png',
|
|
81
|
-
link: 'https://cdn.activepieces.com/pieces/google-drive.png'
|
|
82
|
-
},
|
|
83
|
-
});
|
|
84
|
-
function handleFileContent(newFiles, context) {
|
|
85
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
const newFilesObj = JSON.parse(JSON.stringify(newFiles));
|
|
87
|
-
if (context.propsValue.include_file_content) {
|
|
88
|
-
const fileContentPromises = [];
|
|
89
|
-
for (const file of newFilesObj) {
|
|
90
|
-
fileContentPromises.push((0, get_file_content_1.downloadFileFromDrive)(context.auth, context.files, file["id"], file["name"]));
|
|
91
|
-
}
|
|
92
|
-
const filesContent = yield Promise.all(fileContentPromises);
|
|
93
|
-
for (let i = 0; i < newFilesObj.length; i++) {
|
|
94
|
-
newFilesObj[i].content = filesContent[i];
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return newFilesObj;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
//# sourceMappingURL=new-file.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-file.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-file.ts"],"names":[],"mappings":";;;;AAAA,qEAKwC;AACxC,qEAAiE;AACjE,+DAIqC;AAErC,0DAA0B;AAC1B,kCAA0C;AAC1C,sCAAmC;AACnC,iEAAmE;AAEnE,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,I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AC,QAAQ,CAAC,CAAC,CAAA;QAExD,IAAI,OAAO,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC;YAC5C,MAAM,mBAAmB,GAAsB,EAAE,CAAA;YACjD,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;gBAC/B,mBAAmB,CAAC,IAAI,CAAC,IAAA,wCAAqB,EAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YACzG,CAAC;YAED,MAAM,YAAY,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;YAE3D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC5C,WAAW,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;YAC1C,CAAC;QACH,CAAC;QACD,OAAO,WAAW,CAAA;IACpB,CAAC;CAAA"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const newFolder: import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
4
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
5
|
-
}>)[], {
|
|
6
|
-
parentFolder: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
8
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
9
|
-
}>)[]>;
|
|
10
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
11
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
12
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
13
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
14
|
-
}>)[], {
|
|
15
|
-
parentFolder: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
16
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
17
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
18
|
-
}>)[]>;
|
|
19
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
20
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
21
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
22
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
23
|
-
}>)[], {
|
|
24
|
-
parentFolder: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
25
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
26
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
27
|
-
}>)[]>;
|
|
28
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
29
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
30
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
31
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
32
|
-
}>)[], {
|
|
33
|
-
parentFolder: import("@activepieces/pieces-framework").DropdownProperty<string, false, (import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props> | import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
34
|
-
serviceAccount: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
35
|
-
userEmail: import("@activepieces/pieces-framework").ShortTextProperty<false>;
|
|
36
|
-
}>)[]>;
|
|
37
|
-
include_team_drives: import("@activepieces/pieces-framework").CheckboxProperty<false>;
|
|
38
|
-
}>;
|
|
39
|
-
//# sourceMappingURL=new-folder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-folder.d.ts","sourceRoot":"","sources":["../../../../src/lib/triggers/new-folder.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AA+BjE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCpB,CAAC"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.newFolder = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_framework_2 = require("@activepieces/pieces-framework");
|
|
7
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
-
const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
|
|
9
|
-
const auth_1 = require("../auth");
|
|
10
|
-
const common_1 = require("../common");
|
|
11
|
-
const polling = {
|
|
12
|
-
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
13
|
-
items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
|
|
14
|
-
var _b;
|
|
15
|
-
const currentValues = (_b = (yield common_1.common.getFolders(auth, {
|
|
16
|
-
parent: propsValue.parentFolder,
|
|
17
|
-
createdTime: lastFetchEpochMS,
|
|
18
|
-
includeTeamDrive: propsValue.include_team_drives
|
|
19
|
-
}))) !== null && _b !== void 0 ? _b : [];
|
|
20
|
-
const items = currentValues.map((item) => ({
|
|
21
|
-
epochMilliSeconds: (0, dayjs_1.default)(item.createdTime).valueOf(),
|
|
22
|
-
data: item,
|
|
23
|
-
}));
|
|
24
|
-
return items;
|
|
25
|
-
}),
|
|
26
|
-
};
|
|
27
|
-
exports.newFolder = (0, pieces_framework_1.createTrigger)({
|
|
28
|
-
auth: auth_1.googleDriveAuth,
|
|
29
|
-
name: 'new_folder',
|
|
30
|
-
displayName: 'New Folder',
|
|
31
|
-
description: 'Trigger when a new folder is created or uploaded.',
|
|
32
|
-
props: {
|
|
33
|
-
parentFolder: common_1.common.properties.parentFolder,
|
|
34
|
-
include_team_drives: common_1.common.properties.include_team_drives,
|
|
35
|
-
},
|
|
36
|
-
type: pieces_framework_2.TriggerStrategy.POLLING,
|
|
37
|
-
onEnable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
-
yield pieces_common_1.pollingHelper.onEnable(polling, {
|
|
39
|
-
auth: context.auth,
|
|
40
|
-
store: context.store,
|
|
41
|
-
propsValue: context.propsValue,
|
|
42
|
-
});
|
|
43
|
-
}),
|
|
44
|
-
onDisable: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
45
|
-
yield pieces_common_1.pollingHelper.onDisable(polling, {
|
|
46
|
-
auth: context.auth,
|
|
47
|
-
store: context.store,
|
|
48
|
-
propsValue: context.propsValue,
|
|
49
|
-
});
|
|
50
|
-
}),
|
|
51
|
-
run: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
52
|
-
return yield pieces_common_1.pollingHelper.poll(polling, context);
|
|
53
|
-
}),
|
|
54
|
-
test: (context) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
return yield pieces_common_1.pollingHelper.test(polling, context);
|
|
56
|
-
}),
|
|
57
|
-
sampleData: {
|
|
58
|
-
kind: 'drive#file',
|
|
59
|
-
mimeType: 'application/vnd.google-apps.folder',
|
|
60
|
-
id: '1aMEtTqIYn5651wdK7WLxaK_SDim4mvXW',
|
|
61
|
-
name: 'New Folder WOOOO',
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
//# sourceMappingURL=new-folder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"new-folder.js","sourceRoot":"","sources":["../../../../src/lib/triggers/new-folder.ts"],"names":[],"mappings":";;;;AAAA,qEAIwC;AACxC,qEAAiE;AACjE,+DAIqC;AAErC,0DAA0B;AAC1B,kCAA0C;AAC1C,sCAAmC;AAEnC,MAAM,OAAO,GAGT;IACF,QAAQ,EAAE,8BAAc,CAAC,SAAS;IAClC,KAAK,EAAE,KAA+C,EAAE,oDAA1C,EAAE,IAAI,EAAE,UAAU,EAAE,gBAAgB,EAAE;;QAClD,MAAM,aAAa,GACjB,MAAA,CAAC,MAAM,eAAM,CAAC,UAAU,CAAC,IAAI,EAAE;YAC7B,MAAM,EAAE,UAAU,CAAC,YAAY;YAC/B,WAAW,EAAE,gBAAgB;YAC7B,gBAAgB,EAAC,UAAU,CAAC,mBAAmB;SAChD,CAAC,CAAC,mCAAI,EAAE,CAAC;QACZ,MAAM,KAAK,GAAG,a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