@rippling/rippling-sdk 0.2.0-alpha.85 → 0.2.0-alpha.86
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/core/platform/custom-objects/category.d.mts +125 -0
- package/core/platform/custom-objects/category.d.mts.map +1 -0
- package/core/platform/custom-objects/category.d.ts +125 -0
- package/core/platform/custom-objects/category.d.ts.map +1 -0
- package/core/platform/custom-objects/category.js +188 -0
- package/core/platform/custom-objects/category.js.map +1 -0
- package/core/platform/custom-objects/category.mjs +178 -0
- package/core/platform/custom-objects/category.mjs.map +1 -0
- package/core/platform/custom-objects/definition.d.mts +147 -0
- package/core/platform/custom-objects/definition.d.mts.map +1 -0
- package/core/platform/custom-objects/definition.d.ts +147 -0
- package/core/platform/custom-objects/definition.d.ts.map +1 -0
- package/core/platform/custom-objects/definition.js +200 -0
- package/core/platform/custom-objects/definition.js.map +1 -0
- package/core/platform/custom-objects/definition.mjs +190 -0
- package/core/platform/custom-objects/definition.mjs.map +1 -0
- package/core/platform/custom-objects/fields.d.mts +302 -0
- package/core/platform/custom-objects/fields.d.mts.map +1 -0
- package/core/platform/custom-objects/fields.d.ts +302 -0
- package/core/platform/custom-objects/fields.d.ts.map +1 -0
- package/core/platform/custom-objects/fields.js +369 -0
- package/core/platform/custom-objects/fields.js.map +1 -0
- package/core/platform/custom-objects/fields.mjs +347 -0
- package/core/platform/custom-objects/fields.mjs.map +1 -0
- package/core/platform/custom-objects/function-runtime.d.mts +42 -0
- package/core/platform/custom-objects/function-runtime.d.mts.map +1 -0
- package/core/platform/custom-objects/function-runtime.d.ts +42 -0
- package/core/platform/custom-objects/function-runtime.d.ts.map +1 -0
- package/core/platform/custom-objects/function-runtime.js +38 -0
- package/core/platform/custom-objects/function-runtime.js.map +1 -0
- package/core/platform/custom-objects/function-runtime.mjs +35 -0
- package/core/platform/custom-objects/function-runtime.mjs.map +1 -0
- package/core/platform/custom-objects/lifecycle.d.mts +83 -0
- package/core/platform/custom-objects/lifecycle.d.mts.map +1 -0
- package/core/platform/custom-objects/lifecycle.d.ts +83 -0
- package/core/platform/custom-objects/lifecycle.d.ts.map +1 -0
- package/core/platform/custom-objects/lifecycle.js +372 -0
- package/core/platform/custom-objects/lifecycle.js.map +1 -0
- package/core/platform/custom-objects/lifecycle.mjs +367 -0
- package/core/platform/custom-objects/lifecycle.mjs.map +1 -0
- package/core/platform/custom-objects/manager.d.mts +354 -0
- package/core/platform/custom-objects/manager.d.mts.map +1 -0
- package/core/platform/custom-objects/manager.d.ts +354 -0
- package/core/platform/custom-objects/manager.d.ts.map +1 -0
- package/core/platform/custom-objects/manager.js +646 -0
- package/core/platform/custom-objects/manager.js.map +1 -0
- package/core/platform/custom-objects/manager.mjs +637 -0
- package/core/platform/custom-objects/manager.mjs.map +1 -0
- package/core/platform/custom-objects/provisioning.d.mts +138 -0
- package/core/platform/custom-objects/provisioning.d.mts.map +1 -0
- package/core/platform/custom-objects/provisioning.d.ts +138 -0
- package/core/platform/custom-objects/provisioning.d.ts.map +1 -0
- package/core/platform/custom-objects/provisioning.js +455 -0
- package/core/platform/custom-objects/provisioning.js.map +1 -0
- package/core/platform/custom-objects/provisioning.mjs +447 -0
- package/core/platform/custom-objects/provisioning.mjs.map +1 -0
- package/core/platform/custom-objects/rql.d.mts +122 -0
- package/core/platform/custom-objects/rql.d.mts.map +1 -0
- package/core/platform/custom-objects/rql.d.ts +122 -0
- package/core/platform/custom-objects/rql.d.ts.map +1 -0
- package/core/platform/custom-objects/rql.js +225 -0
- package/core/platform/custom-objects/rql.js.map +1 -0
- package/core/platform/custom-objects/rql.mjs +222 -0
- package/core/platform/custom-objects/rql.mjs.map +1 -0
- package/core/platform/custom-objects/schema-manager.d.mts +203 -0
- package/core/platform/custom-objects/schema-manager.d.mts.map +1 -0
- package/core/platform/custom-objects/schema-manager.d.ts +203 -0
- package/core/platform/custom-objects/schema-manager.d.ts.map +1 -0
- package/core/platform/custom-objects/schema-manager.js +256 -0
- package/core/platform/custom-objects/schema-manager.js.map +1 -0
- package/core/platform/custom-objects/schema-manager.mjs +249 -0
- package/core/platform/custom-objects/schema-manager.mjs.map +1 -0
- package/core/platform/custom-objects/typed-rql.d.mts +157 -0
- package/core/platform/custom-objects/typed-rql.d.mts.map +1 -0
- package/core/platform/custom-objects/typed-rql.d.ts +157 -0
- package/core/platform/custom-objects/typed-rql.d.ts.map +1 -0
- package/core/platform/custom-objects/typed-rql.js +583 -0
- package/core/platform/custom-objects/typed-rql.js.map +1 -0
- package/core/platform/custom-objects/typed-rql.mjs +580 -0
- package/core/platform/custom-objects/typed-rql.mjs.map +1 -0
- package/core/platform/custom-objects/types.d.mts +549 -0
- package/core/platform/custom-objects/types.d.mts.map +1 -0
- package/core/platform/custom-objects/types.d.ts +549 -0
- package/core/platform/custom-objects/types.d.ts.map +1 -0
- package/core/platform/custom-objects/types.js +20 -0
- package/core/platform/custom-objects/types.js.map +1 -0
- package/core/platform/custom-objects/types.mjs +17 -0
- package/core/platform/custom-objects/types.mjs.map +1 -0
- package/core/platform/custom-objects/validation.d.mts +97 -0
- package/core/platform/custom-objects/validation.d.mts.map +1 -0
- package/core/platform/custom-objects/validation.d.ts +97 -0
- package/core/platform/custom-objects/validation.d.ts.map +1 -0
- package/core/platform/custom-objects/validation.js +477 -0
- package/core/platform/custom-objects/validation.js.map +1 -0
- package/core/platform/custom-objects/validation.mjs +465 -0
- package/core/platform/custom-objects/validation.mjs.map +1 -0
- package/core/platform/custom-objects.d.mts +67 -0
- package/core/platform/custom-objects.d.mts.map +1 -0
- package/core/platform/custom-objects.d.ts +67 -0
- package/core/platform/custom-objects.d.ts.map +1 -0
- package/core/platform/custom-objects.js +118 -0
- package/core/platform/custom-objects.js.map +1 -0
- package/core/platform/custom-objects.mjs +45 -0
- package/core/platform/custom-objects.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/custom-objects/custom-objects.d.mts +7 -0
- package/resources/custom-objects/custom-objects.d.mts.map +1 -1
- package/resources/custom-objects/custom-objects.d.ts +7 -0
- package/resources/custom-objects/custom-objects.d.ts.map +1 -1
- package/resources/custom-objects/custom-objects.js.map +1 -1
- package/resources/custom-objects/custom-objects.mjs.map +1 -1
- package/resources/custom-objects/fields.d.mts +129 -54
- package/resources/custom-objects/fields.d.mts.map +1 -1
- package/resources/custom-objects/fields.d.ts +129 -54
- package/resources/custom-objects/fields.d.ts.map +1 -1
- package/resources/levels.d.mts +25 -4
- package/resources/levels.d.mts.map +1 -1
- package/resources/levels.d.ts +25 -4
- package/resources/levels.d.ts.map +1 -1
- package/src/core/platform/custom-objects/category.ts +294 -0
- package/src/core/platform/custom-objects/definition.ts +373 -0
- package/src/core/platform/custom-objects/fields.ts +653 -0
- package/src/core/platform/custom-objects/function-runtime.ts +76 -0
- package/src/core/platform/custom-objects/lifecycle.ts +557 -0
- package/src/core/platform/custom-objects/manager.ts +959 -0
- package/src/core/platform/custom-objects/provisioning.ts +672 -0
- package/src/core/platform/custom-objects/rql.ts +375 -0
- package/src/core/platform/custom-objects/schema-manager.ts +351 -0
- package/src/core/platform/custom-objects/typed-rql.ts +1273 -0
- package/src/core/platform/custom-objects/types.ts +753 -0
- package/src/core/platform/custom-objects/validation.ts +573 -0
- package/src/core/platform/custom-objects.ts +269 -0
- package/src/resources/custom-objects/custom-objects.ts +8 -0
- package/src/resources/custom-objects/fields.ts +192 -59
- package/src/resources/levels.ts +28 -4
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { validateCustomObjectDefinition, validateLogicalCategoryName, validateLogicalCustomFieldName, validateLogicalCustomObjectName, } from "./validation.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Recursively freezes author-authored schema definitions.
|
|
4
|
+
*
|
|
5
|
+
* The schema layer is intended to act like durable configuration data rather
|
|
6
|
+
* than mutable runtime state, so this helper aggressively removes mutation as a
|
|
7
|
+
* failure mode after validation succeeds.
|
|
8
|
+
*
|
|
9
|
+
* @typeParam T - Value being frozen.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Deeply freezes a schema fragment after validation succeeds.
|
|
13
|
+
*
|
|
14
|
+
* @param value - Value to recursively freeze in place.
|
|
15
|
+
* @returns The same value, now deeply frozen where applicable.
|
|
16
|
+
* @typeParam T - Value being frozen.
|
|
17
|
+
*/
|
|
18
|
+
function deepFreeze(value) {
|
|
19
|
+
if (value == null || typeof value !== 'object')
|
|
20
|
+
return value;
|
|
21
|
+
for (const child of Object.values(value)) {
|
|
22
|
+
deepFreeze(child);
|
|
23
|
+
}
|
|
24
|
+
return Object.freeze(value);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Appends the platform-required `__c` suffix to a logical custom-object name.
|
|
28
|
+
*
|
|
29
|
+
* @param name - Logical unsuffixed custom-object name.
|
|
30
|
+
* @returns Wire-level custom-object API name with the required `__c` suffix.
|
|
31
|
+
* @typeParam TObjectName - Logical custom-object name to compile.
|
|
32
|
+
*/
|
|
33
|
+
export function toCustomObjectApiName(name) {
|
|
34
|
+
return `${name}__c`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Appends the platform-required `__c` suffix to a logical custom-field name.
|
|
38
|
+
*
|
|
39
|
+
* @param name - Logical unsuffixed custom-field name.
|
|
40
|
+
* @returns Wire-level custom-field API name with the required `__c` suffix.
|
|
41
|
+
* @typeParam TFieldName - Logical custom-field name to compile.
|
|
42
|
+
*/
|
|
43
|
+
export function toCustomFieldApiName(name) {
|
|
44
|
+
return `${name}__c`;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Appends the platform-required `__c` suffix to a logical category name.
|
|
48
|
+
*
|
|
49
|
+
* @param name - Logical unsuffixed category name.
|
|
50
|
+
* @returns Wire-level category API name with the required `__c` suffix.
|
|
51
|
+
* @typeParam TCategoryName - Logical category name to compile.
|
|
52
|
+
*/
|
|
53
|
+
export function toCustomCategoryApiName(name) {
|
|
54
|
+
return `${name}__c`;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Defines an immutable, strongly typed custom-object schema.
|
|
58
|
+
*
|
|
59
|
+
* Callers author only logical snake_case names. The returned value includes the
|
|
60
|
+
* derived wire-level api names so downstream tooling can emit valid manifest
|
|
61
|
+
* payloads without requiring authors to know about the `__c` suffix contract.
|
|
62
|
+
*
|
|
63
|
+
* @typeParam TObjectName - Logical custom-object name for the definition.
|
|
64
|
+
* @typeParam TCategoryName - Logical category name associated with the object.
|
|
65
|
+
* @typeParam TSections - Section map available to field definitions.
|
|
66
|
+
* @typeParam TFields - Field map keyed by logical custom-field names.
|
|
67
|
+
* @param definition - Author-facing typed schema definition to normalize, validate, and freeze.
|
|
68
|
+
* @returns Immutable normalized custom-object definition with compiled field and object API names.
|
|
69
|
+
* @typeParam TNameField - Name-field behavior for the object.
|
|
70
|
+
*/
|
|
71
|
+
export function defineCustomObject(definition) {
|
|
72
|
+
validateLogicalCustomObjectName(definition.name);
|
|
73
|
+
const categoryDefinition = typeof definition.category === 'string' ? undefined : definition.category;
|
|
74
|
+
const categoryName = typeof definition.category === 'string' ? definition.category : definition.category.name;
|
|
75
|
+
const categoryApiName = typeof definition.category === 'string' ?
|
|
76
|
+
toCustomCategoryApiName(definition.category)
|
|
77
|
+
: definition.category.apiName;
|
|
78
|
+
validateLogicalCategoryName(categoryName);
|
|
79
|
+
const resolvedFields = Object.fromEntries(Object.entries(definition.fields).map(([logicalName, field]) => {
|
|
80
|
+
validateLogicalCustomFieldName(logicalName);
|
|
81
|
+
return [
|
|
82
|
+
logicalName,
|
|
83
|
+
{
|
|
84
|
+
...field,
|
|
85
|
+
logicalName,
|
|
86
|
+
apiName: toCustomFieldApiName(logicalName),
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
}));
|
|
90
|
+
const normalized = {
|
|
91
|
+
name: definition.name,
|
|
92
|
+
apiName: toCustomObjectApiName(definition.name),
|
|
93
|
+
displayName: definition.displayName,
|
|
94
|
+
...(definition.pluralLabel != null ? { pluralLabel: definition.pluralLabel } : {}),
|
|
95
|
+
category: categoryName,
|
|
96
|
+
...(categoryDefinition != null ? { categoryDefinition } : {}),
|
|
97
|
+
...(definition.ownerRole != null ? { ownerRole: definition.ownerRole } : {}),
|
|
98
|
+
...(definition.enableHistory != null ? { enableHistory: definition.enableHistory } : {}),
|
|
99
|
+
categoryApiName: categoryApiName,
|
|
100
|
+
description: definition.description,
|
|
101
|
+
...(definition.icon != null ? { icon: definition.icon } : {}),
|
|
102
|
+
nameField: (definition.nameField ?? { kind: 'text' }),
|
|
103
|
+
sections: (definition.sections ?? {}),
|
|
104
|
+
fields: resolvedFields,
|
|
105
|
+
};
|
|
106
|
+
const issues = validateCustomObjectDefinition(normalized);
|
|
107
|
+
if (issues.length > 0) {
|
|
108
|
+
throw new Error(`Invalid custom object definition for "${definition.name}":\n` +
|
|
109
|
+
issues.map((issue) => `- ${issue.path}: ${issue.message}`).join('\n'));
|
|
110
|
+
}
|
|
111
|
+
return deepFreeze(normalized);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Extends an existing object definition without losing type information.
|
|
115
|
+
*
|
|
116
|
+
* This helper is useful when a platform package wants to publish a base schema
|
|
117
|
+
* and another package wants to add fields or sections in a type-safe way.
|
|
118
|
+
*
|
|
119
|
+
* @typeParam TBase - Existing object definition being extended.
|
|
120
|
+
* @typeParam TAddedSections - New section definitions merged into the base object.
|
|
121
|
+
* @param base - Existing typed object definition to extend.
|
|
122
|
+
* @param extension - Additional metadata, sections, and fields to merge into the base definition.
|
|
123
|
+
* @returns New immutable custom-object definition preserving the combined type information.
|
|
124
|
+
* @typeParam TAddedFields - New field definitions merged into the base object.
|
|
125
|
+
*/
|
|
126
|
+
export function extendCustomObject(base, extension) {
|
|
127
|
+
const mergedSections = {
|
|
128
|
+
...base.sections,
|
|
129
|
+
...(extension.sections ?? {}),
|
|
130
|
+
};
|
|
131
|
+
const mergedFields = Object.fromEntries(Object.entries({ ...base.fields, ...(extension.fields ?? {}) }).map(([logicalName, field]) => [
|
|
132
|
+
logicalName,
|
|
133
|
+
{
|
|
134
|
+
...field,
|
|
135
|
+
logicalName,
|
|
136
|
+
apiName: toCustomFieldApiName(logicalName),
|
|
137
|
+
},
|
|
138
|
+
]));
|
|
139
|
+
return defineCustomObject({
|
|
140
|
+
name: base.name,
|
|
141
|
+
displayName: extension.displayName ?? base.displayName,
|
|
142
|
+
...(extension.pluralLabel != null || base.pluralLabel != null ?
|
|
143
|
+
{ pluralLabel: extension.pluralLabel ?? base.pluralLabel }
|
|
144
|
+
: {}),
|
|
145
|
+
...(extension.ownerRole != null || base.ownerRole != null ?
|
|
146
|
+
{ ownerRole: extension.ownerRole ?? base.ownerRole }
|
|
147
|
+
: {}),
|
|
148
|
+
...(extension.enableHistory != null || base.enableHistory != null ?
|
|
149
|
+
{ enableHistory: extension.enableHistory ?? base.enableHistory }
|
|
150
|
+
: {}),
|
|
151
|
+
category: base.categoryDefinition ?? base.category,
|
|
152
|
+
description: extension.description ?? base.description,
|
|
153
|
+
...((extension.icon ?? base.icon) != null ? { icon: extension.icon ?? base.icon } : {}),
|
|
154
|
+
nameField: base.nameField,
|
|
155
|
+
sections: mergedSections,
|
|
156
|
+
fields: mergedFields,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Returns the logical custom field names defined on an object.
|
|
161
|
+
*
|
|
162
|
+
* @param definition - Object definition whose logical field names should be returned.
|
|
163
|
+
* @returns Frozen array of logical field names from the definition.
|
|
164
|
+
* @typeParam TDefinition - Object definition whose field names should be returned.
|
|
165
|
+
*/
|
|
166
|
+
export function fieldNames(definition) {
|
|
167
|
+
return Object.freeze(Object.keys(definition.fields));
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Retrieves a field definition by logical field name with precise typing.
|
|
171
|
+
*
|
|
172
|
+
* @param definition - Object definition that owns the field.
|
|
173
|
+
* @param fieldName - Logical field name to retrieve.
|
|
174
|
+
* @returns Precisely typed field definition for the requested logical field name.
|
|
175
|
+
* @typeParam TDefinition - Object definition that owns the field.
|
|
176
|
+
* @typeParam TFieldName - Logical field name being retrieved.
|
|
177
|
+
*/
|
|
178
|
+
export function getFieldDefinition(definition, fieldName) {
|
|
179
|
+
return definition.fields[fieldName];
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Returns whether one typed field definition is writable by record create/update helpers.
|
|
183
|
+
*
|
|
184
|
+
* @param field - Typed field definition to inspect.
|
|
185
|
+
* @returns Whether the field may be written by callers.
|
|
186
|
+
*/
|
|
187
|
+
export function isWritableField(field) {
|
|
188
|
+
return field.writable;
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=definition.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definition.mjs","sourceRoot":"","sources":["../../../src/core/platform/custom-objects/definition.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,8BAA8B,EAC9B,2BAA2B,EAC3B,8BAA8B,EAC9B,+BAA+B,GAChC,yBAAqB;AA4EtB;;;;;;;;GAQG;AACH;;;;;;GAMG;AACH,SAAS,UAAU,CAAI,KAAQ;IAC7B,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE7D,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAgC,CAAC,EAAE,CAAC;QACpE,UAAU,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAA0C;IAE1C,OAAO,GAAG,IAAI,KAAyC,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAwC;IAExC,OAAO,GAAG,IAAI,KAAK,CAA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aAAa,IAAI,IAAI,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC;YACjE,EAAE,aAAa,EAAE,SAAS,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,EAAE;YAClE,CAAC,CAAC,EAAE,CAAC;QACL,QAAQ,EAAE,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,QAAQ;QAClD,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW;QACtD,GAAG,CAAC,CAAC,SAAS,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvF,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,QAAQ,EAAE,cAAc;QACxB,MAAM,EAAE,YAA6E;KACtF,CAAC,CAAC;AACL,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,UAAuB;IAEvB,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAA8B,CAAC,CAAC;AACpF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAGhC,UAAuB,EAAE,SAAqB;IAC9C,OAAQ,UAAU,CAAC,MAAkC,CAAC,SAAS,CAAsC,CAAC;AACxG,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,KAAyB;IACvD,OAAO,KAAK,CAAC,QAAQ,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import type { CustomObjectFieldDerivedAggregatedField, CustomObjectFieldFormulaAttrMetas, CustomObjectFieldRqlDefinition, CustomObjectFieldSection as RestCustomObjectFieldSection } from "../../../resources/custom-objects/fields.mjs";
|
|
2
|
+
import type { AnyCustomObjectDefinition, BooleanFieldDefinition, CurrencyFieldDefinition, CustomObjectIdentity, DateFieldDefinition, DatetimeFieldDefinition, EmailFieldDefinition, FileFieldDefinition, FormulaFieldDefinition, LongTextFieldDefinition, LookupFieldDefinition, LookupTarget, NativeModelTarget, NumberFieldDefinition, ParentChildFieldDefinition, PercentageFieldDefinition, PhoneFieldDefinition, RadioFieldDefinition, SectionDefinition, SelectFieldDefinition, TextFieldDefinition, TimeFieldDefinition, UrlFieldDefinition } from "./types.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Internal helper for field factories that expose `required` and `section`.
|
|
5
|
+
*
|
|
6
|
+
* @typeParam TRequired - Literal boolean carried through to derived input types.
|
|
7
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
8
|
+
*/
|
|
9
|
+
interface BooleanLikeProps<TRequired extends boolean, TSectionKey extends string | undefined> {
|
|
10
|
+
readonly required?: TRequired;
|
|
11
|
+
readonly section?: TSectionKey;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Internal helper for choice-based field factories.
|
|
15
|
+
*
|
|
16
|
+
* @typeParam TRequired - Literal boolean carried through to derived input types.
|
|
17
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
18
|
+
*/
|
|
19
|
+
interface ChoiceProps<TRequired extends boolean, TSectionKey extends string | undefined> extends BooleanLikeProps<TRequired, TSectionKey> {
|
|
20
|
+
readonly options: readonly string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Internal helper for numeric field factories that support decimal-place metadata.
|
|
24
|
+
*
|
|
25
|
+
* @typeParam TRequired - Literal boolean carried through to derived input types.
|
|
26
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
27
|
+
*/
|
|
28
|
+
interface NumericProps<TRequired extends boolean, TSectionKey extends string | undefined> extends BooleanLikeProps<TRequired, TSectionKey> {
|
|
29
|
+
readonly decimalPlaces?: number;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Internal presentation properties shared by every field factory.
|
|
33
|
+
*
|
|
34
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
35
|
+
*/
|
|
36
|
+
interface CommonFieldProps<TSectionKey extends string | undefined> {
|
|
37
|
+
readonly displayName: string;
|
|
38
|
+
readonly description: string;
|
|
39
|
+
readonly section?: TSectionKey;
|
|
40
|
+
readonly enableHistory?: boolean;
|
|
41
|
+
readonly formulaAttributeMetas?: CustomObjectFieldFormulaAttrMetas;
|
|
42
|
+
readonly derivedAggregatedField?: CustomObjectFieldDerivedAggregatedField;
|
|
43
|
+
readonly rqlDefinition?: CustomObjectFieldRqlDefinition;
|
|
44
|
+
readonly restSection?: RestCustomObjectFieldSection;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Declares a native Rippling model target for lookup fields.
|
|
48
|
+
*
|
|
49
|
+
* @param apiName - Native model API name, for example `'Employee'`.
|
|
50
|
+
* @returns Immutable native-model target descriptor for lookup fields.
|
|
51
|
+
* @typeParam TApiName - Native model api name, for example `'Employee'`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function nativeModel<TApiName extends string>(apiName: TApiName): NativeModelTarget<TApiName>;
|
|
54
|
+
/**
|
|
55
|
+
* Defines a single-line text field.
|
|
56
|
+
*
|
|
57
|
+
* @param props - Text-field metadata and presentation properties.
|
|
58
|
+
* @returns Immutable text field definition.
|
|
59
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
60
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
61
|
+
*/
|
|
62
|
+
export declare function text<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey> & {
|
|
63
|
+
readonly unique?: boolean;
|
|
64
|
+
readonly maxLength?: number;
|
|
65
|
+
}): TextFieldDefinition<TRequired, TSectionKey>;
|
|
66
|
+
/**
|
|
67
|
+
* Defines a multi-line text field.
|
|
68
|
+
*
|
|
69
|
+
* @param props - Long-text field metadata and presentation properties.
|
|
70
|
+
* @returns Immutable long-text field definition.
|
|
71
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
72
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
73
|
+
*/
|
|
74
|
+
export declare function longText<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey> & {
|
|
75
|
+
readonly maxLength?: number;
|
|
76
|
+
}): LongTextFieldDefinition<TRequired, TSectionKey>;
|
|
77
|
+
/**
|
|
78
|
+
* Defines an email-address field.
|
|
79
|
+
*
|
|
80
|
+
* @param props - Email-field metadata and presentation properties.
|
|
81
|
+
* @returns Immutable email field definition.
|
|
82
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
83
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
84
|
+
*/
|
|
85
|
+
export declare function email<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey> & {
|
|
86
|
+
readonly unique?: boolean;
|
|
87
|
+
}): EmailFieldDefinition<TRequired, TSectionKey>;
|
|
88
|
+
/**
|
|
89
|
+
* Defines a URL field.
|
|
90
|
+
*
|
|
91
|
+
* @param props - URL-field metadata and presentation properties.
|
|
92
|
+
* @returns Immutable URL field definition.
|
|
93
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
94
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
95
|
+
*/
|
|
96
|
+
export declare function url<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey>): UrlFieldDefinition<TRequired, TSectionKey>;
|
|
97
|
+
/**
|
|
98
|
+
* Defines a phone-number field.
|
|
99
|
+
*
|
|
100
|
+
* @param props - Phone-field metadata and presentation properties.
|
|
101
|
+
* @returns Immutable phone field definition.
|
|
102
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
103
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
104
|
+
*/
|
|
105
|
+
export declare function phone<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey>): PhoneFieldDefinition<TRequired, TSectionKey>;
|
|
106
|
+
/**
|
|
107
|
+
* Defines a numeric field.
|
|
108
|
+
*
|
|
109
|
+
* @param props - Number-field metadata and presentation properties.
|
|
110
|
+
* @returns Immutable number field definition.
|
|
111
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
112
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
113
|
+
*/
|
|
114
|
+
export declare function number<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & NumericProps<TRequired, TSectionKey> & {
|
|
115
|
+
readonly unique?: boolean;
|
|
116
|
+
}): NumberFieldDefinition<TRequired, TSectionKey>;
|
|
117
|
+
/**
|
|
118
|
+
* Defines a currency field.
|
|
119
|
+
*
|
|
120
|
+
* @param props - Currency-field metadata and presentation properties.
|
|
121
|
+
* @returns Immutable currency field definition.
|
|
122
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
123
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
124
|
+
*/
|
|
125
|
+
export declare function currency<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & NumericProps<TRequired, TSectionKey> & {
|
|
126
|
+
readonly currency?: string;
|
|
127
|
+
}): CurrencyFieldDefinition<TRequired, TSectionKey>;
|
|
128
|
+
/**
|
|
129
|
+
* Defines a percentage field.
|
|
130
|
+
*
|
|
131
|
+
* @param props - Percentage-field metadata and presentation properties.
|
|
132
|
+
* @returns Immutable percentage field definition.
|
|
133
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
134
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
135
|
+
*/
|
|
136
|
+
export declare function percentage<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey>): PercentageFieldDefinition<TRequired, TSectionKey>;
|
|
137
|
+
/**
|
|
138
|
+
* Defines a date-only field.
|
|
139
|
+
*
|
|
140
|
+
* @param props - Date-field metadata and presentation properties.
|
|
141
|
+
* @returns Immutable date field definition.
|
|
142
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
143
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
144
|
+
*/
|
|
145
|
+
export declare function date<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey>): DateFieldDefinition<TRequired, TSectionKey>;
|
|
146
|
+
/**
|
|
147
|
+
* Defines a date-time field.
|
|
148
|
+
*
|
|
149
|
+
* @param props - Datetime-field metadata and presentation properties.
|
|
150
|
+
* @returns Immutable datetime field definition.
|
|
151
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
152
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
153
|
+
*/
|
|
154
|
+
export declare function datetime<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey>): DatetimeFieldDefinition<TRequired, TSectionKey>;
|
|
155
|
+
/**
|
|
156
|
+
* Defines a time-of-day field.
|
|
157
|
+
*
|
|
158
|
+
* @param props - Time-field metadata and presentation properties.
|
|
159
|
+
* @returns Immutable time field definition.
|
|
160
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
161
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
162
|
+
*/
|
|
163
|
+
export declare function time<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey>): TimeFieldDefinition<TRequired, TSectionKey>;
|
|
164
|
+
/**
|
|
165
|
+
* Defines a multi-select choice field.
|
|
166
|
+
*
|
|
167
|
+
* @param props - Multi-select field metadata and presentation properties.
|
|
168
|
+
* @returns Immutable multi-select field definition.
|
|
169
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
170
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
171
|
+
*/
|
|
172
|
+
export declare function select<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & ChoiceProps<TRequired, TSectionKey>): SelectFieldDefinition<TRequired, TSectionKey>;
|
|
173
|
+
/**
|
|
174
|
+
* Defines a single-select radio field.
|
|
175
|
+
*
|
|
176
|
+
* @param props - Radio-field metadata and presentation properties.
|
|
177
|
+
* @returns Immutable radio field definition.
|
|
178
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
179
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
180
|
+
*/
|
|
181
|
+
export declare function radio<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & ChoiceProps<TRequired, TSectionKey>): RadioFieldDefinition<TRequired, TSectionKey>;
|
|
182
|
+
/**
|
|
183
|
+
* Defines a boolean field.
|
|
184
|
+
*
|
|
185
|
+
* @param props - Boolean-field metadata and presentation properties.
|
|
186
|
+
* @returns Immutable boolean field definition.
|
|
187
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
188
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
189
|
+
*/
|
|
190
|
+
export declare function boolean<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey>): BooleanFieldDefinition<TRequired, TSectionKey>;
|
|
191
|
+
/**
|
|
192
|
+
* Defines a file attachment field.
|
|
193
|
+
*
|
|
194
|
+
* @param props - File-field metadata and presentation properties.
|
|
195
|
+
* @returns Immutable file field definition.
|
|
196
|
+
* @typeParam TRequired - Whether the field is required during record creation.
|
|
197
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
198
|
+
*/
|
|
199
|
+
export declare function file<TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey> & {
|
|
200
|
+
readonly allowedType: 'images' | 'documents' | 'any';
|
|
201
|
+
}): FileFieldDefinition<TRequired, TSectionKey>;
|
|
202
|
+
/**
|
|
203
|
+
* Defines a many-to-one lookup field.
|
|
204
|
+
*
|
|
205
|
+
* @param target - Target object or native model referenced by the lookup.
|
|
206
|
+
* @param props - Lookup-field metadata and presentation properties.
|
|
207
|
+
* @returns Immutable lookup field definition.
|
|
208
|
+
* @typeParam TTarget - Target object or native model referenced by the lookup.
|
|
209
|
+
* @typeParam TRequired - Whether the lookup is required during record creation.
|
|
210
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
211
|
+
*/
|
|
212
|
+
export declare function lookup<TTarget extends LookupTarget, TRequired extends boolean = false, TSectionKey extends string | undefined = string | undefined>(target: TTarget, props: CommonFieldProps<TSectionKey> & BooleanLikeProps<TRequired, TSectionKey> & {
|
|
213
|
+
readonly relatedDataLabel?: string;
|
|
214
|
+
readonly lookupFilterRqlCondition?: string;
|
|
215
|
+
}): LookupFieldDefinition<TTarget, TRequired, TSectionKey>;
|
|
216
|
+
/**
|
|
217
|
+
* Defines a parent-child relationship field.
|
|
218
|
+
*
|
|
219
|
+
* @param target - Parent object definition referenced by the relationship.
|
|
220
|
+
* @param props - Parent-child field metadata and presentation properties.
|
|
221
|
+
* @returns Immutable parent-child field definition.
|
|
222
|
+
* @typeParam TTarget - Parent object definition referenced by the relationship.
|
|
223
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
224
|
+
*/
|
|
225
|
+
export declare function parentChild<TTarget extends Pick<AnyCustomObjectDefinition, 'name' | 'apiName'>, TSectionKey extends string | undefined = string | undefined>(target: TTarget, props: CommonFieldProps<TSectionKey> & {
|
|
226
|
+
readonly relatedDataLabel?: string;
|
|
227
|
+
readonly parentChildType?: 'PRIMARY' | 'SECONDARY';
|
|
228
|
+
readonly enableParentOwnerInheritance?: boolean;
|
|
229
|
+
readonly section?: TSectionKey;
|
|
230
|
+
}): ParentChildFieldDefinition<CustomObjectIdentity<TTarget['name']>, TSectionKey>;
|
|
231
|
+
/** Public helper surface for read-only formula fields. */
|
|
232
|
+
export interface FormulaHelpers {
|
|
233
|
+
/**
|
|
234
|
+
* Defines a text-valued formula field.
|
|
235
|
+
*
|
|
236
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
237
|
+
*/
|
|
238
|
+
text<TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & {
|
|
239
|
+
readonly formula: string;
|
|
240
|
+
readonly maxLength: number;
|
|
241
|
+
}): FormulaFieldDefinition<'formula-text', string, TSectionKey>;
|
|
242
|
+
/**
|
|
243
|
+
* Defines a numeric formula field.
|
|
244
|
+
*
|
|
245
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
246
|
+
*/
|
|
247
|
+
number<TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & {
|
|
248
|
+
readonly formula: string;
|
|
249
|
+
}): FormulaFieldDefinition<'formula-number', number, TSectionKey>;
|
|
250
|
+
/**
|
|
251
|
+
* Defines a boolean formula field.
|
|
252
|
+
*
|
|
253
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
254
|
+
*/
|
|
255
|
+
boolean<TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & {
|
|
256
|
+
readonly formula: string;
|
|
257
|
+
}): FormulaFieldDefinition<'formula-boolean', boolean, TSectionKey>;
|
|
258
|
+
/**
|
|
259
|
+
* Defines a currency-valued formula field.
|
|
260
|
+
*
|
|
261
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
262
|
+
*/
|
|
263
|
+
currency<TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & {
|
|
264
|
+
readonly formula: string;
|
|
265
|
+
}): FormulaFieldDefinition<'formula-currency', number, TSectionKey>;
|
|
266
|
+
/**
|
|
267
|
+
* Defines a percentage-valued formula field.
|
|
268
|
+
*
|
|
269
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
270
|
+
*/
|
|
271
|
+
percentage<TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & {
|
|
272
|
+
readonly formula: string;
|
|
273
|
+
}): FormulaFieldDefinition<'formula-percentage', number, TSectionKey>;
|
|
274
|
+
/**
|
|
275
|
+
* Defines a date-valued formula field.
|
|
276
|
+
*
|
|
277
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
278
|
+
*/
|
|
279
|
+
date<TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & {
|
|
280
|
+
readonly formula: string;
|
|
281
|
+
}): FormulaFieldDefinition<'formula-date', string, TSectionKey>;
|
|
282
|
+
/**
|
|
283
|
+
* Defines a URL-valued formula field.
|
|
284
|
+
*
|
|
285
|
+
* @typeParam TSectionKey - Allowed section-key union for the enclosing object.
|
|
286
|
+
*/
|
|
287
|
+
url<TSectionKey extends string | undefined = string | undefined>(props: CommonFieldProps<TSectionKey> & {
|
|
288
|
+
readonly formula: string;
|
|
289
|
+
}): FormulaFieldDefinition<'formula-url', string, TSectionKey>;
|
|
290
|
+
}
|
|
291
|
+
/** Typed helpers for read-only formula fields. */
|
|
292
|
+
export declare const formula: FormulaHelpers;
|
|
293
|
+
/**
|
|
294
|
+
* Immutable helper for authoring section maps in reusable fragments.
|
|
295
|
+
*
|
|
296
|
+
* @param definitions - Section definitions to freeze and preserve as-is.
|
|
297
|
+
* @returns Frozen section-definition map retaining the caller's key/value types.
|
|
298
|
+
* @typeParam TSections - Concrete section map to preserve in the returned value.
|
|
299
|
+
*/
|
|
300
|
+
export declare function sections<TSections extends Readonly<Record<string, SectionDefinition>>>(definitions: TSections): TSections;
|
|
301
|
+
export {};
|
|
302
|
+
//# sourceMappingURL=fields.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.d.mts","sourceRoot":"","sources":["../../../src/core/platform/custom-objects/fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,uCAAuC,EACvC,iCAAiC,EACjC,8BAA8B,EAC9B,wBAAwB,IAAI,4BAA4B,EACzD,qDAAiD;AAClD,OAAO,KAAK,EACV,yBAAyB,EAEzB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EAGtB,uBAAuB,EACvB,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,EAErB,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EACnB,oBAAgB;AAEjB;;;;;GAKG;AACH,UAAU,gBAAgB,CAAC,SAAS,SAAS,OAAO,EAAE,WAAW,SAAS,MAAM,GAAG,SAAS;IAC1F,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC;CAChC;AAED;;;;;GAKG;AACH,UAAU,WAAW,CAAC,SAAS,SAAS,OAAO,EAAE,WAAW,SAAS,MAAM,GAAG,SAAS,CACrF,SAAQ,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC;IAChD,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;;;GAKG;AACH,U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