My first observation is that the package hasn’t been updated on NPM.
@squidex/squidex - npm (npmjs.com)
This means I’ll need to sideload it somehow. Due to limitations with Vite I won’t be able to use npm link
for this task (at least in Windows). I will use this workaround for testing.
cd node_modules
cd "@squidex"
mv squidex squidex-npm
git clone https://github.com/Squidex/sdk-node.git
mv sdk-node squidex
cd squidex
git checkout openapi-generator
git pull
npm run build
I will note that we have 427 build errors being emitted from the TypeScript transpiler. Most are declared unused variable on the function.
...
Found 427 errors in 203 files.
Errors Files
1 src/generated/models/ActionTypeEnum.ts:43
2 src/generated/models/AddFieldDto.ts:63
2 src/generated/models/AddLanguageDto.ts:43
2 src/generated/models/AddRoleDto.ts:43
2 src/generated/models/AddWorkflowDto.ts:43
1 src/generated/models/AlgoliaRuleActionDto.ts:90
3 src/generated/models/AllContentsByPostDto.ts:70
3 src/generated/models/AnnotateAssetDto.ts:58
2 src/generated/models/AppDto.ts:138
2 src/generated/models/AppLanguageDto.ts:85
3 src/generated/models/AppLanguagesDto.ts:63
4 src/generated/models/AppSettingsDto.ts:97
1 src/generated/models/ArrayCalculatedDefaultValue.ts:42
2 src/generated/models/ArrayFieldPropertiesDto.ts:67
2 src/generated/models/AssetChangedRuleTriggerDto.ts:41
2 src/generated/models/AssetDto.ts:229
2 src/generated/models/AssetFolderDto.ts:78
1 src/generated/models/AssetFolderScope.ts:43
4 src/generated/models/AssetFoldersDto.ts:77
2 src/generated/models/AssetMeta.ts:43
1 src/generated/models/AssetPreviewMode.ts:43
2 src/generated/models/AssetScriptsDto.ts:99
3 src/generated/models/AssetsDto.ts:70
2 src/generated/models/AssetsFieldPropertiesDto.ts:177
1 src/generated/models/AssetType.ts:44
2 src/generated/models/AssignContributorDto.ts:55
2 src/generated/models/AuthSchemeDto.ts:77
2 src/generated/models/AuthSchemeResponseDto.ts:62
3 src/generated/models/AuthSchemeValueDto.ts:41
1 src/generated/models/AzureQueueRuleActionDto.ts:75
2 src/generated/models/BackupJobDto.ts:99
3 src/generated/models/BackupJobsDto.ts:63
1 src/generated/models/BooleanFieldEditor.ts:42
2 src/generated/models/BooleanFieldPropertiesDto.ts:67
2 src/generated/models/BulkResultDto.ts:69
4 src/generated/models/BulkUpdateAssetsDto.ts:59
3 src/generated/models/BulkUpdateAssetsJobDto.ts:97
1 src/generated/models/BulkUpdateAssetType.ts:43
3 src/generated/models/BulkUpdateContentsDto.ts:94
3 src/generated/models/BulkUpdateContentsJobDto.ts:115
1 src/generated/models/BulkUpdateContentType.ts:48
2 src/generated/models/CallsUsageDtoDto.ts:106
2 src/generated/models/CallsUsagePerDateDto.ts:64
3 src/generated/models/ChangeCategoryDto.ts:34
2 src/generated/models/ChangePlanDto.ts:43
2 src/generated/models/ChangeStatusDto.ts:55
2 src/generated/models/ClientDto.ts:98
3 src/generated/models/ClientsDto.ts:63
1 src/generated/models/CommentRuleActionDto.ts:67
2 src/generated/models/CommentRuleTriggerDto.ts:41
2 src/generated/models/ComponentFieldPropertiesDto.ts:41
2 src/generated/models/ComponentsFieldPropertiesDto.ts:73
4 src/generated/models/ConfigureFieldRulesDto.ts:41
3 src/generated/models/ConfigureUIFieldsDto.ts:40
3 src/generated/models/ContentChangedRuleTriggerDto.ts:80
3 src/generated/models/ContentDto.ts:187
4 src/generated/models/ContentsDto.ts:83
2 src/generated/models/ContributorDto.ts:77
3 src/generated/models/ContributorsDto.ts:82
2 src/generated/models/ContributorsMetadata.ts:43
2 src/generated/models/CreateAppDto.ts:49
2 src/generated/models/CreateAssetFolderDto.ts:49
2 src/generated/models/CreateClientDto.ts:43
1 src/generated/models/CreateContentRuleActionDto.ts:84
2 src/generated/models/CreateRuleDto.ts:63
4 src/generated/models/CreateSchemaDto.ts:143
2 src/generated/models/CreateTeamDto.ts:43
2 src/generated/models/CreateUserDto.ts:64
2 src/generated/models/CurrentStorageDto.ts:50
1 src/generated/models/DateTimeCalculatedDefaultValue.ts:42
1 src/generated/models/DateTimeFieldEditor.ts:42
2 src/generated/models/DateTimeFieldPropertiesDto.ts:91
1 src/generated/models/DiscourseRuleActionDto.ts:105
2 src/generated/models/EditorDto.ts:50
1 src/generated/models/ElasticSearchRuleActionDto.ts:96
1 src/generated/models/EmailRuleActionDto.ts:116
2 src/generated/models/ErrorDto.ts:74
2 src/generated/models/EventConsumerDto.ts:90
3 src/generated/models/EventConsumersDto.ts:63
1 src/generated/models/FastlyRuleActionDto.ts:68
2 src/generated/models/FeatureDto.ts:50
3 src/generated/models/FeaturesDto.ts:57
3 src/generated/models/FieldDto.ts:117
1 src/generated/models/FieldRuleAction.ts:43
2 src/generated/models/FieldRuleDto.ts:65
1 src/generated/models/GeolocationFieldEditor.ts:41
2 src/generated/models/GeolocationFieldPropertiesDto.ts:49
2 src/generated/models/HistoryEventDto.ts:78
1 src/generated/models/ImageFormat.ts:48
2 src/generated/models/ImportContentsDto.ts:62
3 src/generated/models/JobDto.ts:126
2 src/generated/models/JobLogMessageDto.ts:50
3 src/generated/models/JobsDto.ts:63
1 src/generated/models/JobStatus.ts:45
2 src/generated/models/JsonFieldPropertiesDto.ts:41
2 src/generated/models/LanguageDto.ts:57
3 src/generated/models/LogDownloadDto.ts:34
3 src/generated/models/ManualRuleTriggerDto.ts:35
1 src/generated/models/MediumRuleActionDto.ts:105
3 src/generated/models/MoveAssetDto.ts:34
3 src/generated/models/MoveAssetFolderDto.ts:34
2 src/generated/models/NestedFieldDto.ts:98
1 src/generated/models/NotificationRuleActionDto.ts:82
1 src/generated/models/NumberFieldEditor.ts:44
2 src/generated/models/NumberFieldPropertiesDto.ts:91
1 src/generated/models/OpenSearchRuleActionDto.ts:96
2 src/generated/models/PatternDto.ts:56
3 src/generated/models/PlanChangedDto.ts:34
2 src/generated/models/PlanDto.ts:109
3 src/generated/models/PlansDto.ts:95
1 src/generated/models/PlansLockedReason.ts:44
1 src/generated/models/PrerenderRuleActionDto.ts:68
3 src/generated/models/QueryDto.ts:52
3 src/generated/models/QueryJsonDto.ts:89
1 src/generated/models/ReferencesFieldEditor.ts:46
2 src/generated/models/ReferencesFieldPropertiesDto.ts:103
2 src/generated/models/ReferralInfo.ts:57
2 src/generated/models/RenameAssetFolderDto.ts:43
2 src/generated/models/RenameTagDto.ts:43
2 src/generated/models/ReorderFieldsDto.ts:43
1 src/generated/models/ResizeMode.ts:47
2 src/generated/models/Resource.ts:50
2 src/generated/models/ResourceLink.ts:56
2 src/generated/models/ResourcesDto.ts:50
2 src/generated/models/RestoreJobDto.ts:79
2 src/generated/models/RestoreRequestDto.ts:49
2 src/generated/models/RichTextFieldPropertiesDto.ts:89
2 src/generated/models/RoleDto.ts:92
3 src/generated/models/RolesDto.ts:63
2 src/generated/models/RuleDto.ts:152
3 src/generated/models/RuleElementDto.ts:88
2 src/generated/models/RuleElementPropertyDto.ts:92
2 src/generated/models/RuleEventDto.ts:125
3 src/generated/models/RuleEventsDto.ts:70
1 src/generated/models/RuleFieldEditor.ts:49
1 src/generated/models/RuleJobResult.ts:45
1 src/generated/models/RuleResult.ts:44
3 src/generated/models/RulesDto.ts:69
2 src/generated/models/ScheduleJobDto.ts:71
2 src/generated/models/SchemaChangedRuleTriggerDto.ts:41
2 src/generated/models/SchemaCondition.ts:49
4 src/generated/models/SchemaDto.ts:208
2 src/generated/models/SchemaPropertiesDto.ts:91
3 src/generated/models/SchemaScriptsDto.ts:64
3 src/generated/models/SchemasDto.ts:63
1 src/generated/models/SchemaType.ts:43
1 src/generated/models/ScriptRuleActionDto.ts:60
2 src/generated/models/SearchResultDto.ts:78
1 src/generated/models/SearchResultType.ts:46
1 src/generated/models/SignalRRuleActionDto.ts:105
2 src/generated/models/SimulatedRuleEventDto.ts:102
3 src/generated/models/SimulatedRuleEventsDto.ts:70
1 src/generated/models/SkipReason.ts:51
1 src/generated/models/SlackRuleActionDto.ts:68
2 src/generated/models/SortNode.ts:59
1 src/generated/models/SortOrder.ts:42
2 src/generated/models/StatusInfoDto.ts:50
2 src/generated/models/StorageUsagePerDateDto.ts:57
1 src/generated/models/StringContentType.ts:43
1 src/generated/models/StringFieldEditor.ts:50
2 src/generated/models/StringFieldPropertiesDto.ts:169
5 src/generated/models/SynchronizeSchemaDto.ts:119
1 src/generated/models/TagsFieldEditor.ts:43
2 src/generated/models/TagsFieldPropertiesDto.ts:85
2 src/generated/models/TeamDto.ts:91
2 src/generated/models/TemplateDetailsDto.ts:57
2 src/generated/models/TemplateDto.ts:78
3 src/generated/models/TemplatesDto.ts:63
3 src/generated/models/TransferToTeamDto.ts:34
2 src/generated/models/TranslateDto.ts:56
2 src/generated/models/TranslationDto.ts:65
1 src/generated/models/TranslationStatus.ts:46
1 src/generated/models/TweetRuleActionDto.ts:76
1 src/generated/models/TypesenseRuleActionDto.ts:90
1 src/generated/models/UIFieldEditor.ts:41
2 src/generated/models/UIFieldPropertiesDto.ts:49
3 src/generated/models/UpdateAppDto.ts:40
4 src/generated/models/UpdateAppSettingsDto.ts:75
3 src/generated/models/UpdateAssetScriptsDto.ts:70
3 src/generated/models/UpdateClientDto.ts:58
2 src/generated/models/UpdateFieldDto.ts:50
3 src/generated/models/UpdateLanguageDto.ts:46
3 src/generated/models/UpdateProfileDto.ts:34
2 src/generated/models/UpdateRoleDto.ts:49
3 src/generated/models/UpdateRuleDto.ts:65
3 src/generated/models/UpdateSchemaDto.ts:70
2 src/generated/models/UpdateSettingDto.ts:43
2 src/generated/models/UpdateTeamDto.ts:43
2 src/generated/models/UpdateUserDto.ts:63
2 src/generated/models/UpdateWorkflowDto.ts:69
5 src/generated/models/UpsertSchemaDto.ts:107
3 src/generated/models/UpsertSchemaFieldDto.ts:93
2 src/generated/models/UpsertSchemaNestedFieldDto.ts:75
1 src/generated/models/UsageRuleTriggerDto.ts:67
2 src/generated/models/UserDto.ts:85
2 src/generated/models/UserProperty.ts:50
3 src/generated/models/UsersDto.ts:70
1 src/generated/models/WebhookMethod.ts:45
1 src/generated/models/WebhookRuleActionDto.ts:104
2 src/generated/models/WorkflowDto.ts:89
3 src/generated/models/WorkflowsDto.ts:70
3 src/generated/models/WorkflowStepDto.ts:71
3 src/generated/models/WorkflowTransitionDto.ts:40
Files: 452
Lines of Library: 39157
Lines of Definitions: 129518
Lines of TypeScript: 33489
Lines of JavaScript: 0
Lines of JSON: 0
Lines of Other: 0
Identifiers: 180509
Symbols: 107323
Types: 8853
Instantiations: 4374
Memory used: 341663K
Assignability cache size: 2390
Identity cache size: 158
Subtype cache size: 88
Strict subtype cache size: 120
I/O Read time: 0.05s
Parse time: 0.51s
ResolveModule time: 0.06s
ResolveTypeReference time: 0.01s
ResolveLibrary time: 0.01s
Program time: 0.72s
Bind time: 0.34s
Check time: 0.69s
transformTime time: 0.21s
commentTime time: 0.14s
I/O Write time: 0.14s
printTime time: 0.93s
Emit time: 0.93s
Total time: 2.68s
When I run npm run astro build
on my project with the release candidate SDK, I’m getting a couple of errors here:
Debugger listening on ws://127.0.0.1:54501/cff097e3-ec4e-4702-91c4-274c4e3f40ca
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
> dashersupply@0.2.1 astro
> astro build
Debugger listening on ws://127.0.0.1:54504/c0ede1cc-1f1e-4469-84f1-d3bceb054dc1
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.
16:05:53 [WARN] [config] The feature "astro:env getSecret" is experimental and subject to change (used by @astrojs/node).
16:05:53 [vite] Re-optimizing dependencies because lockfile has changed
16:05:53 [types] Generated 101ms
16:05:53 [build] output: "server"
16:05:53 [build] directory: D:\sources\dashersupply\dist\
16:05:53 [build] adapter: @astrojs/node
16:05:53 [build] Collecting build info...
16:05:53 [build] ✓ Completed in 125ms.
16:05:53 [build] Building server entrypoints...
16:05:54 [ERROR] [vite] x Build failed in 411ms
[commonjs--resolver] Failed to resolve entry for package "@squidex/squidex". The package may have incorrect main/module/exports specified in its package.json.
Stack trace:
at packageEntryFailure (file:///D:/sources/dashersupply/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:46533:15)
at tryNodeResolve (file:///D:/sources/dashersupply/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:46346:16)
at Object.handler (file:///D:/sources/dashersupply/node_modules/vite/dist/node/chunks/dep-Cy9twKMn.js:65535:15)
at async PluginDriver.hookFirstAndGetPlugin (file:///D:/sources/dashersupply/node_modules/rollup/dist/es/shared/node-entry.js:19813:28)
at async ModuleLoader.resolveId (file:///D:/sources/dashersupply/node_modules/rollup/dist/es/shared/node-entry.js:18890:15)
Waiting for the debugger to disconnect...
Waiting for the debugger to disconnect...
Upon inspection the package.json file shows the entry point and the types are at ‘./index.js’ and ‘./index.d.ts’, respectively, but those files are not present. Instead they should be at ‘./dist/index.js’ and ‘./dist/index.d.ts’ instead. I’ve patched the package.json for the SDK, and then try again.
Re-run npm run-script astro build
after patching node_modules/@squidex/squidex/package.json with success.
Looks like the new interface supports Blobs, so I think this new SDK will resolve this issue.
The new upload function should work like this with the new SDK.
export async function uploadDownloadedImageToSquidexAsAsset(downloadUrl: string, assetFolderId: string) {
let filename = downloadUrl.substring(downloadUrl.lastIndexOf('/')+1);
let response = await axios.get(downloadUrl, { timeout: TIMEOUT_IN_SECONDS * 1000, responseType: 'blob' });
let assetDto = await client.assets.postAsset({ file: response.data, fileName: filename });
assetDto = await client.assets.putAsset({ id: assetDto.id, annotateAssetDto: { metadata: { ...assetDto.metadata, 'amazon-url': downloadUrl }, tags: ['amazon', 'product'] } })
assetDto = await client.assets.putAssetParent({ id: assetDto.id, moveAssetDto: { parentId: assetFolderId } });
return assetDto;
}
Here is a list of all of the things as an SDK consumer I had to change in my project, aside from the package.json patch, as a result of the migration.
Migrated to release candidate Squidex SDK · 77b83f51dd - dashersupply - Gitea: Git with a cup of tea (daball.me)
I will note that the new SDK also fails at getReferences()
, which you were saying needed a patch in .NET codebase for Squidex.
let redirectReferencesDto = await client.contents.getReferences({ schema: SCHEMAS.REDIRECTS, id: redirectDto.items[0].id });
console.log("redirectReferencesDto:", redirectReferencesDto);
I didn’t figure out which version I need to set my Docker to get the patch for that on the .NET side.
TypeError: Cannot read properties of undefined (reading 'map')
at ContentsDtoFromJSONTyped (...\node_modules\@squidex\squidex\dist\generated\models\ContentsDto.js:49:39)
at ContentsDtoFromJSON (...\node_modules\@squidex\squidex\dist\generated\models\ContentsDto.js:39:12)
at JSONApiResponse.transformer (...\node_modules\@squidex\squidex\dist\generated\apis\ContentsApi.js:532:105)
at JSONApiResponse.<anonymous> (...\node_modules\@squidex\squidex\dist\generated\runtime.js:298:25)
at Generator.next (<anonymous>)
at fulfilled (...\node_modules\@squidex\squidex\dist\generated\runtime.js:18:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Fine work, Sebastian. I’ll let you know if I have any trouble, but I suspect this SDK will work even better than the fern SDK. I’m getting better response times.