@osdk/api 2.8.0-beta.9 → 2.8.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/CHANGELOG.md +98 -0
- package/build/browser/aggregate/IntervalRule.js +2 -0
- package/build/browser/aggregate/IntervalRule.js.map +1 -0
- package/build/browser/aggregate/StringFilter.js.map +1 -1
- package/build/browser/aggregate/WhereClause.js.map +1 -1
- package/build/browser/definitions/LinkDefinitions.js.map +1 -1
- package/build/browser/derivedProperties/DerivedProperty.js.map +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/mapping/DataValueMapping.js.map +1 -1
- package/build/browser/object/Media.js.map +1 -1
- package/build/browser/ontology/ActionDefinition.js.map +1 -1
- package/build/browser/ontology/ObjectTypeDefinition.js.map +1 -1
- package/build/browser/ontology/QueryDefinition.js.map +1 -1
- package/build/browser/public/shapes-internal.js +2 -0
- package/build/browser/public/shapes-internal.js.map +1 -0
- package/build/browser/public/unstable.js +2 -0
- package/build/browser/public/unstable.js.map +1 -1
- package/build/browser/queries/Queries.js.map +1 -1
- package/build/browser/shapes/InlineShapeConfig.js +2 -0
- package/build/browser/shapes/InlineShapeConfig.js.map +1 -0
- package/build/browser/shapes/ShapeBuilder.js +243 -0
- package/build/browser/shapes/ShapeBuilder.js.map +1 -0
- package/build/browser/shapes/ShapeDefinition.js +59 -0
- package/build/browser/shapes/ShapeDefinition.js.map +1 -0
- package/build/browser/shapes/computeShapeId.js +97 -0
- package/build/browser/shapes/computeShapeId.js.map +1 -0
- package/build/browser/shapes/configToShapeDefinition.js +115 -0
- package/build/browser/shapes/configToShapeDefinition.js.map +1 -0
- package/build/browser/{definitions/LinkDefinitions.test.js → shapes/index.js} +16 -11
- package/build/browser/shapes/index.js.map +1 -0
- package/build/browser/shapes/internal.js +2 -0
- package/build/browser/shapes/internal.js.map +1 -0
- package/build/browser/test/EmployeeApiTest.js +3 -1
- package/build/browser/test/EmployeeApiTest.js.map +1 -1
- package/build/cjs/{ObjectSet-CqVqDXKn.d.cts → ObjectSet-DxD7I6OR.d.cts} +107 -15
- package/build/cjs/index.d.cts +11 -5
- package/build/cjs/public/shapes-internal.cjs +4 -0
- package/build/cjs/public/shapes-internal.cjs.map +1 -0
- package/build/cjs/public/shapes-internal.d.cts +4 -0
- package/build/cjs/public/unstable.cjs +401 -0
- package/build/cjs/public/unstable.cjs.map +1 -1
- package/build/cjs/public/unstable.d.cts +57 -3
- package/build/cjs/shapes-internal-C7-hN21K.d.cts +152 -0
- package/build/esm/aggregate/IntervalRule.js +2 -0
- package/build/esm/aggregate/IntervalRule.js.map +1 -0
- package/build/esm/aggregate/StringFilter.js.map +1 -1
- package/build/esm/aggregate/WhereClause.js.map +1 -1
- package/build/esm/definitions/LinkDefinitions.js.map +1 -1
- package/build/esm/derivedProperties/DerivedProperty.js.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/mapping/DataValueMapping.js.map +1 -1
- package/build/esm/object/Media.js.map +1 -1
- package/build/esm/ontology/ActionDefinition.js.map +1 -1
- package/build/esm/ontology/ObjectTypeDefinition.js.map +1 -1
- package/build/esm/ontology/QueryDefinition.js.map +1 -1
- package/build/esm/public/shapes-internal.js +2 -0
- package/build/esm/public/shapes-internal.js.map +1 -0
- package/build/esm/public/unstable.js +2 -0
- package/build/esm/public/unstable.js.map +1 -1
- package/build/esm/queries/Queries.js.map +1 -1
- package/build/esm/shapes/InlineShapeConfig.js +2 -0
- package/build/esm/shapes/InlineShapeConfig.js.map +1 -0
- package/build/esm/shapes/ShapeBuilder.js +243 -0
- package/build/esm/shapes/ShapeBuilder.js.map +1 -0
- package/build/esm/shapes/ShapeDefinition.js +59 -0
- package/build/esm/shapes/ShapeDefinition.js.map +1 -0
- package/build/esm/shapes/computeShapeId.js +97 -0
- package/build/esm/shapes/computeShapeId.js.map +1 -0
- package/build/esm/shapes/configToShapeDefinition.js +115 -0
- package/build/esm/shapes/configToShapeDefinition.js.map +1 -0
- package/build/{browser/aggregate/AggregationsClause.test.js → esm/shapes/index.js} +16 -6
- package/build/esm/shapes/index.js.map +1 -0
- package/build/esm/shapes/internal.js +2 -0
- package/build/esm/shapes/internal.js.map +1 -0
- package/build/esm/test/EmployeeApiTest.js +3 -1
- package/build/esm/test/EmployeeApiTest.js.map +1 -1
- package/build/types/aggregate/IntervalRule.d.ts +69 -0
- package/build/types/aggregate/IntervalRule.d.ts.map +1 -0
- package/build/types/aggregate/StringFilter.d.ts +12 -1
- package/build/types/aggregate/StringFilter.d.ts.map +1 -1
- package/build/types/aggregate/WhereClause.d.ts +1 -1
- package/build/types/aggregate/WhereClause.d.ts.map +1 -1
- package/build/types/definitions/LinkDefinitions.d.ts +3 -3
- package/build/types/definitions/LinkDefinitions.d.ts.map +1 -1
- package/build/types/derivedProperties/DerivedProperty.d.ts +1 -10
- package/build/types/derivedProperties/DerivedProperty.d.ts.map +1 -1
- package/build/types/index.d.ts +3 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/mapping/DataValueMapping.d.ts +2 -2
- package/build/types/mapping/DataValueMapping.d.ts.map +1 -1
- package/build/types/object/Media.d.ts +14 -0
- package/build/types/object/Media.d.ts.map +1 -1
- package/build/types/ontology/ActionDefinition.d.ts +2 -0
- package/build/types/ontology/ActionDefinition.d.ts.map +1 -1
- package/build/types/ontology/ObjectTypeDefinition.d.ts +2 -0
- package/build/types/ontology/ObjectTypeDefinition.d.ts.map +1 -1
- package/build/types/ontology/QueryDefinition.d.ts +1 -1
- package/build/types/ontology/QueryDefinition.d.ts.map +1 -1
- package/build/types/public/shapes-internal.d.ts +1 -0
- package/build/types/public/shapes-internal.d.ts.map +1 -0
- package/build/types/public/unstable.d.ts +2 -0
- package/build/types/public/unstable.d.ts.map +1 -1
- package/build/types/queries/Queries.d.ts +2 -0
- package/build/types/queries/Queries.d.ts.map +1 -1
- package/build/types/shapes/InlineShapeConfig.d.ts +29 -0
- package/build/types/shapes/InlineShapeConfig.d.ts.map +1 -0
- package/build/types/shapes/ShapeBuilder.d.ts +21 -0
- package/build/types/shapes/ShapeBuilder.d.ts.map +1 -0
- package/build/types/shapes/ShapeDefinition.d.ts +167 -0
- package/build/types/shapes/ShapeDefinition.d.ts.map +1 -0
- package/build/types/shapes/computeShapeId.d.ts +14 -0
- package/build/types/shapes/computeShapeId.d.ts.map +1 -0
- package/build/types/shapes/configToShapeDefinition.d.ts +6 -0
- package/build/types/shapes/configToShapeDefinition.d.ts.map +1 -0
- package/build/types/shapes/index.d.ts +5 -0
- package/build/types/shapes/index.d.ts.map +1 -0
- package/build/types/shapes/internal.d.ts +1 -0
- package/build/types/shapes/internal.d.ts.map +1 -0
- package/build/types/test/EmployeeApiTest.d.ts +2 -0
- package/build/types/test/EmployeeApiTest.d.ts.map +1 -1
- package/package.json +12 -3
- package/{build/browser/groupby/GroupByClause.test.js → shapes-internal.d.ts} +2 -6
- package/build/browser/OsdkObjectFrom.test.js +0 -204
- package/build/browser/OsdkObjectFrom.test.js.map +0 -1
- package/build/browser/aggregate/AggregationsClause.test.js.map +0 -1
- package/build/browser/definitions/LinkDefinitions.test.js.map +0 -1
- package/build/browser/groupby/GroupByClause.test.js.map +0 -1
- package/build/browser/junk.test.js +0 -23
- package/build/browser/junk.test.js.map +0 -1
- package/build/browser/object/ObjectDefinitions.test.js +0 -28
- package/build/browser/object/ObjectDefinitions.test.js.map +0 -1
- package/build/browser/objectSet/ObjectSet.test.js +0 -736
- package/build/browser/objectSet/ObjectSet.test.js.map +0 -1
- package/build/browser/ontology/ObjectSpecifier.test.js +0 -53
- package/build/browser/ontology/ObjectSpecifier.test.js.map +0 -1
- package/build/browser/ontology/SimplePropertyDef.test.js +0 -48
- package/build/browser/ontology/SimplePropertyDef.test.js.map +0 -1
- package/build/esm/OsdkObjectFrom.test.js +0 -204
- package/build/esm/OsdkObjectFrom.test.js.map +0 -1
- package/build/esm/aggregate/AggregationsClause.test.js +0 -21
- package/build/esm/aggregate/AggregationsClause.test.js.map +0 -1
- package/build/esm/definitions/LinkDefinitions.test.js +0 -26
- package/build/esm/definitions/LinkDefinitions.test.js.map +0 -1
- package/build/esm/groupby/GroupByClause.test.js +0 -21
- package/build/esm/groupby/GroupByClause.test.js.map +0 -1
- package/build/esm/junk.test.js +0 -23
- package/build/esm/junk.test.js.map +0 -1
- package/build/esm/object/ObjectDefinitions.test.js +0 -28
- package/build/esm/object/ObjectDefinitions.test.js.map +0 -1
- package/build/esm/objectSet/ObjectSet.test.js +0 -736
- package/build/esm/objectSet/ObjectSet.test.js.map +0 -1
- package/build/esm/ontology/ObjectSpecifier.test.js +0 -53
- package/build/esm/ontology/ObjectSpecifier.test.js.map +0 -1
- package/build/esm/ontology/SimplePropertyDef.test.js +0 -48
- package/build/esm/ontology/SimplePropertyDef.test.js.map +0 -1
- package/build/types/OsdkObjectFrom.test.d.ts +0 -1
- package/build/types/OsdkObjectFrom.test.d.ts.map +0 -1
- package/build/types/aggregate/AggregationsClause.test.d.ts +0 -46
- package/build/types/aggregate/AggregationsClause.test.d.ts.map +0 -1
- package/build/types/definitions/LinkDefinitions.test.d.ts +0 -1
- package/build/types/definitions/LinkDefinitions.test.d.ts.map +0 -1
- package/build/types/groupby/GroupByClause.test.d.ts +0 -23
- package/build/types/groupby/GroupByClause.test.d.ts.map +0 -1
- package/build/types/junk.test.d.ts +0 -1
- package/build/types/junk.test.d.ts.map +0 -1
- package/build/types/object/ObjectDefinitions.test.d.ts +0 -1
- package/build/types/object/ObjectDefinitions.test.d.ts.map +0 -1
- package/build/types/objectSet/ObjectSet.test.d.ts +0 -2
- package/build/types/objectSet/ObjectSet.test.d.ts.map +0 -1
- package/build/types/ontology/ObjectSpecifier.test.d.ts +0 -1
- package/build/types/ontology/ObjectSpecifier.test.d.ts.map +0 -1
- package/build/types/ontology/SimplePropertyDef.test.d.ts +0 -1
- package/build/types/ontology/SimplePropertyDef.test.d.ts.map +0 -1
|
@@ -28,9 +28,410 @@ var __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks = {
|
|
|
28
28
|
version: "2.0.8"
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
// src/shapes/ShapeDefinition.ts
|
|
32
|
+
var SourcePrimaryKeySymbol = Symbol.for("osdk.query.$sourcePk");
|
|
33
|
+
var LegacyShapesSymbol = Symbol.for("osdk.shapes.$primaryKey");
|
|
34
|
+
function isSourcePkSymbol(value) {
|
|
35
|
+
return typeof value === "symbol" && (value === SourcePrimaryKeySymbol || value === LegacyShapesSymbol);
|
|
36
|
+
}
|
|
37
|
+
var ShapeNullabilityError = class extends Error {
|
|
38
|
+
constructor(shape, violations) {
|
|
39
|
+
const props = violations.map((v) => v.property).join(", ");
|
|
40
|
+
const shapeName = shape.__debugName ?? shape.__shapeId;
|
|
41
|
+
super(`Shape "${shapeName}" requires these properties to be non-null: ${props}`);
|
|
42
|
+
this.shape = shape;
|
|
43
|
+
this.violations = violations;
|
|
44
|
+
this.name = "ShapeNullabilityError";
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/shapes/computeShapeId.ts
|
|
49
|
+
function sortedStringify(obj) {
|
|
50
|
+
return JSON.stringify(obj, (_, v) => v && typeof v === "object" && !Array.isArray(v) ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => a.localeCompare(b))) : v);
|
|
51
|
+
}
|
|
52
|
+
function computeShapeId(input) {
|
|
53
|
+
const canonical = canonicalizeShapeInput(input);
|
|
54
|
+
return simpleHash(sortedStringify(canonical));
|
|
55
|
+
}
|
|
56
|
+
function canonicalizeShapeInput(input) {
|
|
57
|
+
const sortedPropKeys = [...Object.keys(input.props)].sort();
|
|
58
|
+
const canonicalProps = {};
|
|
59
|
+
for (const key of sortedPropKeys) {
|
|
60
|
+
const config = input.props[key];
|
|
61
|
+
const op = config.nullabilityOp;
|
|
62
|
+
canonicalProps[key] = op.type === "withDefault" ? {
|
|
63
|
+
type: op.type,
|
|
64
|
+
defaultValue: op.defaultValue
|
|
65
|
+
} : op.type;
|
|
66
|
+
}
|
|
67
|
+
const canonicalLinks = input.derivedLinks.map((link) => ({
|
|
68
|
+
name: link.name,
|
|
69
|
+
objectSetDef: canonicalizeObjectSetDef(link.objectSetDef),
|
|
70
|
+
targetShapeId: link.targetShape.__shapeId
|
|
71
|
+
}));
|
|
72
|
+
canonicalLinks.sort((a, b) => a.name.localeCompare(b.name));
|
|
73
|
+
return {
|
|
74
|
+
baseType: input.baseTypeApiName,
|
|
75
|
+
props: canonicalProps,
|
|
76
|
+
links: canonicalLinks
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function canonicalizeObjectSetDef(def) {
|
|
80
|
+
const result = {
|
|
81
|
+
segments: def.segments.map((seg) => ({
|
|
82
|
+
type: seg.type,
|
|
83
|
+
linkName: seg.linkName,
|
|
84
|
+
sourceType: seg.sourceType
|
|
85
|
+
}))
|
|
86
|
+
};
|
|
87
|
+
if (def.where) {
|
|
88
|
+
result.where = JSON.parse(sortedStringify(def.where));
|
|
89
|
+
}
|
|
90
|
+
if (def.orderBy && def.orderBy.length > 0) {
|
|
91
|
+
result.orderBy = def.orderBy.map((o) => ({
|
|
92
|
+
property: o.property,
|
|
93
|
+
direction: o.direction
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
if (def.limit !== void 0) {
|
|
97
|
+
result.limit = def.limit;
|
|
98
|
+
}
|
|
99
|
+
if (def.distinct) {
|
|
100
|
+
result.distinct = true;
|
|
101
|
+
}
|
|
102
|
+
if (def.setOperations && def.setOperations.length > 0) {
|
|
103
|
+
result.setOperations = def.setOperations.map((op) => ({
|
|
104
|
+
type: op.type,
|
|
105
|
+
other: canonicalizeObjectSetDef(op.other)
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
function simpleHash(str) {
|
|
111
|
+
let hash = 5381;
|
|
112
|
+
for (let i = 0; i < str.length; i++) {
|
|
113
|
+
const char = str.charCodeAt(i);
|
|
114
|
+
hash = (hash << 5) + hash ^ char;
|
|
115
|
+
}
|
|
116
|
+
const positiveHash = hash >>> 0;
|
|
117
|
+
return positiveHash.toString(16).padStart(8, "0");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// src/shapes/ShapeBuilder.ts
|
|
121
|
+
var ShapeBuilderImpl = class _ShapeBuilderImpl {
|
|
122
|
+
#state;
|
|
123
|
+
constructor(state) {
|
|
124
|
+
this.#state = state;
|
|
125
|
+
}
|
|
126
|
+
#addProps(props, type) {
|
|
127
|
+
const newProps = {
|
|
128
|
+
...this.#state.props
|
|
129
|
+
};
|
|
130
|
+
for (const prop of props) {
|
|
131
|
+
newProps[prop] = {
|
|
132
|
+
nullabilityOp: {
|
|
133
|
+
type
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return newProps;
|
|
138
|
+
}
|
|
139
|
+
select(...props) {
|
|
140
|
+
return new _ShapeBuilderImpl({
|
|
141
|
+
...this.#state,
|
|
142
|
+
props: this.#addProps(props, "select")
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
require(...props) {
|
|
146
|
+
return new _ShapeBuilderImpl({
|
|
147
|
+
...this.#state,
|
|
148
|
+
props: this.#addProps(props, "require")
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
dropIfNull(...props) {
|
|
152
|
+
return new _ShapeBuilderImpl({
|
|
153
|
+
...this.#state,
|
|
154
|
+
props: this.#addProps(props, "dropIfNull")
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
withDefault(prop, defaultValue) {
|
|
158
|
+
return new _ShapeBuilderImpl({
|
|
159
|
+
...this.#state,
|
|
160
|
+
props: {
|
|
161
|
+
...this.#state.props,
|
|
162
|
+
[prop]: {
|
|
163
|
+
nullabilityOp: {
|
|
164
|
+
type: "withDefault",
|
|
165
|
+
defaultValue
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
withTransform(prop, transform) {
|
|
172
|
+
return new _ShapeBuilderImpl({
|
|
173
|
+
...this.#state,
|
|
174
|
+
props: {
|
|
175
|
+
...this.#state.props,
|
|
176
|
+
[prop]: {
|
|
177
|
+
nullabilityOp: {
|
|
178
|
+
type: "withTransform",
|
|
179
|
+
transform
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
deriveLink(name, builder) {
|
|
186
|
+
const linkBuilder = createShapeLinkBuilder(this.#state.baseTypeApiName);
|
|
187
|
+
const linkResult = builder(linkBuilder);
|
|
188
|
+
return new _ShapeBuilderImpl({
|
|
189
|
+
...this.#state,
|
|
190
|
+
props: {
|
|
191
|
+
...this.#state.props
|
|
192
|
+
},
|
|
193
|
+
derivedLinks: [...this.#state.derivedLinks, {
|
|
194
|
+
name,
|
|
195
|
+
objectSetDef: linkResult.objectSetDef,
|
|
196
|
+
targetShape: linkResult.targetShape,
|
|
197
|
+
config: linkResult.config
|
|
198
|
+
}]
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
build() {
|
|
202
|
+
const shapeId = computeShapeId({
|
|
203
|
+
baseTypeApiName: this.#state.baseTypeApiName,
|
|
204
|
+
props: this.#state.props,
|
|
205
|
+
derivedLinks: this.#state.derivedLinks
|
|
206
|
+
});
|
|
207
|
+
return {
|
|
208
|
+
__shapeId: shapeId,
|
|
209
|
+
__debugName: this.#state.debugName,
|
|
210
|
+
__baseType: this.#state.baseType,
|
|
211
|
+
__baseTypeApiName: this.#state.baseTypeApiName,
|
|
212
|
+
__props: Object.freeze({
|
|
213
|
+
...this.#state.props
|
|
214
|
+
}),
|
|
215
|
+
__derivedLinks: Object.freeze([...this.#state.derivedLinks]),
|
|
216
|
+
__selectedPropsType: {},
|
|
217
|
+
__derivedLinksType: {}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
var ShapeLinkBuilderImpl = class _ShapeLinkBuilderImpl {
|
|
222
|
+
#state;
|
|
223
|
+
$primaryKey = SourcePrimaryKeySymbol;
|
|
224
|
+
constructor(state) {
|
|
225
|
+
this.#state = state;
|
|
226
|
+
}
|
|
227
|
+
pivotTo(link) {
|
|
228
|
+
const newSegments = [...this.#state.segments, {
|
|
229
|
+
type: "pivotTo",
|
|
230
|
+
linkName: link,
|
|
231
|
+
sourceType: this.#state.currentTypeApiName
|
|
232
|
+
// targetType is resolved at link execution time when link metadata is available
|
|
233
|
+
}];
|
|
234
|
+
return new _ShapeLinkBuilderImpl({
|
|
235
|
+
...this.#state,
|
|
236
|
+
segments: newSegments,
|
|
237
|
+
// currentTypeApiName is a hint for debugging; actual type resolution happens at execution
|
|
238
|
+
currentTypeApiName: `${this.#state.currentTypeApiName}.${link}`
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/** Sets the where filter for this link. Calling multiple times replaces the previous clause (last-write-wins). */
|
|
242
|
+
where(clause) {
|
|
243
|
+
return new _ShapeLinkBuilderImpl({
|
|
244
|
+
...this.#state,
|
|
245
|
+
where: clause
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
#setOp(type, others) {
|
|
249
|
+
return new _ShapeLinkBuilderImpl({
|
|
250
|
+
...this.#state,
|
|
251
|
+
setOperations: [...this.#state.setOperations, ...others.map((other) => ({
|
|
252
|
+
type,
|
|
253
|
+
other: other.toObjectSetDef()
|
|
254
|
+
}))]
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
union(...others) {
|
|
258
|
+
return this.#setOp("union", others);
|
|
259
|
+
}
|
|
260
|
+
intersect(...others) {
|
|
261
|
+
return this.#setOp("intersect", others);
|
|
262
|
+
}
|
|
263
|
+
subtract(...others) {
|
|
264
|
+
return this.#setOp("subtract", others);
|
|
265
|
+
}
|
|
266
|
+
orderBy(property, direction = "asc") {
|
|
267
|
+
return new _ShapeLinkBuilderImpl({
|
|
268
|
+
...this.#state,
|
|
269
|
+
orderBy: [...this.#state.orderBy, {
|
|
270
|
+
property,
|
|
271
|
+
direction
|
|
272
|
+
}]
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
limit(n) {
|
|
276
|
+
if (!Number.isInteger(n) || n <= 0) {
|
|
277
|
+
throw new Error(`ShapeLinkBuilder.limit() requires a positive integer, got: ${n}`);
|
|
278
|
+
}
|
|
279
|
+
return new _ShapeLinkBuilderImpl({
|
|
280
|
+
...this.#state,
|
|
281
|
+
limit: n
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
distinct() {
|
|
285
|
+
return new _ShapeLinkBuilderImpl({
|
|
286
|
+
...this.#state,
|
|
287
|
+
distinct: true
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
as(shape, config = {}) {
|
|
291
|
+
return {
|
|
292
|
+
targetShape: shape,
|
|
293
|
+
objectSetDef: this.toObjectSetDef(),
|
|
294
|
+
config
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
toObjectSetDef() {
|
|
298
|
+
return {
|
|
299
|
+
segments: Object.freeze([...this.#state.segments]),
|
|
300
|
+
where: this.#state.where,
|
|
301
|
+
orderBy: this.#state.orderBy.length > 0 ? Object.freeze([...this.#state.orderBy]) : void 0,
|
|
302
|
+
limit: this.#state.limit,
|
|
303
|
+
distinct: this.#state.distinct || void 0,
|
|
304
|
+
setOperations: this.#state.setOperations.length > 0 ? Object.freeze([...this.#state.setOperations]) : void 0
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
};
|
|
308
|
+
function createShapeLinkBuilder(sourceTypeApiName) {
|
|
309
|
+
return new ShapeLinkBuilderImpl({
|
|
310
|
+
sourceTypeApiName,
|
|
311
|
+
currentTypeApiName: sourceTypeApiName,
|
|
312
|
+
segments: [],
|
|
313
|
+
orderBy: [],
|
|
314
|
+
distinct: false,
|
|
315
|
+
setOperations: []
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
function createShapeBuilder(baseType, debugName) {
|
|
319
|
+
const state = {
|
|
320
|
+
baseType,
|
|
321
|
+
baseTypeApiName: baseType.apiName,
|
|
322
|
+
debugName,
|
|
323
|
+
props: {},
|
|
324
|
+
derivedLinks: []
|
|
325
|
+
};
|
|
326
|
+
return new ShapeBuilderImpl(state);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// src/shapes/configToShapeDefinition.ts
|
|
330
|
+
function configToShapeDefinition(baseType, config) {
|
|
331
|
+
const baseTypeApiName = baseType.apiName;
|
|
332
|
+
const props = {};
|
|
333
|
+
const seen = /* @__PURE__ */ new Set();
|
|
334
|
+
function addProp(prop, config2) {
|
|
335
|
+
if (seen.has(prop)) {
|
|
336
|
+
throw new Error(`Property "${prop}" appears in multiple config arrays`);
|
|
337
|
+
}
|
|
338
|
+
seen.add(prop);
|
|
339
|
+
props[prop] = config2;
|
|
340
|
+
}
|
|
341
|
+
if (config.require) {
|
|
342
|
+
for (const prop of config.require) {
|
|
343
|
+
addProp(prop, {
|
|
344
|
+
nullabilityOp: {
|
|
345
|
+
type: "require"
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (config.select) {
|
|
351
|
+
for (const prop of config.select) {
|
|
352
|
+
addProp(prop, {
|
|
353
|
+
nullabilityOp: {
|
|
354
|
+
type: "select"
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (config.dropIfNull) {
|
|
360
|
+
for (const prop of config.dropIfNull) {
|
|
361
|
+
addProp(prop, {
|
|
362
|
+
nullabilityOp: {
|
|
363
|
+
type: "dropIfNull"
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (config.defaults) {
|
|
369
|
+
for (const [prop, defaultValue] of Object.entries(config.defaults)) {
|
|
370
|
+
addProp(prop, {
|
|
371
|
+
nullabilityOp: {
|
|
372
|
+
type: "withDefault",
|
|
373
|
+
defaultValue
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (config.transforms) {
|
|
379
|
+
for (const [prop, transform] of Object.entries(config.transforms)) {
|
|
380
|
+
if (typeof transform !== "function") {
|
|
381
|
+
throw new Error(`transforms["${prop}"] must be a function, got: ${typeof transform}`);
|
|
382
|
+
}
|
|
383
|
+
addProp(prop, {
|
|
384
|
+
nullabilityOp: {
|
|
385
|
+
type: "withTransform",
|
|
386
|
+
transform
|
|
387
|
+
}
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
const derivedLinks = [];
|
|
392
|
+
if (config.links) {
|
|
393
|
+
for (const [name, linkConfig] of Object.entries(config.links)) {
|
|
394
|
+
const linkBuilder = createShapeLinkBuilder(baseTypeApiName);
|
|
395
|
+
const traversed = linkConfig.via(linkBuilder);
|
|
396
|
+
const objectSetDef = traversed.toObjectSetDef();
|
|
397
|
+
const targetShape = linkConfig.target;
|
|
398
|
+
derivedLinks.push({
|
|
399
|
+
name,
|
|
400
|
+
objectSetDef,
|
|
401
|
+
targetShape,
|
|
402
|
+
config: {
|
|
403
|
+
defer: linkConfig.defer
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
const shapeId = computeShapeId({
|
|
409
|
+
baseTypeApiName,
|
|
410
|
+
props,
|
|
411
|
+
derivedLinks
|
|
412
|
+
});
|
|
413
|
+
return {
|
|
414
|
+
__shapeId: shapeId,
|
|
415
|
+
__debugName: void 0,
|
|
416
|
+
__baseType: baseType,
|
|
417
|
+
__baseTypeApiName: baseTypeApiName,
|
|
418
|
+
__props: Object.freeze({
|
|
419
|
+
...props
|
|
420
|
+
}),
|
|
421
|
+
__derivedLinks: Object.freeze([...derivedLinks]),
|
|
422
|
+
__selectedPropsType: {},
|
|
423
|
+
__derivedLinksType: {}
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
exports.ShapeNullabilityError = ShapeNullabilityError;
|
|
428
|
+
exports.SourcePrimaryKeySymbol = SourcePrimaryKeySymbol;
|
|
31
429
|
exports.__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference = __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference;
|
|
32
430
|
exports.__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid = __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid;
|
|
33
431
|
exports.__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid = __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid;
|
|
34
432
|
exports.__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks = __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks;
|
|
433
|
+
exports.configToShapeDefinition = configToShapeDefinition;
|
|
434
|
+
exports.createShapeBuilder = createShapeBuilder;
|
|
435
|
+
exports.isSourcePkSymbol = isSourcePkSymbol;
|
|
35
436
|
//# sourceMappingURL=unstable.cjs.map
|
|
36
437
|
//# sourceMappingURL=unstable.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/experimental/createMediaReference.ts","../../../src/experimental/fetchOneByRid.ts","../../../src/experimental/fetchPageByRid.ts","../../../src/experimental/getBulkLinks.ts"],"names":[],"mappings":";;;AA6BO,IAAM,uDAA0D,GAAA;AAAA,EACrE,IAAM,EAAA,yDAAA;AAAA,EACN,IAAM,EAAA,YAAA;AAAA,EACN,OAAS,EAAA;AACX;;;ACjBO,IAAM,gDAAmD,GAAA;AAAA,EAC9D,IAAM,EAAA,kDAAA;AAAA,EACN,IAAM,EAAA,YAAA;AAAA,EACN,OAAS,EAAA;AACX;;;ACJO,IAAM,iDAAoD,GAAA;AAAA,EAC/D,IAAM,EAAA,mDAAA;AAAA,EACN,IAAM,EAAA,YAAA;AAAA,EACN,OAAS,EAAA;AACX;;;ACJO,IAAM,+CAAkD,GAAA;AAAA,EAC7D,IAAM,EAAA,iDAAA;AAAA,EACN,IAAM,EAAA,YAAA;AAAA,EACN,OAAS,EAAA;AACX","file":"unstable.cjs","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @experimental This feature is experimental and might change in the future.\n *\n * Uploads a media item to the media property of the specified object type.\n *\n * @param data - Data to upload as media item\n * @param fileName - Name that will be assigned as path to the uploaded media item.\n * @param objectType - Object type to which the media item will be uploaded.\n * @param propertyType - Media reference property of the corresponding object type to which the media item will be uploaded.\n *\n * @returns media reference of the uploaded media item.\n */\n\nexport const __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference = {\n name: \"__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference\",\n type: \"experiment\",\n version: \"2.1.0\"\n};","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid = {\n name: \"__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid\",\n type: \"experiment\",\n version: \"2.1.0\"\n};","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid = {\n name: \"__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid\",\n type: \"experiment\",\n version: \"2.2.0\"\n};","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks = {\n name: \"__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks\",\n type: \"experiment\",\n version: \"2.0.8\"\n};"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/experimental/createMediaReference.ts","../../../src/experimental/fetchOneByRid.ts","../../../src/experimental/fetchPageByRid.ts","../../../src/experimental/getBulkLinks.ts","../../../src/shapes/ShapeDefinition.ts","../../../src/shapes/computeShapeId.ts","../../../src/shapes/ShapeBuilder.ts","../../../src/shapes/configToShapeDefinition.ts"],"names":[],"mappings":";;;AA6BO,IAAM,uDAA0D,GAAA;AAAA,EACrE,IAAM,EAAA,yDAAA;AAAA,EACN,IAAM,EAAA,YAAA;AAAA,EACN,OAAS,EAAA;AACX;;;ACjBO,IAAM,gDAAmD,GAAA;AAAA,EAC9D,IAAM,EAAA,kDAAA;AAAA,EACN,IAAM,EAAA,YAAA;AAAA,EACN,OAA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MAAM,eAAe,EAAC;AACtB,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IAAW,KAAA,MAAA,CAAC,MAAM,UAAU,CAAA,IAAK,OAAO,OAAQ,CAAA,MAAA,CAAO,KAAK,CAAG,EAAA;AAC7D,MAAM,MAAA,WAAA,GAAc,uBAAuB,eAAe,CAAA;AAC1D,MAAM,MAAA,SAAA,GAAY,UAAW,CAAA,GAAA,CAAI,WAAW,CAAA;AAC5C,MAAM,MAAA,YAAA,GAAe,UAAU,cAAe,EAAA;AAC9C,MAAA,MAAM,cAAc,UAAW,CAAA,MAAA;AAC/B,MAAA,YAAA,CAAa,IAAK,CAAA;AAAA,QAChB,IAAA;AAAA,QACA,YAAA;AAAA,QACA,WAAA;AAAA,QACA,MAAQ,EAAA;AAAA,UACN,OAAO,UAAW,CAAA;AAAA;AACpB,OACD,CAAA;AAAA;AACH;AAEF,EAAA,MAAM,UAAU,cAAe,CAAA;AAAA,IAC7B,eAAA;AAAA,IACA,KAAA;AAAA,IACA;AAAA,GACD,CAAA;AACD,EAAO,OAAA;AAAA,IACL,SAAW,EAAA,OAAA;AAAA,IACX,WAAa,EAAA,MAAA;AAAA,IACb,UAAY,EAAA,QAAA;AAAA,IACZ,iBAAmB,EAAA,eAAA;AAAA,IACnB,OAAA,EAAS,OAAO,MAAO,CAAA;AAAA,MACrB,GAAG;AAAA,KACJ,CAAA;AAAA,IACD,gBAAgB,MAAO,CAAA,MAAA,CAAO,CAAC,GAAG,YAAY,CAAC,CAAA;AAAA,IAC/C,qBAAqB,EAAC;AAAA,IACtB,oBAAoB;AAAC,GACvB;AACF","file":"unstable.cjs","sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * @experimental This feature is experimental and might change in the future.\n *\n * Uploads a media item to the media property of the specified object type.\n *\n * @param data - Data to upload as media item\n * @param fileName - Name that will be assigned as path to the uploaded media item.\n * @param objectType - Object type to which the media item will be uploaded.\n * @param propertyType - Media reference property of the corresponding object type to which the media item will be uploaded.\n *\n * @returns media reference of the uploaded media item.\n */\n\nexport const __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference = {\n name: \"__EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference\",\n type: \"experiment\",\n version: \"2.1.0\"\n};","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid = {\n name: \"__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid\",\n type: \"experiment\",\n version: \"2.1.0\"\n};","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid = {\n name: \"__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid\",\n type: \"experiment\",\n version: \"2.2.0\"\n};","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks = {\n name: \"__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks\",\n type: \"experiment\",\n version: \"2.0.8\"\n};","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const SourcePrimaryKeySymbol = Symbol.for(\"osdk.query.$sourcePk\");\nconst LegacyShapesSymbol = Symbol.for(\"osdk.shapes.$primaryKey\");\nexport function isSourcePkSymbol(value) {\n return typeof value === \"symbol\" && (value === SourcePrimaryKeySymbol || value === LegacyShapesSymbol);\n}\n\n/** Configuration for how a derived link is loaded at runtime. */\n\n/** The result of calling `ShapeLinkBuilder.as()`, binding a link traversal to a target shape. */\n\n/** A single link traversal step in a derived link's object set definition. */\n\n/** Sort clause for a derived link's result set. */\n\n/** A set operation (union/intersect/subtract) applied to a derived link's object set. */\n\n/** Serializable definition of a derived link's object set: link traversals, filters, ordering, and set operations. */\n\n/** How a shape handles null values for a selected property. */\n\n/** Per-property configuration stored in a shape's `__props` map. */\n\n/** A derived link definition stored in a shape's `__derivedLinks` array. */\n\n/**\n * Type projection from an OSDK type. `__props` is the single source of truth for property config.\n *\n * @typeParam BASE - The base ObjectTypeDefinition or InterfaceDefinition\n * @typeParam SELECTED_PROPS - Record of selected properties and their transformed types\n * @typeParam DERIVED_LINKS - Record of derived link names to their result types\n */\n\nexport class ShapeNullabilityError extends Error {\n constructor(shape, violations) {\n const props = violations.map(v => v.property).join(\", \");\n const shapeName = shape.__debugName ?? shape.__shapeId;\n super(`Shape \"${shapeName}\" requires these properties to be non-null: ${props}`);\n this.shape = shape;\n this.violations = violations;\n this.name = \"ShapeNullabilityError\";\n }\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nfunction sortedStringify(obj) {\n return JSON.stringify(obj, (_, v) => v && typeof v === \"object\" && !Array.isArray(v) ? Object.fromEntries(Object.entries(v).sort(([a], [b]) => a.localeCompare(b))) : v);\n}\n\n/**\n * Computes a stable, deterministic identifier for a shape definition.\n * The ID uniquely represents the combination of base type, property\n * selections/nullability configs, and derived link definitions so\n * that identical shapes produce the same ID across calls.\n */\nexport function computeShapeId(input) {\n const canonical = canonicalizeShapeInput(input);\n return simpleHash(sortedStringify(canonical));\n}\nfunction canonicalizeShapeInput(input) {\n const sortedPropKeys = [...Object.keys(input.props)].sort();\n const canonicalProps = {};\n for (const key of sortedPropKeys) {\n const config = input.props[key];\n const op = config.nullabilityOp;\n canonicalProps[key] = op.type === \"withDefault\" ? {\n type: op.type,\n defaultValue: op.defaultValue\n } : op.type;\n }\n const canonicalLinks = input.derivedLinks.map(link => ({\n name: link.name,\n objectSetDef: canonicalizeObjectSetDef(link.objectSetDef),\n targetShapeId: link.targetShape.__shapeId\n }));\n canonicalLinks.sort((a, b) => a.name.localeCompare(b.name));\n return {\n baseType: input.baseTypeApiName,\n props: canonicalProps,\n links: canonicalLinks\n };\n}\nfunction canonicalizeObjectSetDef(def) {\n const result = {\n segments: def.segments.map(seg => ({\n type: seg.type,\n linkName: seg.linkName,\n sourceType: seg.sourceType\n }))\n };\n if (def.where) {\n result.where = JSON.parse(sortedStringify(def.where));\n }\n if (def.orderBy && def.orderBy.length > 0) {\n result.orderBy = def.orderBy.map(o => ({\n property: o.property,\n direction: o.direction\n }));\n }\n if (def.limit !== undefined) {\n result.limit = def.limit;\n }\n if (def.distinct) {\n result.distinct = true;\n }\n if (def.setOperations && def.setOperations.length > 0) {\n result.setOperations = def.setOperations.map(op => ({\n type: op.type,\n other: canonicalizeObjectSetDef(op.other)\n }));\n }\n return result;\n}\n\n// Shape IDs are used for cache keying and equality, not security,\n// so 32-bit is sufficient.\nfunction simpleHash(str) {\n let hash = 5381;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) + hash ^ char;\n }\n const positiveHash = hash >>> 0;\n return positiveHash.toString(16).padStart(8, \"0\");\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { computeShapeId } from \"./computeShapeId.js\";\nimport { SourcePrimaryKeySymbol } from \"./ShapeDefinition.js\";\nclass ShapeBuilderImpl {\n #state;\n constructor(state) {\n this.#state = state;\n }\n #addProps(props, type) {\n const newProps = {\n ...this.#state.props\n };\n for (const prop of props) {\n newProps[prop] = {\n nullabilityOp: {\n type\n }\n };\n }\n return newProps;\n }\n select(...props) {\n return new ShapeBuilderImpl({\n ...this.#state,\n props: this.#addProps(props, \"select\")\n });\n }\n require(...props) {\n return new ShapeBuilderImpl({\n ...this.#state,\n props: this.#addProps(props, \"require\")\n });\n }\n dropIfNull(...props) {\n return new ShapeBuilderImpl({\n ...this.#state,\n props: this.#addProps(props, \"dropIfNull\")\n });\n }\n withDefault(prop, defaultValue) {\n return new ShapeBuilderImpl({\n ...this.#state,\n props: {\n ...this.#state.props,\n [prop]: {\n nullabilityOp: {\n type: \"withDefault\",\n defaultValue\n }\n }\n }\n });\n }\n withTransform(prop, transform) {\n return new ShapeBuilderImpl({\n ...this.#state,\n props: {\n ...this.#state.props,\n [prop]: {\n nullabilityOp: {\n type: \"withTransform\",\n transform\n }\n }\n }\n });\n }\n deriveLink(name, builder) {\n const linkBuilder = createShapeLinkBuilder(this.#state.baseTypeApiName);\n const linkResult = builder(linkBuilder);\n return new ShapeBuilderImpl({\n ...this.#state,\n props: {\n ...this.#state.props\n },\n derivedLinks: [...this.#state.derivedLinks, {\n name,\n objectSetDef: linkResult.objectSetDef,\n targetShape: linkResult.targetShape,\n config: linkResult.config\n }]\n });\n }\n build() {\n const shapeId = computeShapeId({\n baseTypeApiName: this.#state.baseTypeApiName,\n props: this.#state.props,\n derivedLinks: this.#state.derivedLinks\n });\n return {\n __shapeId: shapeId,\n __debugName: this.#state.debugName,\n __baseType: this.#state.baseType,\n __baseTypeApiName: this.#state.baseTypeApiName,\n __props: Object.freeze({\n ...this.#state.props\n }),\n __derivedLinks: Object.freeze([...this.#state.derivedLinks]),\n __selectedPropsType: {},\n __derivedLinksType: {}\n };\n }\n}\nclass ShapeLinkBuilderImpl {\n #state;\n $primaryKey = SourcePrimaryKeySymbol;\n constructor(state) {\n this.#state = state;\n }\n pivotTo(link) {\n const newSegments = [...this.#state.segments, {\n type: \"pivotTo\",\n linkName: link,\n sourceType: this.#state.currentTypeApiName\n // targetType is resolved at link execution time when link metadata is available\n }];\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n segments: newSegments,\n // currentTypeApiName is a hint for debugging; actual type resolution happens at execution\n currentTypeApiName: `${this.#state.currentTypeApiName}.${link}`\n });\n }\n\n /** Sets the where filter for this link. Calling multiple times replaces the previous clause (last-write-wins). */\n where(clause) {\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n where: clause\n });\n }\n #setOp(type, others) {\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n setOperations: [...this.#state.setOperations, ...others.map(other => ({\n type,\n other: other.toObjectSetDef()\n }))]\n });\n }\n union(...others) {\n return this.#setOp(\"union\", others);\n }\n intersect(...others) {\n return this.#setOp(\"intersect\", others);\n }\n subtract(...others) {\n return this.#setOp(\"subtract\", others);\n }\n orderBy(property, direction = \"asc\") {\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n orderBy: [...this.#state.orderBy, {\n property: property,\n direction\n }]\n });\n }\n limit(n) {\n if (!Number.isInteger(n) || n <= 0) {\n throw new Error(`ShapeLinkBuilder.limit() requires a positive integer, got: ${n}`);\n }\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n limit: n\n });\n }\n distinct() {\n return new ShapeLinkBuilderImpl({\n ...this.#state,\n distinct: true\n });\n }\n as(shape, config = {}) {\n // The brand is a compile-time only marker, at runtime it's just undefined\n return {\n targetShape: shape,\n objectSetDef: this.toObjectSetDef(),\n config\n };\n }\n toObjectSetDef() {\n return {\n segments: Object.freeze([...this.#state.segments]),\n where: this.#state.where,\n orderBy: this.#state.orderBy.length > 0 ? Object.freeze([...this.#state.orderBy]) : undefined,\n limit: this.#state.limit,\n distinct: this.#state.distinct || undefined,\n setOperations: this.#state.setOperations.length > 0 ? Object.freeze([...this.#state.setOperations]) : undefined\n };\n }\n}\nexport function createShapeLinkBuilder(sourceTypeApiName) {\n return new ShapeLinkBuilderImpl({\n sourceTypeApiName,\n currentTypeApiName: sourceTypeApiName,\n segments: [],\n orderBy: [],\n distinct: false,\n setOperations: []\n });\n}\n\n/**\n * Creates a new ShapeBuilder for the given base type.\n *\n * @param baseType - The base ObjectTypeDefinition or InterfaceDefinition\n * @param debugName - Optional name for debugging in DevTools\n *\n * @example\n * ```typescript\n * const SlimPlayer = createShapeBuilder(Player, \"SlimPlayer\")\n * .require(\"name\", \"age\")\n * .withDefault(\"position\", \"Unknown\")\n * .build();\n * ```\n */\nexport function createShapeBuilder(baseType, debugName) {\n const state = {\n baseType,\n baseTypeApiName: baseType.apiName,\n debugName,\n props: {},\n derivedLinks: []\n };\n return new ShapeBuilderImpl(state);\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { computeShapeId } from \"./computeShapeId.js\";\nimport { createShapeLinkBuilder } from \"./ShapeBuilder.js\";\nexport function configToShapeDefinition(baseType, config) {\n const baseTypeApiName = baseType.apiName;\n const props = {};\n const seen = new Set();\n function addProp(prop, config2) {\n if (seen.has(prop)) {\n throw new Error(`Property \"${prop}\" appears in multiple config arrays`);\n }\n seen.add(prop);\n props[prop] = config2;\n }\n if (config.require) {\n for (const prop of config.require) {\n addProp(prop, {\n nullabilityOp: {\n type: \"require\"\n }\n });\n }\n }\n if (config.select) {\n for (const prop of config.select) {\n addProp(prop, {\n nullabilityOp: {\n type: \"select\"\n }\n });\n }\n }\n if (config.dropIfNull) {\n for (const prop of config.dropIfNull) {\n addProp(prop, {\n nullabilityOp: {\n type: \"dropIfNull\"\n }\n });\n }\n }\n if (config.defaults) {\n for (const [prop, defaultValue] of Object.entries(config.defaults)) {\n addProp(prop, {\n nullabilityOp: {\n type: \"withDefault\",\n defaultValue\n }\n });\n }\n }\n if (config.transforms) {\n for (const [prop, transform] of Object.entries(config.transforms)) {\n if (typeof transform !== \"function\") {\n throw new Error(`transforms[\"${prop}\"] must be a function, got: ${typeof transform}`);\n }\n addProp(prop, {\n nullabilityOp: {\n type: \"withTransform\",\n transform\n }\n });\n }\n }\n const derivedLinks = [];\n if (config.links) {\n for (const [name, linkConfig] of Object.entries(config.links)) {\n const linkBuilder = createShapeLinkBuilder(baseTypeApiName);\n const traversed = linkConfig.via(linkBuilder);\n const objectSetDef = traversed.toObjectSetDef();\n const targetShape = linkConfig.target;\n derivedLinks.push({\n name,\n objectSetDef,\n targetShape,\n config: {\n defer: linkConfig.defer\n }\n });\n }\n }\n const shapeId = computeShapeId({\n baseTypeApiName,\n props,\n derivedLinks\n });\n return {\n __shapeId: shapeId,\n __debugName: undefined,\n __baseType: baseType,\n __baseTypeApiName: baseTypeApiName,\n __props: Object.freeze({\n ...props\n }),\n __derivedLinks: Object.freeze([...derivedLinks]),\n __selectedPropsType: {},\n __derivedLinksType: {}\n };\n}"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { O as ObjectOrInterfaceDefinition, P as PropertyKeys, M as MediaReference, N as NullabilityAdherence, S as SelectArg, a as Osdk, E as ExtractOptions, F as FetchPageArgs, b as FetchPageResult, c as OsdkBase } from '../ObjectSet-DxD7I6OR.cjs';
|
|
2
|
+
export { d as MinimalObjectSet } from '../ObjectSet-DxD7I6OR.cjs';
|
|
3
|
+
import { P as PropertyType, S as ShapeLinkBuilder, a as ShapeDefinition, R as RequiredProperty, b as ShapeBuilder } from '../shapes-internal-C7-hN21K.cjs';
|
|
4
|
+
export { L as LinkLoadConfig, e as LinkStatus, N as NullabilityViolation, f as ShapeBaseType, g as ShapeDerivedLinks, h as ShapeInstance, j as ShapeLinkResult, c as ShapeNullabilityError, d as SourcePrimaryKeySymbol, i as isSourcePkSymbol } from '../shapes-internal-C7-hN21K.cjs';
|
|
3
5
|
import 'type-fest';
|
|
4
6
|
import 'geojson';
|
|
5
7
|
|
|
@@ -58,4 +60,56 @@ declare const __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks: Experiment<"2.0.8
|
|
|
58
60
|
getBulkLinks: getBulkLinksFn;
|
|
59
61
|
}>;
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
interface InlineShapeConfig<BASE extends ObjectOrInterfaceDefinition> {
|
|
64
|
+
readonly require?: readonly PropertyKeys<BASE>[];
|
|
65
|
+
readonly select?: readonly PropertyKeys<BASE>[];
|
|
66
|
+
readonly dropIfNull?: readonly PropertyKeys<BASE>[];
|
|
67
|
+
readonly defaults?: {
|
|
68
|
+
readonly [K in PropertyKeys<BASE>]?: NonNullable<PropertyType<BASE, K>>;
|
|
69
|
+
};
|
|
70
|
+
readonly transforms?: {
|
|
71
|
+
readonly [K in PropertyKeys<BASE>]?: (value: PropertyType<BASE, K>) => unknown;
|
|
72
|
+
};
|
|
73
|
+
readonly links?: Record<string, InlineLinkConfig<BASE>>;
|
|
74
|
+
}
|
|
75
|
+
interface InlineLinkConfig<SOURCE extends ObjectOrInterfaceDefinition> {
|
|
76
|
+
readonly via: (builder: ShapeLinkBuilder<SOURCE, SOURCE>) => ShapeLinkBuilder<SOURCE, ObjectOrInterfaceDefinition>;
|
|
77
|
+
readonly target: ShapeDefinition<ObjectOrInterfaceDefinition>;
|
|
78
|
+
readonly defer?: boolean;
|
|
79
|
+
}
|
|
80
|
+
type ArrayElement<T> = T extends readonly (infer E)[] ? E : never;
|
|
81
|
+
type InferInlineProps<BASE extends ObjectOrInterfaceDefinition, C extends InlineShapeConfig<BASE>> = {
|
|
82
|
+
[K in ArrayElement<C["require"]> & PropertyKeys<BASE>]: RequiredProperty<PropertyType<BASE, K>>;
|
|
83
|
+
} & {
|
|
84
|
+
[K in ArrayElement<C["select"]> & PropertyKeys<BASE>]: PropertyType<BASE, K>;
|
|
85
|
+
} & {
|
|
86
|
+
[K in ArrayElement<C["dropIfNull"]> & PropertyKeys<BASE>]: RequiredProperty<PropertyType<BASE, K>>;
|
|
87
|
+
} & {
|
|
88
|
+
[K in keyof C["defaults"] & PropertyKeys<BASE>]: NonNullable<PropertyType<BASE, K>>;
|
|
89
|
+
} & {
|
|
90
|
+
[K in keyof C["transforms"] & PropertyKeys<BASE>]: C["transforms"] extends Record<K, (v: PropertyType<BASE, K>) => infer R> ? R : never;
|
|
91
|
+
};
|
|
92
|
+
type InferInlineLinks<BASE extends ObjectOrInterfaceDefinition, C extends InlineShapeConfig<BASE>> = C["links"] extends Record<string, InlineLinkConfig<BASE>> ? {
|
|
93
|
+
[K in keyof C["links"] & string]: C["links"][K]["target"] extends ShapeDefinition<ObjectOrInterfaceDefinition> ? C["links"][K]["target"] : ShapeDefinition<ObjectOrInterfaceDefinition>;
|
|
94
|
+
} : {};
|
|
95
|
+
type InferShapeDefinition<BASE extends ObjectOrInterfaceDefinition, C extends InlineShapeConfig<BASE>> = ShapeDefinition<BASE, InferInlineProps<BASE, C>, InferInlineLinks<BASE, C>>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new ShapeBuilder for the given base type.
|
|
99
|
+
*
|
|
100
|
+
* @param baseType - The base ObjectTypeDefinition or InterfaceDefinition
|
|
101
|
+
* @param debugName - Optional name for debugging in DevTools
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const SlimPlayer = createShapeBuilder(Player, "SlimPlayer")
|
|
106
|
+
* .require("name", "age")
|
|
107
|
+
* .withDefault("position", "Unknown")
|
|
108
|
+
* .build();
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
declare function createShapeBuilder<BASE extends ObjectOrInterfaceDefinition>(baseType: BASE, debugName?: string): ShapeBuilder<BASE, {}, {}>;
|
|
112
|
+
|
|
113
|
+
declare function configToShapeDefinition<BASE extends ObjectOrInterfaceDefinition, const C extends InlineShapeConfig<BASE>>(baseType: BASE, config: C): InferShapeDefinition<BASE, C>;
|
|
114
|
+
|
|
115
|
+
export { type EXPERIMENTAL_BulkLinkResult, type Experiment, type ExperimentFns, type FetchPageByRidPayload, type InferShapeDefinition, type InlineLinkConfig, type InlineShapeConfig, PropertyType, RequiredProperty, ShapeBuilder, ShapeDefinition, ShapeLinkBuilder, __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference, __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid, __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchPageByRid, __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, configToShapeDefinition, createShapeBuilder };
|