@supernova-studio/model 0.47.48 → 0.47.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1093 -1123
- package/dist/index.d.ts +1093 -1123
- package/dist/index.js +343 -343
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1220 -1220
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/dsm/data-sources/data-source.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -456,23 +456,6 @@ function isImportedAsset(asset) {
|
|
|
456
456
|
// src/dsm/data-sources/data-source.ts
|
|
457
457
|
|
|
458
458
|
|
|
459
|
-
// src/dsm/import/support/figma-files.ts
|
|
460
|
-
|
|
461
|
-
var FigmaFileDownloadScope = _zod.z.object({
|
|
462
|
-
styles: _zod.z.boolean(),
|
|
463
|
-
components: _zod.z.boolean(),
|
|
464
|
-
currentVersion: _zod.z.literal("__latest__").nullable(),
|
|
465
|
-
publishedVersion: _zod.z.string().nullable(),
|
|
466
|
-
downloadChunkSize: _zod.z.number().optional(),
|
|
467
|
-
maxFileDepth: _zod.z.number().optional()
|
|
468
|
-
});
|
|
469
|
-
var FigmaFileAccessData = _zod.z.object({
|
|
470
|
-
accessToken: _zod.z.string()
|
|
471
|
-
});
|
|
472
|
-
|
|
473
|
-
// src/dsm/import/support/import-context.ts
|
|
474
|
-
|
|
475
|
-
|
|
476
459
|
// src/dsm/import/warning.ts
|
|
477
460
|
|
|
478
461
|
var ImportWarningType = _zod.z.enum([
|
|
@@ -501,96 +484,8 @@ var ImportWarning = _zod.z.object({
|
|
|
501
484
|
referenceId: _zod.z.string().optional()
|
|
502
485
|
});
|
|
503
486
|
|
|
504
|
-
// src/dsm/
|
|
505
|
-
var ImportFunctionInput = _zod.z.object({
|
|
506
|
-
importJobId: _zod.z.string(),
|
|
507
|
-
importContextId: _zod.z.string(),
|
|
508
|
-
designSystemId: _zod.z.string().optional()
|
|
509
|
-
});
|
|
510
|
-
var ImportedFigmaSourceData = _zod.z.object({
|
|
511
|
-
sourceId: _zod.z.string(),
|
|
512
|
-
figmaRemote: DataSourceFigmaRemote
|
|
513
|
-
});
|
|
514
|
-
var FigmaImportBaseContext = _zod.z.object({
|
|
515
|
-
designSystemId: _zod.z.string(),
|
|
516
|
-
/**
|
|
517
|
-
* Data required for accessing Figma files. This should contain access data for all file ids
|
|
518
|
-
* mentioned in the `importedSourceDataBySourceId`
|
|
519
|
-
*
|
|
520
|
-
* fileId: file data
|
|
521
|
-
*/
|
|
522
|
-
fileAccessByFileId: _zod.z.record(FigmaFileAccessData),
|
|
523
|
-
/**
|
|
524
|
-
* Figma source data for which import was requested
|
|
525
|
-
*
|
|
526
|
-
* sourceId: source data
|
|
527
|
-
*/
|
|
528
|
-
importedSourceDataBySourceId: _zod.z.record(ImportedFigmaSourceData),
|
|
529
|
-
/**
|
|
530
|
-
* Array of warnings that will be written into the import result summary at the end
|
|
531
|
-
* of import job execution and displayed by the client.
|
|
532
|
-
*/
|
|
533
|
-
importWarnings: _zod.z.record(ImportWarning.array()).default({})
|
|
534
|
-
});
|
|
535
|
-
var FigmaImportContextWithSourcesState = FigmaImportBaseContext.extend({
|
|
536
|
-
sourcesWithMissingAccess: _zod.z.array(_zod.z.string()).default([]),
|
|
537
|
-
shadowOpacityOptional: _zod.z.boolean().default(false)
|
|
538
|
-
});
|
|
539
|
-
var ChangedImportedFigmaSourceData = ImportedFigmaSourceData.extend({
|
|
540
|
-
importMetadata: DataSourceFigmaImportMetadata
|
|
541
|
-
});
|
|
542
|
-
var FigmaImportContextWithDownloadScopes = FigmaImportContextWithSourcesState.extend({
|
|
543
|
-
/**
|
|
544
|
-
* Describes what to download from each file, this should contain all file id mentioned in
|
|
545
|
-
* importMetadataBySourceId.
|
|
546
|
-
*
|
|
547
|
-
* File id -> file download scope
|
|
548
|
-
*/
|
|
549
|
-
fileDownloadScopesByFileId: _zod.z.record(FigmaFileDownloadScope),
|
|
550
|
-
/**
|
|
551
|
-
* Sources filtered down to the ones that have changed since last import and therefore need to be
|
|
552
|
-
* imported again.
|
|
553
|
-
*
|
|
554
|
-
* Source id -> import metadata
|
|
555
|
-
*/
|
|
556
|
-
changedImportedSourceDataBySourceId: _zod.z.record(ChangedImportedFigmaSourceData)
|
|
557
|
-
});
|
|
558
|
-
|
|
559
|
-
// src/dsm/import/support/import-model-collections.ts
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
// src/dsm/import/image.ts
|
|
487
|
+
// src/dsm/data-sources/import-summary.ts
|
|
563
488
|
|
|
564
|
-
var ImageImportModelType = _zod.z.enum(["Url", "FigmaRender"]);
|
|
565
|
-
var ImageImportModelBase = _zod.z.object({
|
|
566
|
-
scope: AssetScope
|
|
567
|
-
});
|
|
568
|
-
var UrlImageImportModel = ImageImportModelBase.extend({
|
|
569
|
-
type: _zod.z.literal(ImageImportModelType.enum.Url),
|
|
570
|
-
url: _zod.z.string(),
|
|
571
|
-
originKey: _zod.z.string(),
|
|
572
|
-
extension: _zod.z.string()
|
|
573
|
-
});
|
|
574
|
-
var FigmaRenderFormat = _zod.z.enum(["Svg", "Png"]);
|
|
575
|
-
var FigmaRenderBase = ImageImportModelBase.extend({
|
|
576
|
-
type: _zod.z.literal(ImageImportModelType.enum.FigmaRender),
|
|
577
|
-
fileId: _zod.z.string(),
|
|
578
|
-
fileVersionId: _zod.z.string().optional(),
|
|
579
|
-
nodeId: _zod.z.string(),
|
|
580
|
-
originKey: _zod.z.string()
|
|
581
|
-
});
|
|
582
|
-
var FigmaPngRenderImportModel = FigmaRenderBase.extend({
|
|
583
|
-
format: _zod.z.literal(FigmaRenderFormat.enum.Png),
|
|
584
|
-
scale: _zod.z.number()
|
|
585
|
-
});
|
|
586
|
-
var FigmaSvgRenderImportModel = FigmaRenderBase.extend({
|
|
587
|
-
format: _zod.z.literal(FigmaRenderFormat.enum.Svg)
|
|
588
|
-
});
|
|
589
|
-
var FigmaRenderImportModel = _zod.z.discriminatedUnion("format", [
|
|
590
|
-
FigmaPngRenderImportModel,
|
|
591
|
-
FigmaSvgRenderImportModel
|
|
592
|
-
]);
|
|
593
|
-
var ImageImportModel = _zod.z.union([UrlImageImportModel, FigmaRenderImportModel]);
|
|
594
489
|
|
|
595
490
|
// src/dsm/elements/data/base.ts
|
|
596
491
|
|
|
@@ -2126,253 +2021,83 @@ var PageBlockDefinitionsMap = class {
|
|
|
2126
2021
|
}
|
|
2127
2022
|
};
|
|
2128
2023
|
|
|
2129
|
-
// src/dsm/import
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
var ImportModelBase = _zod.z.object({
|
|
2135
|
-
id: _zod.z.string(),
|
|
2136
|
-
meta: ObjectMeta,
|
|
2137
|
-
origin: DesignElementOrigin,
|
|
2138
|
-
brandPersistentId: _zod.z.string(),
|
|
2139
|
-
sortOrder: _zod.z.number()
|
|
2140
|
-
});
|
|
2141
|
-
var ImportModelInputBase = ImportModelBase.omit({
|
|
2142
|
-
brandPersistentId: true,
|
|
2143
|
-
origin: true,
|
|
2144
|
-
sortOrder: true
|
|
2145
|
-
}).extend({
|
|
2146
|
-
originId: _zod.z.string(),
|
|
2147
|
-
originMetadata: _zod.z.record(_zod.z.any())
|
|
2024
|
+
// src/dsm/data-sources/import-summary.ts
|
|
2025
|
+
var FileStructureStats = _zod.z.object({
|
|
2026
|
+
frames: zeroNumberByDefault(),
|
|
2027
|
+
components: zeroNumberByDefault(),
|
|
2028
|
+
componentSets: zeroNumberByDefault()
|
|
2148
2029
|
});
|
|
2149
|
-
|
|
2150
|
-
//
|
|
2151
|
-
|
|
2152
|
-
|
|
2030
|
+
var SourceImportSummaryByTokenTypeKey = DesignTokenType.or(
|
|
2031
|
+
// Backward compatibility
|
|
2032
|
+
_zod.z.enum(["Measure", "Radius", "GenericToken", "Font", "Text"])
|
|
2033
|
+
);
|
|
2034
|
+
var SourceImportSummaryByTokenType = _zod.z.record(SourceImportSummaryByTokenTypeKey, _zod.z.number());
|
|
2035
|
+
var SourceImportTokenSummary = _zod.z.object({
|
|
2036
|
+
tokensCreated: zeroNumberByDefault(),
|
|
2037
|
+
tokensUpdated: zeroNumberByDefault(),
|
|
2038
|
+
tokensDeleted: zeroNumberByDefault(),
|
|
2039
|
+
tokensCreatedPerType: SourceImportSummaryByTokenType.nullish().transform((v) => _nullishCoalesce(v, () => ( {}))),
|
|
2040
|
+
tokensUpdatedPerType: SourceImportSummaryByTokenType.nullish().transform((v) => _nullishCoalesce(v, () => ( {}))),
|
|
2041
|
+
tokensDeletedPerType: SourceImportSummaryByTokenType.nullish().transform((v) => _nullishCoalesce(v, () => ( {})))
|
|
2153
2042
|
});
|
|
2154
|
-
var
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2043
|
+
var SourceImportComponentSummary = _zod.z.object({
|
|
2044
|
+
componentsCreated: zeroNumberByDefault(),
|
|
2045
|
+
componentsUpdated: zeroNumberByDefault(),
|
|
2046
|
+
componentsDeleted: zeroNumberByDefault(),
|
|
2047
|
+
componentAssetsCreated: zeroNumberByDefault(),
|
|
2048
|
+
componentAssetsUpdated: zeroNumberByDefault(),
|
|
2049
|
+
componentAssetsDeleted: zeroNumberByDefault()
|
|
2158
2050
|
});
|
|
2159
|
-
var
|
|
2160
|
-
|
|
2051
|
+
var SourceImportFrameSummary = _zod.z.object({
|
|
2052
|
+
assetsInFile: nullishToOptional(FileStructureStats.optional()),
|
|
2053
|
+
invalidReferencesCount: nullishToOptional(_zod.z.number().optional())
|
|
2161
2054
|
});
|
|
2162
|
-
var
|
|
2163
|
-
|
|
2164
|
-
|
|
2055
|
+
var SourceImportSummary = _zod.z.object({
|
|
2056
|
+
sourceId: nullishToOptional(_zod.z.string()),
|
|
2057
|
+
brandId: nullishToOptional(_zod.z.string()),
|
|
2058
|
+
versionId: nullishToOptional(_zod.z.string()),
|
|
2059
|
+
error: nullishToOptional(_zod.z.any()),
|
|
2060
|
+
isFailed: _zod.z.boolean(),
|
|
2061
|
+
warnings: _zod.z.array(ImportWarning).nullish().transform((v) => _nullishCoalesce(v, () => ( []))),
|
|
2062
|
+
...SourceImportTokenSummary.shape,
|
|
2063
|
+
...SourceImportComponentSummary.shape,
|
|
2064
|
+
...FileStructureStats.shape
|
|
2165
2065
|
});
|
|
2066
|
+
function zeroNumberByDefault() {
|
|
2067
|
+
return _zod.z.number().nullish().transform((v) => _nullishCoalesce(v, () => ( 0)));
|
|
2068
|
+
}
|
|
2166
2069
|
|
|
2167
|
-
// src/dsm/
|
|
2168
|
-
|
|
2169
|
-
var
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
)
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
origin: ThemeOverrideOrigin
|
|
2178
|
-
})
|
|
2179
|
-
);
|
|
2180
|
-
var ThemeOverrideImportModelInput = ThemeOverrideImportModelBase.and(
|
|
2181
|
-
_zod.z.object({
|
|
2182
|
-
originId: _zod.z.string(),
|
|
2183
|
-
originMetadata: ThemeOverrideOriginPart
|
|
2184
|
-
})
|
|
2185
|
-
);
|
|
2186
|
-
var ThemeImportModel = _zod.z.object({
|
|
2187
|
-
meta: ObjectMeta,
|
|
2188
|
-
brandPersistentId: _zod.z.string(),
|
|
2189
|
-
originSource: ThemeOriginSource,
|
|
2190
|
-
overrides: _zod.z.array(ThemeOverrideImportModel),
|
|
2191
|
-
sortOrder: _zod.z.number()
|
|
2192
|
-
});
|
|
2193
|
-
var ThemeImportModelInput = _zod.z.object({
|
|
2194
|
-
meta: ObjectMeta,
|
|
2195
|
-
originObjects: _zod.z.array(ThemeOriginObject),
|
|
2196
|
-
overrides: _zod.z.array(ThemeOverrideImportModelInput)
|
|
2197
|
-
});
|
|
2198
|
-
var ThemeUpdateImportModel = _zod.z.object({
|
|
2199
|
-
themePersistentId: _zod.z.string(),
|
|
2200
|
-
overrides: _zod.z.array(ThemeOverrideImportModel)
|
|
2070
|
+
// src/dsm/data-sources/data-source.ts
|
|
2071
|
+
var DataSourceRemoteType = _zod.z.enum(["Figma", "TokenStudio", "FigmaVariablesPlugin"]);
|
|
2072
|
+
var DataSourceUploadRemoteSource = _zod.z.enum(["TokenStudio", "FigmaVariablesPlugin", "Custom"]);
|
|
2073
|
+
var DataSourceFigmaState = _zod.z.enum(["Active", "MissingIntegration", "MissingFileAccess", "MissingFileOwner"]);
|
|
2074
|
+
var DataSourceAutoImportMode = _zod.z.enum(["Never", "Hourly"]);
|
|
2075
|
+
var DataSourceStats = _zod.z.object({
|
|
2076
|
+
tokens: zeroNumberByDefault2(),
|
|
2077
|
+
components: zeroNumberByDefault2(),
|
|
2078
|
+
assets: zeroNumberByDefault2(),
|
|
2079
|
+
frames: zeroNumberByDefault2()
|
|
2201
2080
|
});
|
|
2202
|
-
var
|
|
2203
|
-
|
|
2204
|
-
overrides: _zod.z.array(ThemeOverrideImportModelInput)
|
|
2081
|
+
var DataSourceFigmaFileData = _zod.z.object({
|
|
2082
|
+
lastUpdatedAt: _zod.z.coerce.date()
|
|
2205
2083
|
});
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
codeSyntax: _zod.z.record(_zod.z.coerce.string()).optional()
|
|
2084
|
+
var DataSourceFigmaFileVersionData = _zod.z.object({
|
|
2085
|
+
id: _zod.z.string(),
|
|
2086
|
+
label: _zod.z.string().optional(),
|
|
2087
|
+
description: _zod.z.string().optional(),
|
|
2088
|
+
createdAt: _zod.z.coerce.date()
|
|
2212
2089
|
});
|
|
2213
|
-
var
|
|
2214
|
-
|
|
2090
|
+
var DataSourceFigmaScope = _zod.z.object({
|
|
2091
|
+
assets: _zod.z.boolean(),
|
|
2092
|
+
components: _zod.z.boolean(),
|
|
2093
|
+
documentationFrames: _zod.z.boolean(),
|
|
2094
|
+
tokens: _zod.z.boolean(),
|
|
2095
|
+
themePersistentId: _zod.z.string().optional(),
|
|
2096
|
+
isUnpublishedContentFallbackEnabled: _zod.z.boolean()
|
|
2215
2097
|
});
|
|
2216
|
-
var
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
var DesignTokenImportModel = DesignTokenTypedData.and(DesignTokenImportModelBase);
|
|
2220
|
-
var DesignTokenImportModelInput = DesignTokenTypedData.and(DesignTokenImportModelInputBase);
|
|
2221
|
-
function isDesignTokenImportModelOfType(designToken, type) {
|
|
2222
|
-
return designToken.type === type;
|
|
2223
|
-
}
|
|
2224
|
-
function designTokenImportModelTypeFilter(type) {
|
|
2225
|
-
return (designToken) => isDesignTokenImportModelOfType(designToken, type);
|
|
2226
|
-
}
|
|
2227
|
-
|
|
2228
|
-
// src/dsm/import/figma-frames.ts
|
|
2229
|
-
|
|
2230
|
-
var FigmaFileStructureNodeImportModelBase = FigmaFileStructureNodeBase.extend({
|
|
2231
|
-
image: FigmaPngRenderImportModel
|
|
2232
|
-
});
|
|
2233
|
-
var FigmaFileStructureNodeImportModel = FigmaFileStructureNodeImportModelBase.extend({
|
|
2234
|
-
children: _zod.z.lazy(() => FigmaFileStructureNodeImportModel.array())
|
|
2235
|
-
});
|
|
2236
|
-
var FigmaFileStructureImportModelPart = _zod.z.object({
|
|
2237
|
-
data: _zod.z.object({
|
|
2238
|
-
rootNode: FigmaFileStructureNodeImportModel,
|
|
2239
|
-
assetsInFile: FigmaFileStructureStatistics
|
|
2240
|
-
})
|
|
2241
|
-
});
|
|
2242
|
-
var FigmaFileStructureImportModel = ImportModelBase.extend(FigmaFileStructureImportModelPart.shape).extend({
|
|
2243
|
-
origin: FigmaFileStructureOrigin
|
|
2244
|
-
});
|
|
2245
|
-
var FigmaFileStructureImportModelInput = ImportModelInputBase.extend(
|
|
2246
|
-
FigmaFileStructureImportModelPart.shape
|
|
2247
|
-
).extend({
|
|
2248
|
-
fileVersionId: _zod.z.string()
|
|
2249
|
-
});
|
|
2250
|
-
function figmaFileStructureImportModelToMap(root) {
|
|
2251
|
-
const map = /* @__PURE__ */ new Map();
|
|
2252
|
-
recursiveFigmaFileStructureToMap2(root, map);
|
|
2253
|
-
return map;
|
|
2254
|
-
}
|
|
2255
|
-
function recursiveFigmaFileStructureToMap2(node, map) {
|
|
2256
|
-
map.set(node.id, node);
|
|
2257
|
-
for (const child of node.children)
|
|
2258
|
-
recursiveFigmaFileStructureToMap2(child, map);
|
|
2259
|
-
}
|
|
2260
|
-
|
|
2261
|
-
// src/dsm/import/data-source.ts
|
|
2262
|
-
|
|
2263
|
-
var DataSourceImportModel = _zod.z.object({
|
|
2264
|
-
id: _zod.z.string(),
|
|
2265
|
-
fileName: _zod.z.string().optional(),
|
|
2266
|
-
thumbnailUrl: _zod.z.string().optional()
|
|
2267
|
-
});
|
|
2268
|
-
|
|
2269
|
-
// src/dsm/import/support/import-model-collections.ts
|
|
2270
|
-
var ImportModelInputCollection = _zod.z.object({
|
|
2271
|
-
source: DataSourceImportModel,
|
|
2272
|
-
tokens: _zod.z.array(DesignTokenImportModelInput).default([]),
|
|
2273
|
-
components: _zod.z.array(ComponentImportModelInput).default([]),
|
|
2274
|
-
assets: _zod.z.array(AssetImportModelInput).default([]),
|
|
2275
|
-
themeUpdates: _zod.z.array(ThemeUpdateImportModelInput).default([]),
|
|
2276
|
-
themes: _zod.z.array(ThemeImportModelInput).default([]),
|
|
2277
|
-
figmaFileStructure: FigmaFileStructureImportModelInput.optional()
|
|
2278
|
-
});
|
|
2279
|
-
var ImportModelCollection = _zod.z.object({
|
|
2280
|
-
sources: _zod.z.array(DataSourceImportModel),
|
|
2281
|
-
tokens: _zod.z.array(DesignTokenImportModel).default([]),
|
|
2282
|
-
components: _zod.z.array(ComponentImportModel).default([]),
|
|
2283
|
-
themeUpdates: _zod.z.array(ThemeUpdateImportModel).default([]),
|
|
2284
|
-
themes: _zod.z.array(ThemeImportModel).default([]),
|
|
2285
|
-
figmaFileStructures: _zod.z.array(FigmaFileStructureImportModel)
|
|
2286
|
-
});
|
|
2287
|
-
function addImportModelCollections(lhs, rhs) {
|
|
2288
|
-
return {
|
|
2289
|
-
sources: [...lhs.sources, ...rhs.sources],
|
|
2290
|
-
tokens: [...lhs.tokens, ...rhs.tokens],
|
|
2291
|
-
components: [...lhs.components, ...rhs.components],
|
|
2292
|
-
themeUpdates: [...lhs.themeUpdates, ...rhs.themeUpdates],
|
|
2293
|
-
themes: [...lhs.themes, ...rhs.themes],
|
|
2294
|
-
figmaFileStructures: [...lhs.figmaFileStructures, ...rhs.figmaFileStructures]
|
|
2295
|
-
};
|
|
2296
|
-
}
|
|
2297
|
-
|
|
2298
|
-
// src/dsm/data-sources/import-summary.ts
|
|
2299
|
-
|
|
2300
|
-
var FileStructureStats = _zod.z.object({
|
|
2301
|
-
frames: zeroNumberByDefault(),
|
|
2302
|
-
components: zeroNumberByDefault(),
|
|
2303
|
-
componentSets: zeroNumberByDefault()
|
|
2304
|
-
});
|
|
2305
|
-
var SourceImportSummaryByTokenTypeKey = DesignTokenType.or(
|
|
2306
|
-
// Backward compatibility
|
|
2307
|
-
_zod.z.enum(["Measure", "Radius", "GenericToken", "Font", "Text"])
|
|
2308
|
-
);
|
|
2309
|
-
var SourceImportSummaryByTokenType = _zod.z.record(SourceImportSummaryByTokenTypeKey, _zod.z.number());
|
|
2310
|
-
var SourceImportTokenSummary = _zod.z.object({
|
|
2311
|
-
tokensCreated: zeroNumberByDefault(),
|
|
2312
|
-
tokensUpdated: zeroNumberByDefault(),
|
|
2313
|
-
tokensDeleted: zeroNumberByDefault(),
|
|
2314
|
-
tokensCreatedPerType: SourceImportSummaryByTokenType.nullish().transform((v) => _nullishCoalesce(v, () => ( {}))),
|
|
2315
|
-
tokensUpdatedPerType: SourceImportSummaryByTokenType.nullish().transform((v) => _nullishCoalesce(v, () => ( {}))),
|
|
2316
|
-
tokensDeletedPerType: SourceImportSummaryByTokenType.nullish().transform((v) => _nullishCoalesce(v, () => ( {})))
|
|
2317
|
-
});
|
|
2318
|
-
var SourceImportComponentSummary = _zod.z.object({
|
|
2319
|
-
componentsCreated: zeroNumberByDefault(),
|
|
2320
|
-
componentsUpdated: zeroNumberByDefault(),
|
|
2321
|
-
componentsDeleted: zeroNumberByDefault(),
|
|
2322
|
-
componentAssetsCreated: zeroNumberByDefault(),
|
|
2323
|
-
componentAssetsUpdated: zeroNumberByDefault(),
|
|
2324
|
-
componentAssetsDeleted: zeroNumberByDefault()
|
|
2325
|
-
});
|
|
2326
|
-
var SourceImportFrameSummary = _zod.z.object({
|
|
2327
|
-
assetsInFile: nullishToOptional(FileStructureStats.optional()),
|
|
2328
|
-
invalidReferencesCount: nullishToOptional(_zod.z.number().optional())
|
|
2329
|
-
});
|
|
2330
|
-
var SourceImportSummary = _zod.z.object({
|
|
2331
|
-
sourceId: nullishToOptional(_zod.z.string()),
|
|
2332
|
-
brandId: nullishToOptional(_zod.z.string()),
|
|
2333
|
-
versionId: nullishToOptional(_zod.z.string()),
|
|
2334
|
-
error: nullishToOptional(_zod.z.any()),
|
|
2335
|
-
isFailed: _zod.z.boolean(),
|
|
2336
|
-
warnings: _zod.z.array(ImportWarning).nullish().transform((v) => _nullishCoalesce(v, () => ( []))),
|
|
2337
|
-
...SourceImportTokenSummary.shape,
|
|
2338
|
-
...SourceImportComponentSummary.shape,
|
|
2339
|
-
...FileStructureStats.shape
|
|
2340
|
-
});
|
|
2341
|
-
function zeroNumberByDefault() {
|
|
2342
|
-
return _zod.z.number().nullish().transform((v) => _nullishCoalesce(v, () => ( 0)));
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
// src/dsm/data-sources/data-source.ts
|
|
2346
|
-
var DataSourceRemoteType = _zod.z.enum(["Figma", "TokenStudio", "FigmaVariablesPlugin"]);
|
|
2347
|
-
var DataSourceUploadRemoteSource = _zod.z.enum(["TokenStudio", "FigmaVariablesPlugin", "Custom"]);
|
|
2348
|
-
var DataSourceFigmaState = _zod.z.enum(["Active", "MissingIntegration", "MissingFileAccess", "MissingFileOwner"]);
|
|
2349
|
-
var DataSourceAutoImportMode = _zod.z.enum(["Never", "Hourly"]);
|
|
2350
|
-
var DataSourceStats = _zod.z.object({
|
|
2351
|
-
tokens: zeroNumberByDefault2(),
|
|
2352
|
-
components: zeroNumberByDefault2(),
|
|
2353
|
-
assets: zeroNumberByDefault2(),
|
|
2354
|
-
frames: zeroNumberByDefault2()
|
|
2355
|
-
});
|
|
2356
|
-
var DataSourceFigmaFileData = _zod.z.object({
|
|
2357
|
-
lastUpdatedAt: _zod.z.coerce.date()
|
|
2358
|
-
});
|
|
2359
|
-
var DataSourceFigmaFileVersionData = _zod.z.object({
|
|
2360
|
-
id: _zod.z.string(),
|
|
2361
|
-
label: _zod.z.string().optional(),
|
|
2362
|
-
description: _zod.z.string().optional(),
|
|
2363
|
-
createdAt: _zod.z.coerce.date()
|
|
2364
|
-
});
|
|
2365
|
-
var DataSourceFigmaScope = _zod.z.object({
|
|
2366
|
-
assets: _zod.z.boolean(),
|
|
2367
|
-
components: _zod.z.boolean(),
|
|
2368
|
-
documentationFrames: _zod.z.boolean(),
|
|
2369
|
-
tokens: _zod.z.boolean(),
|
|
2370
|
-
themePersistentId: _zod.z.string().optional(),
|
|
2371
|
-
isUnpublishedContentFallbackEnabled: _zod.z.boolean()
|
|
2372
|
-
});
|
|
2373
|
-
var DataSourceFigmaImportMetadata = _zod.z.object({
|
|
2374
|
-
fileData: DataSourceFigmaFileData.optional(),
|
|
2375
|
-
importedPublishedVersion: DataSourceFigmaFileVersionData.optional()
|
|
2098
|
+
var DataSourceFigmaImportMetadata = _zod.z.object({
|
|
2099
|
+
fileData: DataSourceFigmaFileData.optional(),
|
|
2100
|
+
importedPublishedVersion: DataSourceFigmaFileVersionData.optional()
|
|
2376
2101
|
});
|
|
2377
2102
|
var DataSourceFigmaRemote = _zod.z.object({
|
|
2378
2103
|
type: _zod.z.literal(DataSourceRemoteType.Enum.Figma),
|
|
@@ -2813,6 +2538,281 @@ var ElementGroupSnapshot = DesignElementSnapshotBase.extend({
|
|
|
2813
2538
|
group: ElementGroup
|
|
2814
2539
|
});
|
|
2815
2540
|
|
|
2541
|
+
// src/dsm/import/support/figma-files.ts
|
|
2542
|
+
|
|
2543
|
+
var FigmaFileDownloadScope = _zod.z.object({
|
|
2544
|
+
styles: _zod.z.boolean(),
|
|
2545
|
+
components: _zod.z.boolean(),
|
|
2546
|
+
currentVersion: _zod.z.literal("__latest__").nullable(),
|
|
2547
|
+
publishedVersion: _zod.z.string().nullable(),
|
|
2548
|
+
downloadChunkSize: _zod.z.number().optional(),
|
|
2549
|
+
maxFileDepth: _zod.z.number().optional()
|
|
2550
|
+
});
|
|
2551
|
+
var FigmaFileAccessData = _zod.z.object({
|
|
2552
|
+
accessToken: _zod.z.string()
|
|
2553
|
+
});
|
|
2554
|
+
|
|
2555
|
+
// src/dsm/import/support/import-context.ts
|
|
2556
|
+
|
|
2557
|
+
var ImportFunctionInput = _zod.z.object({
|
|
2558
|
+
importJobId: _zod.z.string(),
|
|
2559
|
+
importContextId: _zod.z.string(),
|
|
2560
|
+
designSystemId: _zod.z.string().optional()
|
|
2561
|
+
});
|
|
2562
|
+
var ImportedFigmaSourceData = _zod.z.object({
|
|
2563
|
+
sourceId: _zod.z.string(),
|
|
2564
|
+
figmaRemote: DataSourceFigmaRemote
|
|
2565
|
+
});
|
|
2566
|
+
var FigmaImportBaseContext = _zod.z.object({
|
|
2567
|
+
designSystemId: _zod.z.string(),
|
|
2568
|
+
/**
|
|
2569
|
+
* Data required for accessing Figma files. This should contain access data for all file ids
|
|
2570
|
+
* mentioned in the `importedSourceDataBySourceId`
|
|
2571
|
+
*
|
|
2572
|
+
* fileId: file data
|
|
2573
|
+
*/
|
|
2574
|
+
fileAccessByFileId: _zod.z.record(FigmaFileAccessData),
|
|
2575
|
+
/**
|
|
2576
|
+
* Figma source data for which import was requested
|
|
2577
|
+
*
|
|
2578
|
+
* sourceId: source data
|
|
2579
|
+
*/
|
|
2580
|
+
importedSourceDataBySourceId: _zod.z.record(ImportedFigmaSourceData),
|
|
2581
|
+
/**
|
|
2582
|
+
* Array of warnings that will be written into the import result summary at the end
|
|
2583
|
+
* of import job execution and displayed by the client.
|
|
2584
|
+
*/
|
|
2585
|
+
importWarnings: _zod.z.record(ImportWarning.array()).default({})
|
|
2586
|
+
});
|
|
2587
|
+
var FigmaImportContextWithSourcesState = FigmaImportBaseContext.extend({
|
|
2588
|
+
sourcesWithMissingAccess: _zod.z.array(_zod.z.string()).default([]),
|
|
2589
|
+
shadowOpacityOptional: _zod.z.boolean().default(false)
|
|
2590
|
+
});
|
|
2591
|
+
var ChangedImportedFigmaSourceData = ImportedFigmaSourceData.extend({
|
|
2592
|
+
importMetadata: DataSourceFigmaImportMetadata
|
|
2593
|
+
});
|
|
2594
|
+
var FigmaImportContextWithDownloadScopes = FigmaImportContextWithSourcesState.extend({
|
|
2595
|
+
/**
|
|
2596
|
+
* Describes what to download from each file, this should contain all file id mentioned in
|
|
2597
|
+
* importMetadataBySourceId.
|
|
2598
|
+
*
|
|
2599
|
+
* File id -> file download scope
|
|
2600
|
+
*/
|
|
2601
|
+
fileDownloadScopesByFileId: _zod.z.record(FigmaFileDownloadScope),
|
|
2602
|
+
/**
|
|
2603
|
+
* Sources filtered down to the ones that have changed since last import and therefore need to be
|
|
2604
|
+
* imported again.
|
|
2605
|
+
*
|
|
2606
|
+
* Source id -> import metadata
|
|
2607
|
+
*/
|
|
2608
|
+
changedImportedSourceDataBySourceId: _zod.z.record(ChangedImportedFigmaSourceData)
|
|
2609
|
+
});
|
|
2610
|
+
|
|
2611
|
+
// src/dsm/import/support/import-model-collections.ts
|
|
2612
|
+
|
|
2613
|
+
|
|
2614
|
+
// src/dsm/import/image.ts
|
|
2615
|
+
|
|
2616
|
+
var ImageImportModelType = _zod.z.enum(["Url", "FigmaRender"]);
|
|
2617
|
+
var ImageImportModelBase = _zod.z.object({
|
|
2618
|
+
scope: AssetScope
|
|
2619
|
+
});
|
|
2620
|
+
var UrlImageImportModel = ImageImportModelBase.extend({
|
|
2621
|
+
type: _zod.z.literal(ImageImportModelType.enum.Url),
|
|
2622
|
+
url: _zod.z.string(),
|
|
2623
|
+
originKey: _zod.z.string(),
|
|
2624
|
+
extension: _zod.z.string()
|
|
2625
|
+
});
|
|
2626
|
+
var FigmaRenderFormat = _zod.z.enum(["Svg", "Png"]);
|
|
2627
|
+
var FigmaRenderBase = ImageImportModelBase.extend({
|
|
2628
|
+
type: _zod.z.literal(ImageImportModelType.enum.FigmaRender),
|
|
2629
|
+
fileId: _zod.z.string(),
|
|
2630
|
+
fileVersionId: _zod.z.string().optional(),
|
|
2631
|
+
nodeId: _zod.z.string(),
|
|
2632
|
+
originKey: _zod.z.string()
|
|
2633
|
+
});
|
|
2634
|
+
var FigmaPngRenderImportModel = FigmaRenderBase.extend({
|
|
2635
|
+
format: _zod.z.literal(FigmaRenderFormat.enum.Png),
|
|
2636
|
+
scale: _zod.z.number()
|
|
2637
|
+
});
|
|
2638
|
+
var FigmaSvgRenderImportModel = FigmaRenderBase.extend({
|
|
2639
|
+
format: _zod.z.literal(FigmaRenderFormat.enum.Svg)
|
|
2640
|
+
});
|
|
2641
|
+
var FigmaRenderImportModel = _zod.z.discriminatedUnion("format", [
|
|
2642
|
+
FigmaPngRenderImportModel,
|
|
2643
|
+
FigmaSvgRenderImportModel
|
|
2644
|
+
]);
|
|
2645
|
+
var ImageImportModel = _zod.z.union([UrlImageImportModel, FigmaRenderImportModel]);
|
|
2646
|
+
|
|
2647
|
+
// src/dsm/import/component.ts
|
|
2648
|
+
|
|
2649
|
+
|
|
2650
|
+
// src/dsm/import/base.ts
|
|
2651
|
+
|
|
2652
|
+
var ImportModelBase = _zod.z.object({
|
|
2653
|
+
id: _zod.z.string(),
|
|
2654
|
+
meta: ObjectMeta,
|
|
2655
|
+
origin: DesignElementOrigin,
|
|
2656
|
+
brandPersistentId: _zod.z.string(),
|
|
2657
|
+
sortOrder: _zod.z.number()
|
|
2658
|
+
});
|
|
2659
|
+
var ImportModelInputBase = ImportModelBase.omit({
|
|
2660
|
+
brandPersistentId: true,
|
|
2661
|
+
origin: true,
|
|
2662
|
+
sortOrder: true
|
|
2663
|
+
}).extend({
|
|
2664
|
+
originId: _zod.z.string(),
|
|
2665
|
+
originMetadata: _zod.z.record(_zod.z.any())
|
|
2666
|
+
});
|
|
2667
|
+
|
|
2668
|
+
// src/dsm/import/component.ts
|
|
2669
|
+
var ComponentImportModelPart = _zod.z.object({
|
|
2670
|
+
thumbnail: ImageImportModel
|
|
2671
|
+
});
|
|
2672
|
+
var ComponentImportModel = ImportModelBase.extend(ComponentImportModelPart.shape).extend({
|
|
2673
|
+
isAsset: _zod.z.boolean(),
|
|
2674
|
+
svg: FigmaSvgRenderImportModel.optional(),
|
|
2675
|
+
origin: ComponentOrigin
|
|
2676
|
+
});
|
|
2677
|
+
var ComponentImportModelInput = ImportModelInputBase.extend(ComponentImportModelPart.shape).extend({
|
|
2678
|
+
originMetadata: ComponentOriginPart
|
|
2679
|
+
});
|
|
2680
|
+
var AssetImportModelInput = ImportModelInputBase.extend(ComponentImportModelPart.shape).extend({
|
|
2681
|
+
svg: FigmaSvgRenderImportModel,
|
|
2682
|
+
originMetadata: ComponentOriginPart
|
|
2683
|
+
});
|
|
2684
|
+
|
|
2685
|
+
// src/dsm/import/theme.ts
|
|
2686
|
+
|
|
2687
|
+
var ThemeOverrideImportModelBase = DesignTokenTypedData.and(
|
|
2688
|
+
_zod.z.object({
|
|
2689
|
+
id: _zod.z.string(),
|
|
2690
|
+
meta: ObjectMeta
|
|
2691
|
+
})
|
|
2692
|
+
);
|
|
2693
|
+
var ThemeOverrideImportModel = ThemeOverrideImportModelBase.and(
|
|
2694
|
+
_zod.z.object({
|
|
2695
|
+
origin: ThemeOverrideOrigin
|
|
2696
|
+
})
|
|
2697
|
+
);
|
|
2698
|
+
var ThemeOverrideImportModelInput = ThemeOverrideImportModelBase.and(
|
|
2699
|
+
_zod.z.object({
|
|
2700
|
+
originId: _zod.z.string(),
|
|
2701
|
+
originMetadata: ThemeOverrideOriginPart
|
|
2702
|
+
})
|
|
2703
|
+
);
|
|
2704
|
+
var ThemeImportModel = _zod.z.object({
|
|
2705
|
+
meta: ObjectMeta,
|
|
2706
|
+
brandPersistentId: _zod.z.string(),
|
|
2707
|
+
originSource: ThemeOriginSource,
|
|
2708
|
+
overrides: _zod.z.array(ThemeOverrideImportModel),
|
|
2709
|
+
sortOrder: _zod.z.number()
|
|
2710
|
+
});
|
|
2711
|
+
var ThemeImportModelInput = _zod.z.object({
|
|
2712
|
+
meta: ObjectMeta,
|
|
2713
|
+
originObjects: _zod.z.array(ThemeOriginObject),
|
|
2714
|
+
overrides: _zod.z.array(ThemeOverrideImportModelInput)
|
|
2715
|
+
});
|
|
2716
|
+
var ThemeUpdateImportModel = _zod.z.object({
|
|
2717
|
+
themePersistentId: _zod.z.string(),
|
|
2718
|
+
overrides: _zod.z.array(ThemeOverrideImportModel)
|
|
2719
|
+
});
|
|
2720
|
+
var ThemeUpdateImportModelInput = _zod.z.object({
|
|
2721
|
+
themePersistentId: _zod.z.string(),
|
|
2722
|
+
overrides: _zod.z.array(ThemeOverrideImportModelInput)
|
|
2723
|
+
});
|
|
2724
|
+
|
|
2725
|
+
// src/dsm/import/tokens.ts
|
|
2726
|
+
|
|
2727
|
+
var DesignTokenImportModelPart = _zod.z.object({
|
|
2728
|
+
collection: _zod.z.string().optional(),
|
|
2729
|
+
codeSyntax: _zod.z.record(_zod.z.coerce.string()).optional()
|
|
2730
|
+
});
|
|
2731
|
+
var DesignTokenImportModelBase = ImportModelBase.extend(DesignTokenImportModelPart.shape).extend({
|
|
2732
|
+
origin: DesignTokenOrigin
|
|
2733
|
+
});
|
|
2734
|
+
var DesignTokenImportModelInputBase = ImportModelInputBase.extend(DesignTokenImportModelPart.shape).extend({
|
|
2735
|
+
originMetadata: DesignTokenOriginPart
|
|
2736
|
+
});
|
|
2737
|
+
var DesignTokenImportModel = DesignTokenTypedData.and(DesignTokenImportModelBase);
|
|
2738
|
+
var DesignTokenImportModelInput = DesignTokenTypedData.and(DesignTokenImportModelInputBase);
|
|
2739
|
+
function isDesignTokenImportModelOfType(designToken, type) {
|
|
2740
|
+
return designToken.type === type;
|
|
2741
|
+
}
|
|
2742
|
+
function designTokenImportModelTypeFilter(type) {
|
|
2743
|
+
return (designToken) => isDesignTokenImportModelOfType(designToken, type);
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
// src/dsm/import/figma-frames.ts
|
|
2747
|
+
|
|
2748
|
+
var FigmaFileStructureNodeImportModelBase = FigmaFileStructureNodeBase.extend({
|
|
2749
|
+
image: FigmaPngRenderImportModel
|
|
2750
|
+
});
|
|
2751
|
+
var FigmaFileStructureNodeImportModel = FigmaFileStructureNodeImportModelBase.extend({
|
|
2752
|
+
children: _zod.z.lazy(() => FigmaFileStructureNodeImportModel.array())
|
|
2753
|
+
});
|
|
2754
|
+
var FigmaFileStructureImportModelPart = _zod.z.object({
|
|
2755
|
+
data: _zod.z.object({
|
|
2756
|
+
rootNode: FigmaFileStructureNodeImportModel,
|
|
2757
|
+
assetsInFile: FigmaFileStructureStatistics
|
|
2758
|
+
})
|
|
2759
|
+
});
|
|
2760
|
+
var FigmaFileStructureImportModel = ImportModelBase.extend(FigmaFileStructureImportModelPart.shape).extend({
|
|
2761
|
+
origin: FigmaFileStructureOrigin
|
|
2762
|
+
});
|
|
2763
|
+
var FigmaFileStructureImportModelInput = ImportModelInputBase.extend(
|
|
2764
|
+
FigmaFileStructureImportModelPart.shape
|
|
2765
|
+
).extend({
|
|
2766
|
+
fileVersionId: _zod.z.string()
|
|
2767
|
+
});
|
|
2768
|
+
function figmaFileStructureImportModelToMap(root) {
|
|
2769
|
+
const map = /* @__PURE__ */ new Map();
|
|
2770
|
+
recursiveFigmaFileStructureToMap2(root, map);
|
|
2771
|
+
return map;
|
|
2772
|
+
}
|
|
2773
|
+
function recursiveFigmaFileStructureToMap2(node, map) {
|
|
2774
|
+
map.set(node.id, node);
|
|
2775
|
+
for (const child of node.children)
|
|
2776
|
+
recursiveFigmaFileStructureToMap2(child, map);
|
|
2777
|
+
}
|
|
2778
|
+
|
|
2779
|
+
// src/dsm/import/data-source.ts
|
|
2780
|
+
|
|
2781
|
+
var DataSourceImportModel = _zod.z.object({
|
|
2782
|
+
id: _zod.z.string(),
|
|
2783
|
+
fileName: _zod.z.string().optional(),
|
|
2784
|
+
thumbnailUrl: _zod.z.string().optional()
|
|
2785
|
+
});
|
|
2786
|
+
|
|
2787
|
+
// src/dsm/import/support/import-model-collections.ts
|
|
2788
|
+
var ImportModelInputCollection = _zod.z.object({
|
|
2789
|
+
source: DataSourceImportModel,
|
|
2790
|
+
tokens: _zod.z.array(DesignTokenImportModelInput).default([]),
|
|
2791
|
+
components: _zod.z.array(ComponentImportModelInput).default([]),
|
|
2792
|
+
assets: _zod.z.array(AssetImportModelInput).default([]),
|
|
2793
|
+
themeUpdates: _zod.z.array(ThemeUpdateImportModelInput).default([]),
|
|
2794
|
+
themes: _zod.z.array(ThemeImportModelInput).default([]),
|
|
2795
|
+
figmaFileStructure: FigmaFileStructureImportModelInput.optional()
|
|
2796
|
+
});
|
|
2797
|
+
var ImportModelCollection = _zod.z.object({
|
|
2798
|
+
sources: _zod.z.array(DataSourceImportModel),
|
|
2799
|
+
tokens: _zod.z.array(DesignTokenImportModel).default([]),
|
|
2800
|
+
components: _zod.z.array(ComponentImportModel).default([]),
|
|
2801
|
+
themeUpdates: _zod.z.array(ThemeUpdateImportModel).default([]),
|
|
2802
|
+
themes: _zod.z.array(ThemeImportModel).default([]),
|
|
2803
|
+
figmaFileStructures: _zod.z.array(FigmaFileStructureImportModel)
|
|
2804
|
+
});
|
|
2805
|
+
function addImportModelCollections(lhs, rhs) {
|
|
2806
|
+
return {
|
|
2807
|
+
sources: [...lhs.sources, ...rhs.sources],
|
|
2808
|
+
tokens: [...lhs.tokens, ...rhs.tokens],
|
|
2809
|
+
components: [...lhs.components, ...rhs.components],
|
|
2810
|
+
themeUpdates: [...lhs.themeUpdates, ...rhs.themeUpdates],
|
|
2811
|
+
themes: [...lhs.themes, ...rhs.themes],
|
|
2812
|
+
figmaFileStructures: [...lhs.figmaFileStructures, ...rhs.figmaFileStructures]
|
|
2813
|
+
};
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
2816
|
// src/dsm/views/column.ts
|
|
2817
2817
|
|
|
2818
2818
|
var ElementViewBaseColumnType = _zod.z.enum(["Name", "Description", "Value", "UpdatedAt"]);
|