@sanity/functions 1.4.0 → 1.6.0
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/dist/durables.d.ts +32 -0
- package/dist/durables.js +74 -0
- package/dist/durables.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/invoke.d.ts +38 -2
- package/dist/invoke.js +106 -20
- package/dist/invoke.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +255 -1
- package/package.json +1 -1
- package/src/durables.ts +104 -0
- package/src/index.ts +1 -0
- package/src/invoke.ts +125 -21
- package/src/types.ts +259 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { DurableHandler } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Durables creation function that can be called with or without a config object.
|
|
4
|
+
* @alpha Durables are an experimental feature and may change in the future.
|
|
5
|
+
* @hidden
|
|
6
|
+
* @param handler
|
|
7
|
+
* @returns The handler function, unmodified.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createDurable(handler: DurableHandler): DurableHandler & {
|
|
10
|
+
config?: undefined;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Durables creation function that can be called with or without a config object.
|
|
14
|
+
* @alpha Durables are an experimental feature and may change in the future.
|
|
15
|
+
* @hidden
|
|
16
|
+
* @param config
|
|
17
|
+
* @param handler
|
|
18
|
+
* @returns The handler function, unmodified and the provided config object.
|
|
19
|
+
*/
|
|
20
|
+
export declare function createDurable<TConfig extends {
|
|
21
|
+
name: string;
|
|
22
|
+
}>(config: TConfig, handler: DurableHandler): DurableHandler & {
|
|
23
|
+
config: TConfig;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* @alpha Durable functions are an experimental feature and may change in the future.
|
|
27
|
+
* @hidden
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export declare const durable: {
|
|
31
|
+
createDurable: typeof createDurable;
|
|
32
|
+
};
|
package/dist/durables.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determine if `createDurable({}, () => {})` or `createDurable(() => {})`.
|
|
3
|
+
* @param configOrHandler
|
|
4
|
+
* @param maybeHandler
|
|
5
|
+
* @returns resolved arguments
|
|
6
|
+
*/
|
|
7
|
+
const resolveFuncArgs = (configOrHandler, maybeHandler) => {
|
|
8
|
+
return typeof configOrHandler === 'function'
|
|
9
|
+
? { config: undefined, handler: configOrHandler, hadConfigArg: false }
|
|
10
|
+
: { config: configOrHandler, handler: maybeHandler, hadConfigArg: true };
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Validates the config to ensure config contains proper elements
|
|
14
|
+
* @param config
|
|
15
|
+
* @returns Errors while validating a config object
|
|
16
|
+
*/
|
|
17
|
+
const validateConfig = (config) => {
|
|
18
|
+
const EVENT_TYPES = ['document', 'media-library', 'cron', 'sync-tag-invalidate'];
|
|
19
|
+
const errors = [];
|
|
20
|
+
if (config === undefined || config === null) {
|
|
21
|
+
errors.push('`config` must be defined');
|
|
22
|
+
return errors;
|
|
23
|
+
}
|
|
24
|
+
if (typeof config !== 'object') {
|
|
25
|
+
errors.push('`config` must be an object');
|
|
26
|
+
return errors;
|
|
27
|
+
}
|
|
28
|
+
const name = 'name' in config ? config.name : undefined;
|
|
29
|
+
const event = 'event' in config ? config.event : undefined;
|
|
30
|
+
if (typeof name !== 'string')
|
|
31
|
+
errors.push('`config.name` must be a string');
|
|
32
|
+
if ('event' in config) {
|
|
33
|
+
if (typeof event !== 'object' || event === null) {
|
|
34
|
+
errors.push('`event` must be an object');
|
|
35
|
+
}
|
|
36
|
+
else if ('type' in event) {
|
|
37
|
+
if (typeof event.type !== 'string') {
|
|
38
|
+
errors.push('`event.type` must be defined');
|
|
39
|
+
}
|
|
40
|
+
else if (!EVENT_TYPES.includes(event.type)) {
|
|
41
|
+
errors.push(`\`event.type\` must be one of: ${EVENT_TYPES.join(', ')}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return errors;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Durables creation function that can be called with or without a config object.
|
|
49
|
+
* @alpha Durable functions are an experimental feature and may change in the future.
|
|
50
|
+
* @hidden
|
|
51
|
+
* @public
|
|
52
|
+
* @param configOrHandler
|
|
53
|
+
* @param maybeHandler
|
|
54
|
+
* @returns The handler function, unmodified and the config object if provided
|
|
55
|
+
*/
|
|
56
|
+
export function createDurable(configOrHandler, maybeHandler) {
|
|
57
|
+
const { config, handler, hadConfigArg } = resolveFuncArgs(configOrHandler, maybeHandler);
|
|
58
|
+
const errors = [
|
|
59
|
+
...(hadConfigArg ? validateConfig(config) : []),
|
|
60
|
+
...(typeof handler !== 'function' ? ['`handler` must be a function'] : []),
|
|
61
|
+
];
|
|
62
|
+
if (errors.length > 0) {
|
|
63
|
+
throw new TypeError(errors.join(', '));
|
|
64
|
+
}
|
|
65
|
+
// Separate config from the handler during build
|
|
66
|
+
return Object.assign(handler, { config });
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @alpha Durable functions are an experimental feature and may change in the future.
|
|
70
|
+
* @hidden
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export const durable = { createDurable };
|
|
74
|
+
//# sourceMappingURL=durables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"durables.js","sourceRoot":"","sources":["../src/durables.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,eAAe,GAAG,CACtB,eAAyC,EACzC,YAA6B,EACwC,EAAE;IACvE,OAAO,OAAO,eAAe,KAAK,UAAU;QAC1C,CAAC,CAAC,EAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,KAAK,EAAC;QACpE,CAAC,CAAC,EAAC,MAAM,EAAE,eAAe,EAAE,OAAO,EA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AAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC7C,MAAM,CAAC,IAAI,CAAC,kCAAkC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YACzE,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAqBD;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC3B,eAAyC,EACzC,YAA6B;IAE7B,MAAM,EAAC,MAAM,EAAE,OAAO,EAAE,YAAY,EAAC,GAAG,eAAe,CAAC,eAAe,EAAE,YAAY,CAAC,CAAA;IACtF,MAAM,MAAM,GAAG;QACb,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3E,CAAA;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACxC,CAAC;IACD,gDAAgD;IAChD,OAAO,MAAM,CAAC,MAAM,CAAC,OAAyB,EAAE,EAAC,MAAM,EAAC,CAAC,CAAA;AAC3D,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,EAAC,aAAa,EAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
package/dist/invoke.d.ts
CHANGED
|
@@ -1,2 +1,38 @@
|
|
|
1
|
-
import type { FunctionPayload } from './types.js';
|
|
2
|
-
|
|
1
|
+
import type { FunctionPayload, InvokeOptions } from './types.js';
|
|
2
|
+
/** @internal */
|
|
3
|
+
export declare const MAX_RECURSION_COUNT = 16;
|
|
4
|
+
/**
|
|
5
|
+
* @internal
|
|
6
|
+
* Generate a short UUID.
|
|
7
|
+
* @param {number} [length] - The length of the UUID to generate.
|
|
8
|
+
* @param {string} [characters] - The characters to use to generate the UUID.
|
|
9
|
+
* @returns {string} The generated UUID.
|
|
10
|
+
*/
|
|
11
|
+
export declare function genID(length?: number, characters?: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
* Builds the new lineage token given the existing token.
|
|
15
|
+
* @param {string} name
|
|
16
|
+
* @param {string | undefined} lineage
|
|
17
|
+
* @param {object} options
|
|
18
|
+
* @param {number} options.maxRecursionCount The maximum recursion depth
|
|
19
|
+
* @returns The new lineage token with the count incremented
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildLineageToken(name: string, lineage: string | undefined): string;
|
|
22
|
+
/**
|
|
23
|
+
* Invokes another Sanity Function.
|
|
24
|
+
*
|
|
25
|
+
* By default the invocation is async: the payload is handed off to the function's
|
|
26
|
+
* event source and nothing is returned. Pass `{sync: true}` to invoke the function and
|
|
27
|
+
* wait for its return value.
|
|
28
|
+
*
|
|
29
|
+
* @param name - Name of the function to invoke
|
|
30
|
+
* @param payload - The `{event, context}` envelope to deliver
|
|
31
|
+
* @param options - Set `sync: true` to wait for and return the function's result
|
|
32
|
+
*/
|
|
33
|
+
export declare function invoke<T = unknown>(name: string, payload: FunctionPayload, options: InvokeOptions & {
|
|
34
|
+
sync: true;
|
|
35
|
+
}): Promise<T>;
|
|
36
|
+
export declare function invoke(name: string, payload: FunctionPayload, options?: InvokeOptions & {
|
|
37
|
+
sync?: false;
|
|
38
|
+
}): Promise<void>;
|
package/dist/invoke.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
|
+
import crypto from 'node:crypto';
|
|
2
3
|
import { env } from 'node:process';
|
|
3
|
-
const MAX_EVENT_SIZE_BYTES = 256 * 1024;
|
|
4
4
|
let awsPromise;
|
|
5
5
|
const PARTITION_KEY = 'arc-app-res';
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const MAX_RECURSION_COUNT = 16;
|
|
6
8
|
/**
|
|
9
|
+
* @internal
|
|
7
10
|
* lazy load aws-lite
|
|
8
11
|
*/
|
|
9
12
|
function getAwsLite() {
|
|
@@ -21,6 +24,7 @@ function getAwsLite() {
|
|
|
21
24
|
return awsPromise;
|
|
22
25
|
}
|
|
23
26
|
/**
|
|
27
|
+
* @internal
|
|
24
28
|
* Gets a specific resource based off of function name
|
|
25
29
|
* @param {string} name
|
|
26
30
|
*/
|
|
@@ -42,49 +46,131 @@ async function getResource(name, aws) {
|
|
|
42
46
|
throw new Error(`Resource record for ${name} is missing resources`);
|
|
43
47
|
return result.Item['resources'];
|
|
44
48
|
}
|
|
45
|
-
|
|
49
|
+
/**
|
|
50
|
+
* @internal
|
|
51
|
+
* Generate a short UUID.
|
|
52
|
+
* @param {number} [length] - The length of the UUID to generate.
|
|
53
|
+
* @param {string} [characters] - The characters to use to generate the UUID.
|
|
54
|
+
* @returns {string} The generated UUID.
|
|
55
|
+
*/
|
|
56
|
+
export function genID(length = 32, characters = '23456789abcdefghijklmnopqrstuvwxyz') {
|
|
57
|
+
let result = '';
|
|
58
|
+
const bytes = crypto.randomBytes(length);
|
|
59
|
+
for (let i = 0; i < length; i++) {
|
|
60
|
+
result += characters[bytes[i] % characters.length];
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* @internal
|
|
66
|
+
* Builds the new lineage token given the existing token.
|
|
67
|
+
* @param {string} name
|
|
68
|
+
* @param {string | undefined} lineage
|
|
69
|
+
* @param {object} options
|
|
70
|
+
* @param {number} options.maxRecursionCount The maximum recursion depth
|
|
71
|
+
* @returns The new lineage token with the count incremented
|
|
72
|
+
*/
|
|
73
|
+
export function buildLineageToken(name, lineage) {
|
|
74
|
+
let recursionCount = 0;
|
|
75
|
+
try {
|
|
76
|
+
if (lineage) {
|
|
77
|
+
// split the token, usually into two parts
|
|
78
|
+
const parts = lineage.trim().split(':');
|
|
79
|
+
if (parts.length > 1) {
|
|
80
|
+
// the current count is in the last part
|
|
81
|
+
const count = parts[parts.length - 1];
|
|
82
|
+
recursionCount = Number.parseInt(count, 10);
|
|
83
|
+
// if parsing didn't work or the value was invalid, reset to 0
|
|
84
|
+
if (Number.isNaN(recursionCount) || recursionCount < 0) {
|
|
85
|
+
recursionCount = 0;
|
|
86
|
+
}
|
|
87
|
+
// this handles whitespace, and also if the first parts of the token contained colons
|
|
88
|
+
lineage = parts.slice(0, -1).join(':');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// ignore
|
|
94
|
+
}
|
|
95
|
+
if (recursionCount >= MAX_RECURSION_COUNT) {
|
|
96
|
+
throw new Error(`Function ${name} exceeded the maximum recursion depth of ${MAX_RECURSION_COUNT}`);
|
|
97
|
+
}
|
|
98
|
+
return `${lineage || genID(32)}:${recursionCount + 1}`;
|
|
99
|
+
}
|
|
100
|
+
export async function invoke(name, payload, options) {
|
|
46
101
|
if (!name)
|
|
47
102
|
throw new Error('Function name was not provided');
|
|
48
|
-
const
|
|
103
|
+
const sync = options?.sync ?? false;
|
|
104
|
+
// Update lineage or throw error if we exceed the max recursion value
|
|
105
|
+
const outgoingPayload = {
|
|
106
|
+
...payload,
|
|
107
|
+
context: { ...payload.context, lineage: buildLineageToken(name, payload.context?.lineage) },
|
|
108
|
+
};
|
|
109
|
+
const stringPayload = JSON.stringify(outgoingPayload);
|
|
49
110
|
// Check to make sure payload is not over the max we can handle
|
|
50
|
-
|
|
51
|
-
throw new Error(`Payload exceeds maximum size of ${MAX_EVENT_SIZE_BYTES / 1024}KB`);
|
|
52
|
-
}
|
|
111
|
+
checkPayloadSize(stringPayload, sync);
|
|
53
112
|
// Local invoke path for Sanity CLI
|
|
54
|
-
if (
|
|
55
|
-
if (!
|
|
113
|
+
if (outgoingPayload?.context?.local) {
|
|
114
|
+
if (!outgoingPayload?.context?.invoke) {
|
|
56
115
|
throw new Error(`No local invoke handler configured for function: ${name}`);
|
|
57
116
|
}
|
|
58
|
-
|
|
59
|
-
return;
|
|
117
|
+
return await outgoingPayload.context.invoke(name, outgoingPayload, options);
|
|
60
118
|
}
|
|
61
119
|
const aws = await getAwsLite();
|
|
62
120
|
if (!aws)
|
|
63
121
|
throw new Error(`Unable to invoke function: ${name}`);
|
|
64
122
|
// Look up the function details
|
|
65
123
|
const resource = await getResource(name, aws);
|
|
66
|
-
|
|
67
|
-
|
|
124
|
+
const contextResource = payload?.context?.resources?.(name);
|
|
125
|
+
// Synchronous invocation
|
|
126
|
+
if (sync === true) {
|
|
127
|
+
if (!resource.function || !contextResource) {
|
|
128
|
+
throw new Error(`Function ${name} cannot be invoked synchronously.`);
|
|
129
|
+
}
|
|
130
|
+
if (contextResource.type !== 'sanity.function.pubsub') {
|
|
131
|
+
throw new Error(`Function ${name} of type ${contextResource.type} cannot be invoked synchronously.`);
|
|
132
|
+
}
|
|
133
|
+
const { Payload, FunctionError } = await aws.Lambda.Invoke({
|
|
134
|
+
FunctionName: resource.function.physicalResourceId,
|
|
135
|
+
Payload: outgoingPayload,
|
|
136
|
+
InvocationType: 'RequestResponse',
|
|
137
|
+
});
|
|
138
|
+
if (FunctionError) {
|
|
139
|
+
const detail = typeof Payload === 'object' && Payload !== null ? Payload.errorMessage : undefined;
|
|
140
|
+
throw new Error(`Function ${name} failed: ${detail ?? FunctionError}`);
|
|
141
|
+
}
|
|
142
|
+
// TODO: can we not type cast? might be an aws-lite issue, why is the return type UInt8BlobAdapter
|
|
143
|
+
return Payload;
|
|
144
|
+
}
|
|
145
|
+
// Async invocation by type
|
|
146
|
+
if (resource.topic && contextResource?.type === 'sanity.function.pubsub') {
|
|
68
147
|
await aws.SNS.Publish({
|
|
69
148
|
TopicArn: resource.topic.physicalResourceId,
|
|
70
149
|
Message: stringPayload,
|
|
71
150
|
});
|
|
72
151
|
}
|
|
73
|
-
else if (resource.queue) {
|
|
152
|
+
else if (resource.queue && contextResource?.type === 'sanity.function.queue') {
|
|
74
153
|
await aws.SQS.SendMessage({
|
|
75
154
|
MessageBody: stringPayload,
|
|
76
155
|
QueueUrl: resource.queue.physicalResourceId,
|
|
77
156
|
});
|
|
78
157
|
}
|
|
79
|
-
else if (resource.function) {
|
|
80
|
-
await aws.Lambda.Invoke({
|
|
81
|
-
FunctionName: resource.function.physicalResourceId,
|
|
82
|
-
Payload: payload,
|
|
83
|
-
InvocationType: 'Event',
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
158
|
else {
|
|
87
159
|
throw new Error(`No invokeable resource for function: ${name}`);
|
|
88
160
|
}
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
/** @internal */
|
|
164
|
+
function checkPayloadSize(payload, sync) {
|
|
165
|
+
if (sync) {
|
|
166
|
+
if (Buffer.byteLength(payload, 'utf8') > 6 * 1024 * 1024) {
|
|
167
|
+
throw new Error(`Payload exceeds maximum size of 6MB`);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
if (Buffer.byteLength(payload, 'utf8') > 256 * 1024) {
|
|
172
|
+
throw new Error(`Payload exceeds maximum size of 256KB`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
89
175
|
}
|
|
90
176
|
//# sourceMappingURL=invoke.js.map
|
package/dist/invoke.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.js","sourceRoot":"","sources":["../src/invoke.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"invoke.js","sourceRoot":"","sources":["../src/invoke.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAClC,OAAO,MAAM,MAAM,aAAa,CAAA;AAChC,OAAO,EAAC,GAAG,EAAC,MAAM,cAAc,CAAA;AAIhC,IAAI,UAAsD,CAAA;AAE1D,MAAM,aAAa,GAAG,aAAa,CAAA;AACnC,gBAAgB;AAChB,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAA;AAErC;;;GAGG;AACH,SAAS,UAAU;IACjB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,CAAC,KAAK,IAAI,EAAE;YACvB,MAAM,EAAC,OAAO,EAAE,OAAO,EAAC,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAA;YAC3D,OAAO,OAAO,CAAC;gBACb,OAAO,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,MAAM,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;aACtH,CAAC,CAAA;QACJ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACjB,UAAU,GAAG,SAAS,CAAA;YACtB,MAAM,GAAG,CAAA;QACX,CAAC,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,WAAW,CAAC,IAAY,EAAE,GAA0B;IACjE,MAAM,SAAS,GAAG,GAAG,CAAC,cAAc,CAAC,CAAA;IACrC,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA;IAE/D,MAAM,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