diff --git a/CHANGELOG.md b/CHANGELOG.md index 19bb33b..e30b0d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @code.store/arcxp-sdk-ts +## 5.0.0 + +### Major Changes + +- ESM + CJS, refactor structure, regenerate types, section utils + ## 4.49.1 ### Patch Changes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 447ff9e..327b669 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,8 +62,8 @@ src/api/{service}/ ```typescript import type { GlobalType } from '../../types/entity'; -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; -import type { LocalParamsType } from './types'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; +import type { LocalParamsType } from './types.js'; export class ArcServiceName extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { @@ -219,7 +219,7 @@ Ensure types are exported from the service's `types.ts` and re-exported in `src/ ```typescript // In src/index.ts -export * from './api/{service}/types'; +export * from './api/{service}/types.js'; ``` #### 6. Document Changes @@ -339,7 +339,7 @@ import type { AGallery } from '../../types/gallery'; import type { AnImage } from '../../types/story'; // Importing local types -import type { GetStoryParams, SearchResponse } from './types'; +import type { GetStoryParams, SearchResponse } from './types.js'; ``` ### Handling Unclear Specifications @@ -423,7 +423,7 @@ Write tests for new functionality: ```typescript import { describe, it, expect } from 'vitest'; -import { ArcServiceName } from './index'; +import { ArcServiceName } from './index.js'; describe('ArcServiceName', () => { it('should fetch item by id', async () => { diff --git a/ans-schema.json b/ans-schema.json new file mode 100644 index 0000000..90e5b8f --- /dev/null +++ b/ans-schema.json @@ -0,0 +1,20 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "id": "https://github.com/washingtonpost/ans-schema", + "title": "Root", + "description": "", + "type": "object", + "additionalProperties": false, + "properties": { + "gallery_root": { + "$ref": "https://raw.githubusercontent.com/washingtonpost/ans-schema/master/src/main/resources/schema/ans/0.10.12/gallery.json" + }, + "story_root": { + "$ref": "https://raw.githubusercontent.com/washingtonpost/ans-schema/master/src/main/resources/schema/ans/0.10.12/story.json" + }, + "video_root": { + "$ref": "https://raw.githubusercontent.com/washingtonpost/ans-schema/master/src/main/resources/schema/ans/0.10.12/video.json" + } + }, + "required": ["gallery_root", "story_root", "video_root"] +} diff --git a/package.json b/package.json index cedf0f2..c54f552 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,17 @@ { "name": "@code.store/arcxp-sdk-ts", - "version": "4.49.1", + "version": "5.0.0", "description": "A strongly typed set of ArcXP API's and utilities reduce the amount of work required to develop with ArcXP, starting with reducing the boilerplate code you have to write.", - "type": "commonjs", + "type": "module", "main": "./dist/index.js", "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "require": "./dist/index.cjs" + } + }, "engines": { "node": ">=22.x", "pnpm": ">=10.x" @@ -17,15 +24,14 @@ "dist" ], "scripts": { - "build": "tsc", + "build": "tsc --noEmit && rollup -c", "format": "npx @biomejs/biome format --write .", "check": "npx @biomejs/biome check --write .", "lint": "tsc --noEmit && npx @biomejs/biome lint --write --unsafe .", "test": "npx vitest", "coverage": "npx vitest run --coverage", - "gen:ts": "npx ts-node-dev ./src/scripts/json-schema-to-ts.ts", - "cs": "npx changeset && npx changeset version", - "swaggerToTypes": "npx swagger-typescript-api -p ./tmp/swagger.json -o ./tmp -n swaggerTypes.ts" + "gen:ts": "npx tsx ./src/scripts/json-schema-to-ts.ts", + "cs": "npx changeset && npx changeset version" }, "keywords": [ "ArcXP", @@ -49,16 +55,26 @@ "@biomejs/biome": "^1.9.4", "@changesets/changelog-github": "^0.4.8", "@changesets/cli": "^2.26.2", - "@types/node": "^20.0.0", - "@types/tap": "^15.0.8", - "@types/uuid": "^9.0.7", + "@rollup/plugin-alias": "^5.1.1", + "@rollup/plugin-commonjs": "^28.0.6", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^16.0.2", + "@rollup/plugin-replace": "^6.0.2", + "@rollup/plugin-typescript": "^12.1.4", + "@types/node": "^22.0.0", + "@types/uuid": "^9.0.0", "@types/ws": "^8.5.5", "@vitest/coverage-v8": "^3.0.9", "json-schema-to-typescript": "13.1.1", "nock": "^14.0.10", "openapi-typescript": "^6.2.7", + "rollup": "^4.52.4", + "rollup-plugin-auto-external": "^2.0.0", + "rollup-plugin-node-polyfills": "^0.2.1", + "rollup-plugin-polyfill-node": "^0.13.0", + "rollup-plugin-terser": "^7.0.2", "tap": "^16.3.4", - "ts-node-dev": "^2.0.0", + "tslib": "^2.8.1", "typescript": "^5.3.3", "vite": "^7.1.4", "vitest": "^3.2.4" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a8fdec9..ede32f1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -44,22 +44,37 @@ importers: version: 0.4.8 '@changesets/cli': specifier: ^2.26.2 - version: 2.29.6(@types/node@20.19.11) + version: 2.29.6(@types/node@22.18.10) + '@rollup/plugin-alias': + specifier: ^5.1.1 + version: 5.1.1(rollup@4.52.4) + '@rollup/plugin-commonjs': + specifier: ^28.0.6 + version: 28.0.6(rollup@4.52.4) + '@rollup/plugin-json': + specifier: ^6.1.0 + version: 6.1.0(rollup@4.52.4) + '@rollup/plugin-node-resolve': + specifier: ^16.0.2 + version: 16.0.2(rollup@4.52.4) + '@rollup/plugin-replace': + specifier: ^6.0.2 + version: 6.0.2(rollup@4.52.4) + '@rollup/plugin-typescript': + specifier: ^12.1.4 + version: 12.1.4(rollup@4.52.4)(tslib@2.8.1)(typescript@5.9.2) '@types/node': - specifier: ^20.0.0 - version: 20.19.11 - '@types/tap': - specifier: ^15.0.8 - version: 15.0.12 + specifier: ^22.0.0 + version: 22.18.10 '@types/uuid': - specifier: ^9.0.7 + specifier: ^9.0.0 version: 9.0.8 '@types/ws': specifier: ^8.5.5 version: 8.18.1 '@vitest/coverage-v8': specifier: ^3.0.9 - version: 3.2.4(vitest@3.2.4(@types/node@20.19.11)) + version: 3.2.4(vitest@3.2.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1)) json-schema-to-typescript: specifier: 13.1.1 version: 13.1.1 @@ -69,21 +84,36 @@ importers: openapi-typescript: specifier: ^6.2.7 version: 6.7.6 + rollup: + specifier: ^4.52.4 + version: 4.52.4 + rollup-plugin-auto-external: + specifier: ^2.0.0 + version: 2.0.0(rollup@4.52.4) + rollup-plugin-node-polyfills: + specifier: ^0.2.1 + version: 0.2.1 + rollup-plugin-polyfill-node: + specifier: ^0.13.0 + version: 0.13.0(rollup@4.52.4) + rollup-plugin-terser: + specifier: ^7.0.2 + version: 7.0.2(rollup@4.52.4) tap: specifier: ^16.3.4 - version: 16.3.10(ts-node@10.9.2(@types/node@20.19.11)(typescript@5.9.2))(typescript@5.9.2) - ts-node-dev: - specifier: ^2.0.0 - version: 2.0.0(@types/node@20.19.11)(typescript@5.9.2) + version: 16.3.10(ts-node@10.9.2(@types/node@22.18.10)(typescript@5.9.2))(typescript@5.9.2) + tslib: + specifier: ^2.8.1 + version: 2.8.1 typescript: specifier: ^5.3.3 version: 5.9.2 vite: specifier: ^7.1.4 - version: 7.1.4(@types/node@20.19.11) + version: 7.1.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1) vitest: specifier: ^3.2.4 - version: 3.2.4(@types/node@20.19.11) + version: 3.2.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1) packages: @@ -487,6 +517,9 @@ packages: resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} engines: {node: '>=6.0.0'} + '@jridgewell/source-map@0.3.11': + resolution: {integrity: sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==} + '@jridgewell/sourcemap-codec@1.5.5': resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} @@ -534,108 +567,189 @@ packages: resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} - '@rollup/rollup-android-arm-eabi@4.50.0': - resolution: {integrity: sha512-lVgpeQyy4fWN5QYebtW4buT/4kn4p4IJ+kDNB4uYNT5b8c8DLJDg6titg20NIg7E8RWwdWZORW6vUFfrLyG3KQ==} + '@rollup/plugin-alias@5.1.1': + resolution: {integrity: sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + + '@rollup/plugin-commonjs@28.0.6': + resolution: {integrity: sha512-XSQB1K7FUU5QP+3lOQmVCE3I0FcbbNvmNT4VJSj93iUjayaARrTQeoRdiYQoftAJBLrR9t2agwAd3ekaTgHNlw==} + engines: {node: '>=16.0.0 || 14 >= 14.17'} + peerDependencies: + rollup: ^2.68.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + + '@rollup/plugin-inject@5.0.5': + resolution: {integrity: sha512-2+DEJbNBoPROPkgTDNe8/1YXWcqxbN5DTjASVIOx8HS+pITXushyNiBV56RB08zuptzz8gT3YfkqriTBVycepg==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + + '@rollup/plugin-json@6.1.0': + resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + + '@rollup/plugin-node-resolve@16.0.2': + resolution: {integrity: sha512-tCtHJ2BlhSoK4cCs25NMXfV7EALKr0jyasmqVCq3y9cBrKdmJhtsy1iTz36Xhk/O+pDJbzawxF4K6ZblqCnITQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.78.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + + '@rollup/plugin-replace@6.0.2': + resolution: {integrity: sha512-7QaYCf8bqF04dOy7w/eHmJeNExxTYwvKAmlSAH/EaWWUzbT0h5sbF6bktFoX/0F/0qwng5/dWFMyf3gzaM8DsQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + + '@rollup/plugin-typescript@12.1.4': + resolution: {integrity: sha512-s5Hx+EtN60LMlDBvl5f04bEiFZmAepk27Q+mr85L/00zPDn1jtzlTV6FWn81MaIwqfWzKxmOJrBWHU6vtQyedQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.14.0||^3.0.0||^4.0.0 + tslib: '*' + typescript: '>=3.7.0' + peerDependenciesMeta: + rollup: + optional: true + tslib: + optional: true + + '@rollup/pluginutils@5.3.0': + resolution: {integrity: sha512-5EdhGZtnu3V88ces7s53hhfK5KSASnJZv8Lulpc04cWO3REESroJXg73DFsOmgbU2BhwV0E20bu2IDZb3VKW4Q==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + + '@rollup/rollup-android-arm-eabi@4.52.4': + resolution: {integrity: sha512-BTm2qKNnWIQ5auf4deoetINJm2JzvihvGb9R6K/ETwKLql/Bb3Eg2H1FBp1gUb4YGbydMA3jcmQTR73q7J+GAA==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.50.0': - resolution: {integrity: sha512-2O73dR4Dc9bp+wSYhviP6sDziurB5/HCym7xILKifWdE9UsOe2FtNcM+I4xZjKrfLJnq5UR8k9riB87gauiQtw==} + '@rollup/rollup-android-arm64@4.52.4': + resolution: {integrity: sha512-P9LDQiC5vpgGFgz7GSM6dKPCiqR3XYN1WwJKA4/BUVDjHpYsf3iBEmVz62uyq20NGYbiGPR5cNHI7T1HqxNs2w==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.50.0': - resolution: {integrity: sha512-vwSXQN8T4sKf1RHr1F0s98Pf8UPz7pS6P3LG9NSmuw0TVh7EmaE+5Ny7hJOZ0M2yuTctEsHHRTMi2wuHkdS6Hg==} + '@rollup/rollup-darwin-arm64@4.52.4': + resolution: {integrity: sha512-QRWSW+bVccAvZF6cbNZBJwAehmvG9NwfWHwMy4GbWi/BQIA/laTIktebT2ipVjNncqE6GLPxOok5hsECgAxGZg==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.50.0': - resolution: {integrity: sha512-cQp/WG8HE7BCGyFVuzUg0FNmupxC+EPZEwWu2FCGGw5WDT1o2/YlENbm5e9SMvfDFR6FRhVCBePLqj0o8MN7Vw==} + '@rollup/rollup-darwin-x64@4.52.4': + resolution: {integrity: sha512-hZgP05pResAkRJxL1b+7yxCnXPGsXU0fG9Yfd6dUaoGk+FhdPKCJ5L1Sumyxn8kvw8Qi5PvQ8ulenUbRjzeCTw==} cpu: [x64] os: [darwin] - '@rollup/rollup-freebsd-arm64@4.50.0': - resolution: {integrity: sha512-UR1uTJFU/p801DvvBbtDD7z9mQL8J80xB0bR7DqW7UGQHRm/OaKzp4is7sQSdbt2pjjSS72eAtRh43hNduTnnQ==} + '@rollup/rollup-freebsd-arm64@4.52.4': + resolution: {integrity: sha512-xmc30VshuBNUd58Xk4TKAEcRZHaXlV+tCxIXELiE9sQuK3kG8ZFgSPi57UBJt8/ogfhAF5Oz4ZSUBN77weM+mQ==} cpu: [arm64] os: [freebsd] - '@rollup/rollup-freebsd-x64@4.50.0': - resolution: {integrity: sha512-G/DKyS6PK0dD0+VEzH/6n/hWDNPDZSMBmqsElWnCRGrYOb2jC0VSupp7UAHHQ4+QILwkxSMaYIbQ72dktp8pKA==} + '@rollup/rollup-freebsd-x64@4.52.4': + resolution: {integrity: sha512-WdSLpZFjOEqNZGmHflxyifolwAiZmDQzuOzIq9L27ButpCVpD7KzTRtEG1I0wMPFyiyUdOO+4t8GvrnBLQSwpw==} cpu: [x64] os: [freebsd] - '@rollup/rollup-linux-arm-gnueabihf@4.50.0': - resolution: {integrity: sha512-u72Mzc6jyJwKjJbZZcIYmd9bumJu7KNmHYdue43vT1rXPm2rITwmPWF0mmPzLm9/vJWxIRbao/jrQmxTO0Sm9w==} + '@rollup/rollup-linux-arm-gnueabihf@4.52.4': + resolution: {integrity: sha512-xRiOu9Of1FZ4SxVbB0iEDXc4ddIcjCv2aj03dmW8UrZIW7aIQ9jVJdLBIhxBI+MaTnGAKyvMwPwQnoOEvP7FgQ==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.50.0': - resolution: {integrity: sha512-S4UefYdV0tnynDJV1mdkNawp0E5Qm2MtSs330IyHgaccOFrwqsvgigUD29uT+B/70PDY1eQ3t40+xf6wIvXJyg==} + '@rollup/rollup-linux-arm-musleabihf@4.52.4': + resolution: {integrity: sha512-FbhM2p9TJAmEIEhIgzR4soUcsW49e9veAQCziwbR+XWB2zqJ12b4i/+hel9yLiD8pLncDH4fKIPIbt5238341Q==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.50.0': - resolution: {integrity: sha512-1EhkSvUQXJsIhk4msxP5nNAUWoB4MFDHhtc4gAYvnqoHlaL9V3F37pNHabndawsfy/Tp7BPiy/aSa6XBYbaD1g==} + '@rollup/rollup-linux-arm64-gnu@4.52.4': + resolution: {integrity: sha512-4n4gVwhPHR9q/g8lKCyz0yuaD0MvDf7dV4f9tHt0C73Mp8h38UCtSCSE6R9iBlTbXlmA8CjpsZoujhszefqueg==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.50.0': - resolution: {integrity: sha512-EtBDIZuDtVg75xIPIK1l5vCXNNCIRM0OBPUG+tbApDuJAy9mKago6QxX+tfMzbCI6tXEhMuZuN1+CU8iDW+0UQ==} + '@rollup/rollup-linux-arm64-musl@4.52.4': + resolution: {integrity: sha512-u0n17nGA0nvi/11gcZKsjkLj1QIpAuPFQbR48Subo7SmZJnGxDpspyw2kbpuoQnyK+9pwf3pAoEXerJs/8Mi9g==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-loongarch64-gnu@4.50.0': - resolution: {integrity: sha512-BGYSwJdMP0hT5CCmljuSNx7+k+0upweM2M4YGfFBjnFSZMHOLYR0gEEj/dxyYJ6Zc6AiSeaBY8dWOa11GF/ppQ==} + '@rollup/rollup-linux-loong64-gnu@4.52.4': + resolution: {integrity: sha512-0G2c2lpYtbTuXo8KEJkDkClE/+/2AFPdPAbmaHoE870foRFs4pBrDehilMcrSScrN/fB/1HTaWO4bqw+ewBzMQ==} cpu: [loong64] os: [linux] - '@rollup/rollup-linux-ppc64-gnu@4.50.0': - resolution: {integrity: sha512-I1gSMzkVe1KzAxKAroCJL30hA4DqSi+wGc5gviD0y3IL/VkvcnAqwBf4RHXHyvH66YVHxpKO8ojrgc4SrWAnLg==} + '@rollup/rollup-linux-ppc64-gnu@4.52.4': + resolution: {integrity: sha512-teSACug1GyZHmPDv14VNbvZFX779UqWTsd7KtTM9JIZRDI5NUwYSIS30kzI8m06gOPB//jtpqlhmraQ68b5X2g==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.50.0': - resolution: {integrity: sha512-bSbWlY3jZo7molh4tc5dKfeSxkqnf48UsLqYbUhnkdnfgZjgufLS/NTA8PcP/dnvct5CCdNkABJ56CbclMRYCA==} + '@rollup/rollup-linux-riscv64-gnu@4.52.4': + resolution: {integrity: sha512-/MOEW3aHjjs1p4Pw1Xk4+3egRevx8Ji9N6HUIA1Ifh8Q+cg9dremvFCUbOX2Zebz80BwJIgCBUemjqhU5XI5Eg==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-riscv64-musl@4.50.0': - resolution: {integrity: sha512-LSXSGumSURzEQLT2e4sFqFOv3LWZsEF8FK7AAv9zHZNDdMnUPYH3t8ZlaeYYZyTXnsob3htwTKeWtBIkPV27iQ==} + '@rollup/rollup-linux-riscv64-musl@4.52.4': + resolution: {integrity: sha512-1HHmsRyh845QDpEWzOFtMCph5Ts+9+yllCrREuBR/vg2RogAQGGBRC8lDPrPOMnrdOJ+mt1WLMOC2Kao/UwcvA==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.50.0': - resolution: {integrity: sha512-CxRKyakfDrsLXiCyucVfVWVoaPA4oFSpPpDwlMcDFQvrv3XY6KEzMtMZrA+e/goC8xxp2WSOxHQubP8fPmmjOQ==} + '@rollup/rollup-linux-s390x-gnu@4.52.4': + resolution: {integrity: sha512-seoeZp4L/6D1MUyjWkOMRU6/iLmCU2EjbMTyAG4oIOs1/I82Y5lTeaxW0KBfkUdHAWN7j25bpkt0rjnOgAcQcA==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.50.0': - resolution: {integrity: sha512-8PrJJA7/VU8ToHVEPu14FzuSAqVKyo5gg/J8xUerMbyNkWkO9j2ExBho/68RnJsMGNJq4zH114iAttgm7BZVkA==} + '@rollup/rollup-linux-x64-gnu@4.52.4': + resolution: {integrity: sha512-Wi6AXf0k0L7E2gteNsNHUs7UMwCIhsCTs6+tqQ5GPwVRWMaflqGec4Sd8n6+FNFDw9vGcReqk2KzBDhCa1DLYg==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.50.0': - resolution: {integrity: sha512-SkE6YQp+CzpyOrbw7Oc4MgXFvTw2UIBElvAvLCo230pyxOLmYwRPwZ/L5lBe/VW/qT1ZgND9wJfOsdy0XptRvw==} + '@rollup/rollup-linux-x64-musl@4.52.4': + resolution: {integrity: sha512-dtBZYjDmCQ9hW+WgEkaffvRRCKm767wWhxsFW3Lw86VXz/uJRuD438/XvbZT//B96Vs8oTA8Q4A0AfHbrxP9zw==} cpu: [x64] os: [linux] - '@rollup/rollup-openharmony-arm64@4.50.0': - resolution: {integrity: sha512-PZkNLPfvXeIOgJWA804zjSFH7fARBBCpCXxgkGDRjjAhRLOR8o0IGS01ykh5GYfod4c2yiiREuDM8iZ+pVsT+Q==} + '@rollup/rollup-openharmony-arm64@4.52.4': + resolution: {integrity: sha512-1ox+GqgRWqaB1RnyZXL8PD6E5f7YyRUJYnCqKpNzxzP0TkaUh112NDrR9Tt+C8rJ4x5G9Mk8PQR3o7Ku2RKqKA==} cpu: [arm64] os: [openharmony] - '@rollup/rollup-win32-arm64-msvc@4.50.0': - resolution: {integrity: sha512-q7cIIdFvWQoaCbLDUyUc8YfR3Jh2xx3unO8Dn6/TTogKjfwrax9SyfmGGK6cQhKtjePI7jRfd7iRYcxYs93esg==} + '@rollup/rollup-win32-arm64-msvc@4.52.4': + resolution: {integrity: sha512-8GKr640PdFNXwzIE0IrkMWUNUomILLkfeHjXBi/nUvFlpZP+FA8BKGKpacjW6OUUHaNI6sUURxR2U2g78FOHWQ==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.50.0': - resolution: {integrity: sha512-XzNOVg/YnDOmFdDKcxxK410PrcbcqZkBmz+0FicpW5jtjKQxcW1BZJEQOF0NJa6JO7CZhett8GEtRN/wYLYJuw==} + '@rollup/rollup-win32-ia32-msvc@4.52.4': + resolution: {integrity: sha512-AIy/jdJ7WtJ/F6EcfOb2GjR9UweO0n43jNObQMb6oGxkYTfLcnN7vYYpG+CN3lLxrQkzWnMOoNSHTW54pgbVxw==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.50.0': - resolution: {integrity: sha512-xMmiWRR8sp72Zqwjgtf3QbZfF1wdh8X2ABu3EaozvZcyHJeU0r+XAnXdKgs4cCAp6ORoYoCygipYP1mjmbjrsg==} + '@rollup/rollup-win32-x64-gnu@4.52.4': + resolution: {integrity: sha512-UF9KfsH9yEam0UjTwAgdK0anlQ7c8/pWPU2yVjyWcF1I1thABt6WXE47cI71pGiZ8wGvxohBoLnxM04L/wj8mQ==} + cpu: [x64] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.52.4': + resolution: {integrity: sha512-bf9PtUa0u8IXDVxzRToFQKsNCRz9qLYfR/MpECxl4mRoWYjAeFjgxj1XdZr2M/GNVpT05p+LgQOHopYDlUu6/w==} cpu: [x64] os: [win32] @@ -676,20 +790,14 @@ packages: '@types/node@12.20.55': resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} - '@types/node@20.19.11': - resolution: {integrity: sha512-uug3FEEGv0r+jrecvUUpbY8lLisvIjg6AAic6a2bSP5OEOLeJsDSnvhCDov7ipFFMXS3orMpzlmi0ZcuGkBbow==} + '@types/node@22.18.10': + resolution: {integrity: sha512-anNG/V/Efn/YZY4pRzbACnKxNKoBng2VTFydVu8RRs5hQjikP8CQfaeAV59VFSCzKNp90mXiVXW2QzV56rwMrg==} '@types/prettier@2.7.3': resolution: {integrity: sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==} - '@types/strip-bom@3.0.0': - resolution: {integrity: sha512-xevGOReSYGM7g/kUBZzPqCrR/KYAo+F0yiPc85WFTJa0MSLtyFTVTU6cJu/aV4mid7IffDIWqo69THF2o4JiEQ==} - - '@types/strip-json-comments@0.0.30': - resolution: {integrity: sha512-7NQmHra/JILCd1QqpSzl8+mJRc8ZHz3uDm8YV1Ks9IhK0epEiTw8aIErbvH9PI+6XbqhyIQy3462nEsn7UVzjQ==} - - '@types/tap@15.0.12': - resolution: {integrity: sha512-QuVlxQEBOBASkirrwp0ciwO9stIzOdRMHyaYYsexeVSAYwR4sq+YIYaQbVaYXSXi8+yPf22ZZNieRCB8KAJrTA==} + '@types/resolve@1.20.2': + resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} '@types/uuid@9.0.8': resolution: {integrity: sha512-jg+97EGIcY9AGHJJRaaPVgetKDsrTgbRjQ5Msgjh/DQKEFl0DtyRr/VCOyD1T2R1MNeWPK/u7JoGhlDZnKBAfA==} @@ -861,6 +969,9 @@ packages: buffer-from@1.1.2: resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + builtins@2.0.1: + resolution: {integrity: sha512-XkkVe5QAb6guWPXTzpSrYpSlN3nqEmrrE2TkAr/tp7idSF6+MONh9WvKrAuR3HiKLvoSgmbs8l1U9IPmMrIoLw==} + cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -931,6 +1042,9 @@ packages: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} + commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + commondir@1.0.1: resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} @@ -981,6 +1095,10 @@ packages: resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} engines: {node: '>=6'} + deepmerge@4.3.1: + resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} + engines: {node: '>=0.10.0'} + default-require-extensions@3.0.1: resolution: {integrity: sha512-eXTJmRbm2TIt9MgWTsOH1wEuhew6XGZcMeGKCtLedIg/NCsg1iBePXkceTdK4Fii7pzmN9tGsZhKzZ4h7O/fxw==} engines: {node: '>=8'} @@ -1022,9 +1140,6 @@ packages: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} - dynamic-dedupe@0.3.0: - resolution: {integrity: sha512-ssuANeD+z97meYOqd50e04Ze5qp4bPqo8cCkI4TRjZkzAUgIDTrXV1R8QCdINpiI+hw14+rYazvTRdQrz0/rFQ==} - eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} @@ -1045,6 +1160,9 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} + error-ex@1.3.4: + resolution: {integrity: sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==} + es-define-property@1.0.1: resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} engines: {node: '>= 0.4'} @@ -1103,6 +1221,12 @@ packages: engines: {node: '>=4'} hasBin: true + estree-walker@0.6.1: + resolution: {integrity: sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==} + + estree-walker@2.0.2: + resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} @@ -1279,6 +1403,9 @@ packages: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} hasBin: true + hosted-git-info@2.8.9: + resolution: {integrity: sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==} + html-entities@2.6.0: resolution: {integrity: sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==} @@ -1312,6 +1439,9 @@ packages: inherits@2.0.4: resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + is-arrayish@0.2.1: + resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} + is-binary-path@2.1.0: resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} engines: {node: '>=8'} @@ -1332,6 +1462,9 @@ packages: resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} engines: {node: '>=0.10.0'} + is-module@1.0.0: + resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} + is-node-process@1.2.0: resolution: {integrity: sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==} @@ -1342,6 +1475,9 @@ packages: is-promise@2.2.2: resolution: {integrity: sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==} + is-reference@1.2.1: + resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} + is-retry-allowed@2.2.0: resolution: {integrity: sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==} engines: {node: '>=10'} @@ -1403,6 +1539,10 @@ packages: jackspeak@3.4.3: resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + jest-worker@26.6.2: + resolution: {integrity: sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==} + engines: {node: '>= 10.13.0'} + js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} @@ -1422,6 +1562,9 @@ packages: engines: {node: '>=6'} hasBin: true + json-parse-better-errors@1.0.2: + resolution: {integrity: sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==} + json-schema-to-typescript@13.1.1: resolution: {integrity: sha512-F3CYhtA7F3yPbb8vF7sFchk/2dnr1/yTKf8RcvoNpjnh67ZS/ZMH1ElLt5KHAtf2/bymiejLQQszszPWEeTdSw==} engines: {node: '>=12.0.0'} @@ -1442,6 +1585,10 @@ packages: resolution: {integrity: sha512-S9v19shLTigoMn3c02V7LZ4t09zxmVP3r3RbEAwuHFYeKgF+ESFJxoQ0PMFKW4XdgQhcjVBEwDoopG6WROq/gw==} engines: {node: '>=10'} + load-json-file@4.0.0: + resolution: {integrity: sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==} + engines: {node: '>=4'} + locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -1467,6 +1614,9 @@ packages: lru-queue@0.1.0: resolution: {integrity: sha512-BpdYkt9EvGl8OfWHDQPISVpcl5xZthb+XPsbELj5AQXxIC8IriDZIQYjBJPEm5rS420sjZ0TLEzRcq5KdBhYrQ==} + magic-string@0.25.9: + resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==} + magic-string@0.30.18: resolution: {integrity: sha512-yi8swmWbO17qHhwIBNeeZxTceJMeBvWJaId6dyvTSOwTipqeHhMhOrz6513r1sOKnpvQ7zkhlG8tPrpilwTxHQ==} @@ -1492,6 +1642,9 @@ packages: resolution: {integrity: sha512-DGqD7Hjpi/1or4F/aYAspXKNm5Yili0QDAFAY4QYvpqpgiY6+1jOfqpmByzjxbWd/T9mChbCArXAbDAsTm5oXA==} engines: {node: '>=0.12'} + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} @@ -1576,6 +1729,9 @@ packages: node-releases@2.0.19: resolution: {integrity: sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==} + normalize-package-data@2.5.0: + resolution: {integrity: sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==} + normalize-path@3.0.0: resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} engines: {node: '>=0.10.0'} @@ -1649,6 +1805,10 @@ packages: package-manager-detector@0.2.11: resolution: {integrity: sha512-BEnLolu+yuz22S56CU1SUKq3XC3PkwD5wv4ikR4MfGvnRVcmzXR9DwSlW2fEamyTPyXHomBJRzgapeuBvRNzJQ==} + parse-json@4.0.0: + resolution: {integrity: sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==} + engines: {node: '>=4'} + path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -1668,6 +1828,10 @@ packages: resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} engines: {node: '>=16 || 14 >=14.18'} + path-type@3.0.0: + resolution: {integrity: sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==} + engines: {node: '>=4'} + path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} @@ -1690,6 +1854,10 @@ packages: resolution: {integrity: sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==} engines: {node: '>=12'} + pify@3.0.0: + resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==} + engines: {node: '>=4'} + pify@4.0.1: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'} @@ -1728,6 +1896,13 @@ packages: queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + + read-pkg@3.0.0: + resolution: {integrity: sha512-BLq/cCO9two+lBgiTYNqD6GdtK8s4NpaWrl6/rCO9w0TUS8oJl7cmToOZfRYllKTISY6nt1U7jQ53brmKqY6BA==} + engines: {node: '>=4'} + read-yaml-file@1.1.0: resolution: {integrity: sha512-VIMnQi/Z4HT2Fxuwg5KrY174U1VdUIASQVWXXyqtNRtxSr9IYkn1rsI6Tb6HsrHCmB7gVpNwX6JxPTHcH6IoTA==} engines: {node: '>=6'} @@ -1760,27 +1935,59 @@ packages: resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} - rimraf@2.7.1: - resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} - deprecated: Rimraf versions prior to v4 are no longer supported - hasBin: true - rimraf@3.0.2: resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} deprecated: Rimraf versions prior to v4 are no longer supported hasBin: true - rollup@4.50.0: - resolution: {integrity: sha512-/Zl4D8zPifNmyGzJS+3kVoyXeDeT/GrsJM94sACNg9RtUE0hrHa1bNPtRSrfHTMH5HjRzce6K7rlTh3Khiw+pw==} + rollup-plugin-auto-external@2.0.0: + resolution: {integrity: sha512-HQM3ZkZYfSam1uoZtAB9sK26EiAsfs1phrkf91c/YX+S07wugyRXSigBxrIwiLr5EPPilKYmoMxsrnlGBsXnuQ==} + engines: {node: '>=6'} + peerDependencies: + rollup: '>=0.45.2' + + rollup-plugin-inject@3.0.2: + resolution: {integrity: sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==} + deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject. + + rollup-plugin-node-polyfills@0.2.1: + resolution: {integrity: sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA==} + + rollup-plugin-polyfill-node@0.13.0: + resolution: {integrity: sha512-FYEvpCaD5jGtyBuBFcQImEGmTxDTPbiHjJdrYIp+mFIwgXiXabxvKUK7ZT9P31ozu2Tqm9llYQMRWsfvTMTAOw==} + peerDependencies: + rollup: ^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 + + rollup-plugin-terser@7.0.2: + resolution: {integrity: sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==} + deprecated: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-terser + peerDependencies: + rollup: ^2.0.0 + + rollup-pluginutils@2.8.2: + resolution: {integrity: sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==} + + rollup@4.52.4: + resolution: {integrity: sha512-CLEVl+MnPAiKh5pl4dEWSyMTpuflgNQiLGhMv8ezD5W/qP8AKvmYpCOKRRNOh7oRKnauBZ4SyeYkMS+1VSyKwQ==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + safe-resolve@1.0.0: + resolution: {integrity: sha512-aQpRvfxoi1y0UxKEU0tNO327kb0/LMo8Xrk64M2u172UqOOLCCM0khxN2OTClDiTqTJz5864GMD1X92j4YiHTg==} + safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + semver@5.7.2: + resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==} + hasBin: true + semver@6.3.1: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true @@ -1790,6 +1997,9 @@ packages: engines: {node: '>=10'} hasBin: true + serialize-javascript@4.0.0: + resolution: {integrity: sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==} + set-blocking@2.0.0: resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==} @@ -1826,6 +2036,10 @@ packages: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} + sourcemap-codec@1.4.8: + resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==} + deprecated: Please use @jridgewell/sourcemap-codec instead + spawn-wrap@2.0.0: resolution: {integrity: sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==} engines: {node: '>=8'} @@ -1833,6 +2047,18 @@ packages: spawndamnit@3.0.1: resolution: {integrity: sha512-MmnduQUuHCoFckZoWnXsTg7JaiLBJrKFj9UI2MbRPGaJeVpsLcVBu6P/IGZovziM/YBsellCmsprgNA+w0CzVg==} + spdx-correct@3.2.0: + resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==} + + spdx-exceptions@2.5.0: + resolution: {integrity: sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==} + + spdx-expression-parse@3.0.1: + resolution: {integrity: sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==} + + spdx-license-ids@3.0.22: + resolution: {integrity: sha512-4PRT4nh1EImPbt2jASOKHX7PB7I+e4IWNLvkKFDxNhJlfjbYlleYQh285Z/3mPTHSAK/AvdMmw5BNNuYH8ShgQ==} + sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} @@ -1873,10 +2099,6 @@ packages: resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} engines: {node: '>=8'} - strip-json-comments@2.0.1: - resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==} - engines: {node: '>=0.10.0'} - strip-literal@3.0.0: resolution: {integrity: sha512-TcccoMhJOM3OebGhSBEmp3UZ2SfDMZUEBdRA/9ynfLi8yYajyWX3JiXArcJt4Umh4vISpspkQIY8ZZoCqjbviA==} @@ -1938,6 +2160,11 @@ packages: resolution: {integrity: sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==} engines: {node: '>=8'} + terser@5.44.0: + resolution: {integrity: sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w==} + engines: {node: '>=10'} + hasBin: true + test-exclude@6.0.0: resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} engines: {node: '>=8'} @@ -1989,25 +2216,10 @@ packages: tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} - tree-kill@1.2.2: - resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} - hasBin: true - trivial-deferred@1.1.2: resolution: {integrity: sha512-vDPiDBC3hyP6O4JrJYMImW3nl3c03Tsj9fEXc7Qc/XKa1O7gf5ZtFfIR/E0dun9SnDHdwjna1Z2rSzYgqpxh/g==} engines: {node: '>= 8'} - ts-node-dev@2.0.0: - resolution: {integrity: sha512-ywMrhCfH6M75yftYvrvNarLEY+SUXtUvU8/0Z6llrHQVBx12GiFk5sStF8UdfE/yfzk9IAq7O5EEbTQsxlBI8w==} - engines: {node: '>=0.8.0'} - hasBin: true - peerDependencies: - node-notifier: '*' - typescript: '*' - peerDependenciesMeta: - node-notifier: - optional: true - ts-node@10.9.2: resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} hasBin: true @@ -2022,8 +2234,8 @@ packages: '@swc/wasm': optional: true - tsconfig@7.0.0: - resolution: {integrity: sha512-vZXmzPrL+EmC4T/4rVlT2jNVMWCi/O4DIiSj3UHg1OE5kCKbk4mfrXc6dZksLgRM/TZlKnousKH9bbTazUWRRw==} + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} type-fest@0.8.1: resolution: {integrity: sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==} @@ -2071,6 +2283,9 @@ packages: v8-compile-cache-lib@3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + validate-npm-package-license@3.0.4: + resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} + vite-node@3.2.4: resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==} engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} @@ -2193,10 +2408,6 @@ packages: utf-8-validate: optional: true - xtend@4.0.2: - resolution: {integrity: sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==} - engines: {node: '>=0.4'} - y18n@4.0.3: resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==} @@ -2210,6 +2421,11 @@ packages: resolution: {integrity: sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==} engines: {node: '>= 6'} + yaml@2.8.1: + resolution: {integrity: sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==} + engines: {node: '>= 14.6'} + hasBin: true + yargs-parser@18.1.3: resolution: {integrity: sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==} engines: {node: '>=6'} @@ -2416,7 +2632,7 @@ snapshots: transitivePeerDependencies: - encoding - '@changesets/cli@2.29.6(@types/node@20.19.11)': + '@changesets/cli@2.29.6(@types/node@22.18.10)': dependencies: '@changesets/apply-release-plan': 7.0.12 '@changesets/assemble-release-plan': 6.0.9 @@ -2432,7 +2648,7 @@ snapshots: '@changesets/should-skip-package': 0.1.2 '@changesets/types': 6.1.0 '@changesets/write': 0.4.0 - '@inquirer/external-editor': 1.0.1(@types/node@20.19.11) + '@inquirer/external-editor': 1.0.1(@types/node@22.18.10) '@manypkg/get-packages': 1.1.3 ansi-colors: 4.1.3 ci-info: 3.9.0 @@ -2543,6 +2759,7 @@ snapshots: '@cspotcode/source-map-support@0.8.1': dependencies: '@jridgewell/trace-mapping': 0.3.9 + optional: true '@esbuild/aix-ppc64@0.25.9': optional: true @@ -2624,12 +2841,12 @@ snapshots: '@fastify/busboy@2.1.1': {} - '@inquirer/external-editor@1.0.1(@types/node@20.19.11)': + '@inquirer/external-editor@1.0.1(@types/node@22.18.10)': dependencies: chardet: 2.1.0 iconv-lite: 0.6.3 optionalDependencies: - '@types/node': 20.19.11 + '@types/node': 22.18.10 '@isaacs/balanced-match@4.0.1': {} @@ -2663,6 +2880,11 @@ snapshots: '@jridgewell/resolve-uri@3.1.2': {} + '@jridgewell/source-map@0.3.11': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.30 + '@jridgewell/sourcemap-codec@1.5.5': {} '@jridgewell/trace-mapping@0.3.30': @@ -2674,6 +2896,7 @@ snapshots: dependencies: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 + optional: true '@jsdevtools/ono@7.1.3': {} @@ -2726,76 +2949,147 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@rollup/rollup-android-arm-eabi@4.50.0': + '@rollup/plugin-alias@5.1.1(rollup@4.52.4)': + optionalDependencies: + rollup: 4.52.4 + + '@rollup/plugin-commonjs@28.0.6(rollup@4.52.4)': + dependencies: + '@rollup/pluginutils': 5.3.0(rollup@4.52.4) + commondir: 1.0.1 + estree-walker: 2.0.2 + fdir: 6.5.0(picomatch@4.0.3) + is-reference: 1.2.1 + magic-string: 0.30.18 + picomatch: 4.0.3 + optionalDependencies: + rollup: 4.52.4 + + '@rollup/plugin-inject@5.0.5(rollup@4.52.4)': + dependencies: + '@rollup/pluginutils': 5.3.0(rollup@4.52.4) + estree-walker: 2.0.2 + magic-string: 0.30.18 + optionalDependencies: + rollup: 4.52.4 + + '@rollup/plugin-json@6.1.0(rollup@4.52.4)': + dependencies: + '@rollup/pluginutils': 5.3.0(rollup@4.52.4) + optionalDependencies: + rollup: 4.52.4 + + '@rollup/plugin-node-resolve@16.0.2(rollup@4.52.4)': + dependencies: + '@rollup/pluginutils': 5.3.0(rollup@4.52.4) + '@types/resolve': 1.20.2 + deepmerge: 4.3.1 + is-module: 1.0.0 + resolve: 1.22.10 + optionalDependencies: + rollup: 4.52.4 + + '@rollup/plugin-replace@6.0.2(rollup@4.52.4)': + dependencies: + '@rollup/pluginutils': 5.3.0(rollup@4.52.4) + magic-string: 0.30.18 + optionalDependencies: + rollup: 4.52.4 + + '@rollup/plugin-typescript@12.1.4(rollup@4.52.4)(tslib@2.8.1)(typescript@5.9.2)': + dependencies: + '@rollup/pluginutils': 5.3.0(rollup@4.52.4) + resolve: 1.22.10 + typescript: 5.9.2 + optionalDependencies: + rollup: 4.52.4 + tslib: 2.8.1 + + '@rollup/pluginutils@5.3.0(rollup@4.52.4)': + dependencies: + '@types/estree': 1.0.8 + estree-walker: 2.0.2 + picomatch: 4.0.3 + optionalDependencies: + rollup: 4.52.4 + + '@rollup/rollup-android-arm-eabi@4.52.4': optional: true - '@rollup/rollup-android-arm64@4.50.0': + '@rollup/rollup-android-arm64@4.52.4': optional: true - '@rollup/rollup-darwin-arm64@4.50.0': + '@rollup/rollup-darwin-arm64@4.52.4': optional: true - '@rollup/rollup-darwin-x64@4.50.0': + '@rollup/rollup-darwin-x64@4.52.4': optional: true - '@rollup/rollup-freebsd-arm64@4.50.0': + '@rollup/rollup-freebsd-arm64@4.52.4': optional: true - '@rollup/rollup-freebsd-x64@4.50.0': + '@rollup/rollup-freebsd-x64@4.52.4': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.50.0': + '@rollup/rollup-linux-arm-gnueabihf@4.52.4': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.50.0': + '@rollup/rollup-linux-arm-musleabihf@4.52.4': optional: true - '@rollup/rollup-linux-arm64-gnu@4.50.0': + '@rollup/rollup-linux-arm64-gnu@4.52.4': optional: true - '@rollup/rollup-linux-arm64-musl@4.50.0': + '@rollup/rollup-linux-arm64-musl@4.52.4': optional: true - '@rollup/rollup-linux-loongarch64-gnu@4.50.0': + '@rollup/rollup-linux-loong64-gnu@4.52.4': optional: true - '@rollup/rollup-linux-ppc64-gnu@4.50.0': + '@rollup/rollup-linux-ppc64-gnu@4.52.4': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.50.0': + '@rollup/rollup-linux-riscv64-gnu@4.52.4': optional: true - '@rollup/rollup-linux-riscv64-musl@4.50.0': + '@rollup/rollup-linux-riscv64-musl@4.52.4': optional: true - '@rollup/rollup-linux-s390x-gnu@4.50.0': + '@rollup/rollup-linux-s390x-gnu@4.52.4': optional: true - '@rollup/rollup-linux-x64-gnu@4.50.0': + '@rollup/rollup-linux-x64-gnu@4.52.4': optional: true - '@rollup/rollup-linux-x64-musl@4.50.0': + '@rollup/rollup-linux-x64-musl@4.52.4': optional: true - '@rollup/rollup-openharmony-arm64@4.50.0': + '@rollup/rollup-openharmony-arm64@4.52.4': optional: true - '@rollup/rollup-win32-arm64-msvc@4.50.0': + '@rollup/rollup-win32-arm64-msvc@4.52.4': optional: true - '@rollup/rollup-win32-ia32-msvc@4.50.0': + '@rollup/rollup-win32-ia32-msvc@4.52.4': optional: true - '@rollup/rollup-win32-x64-msvc@4.50.0': + '@rollup/rollup-win32-x64-gnu@4.52.4': optional: true - '@tsconfig/node10@1.0.11': {} + '@rollup/rollup-win32-x64-msvc@4.52.4': + optional: true - '@tsconfig/node12@1.0.11': {} + '@tsconfig/node10@1.0.11': + optional: true - '@tsconfig/node14@1.0.3': {} + '@tsconfig/node12@1.0.11': + optional: true - '@tsconfig/node16@1.0.4': {} + '@tsconfig/node14@1.0.3': + optional: true + + '@tsconfig/node16@1.0.4': + optional: true '@types/chai@5.2.2': dependencies: @@ -2808,7 +3102,7 @@ snapshots: '@types/glob@7.2.0': dependencies: '@types/minimatch': 6.0.0 - '@types/node': 20.19.11 + '@types/node': 22.18.10 '@types/json-schema@7.0.15': {} @@ -2820,27 +3114,21 @@ snapshots: '@types/node@12.20.55': {} - '@types/node@20.19.11': + '@types/node@22.18.10': dependencies: undici-types: 6.21.0 '@types/prettier@2.7.3': {} - '@types/strip-bom@3.0.0': {} - - '@types/strip-json-comments@0.0.30': {} - - '@types/tap@15.0.12': - dependencies: - '@types/node': 20.19.11 + '@types/resolve@1.20.2': {} '@types/uuid@9.0.8': {} '@types/ws@8.18.1': dependencies: - '@types/node': 20.19.11 + '@types/node': 22.18.10 - '@vitest/coverage-v8@3.2.4(vitest@3.2.4(@types/node@20.19.11))': + '@vitest/coverage-v8@3.2.4(vitest@3.2.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1))': dependencies: '@ampproject/remapping': 2.3.0 '@bcoe/v8-coverage': 1.0.2 @@ -2855,7 +3143,7 @@ snapshots: std-env: 3.9.0 test-exclude: 7.0.1 tinyrainbow: 2.0.0 - vitest: 3.2.4(@types/node@20.19.11) + vitest: 3.2.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1) transitivePeerDependencies: - supports-color @@ -2867,13 +3155,13 @@ snapshots: chai: 5.3.3 tinyrainbow: 2.0.0 - '@vitest/mocker@3.2.4(vite@7.1.4(@types/node@20.19.11))': + '@vitest/mocker@3.2.4(vite@7.1.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1))': dependencies: '@vitest/spy': 3.2.4 estree-walker: 3.0.3 magic-string: 0.30.18 optionalDependencies: - vite: 7.1.4(@types/node@20.19.11) + vite: 7.1.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1) '@vitest/pretty-format@3.2.4': dependencies: @@ -2904,6 +3192,7 @@ snapshots: acorn-walk@8.3.4: dependencies: acorn: 8.15.0 + optional: true acorn@8.15.0: {} @@ -2937,7 +3226,8 @@ snapshots: archy@1.0.0: {} - arg@4.1.3: {} + arg@4.1.3: + optional: true argparse@1.0.10: dependencies: @@ -3014,6 +3304,10 @@ snapshots: buffer-from@1.1.2: {} + builtins@2.0.1: + dependencies: + semver: 6.3.1 + cac@6.7.14: {} caching-transform@4.0.0: @@ -3094,6 +3388,8 @@ snapshots: dependencies: delayed-stream: 1.0.0 + commander@2.20.3: {} + commondir@1.0.1: {} concat-map@0.0.1: {} @@ -3102,7 +3398,8 @@ snapshots: convert-source-map@2.0.0: {} - create-require@1.1.1: {} + create-require@1.1.1: + optional: true cross-spawn@7.0.6: dependencies: @@ -3135,6 +3432,8 @@ snapshots: deep-eql@5.0.2: {} + deepmerge@4.3.1: {} + default-require-extensions@3.0.1: dependencies: strip-bom: 4.0.0 @@ -3175,10 +3474,6 @@ snapshots: es-errors: 1.3.0 gopd: 1.2.0 - dynamic-dedupe@0.3.0: - dependencies: - xtend: 4.0.2 - eastasianwidth@0.2.0: {} electron-to-chromium@1.5.213: {} @@ -3194,6 +3489,10 @@ snapshots: entities@4.5.0: {} + error-ex@1.3.4: + dependencies: + is-arrayish: 0.2.1 + es-define-property@1.0.1: {} es-errors@1.3.0: {} @@ -3280,6 +3579,10 @@ snapshots: esprima@4.0.1: {} + estree-walker@0.6.1: {} + + estree-walker@2.0.2: {} + estree-walker@3.0.3: dependencies: '@types/estree': 1.0.8 @@ -3462,6 +3765,8 @@ snapshots: he@1.2.0: {} + hosted-git-info@2.8.9: {} + html-entities@2.6.0: {} html-escaper@2.0.2: {} @@ -3485,6 +3790,8 @@ snapshots: inherits@2.0.4: {} + is-arrayish@0.2.1: {} + is-binary-path@2.1.0: dependencies: binary-extensions: 2.3.0 @@ -3501,12 +3808,18 @@ snapshots: dependencies: is-extglob: 2.1.1 + is-module@1.0.0: {} + is-node-process@1.2.0: {} is-number@7.0.0: {} is-promise@2.2.2: {} + is-reference@1.2.1: + dependencies: + '@types/estree': 1.0.8 + is-retry-allowed@2.2.0: {} is-stream@2.0.1: {} @@ -3582,6 +3895,12 @@ snapshots: optionalDependencies: '@pkgjs/parseargs': 0.11.0 + jest-worker@26.6.2: + dependencies: + '@types/node': 22.18.10 + merge-stream: 2.0.0 + supports-color: 7.2.0 + js-tokens@4.0.0: {} js-tokens@9.0.1: {} @@ -3597,6 +3916,8 @@ snapshots: jsesc@3.1.0: {} + json-parse-better-errors@1.0.2: {} + json-schema-to-typescript@13.1.1: dependencies: '@bcherny/json-schema-ref-parser': 10.0.5-fork @@ -3638,6 +3959,13 @@ snapshots: tcompare: 5.0.7 trivial-deferred: 1.1.2 + load-json-file@4.0.0: + dependencies: + graceful-fs: 4.2.11 + parse-json: 4.0.0 + pify: 3.0.0 + strip-bom: 3.0.0 + locate-path@5.0.0: dependencies: p-locate: 4.1.0 @@ -3660,6 +3988,10 @@ snapshots: dependencies: es5-ext: 0.10.64 + magic-string@0.25.9: + dependencies: + sourcemap-codec: 1.4.8 + magic-string@0.30.18: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 @@ -3678,7 +4010,8 @@ snapshots: dependencies: semver: 7.7.2 - make-error@1.3.6: {} + make-error@1.3.6: + optional: true math-intrinsics@1.1.0: {} @@ -3693,6 +4026,8 @@ snapshots: next-tick: 1.1.0 timers-ext: 0.1.8 + merge-stream@2.0.0: {} + merge2@1.4.1: {} micromatch@4.0.8: @@ -3763,6 +4098,13 @@ snapshots: node-releases@2.0.19: {} + normalize-package-data@2.5.0: + dependencies: + hosted-git-info: 2.8.9 + resolve: 1.22.10 + semver: 5.7.2 + validate-npm-package-license: 3.0.4 + normalize-path@3.0.0: {} nth-check@2.1.1: @@ -3861,6 +4203,11 @@ snapshots: dependencies: quansync: 0.2.11 + parse-json@4.0.0: + dependencies: + error-ex: 1.3.4 + json-parse-better-errors: 1.0.2 + path-exists@4.0.0: {} path-is-absolute@1.0.1: {} @@ -3874,6 +4221,10 @@ snapshots: lru-cache: 10.4.3 minipass: 7.1.2 + path-type@3.0.0: + dependencies: + pify: 3.0.0 + path-type@4.0.0: {} pathe@2.0.3: {} @@ -3886,6 +4237,8 @@ snapshots: picomatch@4.0.3: {} + pify@3.0.0: {} + pify@4.0.1: {} pkg-dir@4.2.0: @@ -3914,6 +4267,16 @@ snapshots: queue-microtask@1.2.3: {} + randombytes@2.1.0: + dependencies: + safe-buffer: 5.2.1 + + read-pkg@3.0.0: + dependencies: + load-json-file: 4.0.0 + normalize-package-data: 2.5.0 + path-type: 3.0.0 + read-yaml-file@1.1.0: dependencies: graceful-fs: 4.2.11 @@ -3943,51 +4306,93 @@ snapshots: reusify@1.1.0: {} - rimraf@2.7.1: + rimraf@3.0.2: dependencies: glob: 7.2.3 - rimraf@3.0.2: + rollup-plugin-auto-external@2.0.0(rollup@4.52.4): dependencies: - glob: 7.2.3 + builtins: 2.0.1 + read-pkg: 3.0.0 + rollup: 4.52.4 + safe-resolve: 1.0.0 + semver: 5.7.2 + + rollup-plugin-inject@3.0.2: + dependencies: + estree-walker: 0.6.1 + magic-string: 0.25.9 + rollup-pluginutils: 2.8.2 + + rollup-plugin-node-polyfills@0.2.1: + dependencies: + rollup-plugin-inject: 3.0.2 + + rollup-plugin-polyfill-node@0.13.0(rollup@4.52.4): + dependencies: + '@rollup/plugin-inject': 5.0.5(rollup@4.52.4) + rollup: 4.52.4 - rollup@4.50.0: + rollup-plugin-terser@7.0.2(rollup@4.52.4): + dependencies: + '@babel/code-frame': 7.27.1 + jest-worker: 26.6.2 + rollup: 4.52.4 + serialize-javascript: 4.0.0 + terser: 5.44.0 + + rollup-pluginutils@2.8.2: + dependencies: + estree-walker: 0.6.1 + + rollup@4.52.4: dependencies: '@types/estree': 1.0.8 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.50.0 - '@rollup/rollup-android-arm64': 4.50.0 - '@rollup/rollup-darwin-arm64': 4.50.0 - '@rollup/rollup-darwin-x64': 4.50.0 - '@rollup/rollup-freebsd-arm64': 4.50.0 - '@rollup/rollup-freebsd-x64': 4.50.0 - '@rollup/rollup-linux-arm-gnueabihf': 4.50.0 - '@rollup/rollup-linux-arm-musleabihf': 4.50.0 - '@rollup/rollup-linux-arm64-gnu': 4.50.0 - '@rollup/rollup-linux-arm64-musl': 4.50.0 - '@rollup/rollup-linux-loongarch64-gnu': 4.50.0 - '@rollup/rollup-linux-ppc64-gnu': 4.50.0 - '@rollup/rollup-linux-riscv64-gnu': 4.50.0 - '@rollup/rollup-linux-riscv64-musl': 4.50.0 - '@rollup/rollup-linux-s390x-gnu': 4.50.0 - '@rollup/rollup-linux-x64-gnu': 4.50.0 - '@rollup/rollup-linux-x64-musl': 4.50.0 - '@rollup/rollup-openharmony-arm64': 4.50.0 - '@rollup/rollup-win32-arm64-msvc': 4.50.0 - '@rollup/rollup-win32-ia32-msvc': 4.50.0 - '@rollup/rollup-win32-x64-msvc': 4.50.0 + '@rollup/rollup-android-arm-eabi': 4.52.4 + '@rollup/rollup-android-arm64': 4.52.4 + '@rollup/rollup-darwin-arm64': 4.52.4 + '@rollup/rollup-darwin-x64': 4.52.4 + '@rollup/rollup-freebsd-arm64': 4.52.4 + '@rollup/rollup-freebsd-x64': 4.52.4 + '@rollup/rollup-linux-arm-gnueabihf': 4.52.4 + '@rollup/rollup-linux-arm-musleabihf': 4.52.4 + '@rollup/rollup-linux-arm64-gnu': 4.52.4 + '@rollup/rollup-linux-arm64-musl': 4.52.4 + '@rollup/rollup-linux-loong64-gnu': 4.52.4 + '@rollup/rollup-linux-ppc64-gnu': 4.52.4 + '@rollup/rollup-linux-riscv64-gnu': 4.52.4 + '@rollup/rollup-linux-riscv64-musl': 4.52.4 + '@rollup/rollup-linux-s390x-gnu': 4.52.4 + '@rollup/rollup-linux-x64-gnu': 4.52.4 + '@rollup/rollup-linux-x64-musl': 4.52.4 + '@rollup/rollup-openharmony-arm64': 4.52.4 + '@rollup/rollup-win32-arm64-msvc': 4.52.4 + '@rollup/rollup-win32-ia32-msvc': 4.52.4 + '@rollup/rollup-win32-x64-gnu': 4.52.4 + '@rollup/rollup-win32-x64-msvc': 4.52.4 fsevents: 2.3.3 run-parallel@1.2.0: dependencies: queue-microtask: 1.2.3 + safe-buffer@5.2.1: {} + + safe-resolve@1.0.0: {} + safer-buffer@2.1.2: {} + semver@5.7.2: {} + semver@6.3.1: {} semver@7.7.2: {} + serialize-javascript@4.0.0: + dependencies: + randombytes: 2.1.0 + set-blocking@2.0.0: {} shebang-command@2.0.0: @@ -4013,6 +4418,8 @@ snapshots: source-map@0.6.1: {} + sourcemap-codec@1.4.8: {} + spawn-wrap@2.0.0: dependencies: foreground-child: 2.0.0 @@ -4027,6 +4434,20 @@ snapshots: cross-spawn: 7.0.6 signal-exit: 4.1.0 + spdx-correct@3.2.0: + dependencies: + spdx-expression-parse: 3.0.1 + spdx-license-ids: 3.0.22 + + spdx-exceptions@2.5.0: {} + + spdx-expression-parse@3.0.1: + dependencies: + spdx-exceptions: 2.5.0 + spdx-license-ids: 3.0.22 + + spdx-license-ids@3.0.22: {} + sprintf-js@1.0.3: {} stack-utils@2.0.6: @@ -4063,8 +4484,6 @@ snapshots: strip-bom@4.0.0: {} - strip-json-comments@2.0.1: {} - strip-literal@3.0.0: dependencies: js-tokens: 9.0.1 @@ -4100,7 +4519,7 @@ snapshots: dependencies: yaml: 1.10.2 - tap@16.3.10(ts-node@10.9.2(@types/node@20.19.11)(typescript@5.9.2))(typescript@5.9.2): + tap@16.3.10(ts-node@10.9.2(@types/node@22.18.10)(typescript@5.9.2))(typescript@5.9.2): dependencies: chokidar: 3.6.0 findit: 2.0.0 @@ -4124,7 +4543,7 @@ snapshots: tcompare: 5.0.7 which: 2.0.2 optionalDependencies: - ts-node: 10.9.2(@types/node@20.19.11)(typescript@5.9.2) + ts-node: 10.9.2(@types/node@22.18.10)(typescript@5.9.2) typescript: 5.9.2 transitivePeerDependencies: - supports-color @@ -4135,6 +4554,13 @@ snapshots: term-size@2.2.1: {} + terser@5.44.0: + dependencies: + '@jridgewell/source-map': 0.3.11 + acorn: 8.15.0 + commander: 2.20.3 + source-map-support: 0.5.21 + test-exclude@6.0.0: dependencies: '@istanbuljs/schema': 0.1.3 @@ -4183,36 +4609,16 @@ snapshots: tr46@0.0.3: {} - tree-kill@1.2.2: {} - trivial-deferred@1.1.2: {} - ts-node-dev@2.0.0(@types/node@20.19.11)(typescript@5.9.2): - dependencies: - chokidar: 3.6.0 - dynamic-dedupe: 0.3.0 - minimist: 1.2.8 - mkdirp: 1.0.4 - resolve: 1.22.10 - rimraf: 2.7.1 - source-map-support: 0.5.21 - tree-kill: 1.2.2 - ts-node: 10.9.2(@types/node@20.19.11)(typescript@5.9.2) - tsconfig: 7.0.0 - typescript: 5.9.2 - transitivePeerDependencies: - - '@swc/core' - - '@swc/wasm' - - '@types/node' - - ts-node@10.9.2(@types/node@20.19.11)(typescript@5.9.2): + ts-node@10.9.2(@types/node@22.18.10)(typescript@5.9.2): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.11 '@tsconfig/node12': 1.0.11 '@tsconfig/node14': 1.0.3 '@tsconfig/node16': 1.0.4 - '@types/node': 20.19.11 + '@types/node': 22.18.10 acorn: 8.15.0 acorn-walk: 8.3.4 arg: 4.1.3 @@ -4222,13 +4628,9 @@ snapshots: typescript: 5.9.2 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 + optional: true - tsconfig@7.0.0: - dependencies: - '@types/strip-bom': 3.0.0 - '@types/strip-json-comments': 0.0.30 - strip-bom: 3.0.0 - strip-json-comments: 2.0.1 + tslib@2.8.1: {} type-fest@0.8.1: {} @@ -4262,15 +4664,21 @@ snapshots: uuid@9.0.1: {} - v8-compile-cache-lib@3.0.1: {} + v8-compile-cache-lib@3.0.1: + optional: true + + validate-npm-package-license@3.0.4: + dependencies: + spdx-correct: 3.2.0 + spdx-expression-parse: 3.0.1 - vite-node@3.2.4(@types/node@20.19.11): + vite-node@3.2.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1): dependencies: cac: 6.7.14 debug: 4.4.1 es-module-lexer: 1.7.0 pathe: 2.0.3 - vite: 7.1.4(@types/node@20.19.11) + vite: 7.1.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1) transitivePeerDependencies: - '@types/node' - jiti @@ -4285,23 +4693,25 @@ snapshots: - tsx - yaml - vite@7.1.4(@types/node@20.19.11): + vite@7.1.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1): dependencies: esbuild: 0.25.9 fdir: 6.5.0(picomatch@4.0.3) picomatch: 4.0.3 postcss: 8.5.6 - rollup: 4.50.0 + rollup: 4.52.4 tinyglobby: 0.2.14 optionalDependencies: - '@types/node': 20.19.11 + '@types/node': 22.18.10 fsevents: 2.3.3 + terser: 5.44.0 + yaml: 2.8.1 - vitest@3.2.4(@types/node@20.19.11): + vitest@3.2.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1): dependencies: '@types/chai': 5.2.2 '@vitest/expect': 3.2.4 - '@vitest/mocker': 3.2.4(vite@7.1.4(@types/node@20.19.11)) + '@vitest/mocker': 3.2.4(vite@7.1.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1)) '@vitest/pretty-format': 3.2.4 '@vitest/runner': 3.2.4 '@vitest/snapshot': 3.2.4 @@ -4319,11 +4729,11 @@ snapshots: tinyglobby: 0.2.14 tinypool: 1.1.1 tinyrainbow: 2.0.0 - vite: 7.1.4(@types/node@20.19.11) - vite-node: 3.2.4(@types/node@20.19.11) + vite: 7.1.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1) + vite-node: 3.2.4(@types/node@22.18.10)(terser@5.44.0)(yaml@2.8.1) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 20.19.11 + '@types/node': 22.18.10 transitivePeerDependencies: - jiti - less @@ -4385,8 +4795,6 @@ snapshots: ws@8.18.3: {} - xtend@4.0.2: {} - y18n@4.0.3: {} yallist@3.1.1: {} @@ -4395,6 +4803,9 @@ snapshots: yaml@1.10.2: {} + yaml@2.8.1: + optional: true + yargs-parser@18.1.3: dependencies: camelcase: 5.3.1 @@ -4416,4 +4827,5 @@ snapshots: y18n: 4.0.3 yargs-parser: 18.1.3 - yn@3.1.1: {} + yn@3.1.1: + optional: true diff --git a/rollup.config.mjs b/rollup.config.mjs new file mode 100644 index 0000000..b397357 --- /dev/null +++ b/rollup.config.mjs @@ -0,0 +1,47 @@ +import commonjs from '@rollup/plugin-commonjs'; +import json from '@rollup/plugin-json'; +import resolve from '@rollup/plugin-node-resolve'; +import typescript from '@rollup/plugin-typescript'; +import autoExternal from 'rollup-plugin-auto-external'; + +export default [ + // 📦 CommonJS build + { + input: 'src/index.ts', + output: { + file: 'dist/index.cjs', + format: 'cjs', + sourcemap: true, + exports: 'named', + }, + plugins: [ + json(), + resolve({ preferBuiltins: true }), + commonjs(), + typescript({ + declaration: false, + }), + autoExternal(), + ], + }, + + // 📦 ES Module build + { + input: 'src/index.ts', + output: { + file: 'dist/index.js', + format: 'esm', + sourcemap: true, + exports: 'named', + }, + plugins: [ + json(), + resolve({ preferBuiltins: true, browser: false }), + commonjs(), + typescript({ + declaration: true, + }), + autoExternal(), + ], + }, +]; diff --git a/src/api/abstract-api.ts b/src/api/abstract-api.ts index a268e45..06975c3 100644 --- a/src/api/abstract-api.ts +++ b/src/api/abstract-api.ts @@ -1,8 +1,8 @@ import axios, { type AxiosError } from 'axios'; -import rateLimit, { type RateLimitedAxiosInstance } from 'axios-rate-limit'; +import * as rateLimit from 'axios-rate-limit'; import axiosRetry from 'axios-retry'; -import { AxiosResponseErrorInterceptor } from '../utils'; -import { ArcError } from './error'; +import { AxiosResponseErrorInterceptor } from '../utils/index.js'; +import { ArcError } from './error.js'; export type ArcAbstractAPIOptions = { credentials: { organizationName: string; accessToken: string }; @@ -14,7 +14,7 @@ export type ArcAPIOptions = Omit; export abstract class ArcAbstractAPI { protected name = this.constructor.name; - protected client: RateLimitedAxiosInstance; + protected client: rateLimit.RateLimitedAxiosInstance; private token = ''; private host = ''; @@ -33,13 +33,14 @@ export abstract class ArcAbstractAPI { }); // apply rate limiting - this.client = rateLimit(instance, { maxRPS: options.maxRPS || 10 }); + this.client = (rateLimit as any).default(instance, { maxRPS: options.maxRPS || 10 }); // apply retry - axiosRetry(this.client, { + const retry = typeof axiosRetry === 'function' ? axiosRetry : (axiosRetry as any).default; + retry(this.client, { retries: 5, retryDelay: axiosRetry.exponentialDelay, - retryCondition: (err) => this.retryCondition(err), + retryCondition: (err: AxiosError) => this.retryCondition(err), }); // wrap response errors diff --git a/src/api/author/index.ts b/src/api/author/index.ts index 9bfc71a..39a17d6 100644 --- a/src/api/author/index.ts +++ b/src/api/author/index.ts @@ -1,5 +1,5 @@ -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; -import type { ListAuthorsParams, ListAuthorsResponse } from './types'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; +import type { ListAuthorsParams, ListAuthorsResponse } from './types.js'; export class ArcAuthor extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { diff --git a/src/api/author/types.ts b/src/api/author/types.ts index fcef7ba..4043c38 100644 --- a/src/api/author/types.ts +++ b/src/api/author/types.ts @@ -1,5 +1,3 @@ -import type { AuthorANS } from '../migration-center/types'; - export type ListAuthorsParams = Partial<{ limit: number; last: string; @@ -10,3 +8,32 @@ export type ListAuthorsResponse = { more?: boolean; last?: string; }; + +export type AuthorANS = { + type: 'author'; + _id: string; + firstName: string; + lastName: string; + byline: string; + slug: string; + email: string; + image?: string; + affiliations?: string; + author_type?: string; + education?: { name: string }[]; + awards?: { name: string }[]; + bio_page?: string; + bio?: string; + longBio?: string; + native_app_rendering?: boolean; + fuzzy_match?: boolean; + contributor?: boolean; + location?: string; + role?: string; + expertise?: string; + personal_website?: string; + twitter?: string; + facebook?: string; + linkedin?: string; + status?: boolean; +}; diff --git a/src/api/content-ops/index.ts b/src/api/content-ops/index.ts index 2e581b3..ee2f99c 100644 --- a/src/api/content-ops/index.ts +++ b/src/api/content-ops/index.ts @@ -1,5 +1,5 @@ -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; -import type { ScheduleOperationPayload, UnscheduleOperationPayload } from './types'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; +import type { ScheduleOperationPayload, UnscheduleOperationPayload } from './types.js'; export class ArcContentOps extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { diff --git a/src/api/content/index.ts b/src/api/content/index.ts index b319bd0..90593d4 100644 --- a/src/api/content/index.ts +++ b/src/api/content/index.ts @@ -1,5 +1,5 @@ -import type { AStory } from '../../types/story'; -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; +import type { ANS } from '../../types/index.js'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; import type { GetStoriesByIdsParams, GetStoryParams, @@ -7,14 +7,14 @@ import type { ScanResponse, SearchParams, SearchResponse, -} from './types'; +} from './types.js'; export class ArcContent extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { super({ ...options, apiPath: 'content/v4' }); } - async getStory(params: GetStoryParams): Promise { + async getStory(params: GetStoryParams): Promise { const { data } = await this.client.get('/stories', { params }); return data; } diff --git a/src/api/content/types.ts b/src/api/content/types.ts index d980bf9..3828884 100644 --- a/src/api/content/types.ts +++ b/src/api/content/types.ts @@ -1,5 +1,4 @@ -import type { AGallery } from '../../types/gallery'; -import type { ARedirectObject, AStory } from '../../types/story'; +import type { ANS } from '../../types/index.js'; export type GetStoryParams = { /** Specifies the ID of the website making the request. Required. */ @@ -48,7 +47,7 @@ export type ScanParams = { export type SearchResponse = { type: 'results'; - content_elements: (AStory | AGallery | ARedirectObject)[]; + content_elements: (ANS.AStory | ANS.AGallery | ANS.ARedirectObject)[]; count: number; next?: number; previous?: number; @@ -56,7 +55,7 @@ export type SearchResponse = { export type ScanResponse = { type: 'results'; - content_elements: (AStory | AGallery | ARedirectObject)[]; + content_elements: (ANS.AStory | ANS.AGallery | ANS.ARedirectObject)[]; count: number; next: string; }; diff --git a/src/api/custom/index.ts b/src/api/custom/index.ts index 34160cb..6fa1ca8 100644 --- a/src/api/custom/index.ts +++ b/src/api/custom/index.ts @@ -1,5 +1,5 @@ import type { AxiosRequestConfig, AxiosResponse } from 'axios'; -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; export interface RequestConfig extends AxiosRequestConfig {} diff --git a/src/api/draft/index.ts b/src/api/draft/index.ts index 8e3cf7e..e3187a9 100644 --- a/src/api/draft/index.ts +++ b/src/api/draft/index.ts @@ -1,5 +1,5 @@ -import type { AStory } from '../../types/story'; -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; +import type { ANS } from '../../types/index.js'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; import type { Circulations, CreateDocumentRedirectPayload, @@ -11,7 +11,7 @@ import type { Revision, Revisions, UpdateDraftRevisionPayload, -} from './types'; +} from './types.js'; export class ArcDraft extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { @@ -23,7 +23,7 @@ export class ArcDraft extends ArcAbstractAPI { return data.id; } - async createDocument(ans: AStory, type = 'story') { + async createDocument(ans: ANS.AStory, type = 'story') { const { data } = await this.client.post(`/${type}`, ans); return data; } diff --git a/src/api/draft/types.ts b/src/api/draft/types.ts index 8e626a7..21591e3 100644 --- a/src/api/draft/types.ts +++ b/src/api/draft/types.ts @@ -1,5 +1,5 @@ -import type { AStory } from '../../types/story'; -import type { CirculationReference } from '../migration-center/types'; +import type { ANS } from '../../types/index.js'; +import type { CirculationReference } from '../migration-center/types.js'; export type CreateExternalRedirectPayload = { redirect_to: string; @@ -34,7 +34,7 @@ export type Revision = { created_at: string; type: string; user_id?: string; - ans: AStory; + ans: ANS.AStory; }; export type Document = { @@ -51,7 +51,7 @@ export type Document = { export type UpdateDraftRevisionPayload = { document_id: string; - ans: AStory; + ans: ANS.AStory; type: 'DRAFT'; }; diff --git a/src/api/error.ts b/src/api/error.ts index 6638761..4f8b9f9 100644 --- a/src/api/error.ts +++ b/src/api/error.ts @@ -1,5 +1,5 @@ import type { AxiosError, InternalAxiosRequestConfig } from 'axios'; -import { safeJSONStringify } from '../utils'; +import { safeJSONStringify } from '../utils/index.js'; export class ArcError extends Error { public responseData: unknown; diff --git a/src/api/global-settings/index.ts b/src/api/global-settings/index.ts index 37cb5fe..6591d40 100644 --- a/src/api/global-settings/index.ts +++ b/src/api/global-settings/index.ts @@ -1,5 +1,5 @@ -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; -import type { CreateDistributorPayload, Distributor, GetDistributorsParams, GetDistributorsResponse } from './types'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; +import type { CreateDistributorPayload, Distributor, GetDistributorsParams, GetDistributorsResponse } from './types.js'; export class GlobalSettings extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { diff --git a/src/api/identity/index.ts b/src/api/identity/index.ts index 7cb98e3..7fc52da 100644 --- a/src/api/identity/index.ts +++ b/src/api/identity/index.ts @@ -1,5 +1,5 @@ -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; -import type { GetUserResponse, MigrateBatchUsersPayload, MigrateBatchUsersResponse, UserProfile } from './types'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; +import type { GetUserResponse, MigrateBatchUsersPayload, MigrateBatchUsersResponse, UserProfile } from './types.js'; export class ArcIdentity extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { diff --git a/src/api/ifx/index.ts b/src/api/ifx/index.ts index cbdbf5c..46e94ac 100644 --- a/src/api/ifx/index.ts +++ b/src/api/ifx/index.ts @@ -1,6 +1,5 @@ -import { createReadStream } from 'node:fs'; -import FormData from 'form-data'; -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; +import platform from '../../lib/platform/index.js'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; import type { AddSecretPayload, Bundle, @@ -11,7 +10,7 @@ import type { Integration, SubscribePayload, UpdateIntegrationPayload, -} from './types'; +} from './types.js'; export class ArcIFX extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { @@ -95,9 +94,15 @@ export class ArcIFX extends ArcAbstractAPI { } async uploadBundle(integrationName: string, name: string, bundlePath: string) { - const bundle = createReadStream(bundlePath); + const fs = await platform.fs(); + const FormData = await platform.form_data(); + const form = new FormData(); + console.log('platform', platform); + console.log(form); + const bundle = fs.createReadStream(bundlePath); + form.append('bundle', bundle); form.append('name', name); diff --git a/src/api/index.ts b/src/api/index.ts index 339ab1e..4a23e14 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,21 +1,21 @@ -import type { ArcAPIOptions } from './abstract-api'; -import { ArcAuthor } from './author'; -import { ArcContent } from './content'; -import { ArcContentOps } from './content-ops'; -import { Custom } from './custom'; -import { ArcDraft } from './draft'; -import { GlobalSettings } from './global-settings'; -import { ArcIdentity } from './identity'; -import { ArcIFX } from './ifx'; -import { ArcMigrationCenter } from './migration-center'; -import { ArcProtoCenter } from './photo-center'; -import { ArcRedirect } from './redirect'; -import { ArcRetailEvents } from './retail-events'; -import { ArcSales } from './sales'; -import { ArcSigningService } from './signing-service'; -import { ArcSite } from './site'; -import { ArcTags } from './tags'; -import { ArcWebsked } from './websked'; +import type { ArcAPIOptions } from './abstract-api.js'; +import { ArcAuthor } from './author/index.js'; +import { ArcContentOps } from './content-ops/index.js'; +import { ArcContent } from './content/index.js'; +import { Custom } from './custom/index.js'; +import { ArcDraft } from './draft/index.js'; +import { GlobalSettings } from './global-settings/index.js'; +import { ArcIdentity } from './identity/index.js'; +import { ArcIFX } from './ifx/index.js'; +import { ArcMigrationCenter } from './migration-center/index.js'; +import { ArcProtoCenter } from './photo-center/index.js'; +import { ArcRedirect } from './redirect/index.js'; +import { ArcRetailEvents } from './retail-events/index.js'; +import { ArcSales } from './sales/index.js'; +import { ArcSigningService } from './signing-service/index.js'; +import { ArcSite } from './site/index.js'; +import { ArcTags } from './tags/index.js'; +import { ArcWebsked } from './websked/index.js'; export const ArcAPI = (options: ArcAPIOptions) => { const API = { @@ -34,16 +34,15 @@ export const ArcAPI = (options: ArcAPIOptions) => { GlobalSettings: new GlobalSettings(options), Tags: new ArcTags(options), ContentOps: new ArcContentOps(options), + RetailEvents: new ArcRetailEvents(options), Custom: new Custom(options), }; - return { - ...API, - setMaxRPS: (rps: number) => { - Object.values(API).forEach((a) => a.setMaxRPS(rps)); - }, - RetailEvents: new ArcRetailEvents(options), - }; + API.MigrationCenter.setMaxRPS(12); + API.Draft.setMaxRPS(4); + API.Content.setMaxRPS(3); + + return API; }; export type ArcAPIType = ReturnType; diff --git a/src/api/migration-center/index.ts b/src/api/migration-center/index.ts index 8137625..1527bed 100644 --- a/src/api/migration-center/index.ts +++ b/src/api/migration-center/index.ts @@ -1,4 +1,4 @@ -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; import type { Count, CountRequest, @@ -12,7 +12,7 @@ import type { PostANSPayload, Summary, SummaryReportRequest, -} from './types'; +} from './types.js'; export class ArcMigrationCenter extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { diff --git a/src/api/migration-center/types.ts b/src/api/migration-center/types.ts index dafb71d..c92a4a6 100644 --- a/src/api/migration-center/types.ts +++ b/src/api/migration-center/types.ts @@ -1,38 +1,7 @@ -import type { AGallery } from '../../types/gallery'; -import type { SectionReference } from '../../types/section'; -import type { AStory, AnImage, Tag } from '../../types/story'; -import type { VideoContent } from '../../types/video'; - -type TagANS = Tag & { name: string }; - -export type AuthorANS = { - type: 'author'; - _id: string; - firstName: string; - lastName: string; - byline: string; - slug: string; - email: string; - image?: string; - affiliations?: string; - author_type?: string; - education?: { name: string }[]; - awards?: { name: string }[]; - bio_page?: string; - bio?: string; - longBio?: string; - native_app_rendering?: boolean; - fuzzy_match?: boolean; - contributor?: boolean; - location?: string; - role?: string; - expertise?: string; - personal_website?: string; - twitter?: string; - facebook?: string; - linkedin?: string; - status?: boolean; -}; +import type { ANS, SectionReference } from '../../types/index.js'; +import type { AuthorANS } from '../author/types.js'; + +type TagANS = ANS.Tag & { name: string }; export type CirculationReference = { document_id: string; @@ -52,7 +21,7 @@ export type Operation = { endpoint: string; }; -export type ANSContent = AStory | AGallery | AnImage | AuthorANS | TagANS | VideoContent; +export type ANSContent = ANS.AStory | ANS.AGallery | ANS.AnImage | AuthorANS | TagANS | ANS.VideoContent; export type PostANSPayload = { sourceId: string; diff --git a/src/api/photo-center/index.ts b/src/api/photo-center/index.ts index 164e3de..b9ee2c4 100644 --- a/src/api/photo-center/index.ts +++ b/src/api/photo-center/index.ts @@ -1,34 +1,36 @@ import type { ReadStream } from 'node:fs'; -import path from 'node:path'; -import FormData from 'form-data'; -import type { AGallery } from '../../types/gallery'; -import type { AnImage } from '../../types/story'; -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; -import type { GetGalleriesParams, GetGalleriesResponse, GetImagesParams, GetImagesResponse } from './types'; +import platform from '../../lib/platform/index.js'; +import type { ANS } from '../../types/index.js'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; +import type { GetGalleriesParams, GetGalleriesResponse, GetImagesParams, GetImagesResponse } from './types.js'; export class ArcProtoCenter extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { super({ ...options, apiPath: 'photo/api' }); } - async getImageDataById(imageId: string): Promise { + async getImageDataById(imageId: string): Promise { const { data } = await this.client.get(`/v2/photos/${imageId}`); return data; } - async uploadImageANS(image: AnImage) { + async uploadImageANS(image: ANS.AnImage) { + const FormData = await platform.form_data(); const form = new FormData(); + form.append('ans', JSON.stringify(image), { filename: 'ans.json', contentType: 'application/json', }); - const { data } = await this.client.post('/v2/photos', form, { headers: form.getHeaders() }); + const { data } = await this.client.post('/v2/photos', form, { headers: form.getHeaders() }); return data; } async uploadImageStream( readableStream: ReadStream, options?: { contentType?: string; filename?: string } - ): Promise { + ): Promise { + const path = await platform.path(); + const FormData = await platform.form_data(); const form = new FormData(); const contentType = options?.contentType ?? 'application/octet-stream'; const filename = path.basename(String(options?.filename || readableStream.path || 'file.jpg')); @@ -64,12 +66,12 @@ export class ArcProtoCenter extends ArcAbstractAPI { } async getGallery(galleryId: string) { - const { data } = await this.client.get(`/v2/galleries/${galleryId}`); + const { data } = await this.client.get(`/v2/galleries/${galleryId}`); return data; } - async updateImage(imageId: string, photoDto: AnImage) { - const { data } = await this.client.put(`/v2/photos/${imageId}`, photoDto); + async updateImage(imageId: string, photoDto: ANS.AnImage) { + const { data } = await this.client.put(`/v2/photos/${imageId}`, photoDto); return data; } } diff --git a/src/api/photo-center/types.ts b/src/api/photo-center/types.ts index fdfda52..8055637 100644 --- a/src/api/photo-center/types.ts +++ b/src/api/photo-center/types.ts @@ -1,5 +1,4 @@ -import type { AGallery } from '../../types/gallery'; -import type { AnImage } from '../../types/story'; +import type { ANS } from '../../types/index.js'; export type GetImagesParams = Partial<{ primaryWebsite: string; @@ -15,6 +14,6 @@ export type GetGalleriesParams = Partial<{ limit: number; }>; -export type GetImagesResponse = AnImage[]; +export type GetImagesResponse = ANS.AnImage[]; -export type GetGalleriesResponse = AGallery[]; +export type GetGalleriesResponse = ANS.AGallery[]; diff --git a/src/api/redirect/index.ts b/src/api/redirect/index.ts index 8070c9c..e162c0d 100644 --- a/src/api/redirect/index.ts +++ b/src/api/redirect/index.ts @@ -1,5 +1,5 @@ -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; -import type { ArcRedirectRuleContentType, ArcRedirectRuleType, ArcRedirectRulesResponse } from './types'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; +import type { ArcRedirectRuleContentType, ArcRedirectRuleType, ArcRedirectRulesResponse } from './types.js'; export class ArcRedirect extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { diff --git a/src/api/retail-events/index.ts b/src/api/retail-events/index.ts index b27bce7..66d790e 100644 --- a/src/api/retail-events/index.ts +++ b/src/api/retail-events/index.ts @@ -1,5 +1,5 @@ -import type { ArcAPIOptions } from '../abstract-api'; -import { WsClient } from '../ws.client'; +import type { ArcAPIOptions } from '../abstract-api.js'; +import { WsClient } from '../ws.client.js'; export class ArcRetailEvents { constructor(private readonly options: Pick) {} diff --git a/src/api/sales/index.ts b/src/api/sales/index.ts index ba24aac..1089c57 100644 --- a/src/api/sales/index.ts +++ b/src/api/sales/index.ts @@ -1,6 +1,6 @@ import FormData from 'form-data'; -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; -import type { MigrateBatchSubscriptionsPayload, MigrateBatchSubscriptionsResponse } from './types'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; +import type { MigrateBatchSubscriptionsPayload, MigrateBatchSubscriptionsResponse } from './types.js'; export class ArcSales extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { diff --git a/src/api/signing-service/index.ts b/src/api/signing-service/index.ts index 213d021..1886e26 100644 --- a/src/api/signing-service/index.ts +++ b/src/api/signing-service/index.ts @@ -1,5 +1,5 @@ -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; -import type { SignResponse } from './types'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; +import type { SignResponse } from './types.js'; export class ArcSigningService extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { diff --git a/src/api/site/index.ts b/src/api/site/index.ts index c628aa8..ebd8402 100644 --- a/src/api/site/index.ts +++ b/src/api/site/index.ts @@ -1,6 +1,14 @@ -import type { Section, SetSection } from '../../types/section'; -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; -import type { GetLinksParams, GetLinksResponse, GetSectionParams, GetSectionsResponse, Link, Website } from './types'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; +import type { + GetLinksParams, + GetLinksResponse, + GetSectionParams, + GetSectionsResponse, + Link, + Section, + SetSectionPayload, + Website, +} from './types.js'; export class ArcSite extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { @@ -25,7 +33,7 @@ export class ArcSite extends ArcAbstractAPI { await this.client.delete(`/website/${website}/section?_id=${id}`); } - async putSection(section: SetSection) { + async putSection(section: SetSectionPayload) { const { data } = await this.client.put(`/website/${section.website}/section?_id=${section._id}`, section); return data; diff --git a/src/api/site/types.ts b/src/api/site/types.ts index f4bbe28..a050d48 100644 --- a/src/api/site/types.ts +++ b/src/api/site/types.ts @@ -1,5 +1,3 @@ -import type { Section } from '../../types/section'; - export type Website = { _id: string; display_name: string; @@ -40,3 +38,67 @@ export type GetSectionParams = { offset?: number; include_inactive?: boolean; }; + +export type SectionReference = { + type: 'reference'; + referent: { + id: string; + website: string; + type: 'section'; + }; +}; + +export type SectionOrder = { default?: number; footer?: number; main_navigation?: number; header?: number } & { + [key: string]: number | undefined; +}; + +export type SectionParent = { default?: string; footer?: null | string; main_navigation?: string; header?: string } & { + [key: string]: string | undefined; +}; + +export type Section = { + _id: string; + site?: { + site_url: null; + site_keywords: null; + site_description: string; + site_tagline: null; + pagebuilder_path_for_native_apps: null; + site_about: null; + site_title: string; + section_collection: string; + }; + social?: { twitter: null; rss: null; facebook: null; instagram: null }; + navigation?: { nav_title: string }; + site_topper?: { site_logo_image: null }; + _admin?: { alias_ids: string[] }; + _website?: string; + name: string; + order?: SectionOrder; + parent?: SectionParent; + ancestors?: { default: []; footer: []; header: [] }; + inactive?: false; + node_type?: 'section'; +}; + +export type SetSectionPayload = { + _id: string; + website: string; + name: string; + navigation?: { nav_title: string }; + _admin?: { alias_ids: string[] }; + ancestors?: string[]; + order?: SectionOrder; + parent?: SectionParent; + inactive?: false; + site?: Partial<{ + site_url: null; + site_keywords: null; + site_description: string; + site_tagline: null; + pagebuilder_path_for_native_apps: null; + site_about: null; + site_title: string; + section_collection: string; + }>; +}; diff --git a/src/api/tags/index.ts b/src/api/tags/index.ts index 0e90d19..ca55024 100644 --- a/src/api/tags/index.ts +++ b/src/api/tags/index.ts @@ -1,4 +1,4 @@ -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; import type { AddTagRequest, AddTagsResponse, @@ -8,7 +8,7 @@ import type { GetTagsResponse, SearchTagsParams, SearchTagsV2Params, -} from './types'; +} from './types.js'; export class ArcTags extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { diff --git a/src/api/websked/index.ts b/src/api/websked/index.ts index b739c93..e6462c3 100644 --- a/src/api/websked/index.ts +++ b/src/api/websked/index.ts @@ -1,4 +1,4 @@ -import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api'; +import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; import type { CreateTaskPayload, CreateTaskResponse, @@ -8,7 +8,7 @@ import type { ReportStatusChangePayload, SectionEdition, WebskedPublication, -} from './types'; +} from './types.js'; export class ArcWebsked extends ArcAbstractAPI { constructor(options: ArcAPIOptions) { diff --git a/src/api/ws.client.ts b/src/api/ws.client.ts index 41376f2..724ec83 100644 --- a/src/api/ws.client.ts +++ b/src/api/ws.client.ts @@ -1,4 +1,4 @@ -import ws from 'ws'; +import * as ws from 'ws'; export type PromiseOr = Promise | T; export type Callback = (...args: Args) => PromiseOr; diff --git a/src/content-elements/content-elements.ts b/src/content-elements/content-elements.ts index a135851..d4c1f56 100644 --- a/src/content-elements/content-elements.ts +++ b/src/content-elements/content-elements.ts @@ -1,5 +1,5 @@ -import type { CElement } from '../types/content-elements'; -import type { Alignment, AnImage } from '../types/story'; +import type { ANS } from '../types/index.js'; +import type { CElement } from './types.js'; export const ContentElement = { divider: () => { @@ -7,7 +7,7 @@ export const ContentElement = { type: 'divider' as const, }; }, - text: (content: string, alignment: Alignment | null = 'left') => { + text: (content: string, alignment: ANS.Alignment | null = 'left') => { return { type: 'text' as const, content, @@ -74,7 +74,7 @@ export const ContentElement = { }), }; }, - image: (id: string, properties?: AnImage) => { + image: (id: string, properties?: ANS.AnImage) => { return { referent: { id, diff --git a/src/content-elements/html/html.processor.ts b/src/content-elements/html/html.processor.ts index 60dced2..2b2dee9 100644 --- a/src/content-elements/html/html.processor.ts +++ b/src/content-elements/html/html.processor.ts @@ -1,8 +1,8 @@ import { type CommentNode, type HTMLElement, type Node, parse } from 'node-html-parser'; -import type { CElement, ContentElementType } from '../../types/content-elements'; -import type { MaybePromise } from '../../types/utils'; -import { ContentElement } from '../content-elements'; -import { BLOCK_ELEMENT_TAGS } from './html.constants'; +import type { MaybePromise } from '../../types/utils.js'; +import { ContentElement } from '../content-elements.js'; +import type { CElement, ContentElementType } from '../types.js'; +import { BLOCK_ELEMENT_TAGS } from './html.constants.js'; import { getHTMLElementAttribute, isCommentNode, @@ -11,7 +11,7 @@ import { isTextNode, nodeTagIn, nodeTagIs, -} from './html.utils'; +} from './html.utils.js'; export type NodeHandler = (node: Node) => MaybePromise; export type WrapHandler = (node: Node, content: ContentElementType<'text'>) => ContentElementType<'text'> | undefined; diff --git a/src/content-elements/html/html.utils.ts b/src/content-elements/html/html.utils.ts index d3e462e..9de1fea 100644 --- a/src/content-elements/html/html.utils.ts +++ b/src/content-elements/html/html.utils.ts @@ -1,6 +1,6 @@ import { decode } from 'html-entities'; -import parse, { HTMLElement, CommentNode, type Options, TextNode, type Node } from 'node-html-parser'; -import type { CElement, ContentElementType } from '../../types/content-elements'; +import { CommentNode, HTMLElement, type Node, type Options, TextNode, parse } from 'node-html-parser'; +import type { CElement, ContentElementType } from '../types.js'; export const isTextNode = (node?: Node): node is TextNode => { return node instanceof TextNode; diff --git a/src/content-elements/html/index.ts b/src/content-elements/html/index.ts index dd33b5d..06f0c6a 100644 --- a/src/content-elements/html/index.ts +++ b/src/content-elements/html/index.ts @@ -1,3 +1,3 @@ -export * as Constants from './html.constants'; -export { HTMLProcessor } from './html.processor'; -export * as Utils from './html.utils'; +export * as Constants from './html.constants.js'; +export { HTMLProcessor } from './html.processor.js'; +export * as Utils from './html.utils.js'; diff --git a/src/content-elements/index.ts b/src/content-elements/index.ts index 2785bda..8f01a81 100644 --- a/src/content-elements/index.ts +++ b/src/content-elements/index.ts @@ -1,2 +1,2 @@ -export * from './content-elements'; -export * as HTML from './html'; +export * from './content-elements.js'; +export * as HTML from './html/index.js'; diff --git a/src/content-elements/types.ts b/src/content-elements/types.ts new file mode 100644 index 0000000..22de3ee --- /dev/null +++ b/src/content-elements/types.ts @@ -0,0 +1,5 @@ +import type { ANS } from '../types/index.js'; +import type { ContentElement } from './content-elements.js'; + +export type CElement = ANS.AnElementThatCanBeListedAsPartOfContentElements; +export type ContentElementType = ReturnType<(typeof ContentElement)[T]>; diff --git a/src/index.ts b/src/index.ts index d67d689..d4b4470 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,21 +1,12 @@ -export * as ArcTypes from './types'; -export * from './api/identity/types'; -export * from './api/draft/types'; -export * from './api/site/types'; -export * from './api/ifx/types'; -export * from './api/redirect/types'; -export * from './api/migration-center/types'; -export * from './api/sales/types'; -export * from './api/websked/types'; -export * from './api/content/types'; -export * from './api/photo-center/types'; -export * from './api/global-settings/types'; -export * from './api/tags/types'; -export * from './api/content-ops/types'; +import { ArcAPI } from './api/index.js'; -export { ArcAPI, ArcAPIType } from './api'; -export { ArcUtils } from './utils/arc'; -export { ArcError } from './api/error'; -export { WsClient } from './api/ws.client'; -export * as AnsMapper from './mapper'; -export * as ContentElements from './content-elements'; +export * as ArcTypes from './types/index.js'; + +export { ArcAPI, ArcAPIType } from './api/index.js'; +export { ArcUtils } from './utils/arc/index.js'; +export { ArcError } from './api/error.js'; +export { WsClient } from './api/ws.client.js'; +export * as AnsMapper from './mapper/index.js'; +export * as ContentElements from './content-elements/index.js'; + +export default ArcAPI; diff --git a/src/lib/platform/index.ts b/src/lib/platform/index.ts new file mode 100644 index 0000000..7a4b43e --- /dev/null +++ b/src/lib/platform/index.ts @@ -0,0 +1,5 @@ +import node from './node'; + +export default { + ...node, +}; diff --git a/src/lib/platform/node.ts b/src/lib/platform/node.ts new file mode 100644 index 0000000..90fc39e --- /dev/null +++ b/src/lib/platform/node.ts @@ -0,0 +1,10 @@ +const importNodeModule = async (moduleId: string) => await import(moduleId); + +const modules = { + // make it like that so static analyzer of webpack won't bundle it + fs: () => importNodeModule('node:fs') as Promise, + path: () => importNodeModule('node:path') as Promise, + form_data: () => importNodeModule('form-data') as Promise, +}; + +export default modules; diff --git a/src/mapper/doc.ts b/src/mapper/doc.ts index cac33a0..2b24f4d 100644 --- a/src/mapper/doc.ts +++ b/src/mapper/doc.ts @@ -1,13 +1,14 @@ -import type { ArcTypes } from '..'; -import type { ANSContent, CirculationReference, PostANSParams, PostANSPayload } from '../api/migration-center/types'; -import type { MaybePromise, Optional } from '../types/utils'; +import type { ANSContent, CirculationReference, PostANSParams, PostANSPayload } from '../api/migration-center/types.js'; +import type { ContentElementType } from '../content-elements/types.js'; +import type { ANS } from '../types/index.js'; +import type { MaybePromise, Optional } from '../types/utils.js'; /** * Base class for all arc entities, it provides common methods and properties * If you want to create a new entity subtype you should extend this class * * Use case: You want to migrate stories from BBC - * You define `class BBCStory extends ArcDocument` and implement all abstract methods + * You define `class BBCStory extends ArcDocument` and implement all abstract methods * Then you can override the specific methods to enrich the story with the data from BBC * * To migrate it call .migrate() method @@ -27,7 +28,7 @@ export abstract class Document { abstract arcId(): MaybePromise; abstract type(): MaybePromise; abstract groupId(): MaybePromise; - abstract version(): ArcTypes.Story.DescribesTheANSVersionOfThisObject; + abstract version(): ANS.DescribesTheANSVersionOfThisObject; abstract getAns(): MaybePromise; @@ -80,7 +81,7 @@ export abstract class Document { return 'historical'; } - protected getDistributor(): MaybePromise> { + protected getDistributor(): MaybePromise> { return; } @@ -88,11 +89,11 @@ export abstract class Document { return 'en-GB'; } - protected getComments(): Optional { + protected getComments(): Optional { return; } - protected async getSource(): Promise> { + protected async getSource(): Promise> { return { name: 'code-store', system: 'code-store', @@ -100,13 +101,13 @@ export abstract class Document { }; } - protected getSubheadlines(): Optional { + protected getSubheadlines(): Optional { return { basic: '', }; } - protected getDescription(): Optional { + protected getDescription(): Optional { return this.getSubheadlines(); } @@ -119,7 +120,7 @@ export abstract class Document { return new Date(); } - protected async getContentElements(): Promise[]> { + protected async getContentElements(): Promise[]> { return []; } @@ -127,37 +128,37 @@ export abstract class Document { return new Date(); } - protected getHeadlines(): Optional { + protected getHeadlines(): Optional { return { basic: '', }; } - protected getTags(): MaybePromise> { + protected getTags(): MaybePromise> { return; } - protected getSubtype(): MaybePromise> { + protected getSubtype(): MaybePromise> { return; } - protected getLabel(): MaybePromise> { + protected getLabel(): MaybePromise> { return; } - protected getRelatedContent(): MaybePromise> { + protected getRelatedContent(): MaybePromise> { return; } - protected async getPromoItems(): Promise> { + protected async getPromoItems(): Promise> { return; } - protected getWebskedStatusCode(): MaybePromise { + protected getWebskedStatusCode(): MaybePromise { return; } - protected getCreditsBy(): MaybePromise { + protected getCreditsBy(): MaybePromise { return []; } @@ -165,27 +166,27 @@ export abstract class Document { return []; } - protected getEditorNote(): MaybePromise> { + protected getEditorNote(): MaybePromise> { return; } - protected getContentRestrictions(): MaybePromise> { + protected getContentRestrictions(): MaybePromise> { return; } - protected getOwnerInformation(): MaybePromise> { + protected getOwnerInformation(): MaybePromise> { return; } - protected getSyndication(): MaybePromise> { + protected getSyndication(): MaybePromise> { return; } - protected getSchedulingInformation(): MaybePromise> { + protected getSchedulingInformation(): MaybePromise> { return; } - protected getTaxonomy(): MaybePromise> { + protected getTaxonomy(): MaybePromise> { return; } } diff --git a/src/mapper/index.ts b/src/mapper/index.ts index 7989f44..69f026b 100644 --- a/src/mapper/index.ts +++ b/src/mapper/index.ts @@ -1,2 +1,2 @@ -export { Document } from './doc'; -export { Story } from './story'; +export { Document } from './doc.js'; +export { Story } from './story.js'; diff --git a/src/mapper/story.ts b/src/mapper/story.ts index 22be585..c98076d 100644 --- a/src/mapper/story.ts +++ b/src/mapper/story.ts @@ -1,6 +1,6 @@ -import type { ANSContent } from '../api/migration-center/types'; -import type * as Types from '../types'; -import { Document } from './doc'; +import type { ANSContent } from '../api/migration-center/types.js'; +import type { ANS } from '../types/index.js'; +import { Document } from './doc.js'; /** * Base class for all arc stories, it provides common methods and properties @@ -19,7 +19,7 @@ import { Document } from './doc'; * }]; * } */ -export abstract class Story extends Document { +export abstract class Story extends Document { type() { return 'story' as const; } diff --git a/src/scripts/json-schema-to-ts.ts b/src/scripts/json-schema-to-ts.ts index 11f035b..daabfd4 100644 --- a/src/scripts/json-schema-to-ts.ts +++ b/src/scripts/json-schema-to-ts.ts @@ -1,7 +1,7 @@ import { writeFileSync } from 'node:fs'; import { compileFromFile } from 'json-schema-to-typescript'; -const input = './input.json'; -const output = './output.ts'; +const input = './ans-schema.json'; +const output = './src/types/ans-types.ts'; compileFromFile(input).then((ts) => writeFileSync(output, ts)); diff --git a/src/tests/api/utils.test.ts b/src/tests/api/utils.test.ts index 5ca1982..19f6b1e 100644 --- a/src/tests/api/utils.test.ts +++ b/src/tests/api/utils.test.ts @@ -37,6 +37,12 @@ describe('Arc Utils', () => { expect(id1).not.toEqual(id2); }); + + test('Resolves to same id', () => { + const id = ArcUtils.Id.generateArcId('123456789', 'code.store'); + + expect(id).toEqual('2VODOGXJ4ZLSBFE4Z6ZYTLFNE4'); + }); }); describe('ArcUtils.content.createSocial', () => { diff --git a/src/tests/build.test.ts b/src/tests/build.test.ts new file mode 100644 index 0000000..a13fc91 --- /dev/null +++ b/src/tests/build.test.ts @@ -0,0 +1,27 @@ +import path from 'node:path'; +import { fileURLToPath } from 'node:url'; +import { describe, expect, it } from 'vitest'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +function createAPI(mod: typeof import('../../dist/index.js')) { + const api = mod.ArcAPI({ credentials: { accessToken: '', organizationName: '' } }); + return api; +} + +describe('Module import', () => { + it('CJS', async () => { + const mod = await import(path.resolve(__dirname, '../../dist/index.cjs')); + expect(mod).toBeDefined(); + expect(typeof mod.ArcAPI).toBe('function'); + expect(createAPI(mod)).toBeTypeOf('object'); + }); + + it('ESM', async () => { + const mod = await import(path.resolve(__dirname, '../../dist/index.js')); + expect(mod).toBeDefined(); + expect(typeof mod.ArcAPI).toBe('function'); + expect(createAPI(mod)).toBeTypeOf('object'); + }); +}); diff --git a/src/types/story.ts b/src/types/ans-types.ts similarity index 86% rename from src/types/story.ts rename to src/types/ans-types.ts index e964768..558f3c5 100644 --- a/src/types/story.ts +++ b/src/types/ans-types.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ /** * This file was automatically generated by json-schema-to-typescript. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, @@ -11,7 +12,7 @@ export type GloballyUniqueIDTrait = string; /** * The version of ANS that this object was serialized as, in major.minor.patch format. For top-level content objects, this is a required trait. */ -export type DescribesTheANSVersionOfThisObject = '0.10.10'; +export type DescribesTheANSVersionOfThisObject = '0.10.12'; /** * A user-defined categorization method to supplement type. In Arc, this field is reserved for organization-defined purposes, such as selecting the PageBuilder template that should be used to render a document. */ @@ -165,7 +166,7 @@ export type SEOFilename = string; export type SocialLinks = { site?: string; url?: string; - [k: string]: unknown | undefined; + [k: string]: unknown; }[]; /** * The real first name of a human author. @@ -267,7 +268,7 @@ export type Org = string; export type SocialLinks1 = { site?: string; url?: string; - [k: string]: unknown | undefined; + [k: string]: unknown; }[]; /** * The primary author(s) of this document. For a story, is is the writer or reporter. For an image, it is the photographer. @@ -277,14 +278,18 @@ export type By = (AnAuthorOfAPieceOfContent | RepresentationOfANormalizedElement * The photographer(s) of supplementary images included in this document, if it is a story. Note that if this document is an image, the photographer(s) should appear in the 'by' slot. */ export type PhotosBy1 = (AnAuthorOfAPieceOfContent | RepresentationOfANormalizedElement)[]; -/** - * Trait that applies a list of corrections to a document. - */ -export type Corrections = Correction[]; /** * Holds attributes of an ANS collection - a common parent to story and gallery objects. */ export type ACollectionOfContent = AnElementThatCanBeListedAsPartOfContentElements[]; +/** + * The absolute URL of the document on website which will override any relative URL specified by the `canonical_url` field. + */ +export type CanonicalExternalURL = string; +/** + * Trait that applies a list of corrections to a document. + */ +export type Corrections = Correction[]; /** * True if and only if at least one published edition exists for this content item. */ @@ -353,8 +358,8 @@ export type VoiceTranscriptSConfigurationAndOutput = [ subtype?: SubtypeOrTemplate; options: OptionsRequested; options_used?: OptionsUsed; - output?: HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01010AudioJson; - [k: string]: unknown | undefined; + output?: HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01012AudioJson; + [k: string]: unknown; }, ...{ _id?: GloballyUniqueIDTrait; @@ -362,8 +367,8 @@ export type VoiceTranscriptSConfigurationAndOutput = [ subtype?: SubtypeOrTemplate; options: OptionsRequested; options_used?: OptionsUsed; - output?: HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01010AudioJson; - [k: string]: unknown | undefined; + output?: HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01012AudioJson; + [k: string]: unknown; }[], ]; /** @@ -385,7 +390,7 @@ export type VoiceID1 = string; /** * Audio Content */ -export type HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01010AudioJson = { +export type HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01012AudioJson = { type: 'audio'; _id?: GloballyUniqueIDTrait; version: DescribesTheANSVersionOfThisObject; @@ -461,10 +466,10 @@ export type HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainReso streams?: [AStreamOfAudio, ...AStreamOfAudio[]]; } & ( | { - [k: string]: unknown | undefined; + [k: string]: unknown; } | { - [k: string]: unknown | undefined; + [k: string]: unknown; } ); /** @@ -488,11 +493,16 @@ export type URL1 = string; */ export type Bitrate = number; +export interface Root { + gallery_root: AGallery; + story_root: AStory; + video_root: VideoContent; +} /** - * Holds attributes of an ANS story. In the Arc ecosystem, these are stored in the Story API. + * Holds attributes of an ANS gallery. In the Arc ecosystem, these are stored in Anglerfish. */ -export interface AStory { - type: 'story'; +export interface AGallery { + type: 'gallery'; _id?: GloballyUniqueIDTrait; version: DescribesTheANSVersionOfThisObject; subtype?: SubtypeOrTemplate; @@ -536,14 +546,9 @@ export interface AStory { label?: Label; slug?: Slug; content_restrictions?: ContentRestrictions; - rendering_guides?: RenderingGuides; additional_properties?: HasAdditionalProperties; content_aliases?: AliasesTrait; - corrections?: Corrections; content_elements?: ACollectionOfContent; - publishing?: PublishingInformation; - variations?: VariantContentMetadata; - voice_transcripts?: VoiceTranscriptSConfigurationAndOutput; websites?: WebsitesInput; contributors?: Contributors; } @@ -553,7 +558,7 @@ export interface AStory { export interface Geo { latitude?: number; longitude?: number; - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * An Address following the convention of http://microformats.org/wiki/hcard @@ -572,7 +577,7 @@ export interface Address { * A grab-bag object for non-validatable data. */ export interface HasAdditionalProperties { - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * The headline(s) or title for this content. The 'basic' key is required. @@ -801,7 +806,7 @@ export interface RepresentationOfANormalizedElement { * An object for key-value pairs that should override the values of keys with the same name in the denormalized object */ referent_properties?: { - [k: string]: unknown | undefined; + [k: string]: unknown; }; }; } @@ -847,16 +852,16 @@ export interface Taxonomy { */ custom_entities?: CustomEntity[]; /** - * Deprecated in 0.10.10. (See `primary_section` instead.) A primary site object or reference to one. In the Arc ecosystem, a reference here is denormalized into a site from the arc-site-service. + * Deprecated in 0.10.12. (See `primary_section` instead.) A primary site object or reference to one. In the Arc ecosystem, a reference here is denormalized into a site from the arc-site-service. */ primary_site?: | Site | (RepresentationOfANormalizedElement & { referent?: { type?: 'site'; - [k: string]: unknown | undefined; + [k: string]: unknown; }; - [k: string]: unknown | undefined; + [k: string]: unknown; }); /** * A primary section object or reference to one. In the Arc ecosystem, a reference here is denormalized into a site from the arc-site-service. @@ -866,21 +871,21 @@ export interface Taxonomy { | (RepresentationOfANormalizedElement & { referent?: { type?: 'section'; - [k: string]: unknown | undefined; + [k: string]: unknown; }; - [k: string]: unknown | undefined; + [k: string]: unknown; }); /** - * Deprecated in 0.10.10. (See `sections` instead.) A list of site objects or references to them. In the Arc ecosystem, references in this list are denormalized into sites from the arc-site-service. In a multi-site context, sites will be denormalized against an organization's default website only. + * Deprecated in 0.10.12. (See `sections` instead.) A list of site objects or references to them. In the Arc ecosystem, references in this list are denormalized into sites from the arc-site-service. In a multi-site context, sites will be denormalized against an organization's default website only. */ sites?: ( | Site | (RepresentationOfANormalizedElement & { referent?: { type?: 'site'; - [k: string]: unknown | undefined; + [k: string]: unknown; }; - [k: string]: unknown | undefined; + [k: string]: unknown; }) )[]; /** @@ -891,9 +896,9 @@ export interface Taxonomy { | (RepresentationOfANormalizedElement & { referent?: { type?: 'section'; - [k: string]: unknown | undefined; + [k: string]: unknown; }; - [k: string]: unknown | undefined; + [k: string]: unknown; }) )[]; /** @@ -1175,7 +1180,7 @@ export interface Section { */ parent?: { default?: string; - [k: string]: unknown | undefined; + [k: string]: unknown; }; /** * Is this the primary site? @@ -1189,7 +1194,7 @@ export interface PromoItems { basic?: | AContentObject | RepresentationOfANormalizedElement - | HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01010StoryElementsRawHtmlJson + | HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01012StoryElementsRawHtmlJson | CustomEmbed; /** * This interface was referenced by `PromoItems`'s JSON-Schema definition @@ -1198,7 +1203,7 @@ export interface PromoItems { [k: string]: | AContentObject | RepresentationOfANormalizedElement - | HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01010StoryElementsRawHtmlJson + | HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01012StoryElementsRawHtmlJson | CustomEmbed | undefined; } @@ -1250,7 +1255,7 @@ export interface AContentObject { additional_properties?: HasAdditionalProperties; content_aliases?: AliasesTrait; contributors?: Contributors; - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * Lists of content items or references this story is related to, arbitrarily keyed. In the Arc ecosystem, references in this object will be denormalized into the fully-inflated content objects they represent. @@ -1266,7 +1271,7 @@ export interface Related_Content { * This interface was referenced by `Related_Content`'s JSON-Schema definition * via the `patternProperty` ".*". */ - [k: string]: (AContentObject | RepresentationOfANormalizedElement | CustomEmbed)[] | [ARedirectObject] | undefined; + [k: string]: [ARedirectObject] | (AContentObject | RepresentationOfANormalizedElement | CustomEmbed)[] | undefined; } /** * A redirect to another story. @@ -1289,14 +1294,14 @@ export interface OwnerInformation { */ id?: string; /** - * Deprecated in 0.10.10. See `distributor.name`. (Formerly: The human-readable name of original producer of content. Distinguishes between Wires, Staff and other sources.) + * Deprecated in 0.10.12. See `distributor.name`. (Formerly: The human-readable name of original producer of content. Distinguishes between Wires, Staff and other sources.) */ name?: string; /** * True if this content is advertorial or native advertising. */ sponsored?: boolean; - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * Trait that applies revision information to a document. In the Arc ecosystem, many of these fields are populated in stories by the Story API. @@ -1353,19 +1358,19 @@ export interface Embed { */ export interface EmbedConfiguration { referent?: { - [k: string]: unknown | undefined; + [k: string]: unknown; }; type?: { - [k: string]: unknown | undefined; + [k: string]: unknown; }; version?: { - [k: string]: unknown | undefined; + [k: string]: unknown; }; /** * This interface was referenced by `EmbedConfiguration`'s JSON-Schema definition * via the `patternProperty` "^([a-zA-Z0-9_])*$". */ - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * Trait that applies planning information to a document or resource. In the Arc ecosystem, this data is generated by WebSked. Newsroom use only. All these fields should be available and editable in WebSked. @@ -1584,11 +1589,11 @@ export interface Source { */ source_id?: string; /** - * Deprecated in 0.10.10. See `distributor.category` and `distributor.subcategory`. (Formerly: The method used to enter this content. E.g. 'staff', 'wires'.) + * Deprecated in 0.10.12. See `distributor.category` and `distributor.subcategory`. (Formerly: The method used to enter this content. E.g. 'staff', 'wires'.) */ source_type?: string; /** - * Deprecated in 0.10.10. See `distributor.name`. (Formerly: The human-readable name of the organization who first produced this content. E.g., 'Reuters'.) + * Deprecated in 0.10.12. See `distributor.name`. (Formerly: The human-readable name of the organization who first produced this content. E.g., 'Reuters'.) */ name?: string; /** @@ -1605,7 +1610,7 @@ export interface Source { * Tracking information, probably implementation-dependent */ export interface Tracking { - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * Comment configuration data @@ -1628,7 +1633,7 @@ export interface Comments { */ moderation_required?: boolean; additional_properties?: HasAdditionalProperties; - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * What the Washington Post calls a Kicker @@ -1720,7 +1725,7 @@ export interface ContentRestrictions { }, ]; }; - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * Trait that holds information on who created and contributed to a given document in Arc. @@ -1738,13 +1743,13 @@ export interface Contributors { * The display name of the Arc user who created the Document */ display_name?: string; - [k: string]: unknown | undefined; + [k: string]: unknown; }; } /** * An html content element */ -export interface HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01010StoryElementsRawHtmlJson { +export interface HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01012StoryElementsRawHtmlJson { type: 'raw_html'; _id?: GloballyUniqueIDTrait; subtype?: SubtypeOrTemplate; @@ -1768,7 +1773,7 @@ export interface FocalPoint { * The coordinate point on the vertical axis */ y: number; - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * Mapping of integers to tokens, where the integer represents the Signing Service's secret version, and token represents an object's public key for usage on the frontend. @@ -1787,6 +1792,98 @@ export interface Book { export interface School { school_name?: SchoolName; } +/** + * An item that conforms to this schema can be rendered in a sequence + */ +export interface AnElementThatCanBeListedAsPartOfContentElements { + type: string; + _id?: GloballyUniqueIDTrait; + subtype?: SubtypeOrTemplate; + channels?: ChannelTrait; + alignment?: Alignment; + additional_properties?: HasAdditionalProperties; + gallery_properties?: HasGalleryProperties; + [k: string]: unknown; +} +/** + * An object for overrides for images when images are used in a gallery. Example usage: Each image in a gallery may have the images own focal point overridden by the gallery. + */ +export interface HasGalleryProperties { + [k: string]: unknown; +} +/** + * Website-specific metadata for url generation for multi-site copies. These fields are not indexed in Content API. + */ +export interface WebsitesInput { + /** + * This interface was referenced by `WebsitesInput`'s JSON-Schema definition + * via the `patternProperty` "^[a-zA-Z0-9_]*". + */ + [k: string]: { + website_section?: RepresentationOfANormalizedElement | Section; + website_url?: WebsiteURL; + }; +} +/** + * Holds attributes of an ANS story. In the Arc ecosystem, these are stored in the Story API. + */ +export interface AStory { + type: 'story'; + _id?: GloballyUniqueIDTrait; + version: DescribesTheANSVersionOfThisObject; + subtype?: SubtypeOrTemplate; + channels?: ChannelTrait; + alignment?: Alignment; + language?: Locale; + copyright?: CopyrightInformation; + canonical_url?: CanonicalURL; + canonical_url_external?: CanonicalExternalURL; + canonical_website?: CanonicalWebsite; + website?: Website; + website_url?: WebsiteURL; + short_url?: Short_Url; + created_date?: CreatedDate; + last_updated_date?: LastUpdatedDate; + publish_date?: Publish_Date; + first_publish_date?: FirstPublishDate; + display_date?: Display_Date; + location?: LocationRelatedTrait; + geo?: Geo; + address?: Address; + editor_note?: Editor_Note; + status?: Status; + headlines?: Headlines; + subheadlines?: SubHeadlines; + description?: Description; + credits?: CreditTrait; + vanity_credits?: VanityCreditsTrait; + taxonomy?: Taxonomy; + promo_items?: PromoItems; + related_content?: Related_Content; + owner?: OwnerInformation; + planning?: SchedulingInformation; + workflow?: WorkflowInformation; + pitches?: Pitches; + revision?: Revision; + syndication?: Syndication; + source?: Source; + distributor?: Distributor; + tracking?: Tracking; + comments?: Comments; + label?: Label; + slug?: Slug; + content_restrictions?: ContentRestrictions; + rendering_guides?: RenderingGuides; + additional_properties?: HasAdditionalProperties; + content_aliases?: AliasesTrait; + corrections?: Corrections; + content_elements?: ACollectionOfContent; + publishing?: PublishingInformation; + variations?: VariantContentMetadata; + voice_transcripts?: VoiceTranscriptSConfigurationAndOutput; + websites?: WebsitesInput; + contributors?: Contributors; +} /** * Trait that provides suggestions for the rendering system. */ @@ -1795,7 +1892,7 @@ export interface RenderingGuides { * The preferred rendering method of the story. Blank means there is no preference. If the rendering application is aware of these other options, it can decide to either use one of them, render messaging to the viewer, or render the story as normal */ preferred_method?: (('website' | 'native') | string)[]; - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * Describes a change that has been made to the document for transparency, or describes inaccuracies or falsehoods that remain in the document. @@ -1816,25 +1913,6 @@ export interface Correction { */ text: string; } -/** - * An item that conforms to this schema can be rendered in a sequence - */ -export interface AnElementThatCanBeListedAsPartOfContentElements { - type: string; - _id?: GloballyUniqueIDTrait; - subtype?: SubtypeOrTemplate; - channels?: ChannelTrait; - alignment?: Alignment; - additional_properties?: HasAdditionalProperties; - gallery_properties?: HasGalleryProperties; - [k: string]: unknown | undefined; -} -/** - * An object for overrides for images when images are used in a gallery. Example usage: Each image in a gallery may have the images own focal point overridden by the gallery. - */ -export interface HasGalleryProperties { - [k: string]: unknown | undefined; -} /** * The current published state of all editions of a content item as well as any scheduled publishing information. Machine-generated. */ @@ -1945,6 +2023,7 @@ export interface AStory1 { language?: Locale; copyright?: CopyrightInformation; canonical_url?: CanonicalURL; + canonical_url_external?: CanonicalExternalURL; canonical_website?: CanonicalWebsite; website?: Website; website_url?: WebsiteURL; @@ -1997,7 +2076,7 @@ export interface AStory1 { export interface OptionsRequested { enabled: Enabled; voice?: VoiceID; - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * The transcription settings that were used by the renderer to generate the final output. (If these differ from 'options' it may indicate an inability to render exactly as specified.) These values can be used when rendering to readers or external users. @@ -2005,7 +2084,7 @@ export interface OptionsRequested { export interface OptionsUsed { enabled: Enabled1; voice?: VoiceID1; - [k: string]: unknown | undefined; + [k: string]: unknown; } /** * Configuration for a piece of audio content, over a stream. @@ -2016,18 +2095,233 @@ export interface AStreamOfAudio { stream_type?: AudioStreamType; url: URL1; bitrate?: Bitrate; - [k: string]: unknown | undefined; + [k: string]: unknown; } /** - * Website-specific metadata for url generation for multi-site copies. These fields are not indexed in Content API. + * Holds attributes of an ANS video component. In the Arc ecosystem, these are stored in Goldfish. */ -export interface WebsitesInput { +export interface VideoContent { + type: 'video'; + _id?: GloballyUniqueIDTrait; + version: DescribesTheANSVersionOfThisObject; + subtype?: SubtypeOrTemplate; + channels?: ChannelTrait; + alignment?: Alignment; + language?: Locale; + copyright?: CopyrightInformation; + canonical_url?: CanonicalURL; + canonical_website?: CanonicalWebsite; + website?: Website; + website_url?: WebsiteURL; + short_url?: Short_Url; + created_date?: CreatedDate; + last_updated_date?: LastUpdatedDate; + publish_date?: Publish_Date; + first_publish_date?: FirstPublishDate; + display_date?: Display_Date; + location?: LocationRelatedTrait; + geo?: Geo; + address?: Address; + editor_note?: Editor_Note; + status?: Status; + headlines?: Headlines; + subheadlines?: SubHeadlines; + description?: Description; + credits?: CreditTrait; + vanity_credits?: VanityCreditsTrait; + taxonomy?: Taxonomy; + promo_items?: PromoItems; + related_content?: Related_Content; + owner?: OwnerInformation; + planning?: SchedulingInformation; + workflow?: WorkflowInformation; + pitches?: Pitches; + revision?: Revision; + syndication?: Syndication; + source?: Source; + distributor?: Distributor; + tracking?: Tracking; + comments?: Comments; + label?: Label; + slug?: Slug; + content_restrictions?: ContentRestrictions; + additional_properties?: HasAdditionalProperties; + content_aliases?: AliasesTrait; /** - * This interface was referenced by `WebsitesInput`'s JSON-Schema definition - * via the `patternProperty` "^[a-zA-Z0-9_]*". + * Runtime of the video in milliseconds. */ - [k: string]: { - website_section?: RepresentationOfANormalizedElement | Section; - website_url?: WebsiteURL; - }; + duration?: number; + /** + * A transcript of the contents of the video. + */ + transcript?: string; + /** + * A rating of the video, to be used for appropriate age/content warnings. + */ + rating?: string; + /** + * The type of video (e.g. clip, livestream, etc) + */ + video_type?: string; + /** + * The YouTube ID of the content, if (re)hosted on youtube.com + */ + youtube_content_id?: string; + /** + * The different streams this video can play in. + */ + streams?: AStreamOfVideo[]; + subtitles?: VideoSubtitleConfigurationSchema; + promo_image?: AnImage1; + /** + * An HTML snippet used to embed this video in another document. Used for oembed responses. + */ + embed_html?: string; + corrections?: Corrections; + websites?: WebsitesInput; + contributors?: Contributors; +} +/** + * Configuration for a piece of video content, over a stream. + */ +export interface AStreamOfVideo { + /** + * The height of the video. + */ + height?: number; + /** + * The width of the video. + */ + width?: number; + /** + * The size of the video, in bytes. + */ + filesize?: number; + /** + * The audio codec. + */ + audio_codec?: string; + /** + * The video codec. + */ + video_codec?: string; + /** + * The type of video (e.g. mp4). + */ + stream_type?: string; + /** + * Where to get the stream from. + */ + url?: string; + /** + * The bitrate of the video + */ + bitrate?: number; + /** + * The provider of the video. + */ + provider?: string; + [k: string]: unknown; +} +/** + * Data about different subtitle encodings and confidences of auto-transcribed content. + */ +export interface VideoSubtitleConfigurationSchema { + /** + * How confident the transcriber (human or automated) is of the accuracy of the subtitles. + */ + confidence?: number; + /** + * The locations of any subtitle transcriptions of the video. + */ + urls?: SubtitleUrl[]; + [k: string]: unknown; +} +export interface SubtitleUrl { + /** + * The format of the subtitles (e.g. SRT, DFXP, WEB_VTT, etc) + */ + format?: string; + /** + * The url of the subtitle stream. + */ + url?: string; + [k: string]: unknown; +} +/** + * Holds attributes of an ANS image component. In the Arc ecosystem, these are stored in Anglerfish. + */ +export interface AnImage1 { + type: 'image'; + _id?: GloballyUniqueIDTrait; + version: DescribesTheANSVersionOfThisObject; + subtype?: SubtypeOrTemplate; + channels?: ChannelTrait; + alignment?: Alignment; + language?: Locale; + copyright?: CopyrightInformation; + canonical_url?: CanonicalURL; + short_url?: Short_Url; + created_date?: CreatedDate; + last_updated_date?: LastUpdatedDate; + publish_date?: Publish_Date; + first_publish_date?: FirstPublishDate; + display_date?: Display_Date; + location?: LocationRelatedTrait; + geo?: Geo; + address?: Address; + editor_note?: Editor_Note; + status?: Status; + headlines?: Headlines; + subheadlines?: SubHeadlines; + description?: Description; + credits?: CreditTrait; + vanity_credits?: VanityCreditsTrait; + taxonomy?: Taxonomy; + promo_items?: PromoItems; + related_content?: Related_Content; + owner?: OwnerInformation; + planning?: SchedulingInformation; + workflow?: WorkflowInformation; + pitches?: Pitches; + revision?: Revision; + syndication?: Syndication; + source?: Source; + distributor?: Distributor; + tracking?: Tracking; + comments?: Comments; + label?: Label; + slug?: Slug; + content_restrictions?: ContentRestrictions; + image_type?: ImageType; + alt_text?: AltText; + focal_point?: FocalPoint; + auth?: Auth; + seo_filename?: SEOFilename; + additional_properties?: HasAdditionalProperties; + /** + * Subtitle for the image. + */ + subtitle?: string; + /** + * Caption for the image. + */ + caption?: string; + /** + * URL for the image. + */ + url?: string; + /** + * Width for the image. + */ + width?: number; + /** + * Height for the image. + */ + height?: number; + /** + * True if the image can legally be licensed to others. + */ + licensable?: boolean; + contributors?: Contributors; } diff --git a/src/types/author.ts b/src/types/author.ts deleted file mode 100644 index 8a6f02f..0000000 --- a/src/types/author.ts +++ /dev/null @@ -1,1665 +0,0 @@ -/** - * This file was automatically generated by json-schema-to-typescript. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run json-schema-to-typescript to regenerate this file. - */ - -/** - * A globally unique identifier of the content in the ANS repository. - */ -export type GloballyUniqueIDTrait = string; -/** - * The version of ANS that this object was serialized as, in major.minor.patch format. For top-level content objects, this is a required trait. - */ -export type DescribesTheANSVersionOfThisObject = '0.10.10'; -/** - * The full human name of contributor. See also byline, first_name, last_name, middle_name, suffix. - */ -export type Name = string; -/** - * A user-defined categorization method to supplement type. In Arc, this field is reserved for organization-defined purposes, such as selecting the PageBuilder template that should be used to render a document. - */ -export type SubtypeOrTemplate = string; -/** - * An optional list of output types for which this element should be visible - */ -export type ChannelTrait = string[]; -/** - * A property used to determine horizontal positioning of a content element relative to the elements that immediately follow it in the element sequence. - */ -export type Alignment = 'left' | 'right' | 'center'; -/** - * The primary language of the content. The value should follow IETF BCP47. (e.g. 'en', 'es-419', etc.) - */ -export type Locale = string; -/** - * A copyright notice for the legal owner of this content. E.g., '© 1996-2018 The Washington Post.' Format may vary between organizations. - */ -export type CopyrightInformation = string; -/** - * The relative URL to this document on the website specified by the `canonical_website` field. In the Arc ecosystem, this will be populated by the content api from the arc-canonical-url service if present based on the canonical_website. In conjunction with canonical_website, it can be used to determine the SEO canonical url or open graph url. In a multi-site context, this field may be different from the website_url field. - */ -export type CanonicalURL = string; -/** - * A url-shortened version of the canonical url. - */ -export type Short_Url = string; -/** - * When the content was originally created (RFC3339-formatted). In the Arc ecosystem, this will be automatically generated for stories in the Story API. - */ -export type CreatedDate = string; -/** - * When the content was last updated (RFC3339-formatted). - */ -export type LastUpdatedDate = string; -/** - * When the story was published. - */ -export type Publish_Date = string; -/** - * When the story was first published. - */ -export type FirstPublishDate = string; -/** - * The RFC3339-formatted dated time of the most recent date the story was (re)displayed on a public site. - */ -export type Display_Date = string; -/** - * A description of the location, useful if a full address or lat/long specification is overkill. - */ -export type LocationRelatedTrait = string; -/** - * Additional information to be displayed near the content from the editor. - */ -export type Editor_Note = string; -/** - * Optional field to story story workflow related status (e.g. published/embargoed/etc) - */ -export type Status = string; -/** - * The full human name of contributor. See also byline, first_name, last_name, middle_name, suffix. - */ -export type Name1 = string; -/** - * Links to various social media - */ -export type SocialLinks = { - site?: string; - url?: string; - [k: string]: unknown; -}[]; -/** - * A short reference name for internal editorial use - */ -export type Slug = string; -/** - * The real first name of a human author. - */ -export type FirstName = string; -/** - * The real middle name of a human author. - */ -export type MiddleName = string; -/** - * The real last name of a human author. - */ -export type LastName = string; -/** - * The real suffix of a human author. - */ -export type Suffix = string; -/** - * The public-facing name, or nom-de-plume, name of the author. - */ -export type Byline = string; -/** - * The city or locality that the author resides in or is primarily associated with. - */ -export type Location = string; -/** - * The desk or group that this author normally reports to. E.g., 'Politics' or 'Sports.' - */ -export type Division = string; -/** - * The professional email address of this author. - */ -export type EMail = string; -/** - * The organizational role or title of this author. - */ -export type Role = string; -/** - * A comma-delimited list of subjects the author in which the author has expertise. - */ -export type Expertise = string; -/** - * The name of an organization the author is affiliated with. E.g., The Washington Post, or George Mason University. - */ -export type Affiliation = string; -/** - * A description of list of languages that the author is somewhat fluent in, excluding the native language of the parent publication, and identified in the language of the parent publication. E.g., Russian, Japanese, Greek. - */ -export type Languages = string; -/** - * A one or two sentence description of the author. - */ -export type ShortBiography = string; -/** - * The full biography of the author. - */ -export type LongBiography = string; -/** - * The book title. - */ -export type Title = string; -/** - * A link to a page to purchase or learn more about the book. - */ -export type URL = string; -/** - * A list of books written by the author. - */ -export type Books = Book[]; -/** - * The name of the school. - */ -export type SchoolName = string; -/** - * A list of schools that this author has graduated from. - */ -export type Education = School[]; -/** - * The name of the award. - */ -export type AwardName = string; -/** - * A list of awards the author has received. - */ -export type Awards = { - award_name?: AwardName; -}[]; -/** - * If true, this author is an external contributor to the publication. - */ -export type Contributor = boolean; -/** - * Deprecated. In ANS 0.5.8 and prior versions, this field is populated with the 'location' field from Arc Author Service. New implementations should use the 'location' and 'affiliation' field. Content should be identical to 'location.' - */ -export type Org = string; -/** - * Links to various social media - */ -export type SocialLinks1 = { - site?: string; - url?: string; - [k: string]: unknown; -}[]; -/** - * The primary author(s) of this document. For a story, is is the writer or reporter. For an image, it is the photographer. - */ -export type By = (AnAuthorOfAPieceOfContent1 | RepresentationOfANormalizedElement)[]; -/** - * The photographer(s) of supplementary images included in this document, if it is a story. Note that if this document is an image, the photographer(s) should appear in the 'by' slot. - */ -export type PhotosBy = (AnAuthorOfAPieceOfContent1 | RepresentationOfANormalizedElement)[]; -/** - * The primary author(s) of this document. For a story, is is the writer or reporter. For an image, it is the photographer. - */ -export type By1 = (AnAuthorOfAPieceOfContent1 | RepresentationOfANormalizedElement)[]; -/** - * The photographer(s) of supplementary images included in this document, if it is a story. Note that if this document is an image, the photographer(s) should appear in the 'by' slot. - */ -export type PhotosBy1 = (AnAuthorOfAPieceOfContent1 | RepresentationOfANormalizedElement)[]; -/** - * The _id of the website on which this document exists. This field is only available in Content API. If different from canonical_website, then this document was originally sourced from the canonical_website. Generated at fetch time by Content API. - */ -export type Website = string; -/** - * Foreign ID of embedded item. - */ -export type EmbedID = string; -/** - * Provider URL for this embed item. When concatenated with Embed ID, should produce a URL that returns json metadata about the embedded content. - */ -export type EmbedProviderURL = string; -/** - * This note is used for shared communication inside the newsroom. - */ -export type InternalNote = string; -/** - * Used for the newsroom to identify what the story is about, especially if a user is unfamiliar with the slug of a story and the headline or they do not yet exist. Newsroom use only. - */ -export type BudgetLine = string; -/** - * Information about a third party that provided this content from outside this document's hosted organization. - */ -export type Distributor = - | { - /** - * The human-readable name of the distributor of this content. E.g., Reuters. - */ - name?: string; - /** - * The machine-readable category of how this content was produced. Use 'staff' if this content was produced by an employee of the organization who owns this document repository. (Multisite note: content produced within a single *organization*, but shared across multiple *websites* should still be considered 'staff.') Use ‘wires’ if this content was produced for another organization and shared with the one who owns this document repository. Use 'freelance' if this content was produced by an individual on behalf of the organization who owns this document repository. Use 'stock' if this content is stock media distributed directly from a stock media provider. Use 'handout' if this is content provided from a source for an article (usually promotional media distributed directly from a company). Use 'other' for all other cases. - */ - category?: 'staff' | 'wires' | 'freelance' | 'stock' | 'handout' | 'other'; - /** - * The machine-readable subcategory of how this content was produced. E.g., 'freelance - signed'. May vary between organizations. - */ - subcategory?: string; - additional_properties?: HasAdditionalProperties; - mode?: 'custom'; - } - | { - /** - * The ARC UUID of the distributor of this content. E.g., ABCDEFGHIJKLMNOPQRSTUVWXYZ. - */ - reference_id: string; - mode: 'reference'; - }; -/** - * An list of alternate names that this content can be fetched by instead of id. - */ -export type AliasesTrait = string[]; -/** - * A more specific category for an image. - */ -export type ImageType = string; -/** - * The direct ANS equivalent of the HTML 'alt' attribute. A description of the contents of an image for improved accessibility. - */ -export type AltText = string; -/** - * Human-friendly filename used by PageBuilder & Resizer to improve image SEO scoring. - */ -export type SEOFilename = string; -/** - * The real first name of a human author. - */ -export type FirstName1 = string; -/** - * The real middle name of a human author. - */ -export type MiddleName1 = string; -/** - * The real last name of a human author. - */ -export type LastName1 = string; -/** - * The real suffix of a human author. - */ -export type Suffix1 = string; -/** - * The public-facing name, or nom-de-plume, name of the author. - */ -export type Byline1 = string; -/** - * The city or locality that the author resides in or is primarily associated with. - */ -export type Location1 = string; -/** - * The desk or group that this author normally reports to. E.g., 'Politics' or 'Sports.' - */ -export type Division1 = string; -/** - * The professional email address of this author. - */ -export type EMail1 = string; -/** - * The organizational role or title of this author. - */ -export type Role1 = string; -/** - * A comma-delimited list of subjects the author in which the author has expertise. - */ -export type Expertise1 = string; -/** - * The name of an organization the author is affiliated with. E.g., The Washington Post, or George Mason University. - */ -export type Affiliation1 = string; -/** - * A description of list of languages that the author is somewhat fluent in, excluding the native language of the parent publication, and identified in the language of the parent publication. E.g., Russian, Japanese, Greek. - */ -export type Languages1 = string; -/** - * A one or two sentence description of the author. - */ -export type ShortBiography1 = string; -/** - * The full biography of the author. - */ -export type LongBiography1 = string; -/** - * The book title. - */ -export type Title1 = string; -/** - * A link to a page to purchase or learn more about the book. - */ -export type URL1 = string; -/** - * A list of books written by the author. - */ -export type Books1 = Book1[]; -/** - * The name of the school. - */ -export type SchoolName1 = string; -/** - * A list of schools that this author has graduated from. - */ -export type Education1 = School1[]; -/** - * The name of the award. - */ -export type AwardName1 = string; -/** - * A list of awards the author has received. - */ -export type Awards1 = { - award_name?: AwardName1; -}[]; -/** - * If true, this author is an external contributor to the publication. - */ -export type Contributor1 = boolean; -/** - * Deprecated. In ANS 0.5.8 and prior versions, this field is populated with the 'location' field from Arc Author Service. New implementations should use the 'location' and 'affiliation' field. Content should be identical to 'location.' - */ -export type Org1 = string; -/** - * Links to various social media - */ -export type SocialLinks2 = { - site?: string; - url?: string; - [k: string]: unknown; -}[]; - -/** - * Models attribution to an individual or group for contribution towards some content item. In the Arc ecosystem, these are stored in the arc-author-service. - */ -export interface AnAuthorOfAPieceOfContent { - _id?: GloballyUniqueIDTrait; - /** - * Indicates that this is an author - */ - type: 'author'; - version?: DescribesTheANSVersionOfThisObject; - name: Name; - image?: AnImage; - /** - * A link to an author's landing page on the website, or a personal website. - */ - url?: string; - social_links?: SocialLinks; - slug?: Slug; - first_name?: FirstName1; - middle_name?: MiddleName1; - last_name?: LastName1; - suffix?: Suffix1; - byline?: Byline1; - location?: Location1; - division?: Division1; - email?: EMail1; - role?: Role1; - expertise?: Expertise1; - affiliation?: Affiliation1; - languages?: Languages1; - bio?: ShortBiography1; - long_bio?: LongBiography1; - books?: Books1; - education?: Education1; - awards?: Awards1; - contributor?: Contributor1; - org?: Org1; - socialLinks?: SocialLinks2; - additional_properties?: HasAdditionalProperties; -} -/** - * Holds attributes of an ANS image component. In the Arc ecosystem, these are stored in Anglerfish. - */ -export interface AnImage { - type: 'image'; - _id?: GloballyUniqueIDTrait; - version: DescribesTheANSVersionOfThisObject; - subtype?: SubtypeOrTemplate; - channels?: ChannelTrait; - alignment?: Alignment; - language?: Locale; - copyright?: CopyrightInformation; - canonical_url?: CanonicalURL; - short_url?: Short_Url; - created_date?: CreatedDate; - last_updated_date?: LastUpdatedDate; - publish_date?: Publish_Date; - first_publish_date?: FirstPublishDate; - display_date?: Display_Date; - location?: LocationRelatedTrait; - geo?: Geo; - address?: Address; - editor_note?: Editor_Note; - status?: Status; - headlines?: Headlines; - subheadlines?: SubHeadlines; - description?: Description; - credits?: CreditTrait; - vanity_credits?: VanityCreditsTrait; - taxonomy?: Taxonomy; - promo_items?: PromoItems; - related_content?: Related_Content; - owner?: OwnerInformation; - planning?: SchedulingInformation; - workflow?: WorkflowInformation; - pitches?: Pitches; - revision?: Revision; - syndication?: Syndication; - source?: Source; - distributor?: Distributor; - tracking?: Tracking; - comments?: Comments; - label?: Label; - slug?: Slug; - content_restrictions?: ContentRestrictions; - image_type?: ImageType; - alt_text?: AltText; - focal_point?: FocalPoint; - auth?: Auth; - seo_filename?: SEOFilename; - additional_properties?: HasAdditionalProperties; - /** - * Subtitle for the image. - */ - subtitle?: string; - /** - * Caption for the image. - */ - caption?: string; - /** - * URL for the image. - */ - url?: string; - /** - * Width for the image. - */ - width?: number; - /** - * Height for the image. - */ - height?: number; - /** - * True if the image can legally be licensed to others. - */ - licensable?: boolean; - contributors?: Contributors; -} -/** - * Latitidue and Longitude of the content - */ -export interface Geo { - latitude?: number; - longitude?: number; - [k: string]: unknown; -} -/** - * An Address following the convention of http://microformats.org/wiki/hcard - */ -export interface Address { - post_office_box?: string; - extended_address?: string; - street_address?: string; - locality?: string; - region?: string; - postal_code?: string; - country_name?: string; - additional_properties?: HasAdditionalProperties; -} -/** - * A grab-bag object for non-validatable data. - */ -export interface HasAdditionalProperties { - [k: string]: unknown; -} -/** - * The headline(s) or title for this content. The 'basic' key is required. - */ -export interface Headlines { - basic: string; - /** - * This interface was referenced by `Headlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `SubHeadlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `Description`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: string; -} -/** - * The sub-headline(s) for the content. - */ -export interface SubHeadlines { - basic: string; - /** - * This interface was referenced by `Headlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `SubHeadlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `Description`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: string; -} -/** - * The descriptions, or blurbs, for the content. - */ -export interface Description { - basic: string; - /** - * This interface was referenced by `Headlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `SubHeadlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `Description`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: string; -} -/** - * A list of people and groups attributed to this content, keyed by type of contribution. In the Arc ecosystem, references in this list will be denormalized into author objects from the arc-author-service. - */ -export interface CreditTrait { - by?: By; - photos_by?: PhotosBy; - /** - * This interface was referenced by `CreditTrait`'s JSON-Schema definition - * via the `patternProperty` "^[a-zA-Z0-9_]*". - */ - [k: string]: (AnAuthorOfAPieceOfContent1 | RepresentationOfANormalizedElement)[] | undefined; -} -/** - * Models attribution to an individual or group for contribution towards some content item. In the Arc ecosystem, these are stored in the arc-author-service. - */ -export interface AnAuthorOfAPieceOfContent1 { - _id?: GloballyUniqueIDTrait; - /** - * Indicates that this is an author - */ - type: 'author'; - version?: DescribesTheANSVersionOfThisObject; - name: Name1; - image?: AnImage; - /** - * A link to an author's landing page on the website, or a personal website. - */ - url?: string; - social_links?: SocialLinks; - slug?: Slug; - first_name?: FirstName; - middle_name?: MiddleName; - last_name?: LastName; - suffix?: Suffix; - byline?: Byline; - location?: Location; - division?: Division; - email?: EMail; - role?: Role; - expertise?: Expertise; - affiliation?: Affiliation; - languages?: Languages; - bio?: ShortBiography; - long_bio?: LongBiography; - books?: Books; - education?: Education; - awards?: Awards; - contributor?: Contributor; - org?: Org; - socialLinks?: SocialLinks1; - additional_properties?: HasAdditionalProperties; -} -export interface Book { - book_title?: Title; - book_url?: URL; -} -export interface School { - school_name?: SchoolName; -} -/** - * This represents a reference to external content that should be denormalized - */ -export interface RepresentationOfANormalizedElement { - type: 'reference'; - additional_properties?: HasAdditionalProperties; - _id?: GloballyUniqueIDTrait; - subtype?: SubtypeOrTemplate; - channels?: ChannelTrait; - alignment?: Alignment; - referent: { - /** - * The ANS type that the provider should return. - */ - type?: string; - /** - * The type of interaction the provider expects. E.g., 'oembed' - */ - service?: string; - /** - * The id passed to the provider to retrieve an ANS document - */ - id: string; - /** - * A URL that can resolve the id into an ANS element - */ - provider?: string; - /** - * The website which the referenced id belongs to. Currently supported only for sections. - */ - website?: string; - /** - * An object for key-value pairs that should override the values of keys with the same name in the denormalized object - */ - referent_properties?: { - [k: string]: unknown; - }; - }; -} -/** - * Similar to the credits trait, but to be used only when ANS is being directly rendered to readers natively. For legal and technical reasons, the `credits` trait is preferred when converting ANS into feeds or other distribution formats. However, when present, `vanity_credits` allows more sophisticated credits presentation to override the default without losing that original data. - */ -export interface VanityCreditsTrait { - by?: By1; - photos_by?: PhotosBy1; - /** - * This interface was referenced by `VanityCreditsTrait`'s JSON-Schema definition - * via the `patternProperty` "^[a-zA-Z0-9_]*". - */ - [k: string]: (AnAuthorOfAPieceOfContent1 | RepresentationOfANormalizedElement)[] | undefined; -} -/** - * Holds the collection of tags, categories, keywords, etc that describe content. - */ -export interface Taxonomy { - /** - * A list of keywords. In the Arc ecosystem, this list is populated by Clavis. - */ - keywords?: Keyword[]; - /** - * A list of named entities. In the Arc ecosystem, this list is populated by Clavis. - */ - named_entities?: NamedEntity[]; - /** - * A list of topics. In the Arc ecosystem, this list is populated by Clavis. - */ - topics?: Topic[]; - /** - * A list of auxiliaries. In the Arc ecosystem, this list is populated by Clavis. - */ - auxiliaries?: Auxiliary[]; - tags?: Tag[]; - /** - * A list of categories. Categories are overall, high-level classification of what the content is about. - */ - categories?: Category[]; - /** - * A list of topics. Topics are the subjects that the content is about. - */ - content_topics?: ContentTopic[]; - /** - * A list of entities. Entities are proper nouns, like people, places, and organizations. - */ - entities?: Entity[]; - /** - * A list of custom categories. Categories are overall, high-level classification of what the content is about. - */ - custom_categories?: CustomCategory[]; - /** - * A list of custom entities. Entities are proper nouns, like people, places, and organizations. - */ - custom_entities?: CustomEntity[]; - /** - * Deprecated in 0.10.10. (See `primary_section` instead.) A primary site object or reference to one. In the Arc ecosystem, a reference here is denormalized into a site from the arc-site-service. - */ - primary_site?: - | Site - | (RepresentationOfANormalizedElement & { - referent?: { - type?: 'site'; - [k: string]: unknown; - }; - [k: string]: unknown; - }); - /** - * A primary section object or reference to one. In the Arc ecosystem, a reference here is denormalized into a site from the arc-site-service. - */ - primary_section?: - | Section - | (RepresentationOfANormalizedElement & { - referent?: { - type?: 'section'; - [k: string]: unknown; - }; - [k: string]: unknown; - }); - /** - * Deprecated in 0.10.10. (See `sections` instead.) A list of site objects or references to them. In the Arc ecosystem, references in this list are denormalized into sites from the arc-site-service. In a multi-site context, sites will be denormalized against an organization's default website only. - */ - sites?: ( - | Site - | (RepresentationOfANormalizedElement & { - referent?: { - type?: 'site'; - [k: string]: unknown; - }; - [k: string]: unknown; - }) - )[]; - /** - * A list of site objects or references to them. In the Arc ecosystem, references in this list are denormalized into sites from the arc-site-service. In a multi-site context, sites will be denormalized against an organization's default website only. - */ - sections?: ( - | Section - | (RepresentationOfANormalizedElement & { - referent?: { - type?: 'section'; - [k: string]: unknown; - }; - [k: string]: unknown; - }) - )[]; - /** - * A list of user-editable manually entered keywords for search purposes. In the Arc ecosystem, these can be generated and saved in source CMS systems, editors, etc. - */ - seo_keywords?: string[]; - /** - * A list of stock symbols of companies related to this content. In the Arc ecosystem, these can be generated and saved in source CMS systems, editors, etc. - */ - stock_symbols?: string[]; - /** - * A list of WebSked task IDs that this content was created or curated to satisfy. - * - * @maxItems 200 - */ - associated_tasks?: string[]; - additional_properties?: HasAdditionalProperties; -} -/** - * Models a keyword used in describing a piece of content. - */ -export interface Keyword { - /** - * The keyword used to describe a piece of content - */ - keyword: string; - /** - * An arbitrary weighting to give the keyword - */ - score: number; - /** - * The Part of Speech tag for this keyword. - */ - tag?: string; - /** - * An optional count of the frequency of the keyword as it appears in the content it describes - */ - frequency?: number; -} -/** - * Models a named entity (i.e. name of a person, place, or organization) used in a piece of content. - */ -export interface NamedEntity { - /** - * A unique identifier for the concept of the named entity. - */ - _id: string; - /** - * The actual string of text that was identified as a named entity. - */ - name: string; - /** - * A description of what the named entity is. E.g. 'organization', 'person', or 'location'. - */ - type: string; - score?: number; -} -/** - * Models a topic used in describing a piece of content. - */ -export interface Topic { - /** - * The unique identifier for this topic. - */ - _id: string; - /** - * The general name for this topic. - */ - name?: string; - /** - * An arbitrary weighting to give the topic - */ - score: number; - /** - * A short identifier for this topic. Usually used in cases where a long form id cannot work. - */ - uid: string; -} -/** - * Models a auxiliary used in targeting a piece of content. - */ -export interface Auxiliary { - /** - * The unique identifier for this auxiliary. - */ - _id: string; - /** - * The general name for this auxiliary. - */ - name?: string; - /** - * A short identifier for this auxiliary. Usually used in cases where a long form id cannot work. - */ - uid: string; -} -/** - * Models a keyword used in describing a piece of content. - */ -export interface Tag { - _id?: GloballyUniqueIDTrait; - type?: 'tag'; - subtype?: SubtypeOrTemplate; - /** - * The text of the tag as displayed to users. - */ - text: string; - /** - * A more detailed description of the tag. - */ - description?: string; - additional_properties?: HasAdditionalProperties; - slug?: Slug; -} -/** - * Models a category used in classifying a piece of content. - */ -export interface Category { - /** - * The unique ID for this category within its classifier. - */ - _id: string; - /** - * The unique identifier for the classifier that matched this category. - */ - classifier: string; - /** - * The human readable label for this category. - */ - name: string; - /** - * The score assigned to this category between 0 and 1, where 1 is an exact match. - */ - score?: number; -} -/** - * Models a keyword used in describing a piece of content. - */ -export interface ContentTopic { - /** - * The unique Wikidata ID for this topic. - */ - _id: string; - /** - * A topic this piece of content is about. - */ - label: string; - /** - * The score assigned to this topic between 0 and 1, where 1 is an exact match. - */ - score: number; -} -/** - * Models a named entity (i.e. name of a person, place, or organization) used in a piece of content. - */ -export interface Entity { - /** - * The unique Wikidata ID for this entity. - */ - _id?: string; - /** - * A unique identifier for a custom-defined entity. - */ - custom_id?: string; - /** - * The actual string of text that was identified as a named entity. - */ - label: string; - /** - * A description of what the named entity is. E.g. 'organization', 'person', or 'location'. - */ - type?: string; - /** - * The score assigned to this entity between 0 and 1, where 1 is an exact match. - */ - score?: number; -} -/** - * Models a category used in classifying a piece of content. - */ -export interface CustomCategory { - /** - * The unique ID for this category within its classifier. - */ - _id: string; - /** - * The unique identifier for the classifier that matched this category. - */ - classifier: string; - /** - * The human readable label for this category. - */ - name: string; - /** - * The score assigned to this category between 0 and 1, where 1 is an exact match. - */ - score?: number; -} -/** - * Models a named custom entity (i.e. name of a person, place, or organization) used in a piece of content. - */ -export interface CustomEntity { - /** - * The unique ID for this entity. - */ - _id?: string; - /** - * A unique identifier for a custom-defined entity. - */ - custom_id?: string; - /** - * The actual string of text that was identified as a named entity. - */ - label: string; - /** - * A description of what the named entity is. E.g. 'organization', 'person', or 'location'. - */ - type?: string; - /** - * The score assigned to this entity between 0 and 1, where 1 is an exact match. - */ - score?: number; -} -/** - * A hierarchical section or 'site' in a taxonomy. In the Arc ecosystem, these are stored in the arc-site-service. - */ -export interface Site { - type: 'site'; - _id?: GloballyUniqueIDTrait; - version: DescribesTheANSVersionOfThisObject; - additional_properties?: HasAdditionalProperties; - /** - * The name of this site - */ - name: string; - /** - * A short description or tagline about this site - */ - description?: string; - /** - * The url path to this site - */ - path?: string; - /** - * The id of this section's parent site, if any - */ - parent_id?: string; - /** - * Is this the primary site? - */ - primary?: boolean; -} -/** - * A hierarchical section in a taxonomy. In the Arc ecosystem, these are stored in the arc-site-service. - */ -export interface Section { - type: 'section'; - _id?: GloballyUniqueIDTrait; - _website?: Website; - version: DescribesTheANSVersionOfThisObject; - additional_properties?: HasAdditionalProperties; - /** - * The name of this site - */ - name: string; - /** - * A short description or tagline about this site - */ - description?: string; - /** - * The url path to this site - */ - path?: string; - /** - * The id of this section's parent section in the default hierarchy, if any. - */ - parent_id?: string; - /** - * The id of this section's parent section in various commonly-used hierarchies, where available. - */ - parent?: { - default?: string; - [k: string]: unknown; - }; - /** - * Is this the primary site? - */ - primary?: boolean; -} -/** - * Lists of promotional content to use when highlighting the story. In the Arc ecosystem, references in these lists will be denormalized. - */ -export interface PromoItems { - basic?: - | AContentObject - | RepresentationOfANormalizedElement - | HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01010StoryElementsRawHtmlJson - | CustomEmbed; - /** - * This interface was referenced by `PromoItems`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: - | AContentObject - | RepresentationOfANormalizedElement - | HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01010StoryElementsRawHtmlJson - | CustomEmbed - | undefined; -} -/** - * Holds common attributes of ANS Content objects. - */ -export interface AContentObject { - type: string; - _id?: GloballyUniqueIDTrait; - version: DescribesTheANSVersionOfThisObject; - subtype?: SubtypeOrTemplate; - channels?: ChannelTrait; - alignment?: Alignment; - language?: Locale; - copyright?: CopyrightInformation; - canonical_url?: CanonicalURL; - short_url?: Short_Url; - created_date?: CreatedDate; - last_updated_date?: LastUpdatedDate; - publish_date?: Publish_Date; - first_publish_date?: FirstPublishDate; - display_date?: Display_Date; - location?: LocationRelatedTrait; - geo?: Geo; - address?: Address; - editor_note?: Editor_Note; - status?: Status; - headlines?: Headlines; - subheadlines?: SubHeadlines; - description?: Description; - credits?: CreditTrait; - vanity_credits?: VanityCreditsTrait; - taxonomy?: Taxonomy; - promo_items?: PromoItems; - related_content?: Related_Content; - owner?: OwnerInformation; - planning?: SchedulingInformation; - workflow?: WorkflowInformation; - pitches?: Pitches; - revision?: Revision; - syndication?: Syndication; - source?: Source; - distributor?: Distributor; - tracking?: Tracking; - comments?: Comments; - label?: Label; - slug?: Slug; - content_restrictions?: ContentRestrictions; - additional_properties?: HasAdditionalProperties; - content_aliases?: AliasesTrait; - contributors?: Contributors; - [k: string]: unknown; -} -/** - * Lists of content items or references this story is related to, arbitrarily keyed. In the Arc ecosystem, references in this object will be denormalized into the fully-inflated content objects they represent. - */ -export interface Related_Content { - /** - * An attached redirect. In Arc, when this content item is fetched by url, content api will instead return this redirect object with appropriate headers. In all other cases, this content should be treated normally. - * - * @maxItems 1 - */ - redirect?: [] | [ARedirectObject]; - /** - * This interface was referenced by `Related_Content`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: [ARedirectObject] | (AContentObject | RepresentationOfANormalizedElement | CustomEmbed)[] | undefined; -} -/** - * A redirect to another story. - */ -export interface ARedirectObject { - type: 'redirect'; - _id?: GloballyUniqueIDTrait; - version: DescribesTheANSVersionOfThisObject; - owner?: OwnerInformation; - revision?: Revision; - canonical_url: CanonicalURL; - redirect_url: CanonicalURL; -} -/** - * Various unrelated fields that should be preserved for backwards-compatibility reasons. See also trait_source. - */ -export interface OwnerInformation { - /** - * The machine-readable unique identifier of the organization whose database this content is stored in. In Arc, this is equivalent to ARC_ORG_NAME. - */ - id?: string; - /** - * Deprecated in 0.10.10. See `distributor.name`. (Formerly: The human-readable name of original producer of content. Distinguishes between Wires, Staff and other sources.) - */ - name?: string; - /** - * True if this content is advertorial or native advertising. - */ - sponsored?: boolean; - [k: string]: unknown; -} -/** - * Trait that applies revision information to a document. In the Arc ecosystem, many of these fields are populated in stories by the Story API. - */ -export interface Revision { - /** - * The unique id of this revision. - */ - revision_id?: string; - /** - * The unique id of the revision that this revisions was branched from, or preceded it on the current branch. - */ - parent_id?: string; - /** - * The name of the branch this revision was created on. - */ - branch?: string; - /** - * A list of identifiers of editions that point to this revision. - */ - editions?: string[]; - /** - * The unique user id of the person who created this revision. - */ - user_id?: string; - /** - * Whether or not this revision's parent story is published, in any form or place - */ - published?: boolean; - additional_properties?: HasAdditionalProperties; -} -/** - * A custom embed element. Can be used to reference content from external providers about which little is known. - */ -export interface CustomEmbed { - type: 'custom_embed'; - _id?: GloballyUniqueIDTrait; - subtype?: SubtypeOrTemplate; - channels?: ChannelTrait; - alignment?: Alignment; - additional_properties?: HasAdditionalProperties; - embed: Embed; -} -/** - * The embed data. - */ -export interface Embed { - id: EmbedID; - url: EmbedProviderURL; - config?: EmbedConfiguration; -} -/** - * Arbitrary configuration data generated by a plugin. Users are responsible for maintaining schema. - */ -export interface EmbedConfiguration { - referent?: { - [k: string]: unknown; - }; - type?: { - [k: string]: unknown; - }; - version?: { - [k: string]: unknown; - }; - /** - * This interface was referenced by `EmbedConfiguration`'s JSON-Schema definition - * via the `patternProperty` "^([a-zA-Z0-9_])*$". - */ - [k: string]: unknown; -} -/** - * Trait that applies planning information to a document or resource. In the Arc ecosystem, this data is generated by WebSked. Newsroom use only. All these fields should be available and editable in WebSked. - */ -export interface SchedulingInformation { - additional_properties?: HasAdditionalProperties; - /** - * Date to be used for chronological sorting in WebSked. - */ - websked_sort_date?: string; - /** - * The delta between the story's planned publish date and actual first publish time, in minutes. - */ - deadline_miss?: number; - internal_note?: InternalNote; - budget_line?: BudgetLine; - /** - * Scheduling information. - */ - scheduling?: { - /** - * When the content is planned to be published. - */ - planned_publish_date?: string; - /** - * When the content was first published. - */ - scheduled_publish_date?: string; - /** - * Will this content have galleries? - */ - will_have_gallery?: boolean; - /** - * Will this content have graphics? - */ - will_have_graphic?: boolean; - /** - * Will this content have images? - */ - will_have_image?: boolean; - /** - * Will this content have videos? - */ - will_have_video?: boolean; - }; - /** - * Story length information. - */ - story_length?: { - /** - * The anticipated number of words in the story. - */ - word_count_planned?: number; - /** - * Current number of words. - */ - word_count_actual?: number; - /** - * The anticipated length of the story in inches. - */ - inch_count_planned?: number; - /** - * The current length of the story in inches. - */ - inch_count_actual?: number; - /** - * The anticipated length of the story in lines. - */ - line_count_planned?: number; - /** - * The current length of the story in lines. - */ - line_count_actual?: number; - /** - * The anticipated number of characters in the story. - */ - character_count_planned?: number; - /** - * The current number of characters in the story. - */ - character_count_actual?: number; - /** - * The encoding used for counting characters in the story. - */ - character_encoding?: string; - }; -} -/** - * Trait that applies workflow information to a document or resource. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface WorkflowInformation { - additional_properties?: HasAdditionalProperties; - /** - * Code indicating the story's current workflow status. This number should match the values configured in WebSked. - */ - status_code?: number; - /** - * This note will be used for any task automatically generated via WebSked task triggers. - */ - note?: string; -} -/** - * Trait that represents a story's pitches. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface Pitches { - additional_properties?: HasAdditionalProperties; - /** - * A list of the story's pitches to a platform. - */ - platform?: PlatformPitch[]; - /** - * A list of the story's pitches to a publication. - */ - publication?: PublicationPitch[]; -} -/** - * Trait that represents a pitch to a platform. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface PlatformPitch { - additional_properties?: HasAdditionalProperties; - /** - * The path of the platform that this pitch targets. - */ - platform_path?: string; - creation_event?: PlatformPitchEvent; - latest_event?: PlatformPitchEvent; -} -/** - * Trait that represents an update event for a pitch to a platform. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface PlatformPitchEvent { - additional_properties?: HasAdditionalProperties; - /** - * The current status of the pitch. - */ - status?: string; - /** - * The time of this update. - */ - time?: string; - /** - * The ID of the user who made this update. - */ - user_id?: string; - /** - * Optional note associated with this update. - */ - note?: string; -} -/** - * Trait that represents a pitch to a publication. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface PublicationPitch { - additional_properties?: HasAdditionalProperties; - /** - * The ID of the publication that this pitch targets. - */ - publication_id?: string; - creation_event?: PublicationPitchEvent; - latest_event?: PublicationPitchEvent; -} -/** - * Trait that represents an update event for a pitch to a publication. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface PublicationPitchEvent { - additional_properties?: HasAdditionalProperties; - /** - * The current status of the pitch. - */ - status?: string; - /** - * The time of this update. - */ - time?: string; - /** - * The ID of the user who made this update. - */ - user_id?: string; - /** - * Optional note associated with this update. - */ - note?: string; - /** - * The ID of the publication edition that this pitch targets. - */ - edition_id?: string; - /** - * The time of the publication edition that this pitch targets. - */ - edition_time?: string; -} -/** - * Key-boolean pair of syndication services where this article may go - */ -export interface Syndication { - /** - * Necessary for fulfilling contractual agreements with third party clients - */ - external_distribution?: boolean; - /** - * Necessary so that we can filter out all articles that editorial has deemed should not be discoverable via search - */ - search?: boolean; - /** - * This interface was referenced by `Syndication`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: boolean | undefined; -} -/** - * Information about the original source and/or owner of this content - */ -export interface Source { - /** - * The id of this content in a foreign CMS. - */ - source_id?: string; - /** - * Deprecated in 0.10.10. See `distributor.category` and `distributor.subcategory`. (Formerly: The method used to enter this content. E.g. 'staff', 'wires'.) - */ - source_type?: string; - /** - * Deprecated in 0.10.10. See `distributor.name`. (Formerly: The human-readable name of the organization who first produced this content. E.g., 'Reuters'.) - */ - name?: string; - /** - * The software (CMS or editor) that was used to enter this content. E.g., 'wordpress', 'ellipsis'. - */ - system?: string; - /** - * A link to edit this content in its source CMS. - */ - edit_url?: string; - additional_properties?: HasAdditionalProperties; -} -/** - * Tracking information, probably implementation-dependent - */ -export interface Tracking { - [k: string]: unknown; -} -/** - * Comment configuration data - */ -export interface Comments { - /** - * How long (in days) after publish date until comments are closed. - */ - comments_period?: number; - /** - * If false, commenting is disabled on this content. - */ - allow_comments?: boolean; - /** - * If false, do not render comments on this content. - */ - display_comments?: boolean; - /** - * If true, comments must be moderator-approved before being displayed. - */ - moderation_required?: boolean; - additional_properties?: HasAdditionalProperties; - [k: string]: unknown; -} -/** - * What the Washington Post calls a Kicker - */ -export interface Label { - /** - * The default label object for this piece of content. - */ - basic?: { - /** - * The text of this label. - */ - text: string; - /** - * An optional destination url of this label. - */ - url?: string; - /** - * If false, this label should be hidden. - */ - display?: boolean; - additional_properties?: HasAdditionalProperties; - }; - /** - * Additional user-defined keyed label objects. - * - * This interface was referenced by `Label`'s JSON-Schema definition - * via the `patternProperty` "^[a-zA-Z0-9_]*$". - */ - [k: string]: - | { - /** - * The text of this label. - */ - text: string; - /** - * An optional destination url of this label. - */ - url?: string; - /** - * If false, this label should be hidden. - */ - display?: boolean; - additional_properties?: HasAdditionalProperties; - } - | undefined; -} -/** - * Trait that applies contains the content restrictions of an ANS object. - */ -export interface ContentRestrictions { - /** - * The content restriction code/level/flag associated with the ANS object - */ - content_code?: string; - /** - * Embargo configuration to enforce publishing restrictions. Embargoed content must not go live. - */ - embargo?: { - /** - * The boolean flag to indicate if the embargo is active or not. If this field is false, ignore the embargo. - */ - active: boolean; - /** - * An optional end time for the embargo to indicate when it ends. When it's not defined, it means the embargo keeps applying. The end time should be ignored if active flag is false. - */ - end_time?: string; - /** - * An optional description for the embargo. - */ - description?: string; - }; - /** - * Geo-Restriction configuration that contains the restriction ids that this content should be associated with. - */ - geo?: { - /** - * An array containing the geo-restriction objects. Limited to a size of 1 for now. - * - * @minItems 1 - * @maxItems 1 - */ - restrictions: [ - { - /** - * The _id of the restriction that is stored in Global Settings. - */ - restriction_id: string; - }, - ]; - }; - [k: string]: unknown; -} -/** - * Trait that holds information on who created and contributed to a given document in Arc. - */ -export interface Contributors { - /** - * The Creator of the Document. - */ - created_by?: { - /** - * The unique ID of the Arc user who created the Document - */ - user_id?: string; - /** - * The display name of the Arc user who created the Document - */ - display_name?: string; - [k: string]: unknown; - }; -} -/** - * An html content element - */ -export interface HttpsRawGithubusercontentComWashingtonpostAnsSchemaMasterSrcMainResourcesSchemaAns01010StoryElementsRawHtmlJson { - type: 'raw_html'; - _id?: GloballyUniqueIDTrait; - subtype?: SubtypeOrTemplate; - channels?: ChannelTrait; - alignment?: Alignment; - additional_properties?: HasAdditionalProperties; - /** - * Any arbitrary chunk of HTML. - */ - content: string; -} -/** - * Coordinates representing the 'visual center' of an image. The X axis is horizontal line and the Y axis the vertical line, with 0,0 being the LEFT, TOP of the image. - */ -export interface FocalPoint { - /** - * The coordinate point on the horizontal axis - */ - x: number; - /** - * The coordinate point on the vertical axis - */ - y: number; - [k: string]: unknown; -} -/** - * Mapping of integers to tokens, where the integer represents the Signing Service's secret version, and token represents an object's public key for usage on the frontend. - */ -export interface Auth { - /** - * This interface was referenced by `Auth`'s JSON-Schema definition - * via the `patternProperty` "^\d+$". - */ - [k: string]: string; -} -export interface Book1 { - book_title?: Title1; - book_url?: URL1; -} -export interface School1 { - school_name?: SchoolName1; -} diff --git a/src/types/content-elements.ts b/src/types/content-elements.ts deleted file mode 100644 index 8347bb4..0000000 --- a/src/types/content-elements.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { ContentElement } from '../content-elements/content-elements'; -import type { AnElementThatCanBeListedAsPartOfContentElements } from '../types/story'; - -export type CElement = AnElementThatCanBeListedAsPartOfContentElements; -export type ContentElementType = ReturnType<(typeof ContentElement)[T]>; diff --git a/src/types/gallery.ts b/src/types/gallery.ts deleted file mode 100644 index 6a2a34b..0000000 --- a/src/types/gallery.ts +++ /dev/null @@ -1,102 +0,0 @@ -import type { - ACollectionOfContent, - Address, - AliasesTrait, - Alignment, - CanonicalURL, - CanonicalWebsite, - ChannelTrait, - Comments, - ContentRestrictions, - Contributors, - CopyrightInformation, - CreatedDate, - CreditTrait, - DescribesTheANSVersionOfThisObject, - Description, - Display_Date, - Distributor, - Editor_Note, - FirstPublishDate, - Geo, - GloballyUniqueIDTrait, - HasAdditionalProperties, - Headlines, - Label, - LastUpdatedDate, - Locale, - LocationRelatedTrait, - OwnerInformation, - Pitches, - PromoItems, - Publish_Date, - Related_Content, - Revision, - SchedulingInformation, - Short_Url, - Slug, - Source, - Status, - SubHeadlines, - SubtypeOrTemplate, - Syndication, - Taxonomy, - Tracking, - VanityCreditsTrait, - Website, - WebsiteURL, - WebsitesInput, - WorkflowInformation, -} from './story'; - -export interface AGallery { - type: 'gallery'; - _id?: GloballyUniqueIDTrait; - version: DescribesTheANSVersionOfThisObject; - subtype?: SubtypeOrTemplate; - channels?: ChannelTrait; - alignment?: Alignment; - language?: Locale; - copyright?: CopyrightInformation; - canonical_url?: CanonicalURL; - canonical_website?: CanonicalWebsite; - website?: Website; - website_url?: WebsiteURL; - short_url?: Short_Url; - created_date?: CreatedDate; - last_updated_date?: LastUpdatedDate; - publish_date?: Publish_Date; - first_publish_date?: FirstPublishDate; - display_date?: Display_Date; - location?: LocationRelatedTrait; - geo?: Geo; - address?: Address; - editor_note?: Editor_Note; - status?: Status; - headlines?: Headlines; - subheadlines?: SubHeadlines; - description?: Description; - credits?: CreditTrait; - vanity_credits?: VanityCreditsTrait; - taxonomy?: Taxonomy; - promo_items?: PromoItems; - related_content?: Related_Content; - owner?: OwnerInformation; - planning?: SchedulingInformation; - workflow?: WorkflowInformation; - pitches?: Pitches; - revision?: Revision; - syndication?: Syndication; - source?: Source; - distributor?: Distributor; - tracking?: Tracking; - comments?: Comments; - label?: Label; - slug?: Slug; - content_restrictions?: ContentRestrictions; - additional_properties?: HasAdditionalProperties; - content_aliases?: AliasesTrait; - content_elements?: ACollectionOfContent; - websites?: WebsitesInput; - contributors?: Contributors; -} diff --git a/src/types/index.ts b/src/types/index.ts index 9d55436..ffc09c3 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,7 +1,16 @@ -export * as Author from './author'; -export * as Story from './story'; -export * as Section from './section'; -export * as Gallery from './gallery'; -export * as Video from './video'; -export * as Utils from './utils'; -export * as ContentElements from './content-elements'; +export * as ANS from './ans-types'; +export * as TypeUtils from './utils'; + +export * from '../api/identity/types.js'; +export * from '../api/draft/types.js'; +export * from '../api/site/types.js'; +export * from '../api/ifx/types.js'; +export * from '../api/redirect/types.js'; +export * from '../api/migration-center/types.js'; +export * from '../api/sales/types.js'; +export * from '../api/websked/types.js'; +export * from '../api/content/types.js'; +export * from '../api/photo-center/types.js'; +export * from '../api/global-settings/types.js'; +export * from '../api/tags/types.js'; +export * from '../api/content-ops/types.js'; diff --git a/src/types/section.ts b/src/types/section.ts deleted file mode 100644 index 9c6baae..0000000 --- a/src/types/section.ts +++ /dev/null @@ -1,63 +0,0 @@ -export type SectionReference = { - type: 'reference'; - referent: { - id: string; - website: string; - type: 'section'; - }; -}; - -export type SectionOrder = { default?: number; footer?: number; main_navigation?: number; header?: number } & { - [key: string]: number | undefined; -}; - -export type SectionParent = { default?: string; footer?: null | string; main_navigation?: string; header?: string } & { - [key: string]: string | undefined; -}; - -export type Section = { - _id: string; - site?: { - site_url: null; - site_keywords: null; - site_description: string; - site_tagline: null; - pagebuilder_path_for_native_apps: null; - site_about: null; - site_title: string; - section_collection: string; - }; - social?: { twitter: null; rss: null; facebook: null; instagram: null }; - navigation?: { nav_title: string }; - site_topper?: { site_logo_image: null }; - _admin?: { alias_ids: string[] }; - _website?: string; - name: string; - order?: SectionOrder; - parent?: SectionParent; - ancestors?: { default: []; footer: []; header: [] }; - inactive?: false; - node_type?: 'section'; -}; - -export type SetSection = { - _id: string; - website: string; - name: string; - navigation?: { nav_title: string }; - _admin?: { alias_ids: string[] }; - ancestors?: string[]; - order?: SectionOrder; - parent?: SectionParent; - inactive?: false; - site?: Partial<{ - site_url: null; - site_keywords: null; - site_description: string; - site_tagline: null; - pagebuilder_path_for_native_apps: null; - site_about: null; - site_title: string; - section_collection: string; - }>; -}; diff --git a/src/types/video.ts b/src/types/video.ts deleted file mode 100644 index a746657..0000000 --- a/src/types/video.ts +++ /dev/null @@ -1,1441 +0,0 @@ -/** - * This file was automatically generated by json-schema-to-typescript. - * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, - * and run json-schema-to-typescript to regenerate this file. - */ - -/** - * A globally unique identifier of the content in the ANS repository. - */ -export type GloballyUniqueIDTrait = string; -/** - * The version of ANS that this object was serialized as, in major.minor.patch format. For top-level content objects, this is a required trait. - */ -export type DescribesTheANSVersionOfThisObject = '0.8.0'; -/** - * A more granular type than story, gallery, etc. (E.g., column, blog_post) - */ -export type SubtypeTrait = string; -/** - * An optional list of output types for which this element should be visible - */ -export type ChannelTrait = string[]; -/** - * A property used to determine horizontal positioning of a content element relative to the elements that immediately follow it in the element sequence. - */ -export type Alignment = 'left' | 'right' | 'center'; -/** - * The primary language of the content. The value should follow IETF BCP47. (e.g. 'en', 'es-419', etc.) - */ -export type DescribesLanguageForAnElement = string; -/** - * A copyright notice for the legal owner of this content. E.g., '© 1996-2018 The Washington Post.' Format may vary between organizations. - */ -export type CopyrightInformation = string; -/** - * The relative URL to this document on the website specified by the `canonical_website` field. In the Arc ecosystem, this will be populated by the content api from the arc-canonical-url service if present based on the canonical_website. In conjunction with canonical_website, it can be used to determine the SEO canonical url or open graph url. In a multi-site context, this field may be different from the website_url field. - */ -export type CanonicalURL = string; -/** - * The _id of the website from which this document was originally authored. In conjunction with canonical_url, it can be used to determine the SEO canonical url or open graph url. In a multi-site context, this field may be different from the website field. - */ -export type CanonicalWebsite = string; -/** - * The _id of the website on which this document exists. This field is only available in Content API. If different from canonical_website, then this document was originally sourced from the canonical_website. Generated at fetch time by Content API. - */ -export type Website = string; -/** - * The relative URL to this document on the website specified by the `website` field. In a multi-site context, this is the url that is typically queried on when fetching by URL. It may be different than canonical_url. Generated at fetch time by Content API. - */ -export type WebsiteURL = string; -/** - * A url-shortened version of the canonical url. - */ -export type Short_Url = string; -/** - * When the content was originally created (RFC3339-formatted). In the Arc ecosystem, this will be automatically generated for stories in the Story API. - */ -export type CreatedDate = string; -/** - * When the content was last updated (RFC3339-formatted). - */ -export type LastUpdatedDate = string; -/** - * When the story was published. - */ -export type Publish_Date = string; -/** - * When the story was first published. - */ -export type FirstPublishDate = string; -/** - * The RFC3339-formatted dated time of the most recent date the story was (re)displayed on a public site. - */ -export type Display_Date = string; -/** - * A description of the location, useful if a full address or lat/long specification is overkill. - */ -export type LocationRelatedTrait = string; -/** - * Additional information to be displayed near the content from the editor. - */ -export type Editor_Note = string; -/** - * Optional field to story story workflow related status (e.g. published/embargoed/etc) - */ -export type Status = string; -/** - * The full human name of contributor. See also byline, first_name, last_name, middle_name, suffix. - */ -export type Name = string; -/** - * A short reference name for internal editorial use - */ -export type Slug = string; -/** - * This note is used for shared communication inside the newsroom. - */ -export type InternalNote = string; -/** - * Used for the newsroom to identify what the story is about, especially if a user is unfamiliar with the slug of a story and the headline or they do not yet exist. Newsroom use only. - */ -export type BudgetLine = string; -/** - * Information about a third party that provided this content from outside this document's hosted organization. - */ -export type Distributor = - | { - /** - * The human-readable name of the distributor of this content. E.g., Reuters. - */ - name?: string; - /** - * The machine-readable category of how this content was produced. Use 'staff' if this content was produced by an employee of the organization who owns this document repository. (Multisite note: content produced within a single *organization*, but shared across multiple *websites* should still be considered 'staff.') Use ‘wires’ if this content was produced for another organization and shared with the one who owns this document repository. Use 'freelance' if this content was produced by an individual on behalf of the organization who owns this document repository. Use 'stock' if this content is stock media distributed directly from a stock media provider. Use 'handout' if this is content provided from a source for an article (usually promotional media distributed directly from a company). Use 'other' for all other cases. - */ - category?: 'staff' | 'wires' | 'freelance' | 'stock' | 'handout' | 'other'; - /** - * The machine-readable subcategory of how this content was produced. E.g., 'freelance - signed'. May vary between organizations. - */ - subcategory?: string; - additional_properties?: HasAdditionalProperties; - mode?: 'custom'; - } - | { - /** - * The ARC UUID of the distributor of this content. E.g., ABCDEFGHIJKLMNOPQRSTUVWXYZ. - */ - reference_id: string; - mode: 'reference'; - }; -/** - * An list of alternate names that this content can be fetched by instead of id. - */ -export type AliasesTrait = string[]; -/** - * Links to various social media - */ -export type SocialLinks = { - site?: string; - url?: string; - [k: string]: unknown; -}[]; -/** - * The real first name of a human author. - */ -export type FirstName = string; -/** - * The real middle name of a human author. - */ -export type MiddleName = string; -/** - * The real last name of a human author. - */ -export type LastName = string; -/** - * The real suffix of a human author. - */ -export type Suffix = string; -/** - * The public-facing name, or nom-de-plume, name of the author. - */ -export type Byline = string; -/** - * The city or locality that the author resides in or is primarily associated with. - */ -export type Location = string; -/** - * The desk or group that this author normally reports to. E.g., 'Politics' or 'Sports.' - */ -export type Division = string; -/** - * The professional email address of this author. - */ -export type EMail = string; -/** - * The organizational role or title of this author. - */ -export type Role = string; -/** - * A comma-delimited list of subjects the author in which the author has expertise. - */ -export type Expertise = string; -/** - * The name of an organization the author is affiliated with. E.g., The Washington Post, or George Mason University. - */ -export type Affiliation = string; -/** - * A description of list of languages that the author is somewhat fluent in, excluding the native language of the parent publication, and identified in the language of the parent publication. E.g., Russian, Japanese, Greek. - */ -export type Languages = string; -/** - * A one or two sentence description of the author. - */ -export type ShortBiography = string; -/** - * The full biography of the author. - */ -export type LongBiography = string; -/** - * The book title. - */ -export type Title = string; -/** - * A link to a page to purchase or learn more about the book. - */ -export type URL = string; -/** - * A list of books written by the author. - */ -export type Books = Book[]; -/** - * The name of the school. - */ -export type SchoolName = string; -/** - * A list of schools that this author has graduated from. - */ -export type Education = School[]; -/** - * The name of the award. - */ -export type AwardName = string; -/** - * A list of awards the author has received. - */ -export type Awards = { - award_name?: AwardName; -}[]; -/** - * If true, this author is an external contributor to the publication. - */ -export type Contributor = boolean; -/** - * Deprecated. In ANS 0.5.8 and prior versions, this field is populated with the 'location' field from Arc Author Service. New implementations should use the 'location' and 'affiliation' field. Content should be identical to 'location.' - */ -export type Org = string; -/** - * Links to various social media - */ -export type SocialLinks1 = { - site?: string; - url?: string; - [k: string]: unknown; -}[]; -/** - * The primary author(s) of this document. For a story, is is the writer or reporter. For an image, it is the photographer. - */ -export type By = (AnAuthorOfAPieceOfContent | RepresentationOfANormalizedElement)[]; -/** - * The photographer(s) of supplementary images included in this document, if it is a story. Note that if this document is an image, the photographer(s) should appear in the 'by' slot. - */ -export type PhotosBy = (AnAuthorOfAPieceOfContent | RepresentationOfANormalizedElement)[]; -/** - * Trait that applies a list of corrections to a document. - */ -export type Corrections = Correction[]; - -/** - * Holds attributes of an ANS video component. In the Arc ecosystem, these are stored in Goldfish. - */ -export interface VideoContent { - type: 'video'; - _id?: GloballyUniqueIDTrait; - version: DescribesTheANSVersionOfThisObject; - subtype?: SubtypeTrait; - channels?: ChannelTrait; - alignment?: Alignment; - language?: DescribesLanguageForAnElement; - copyright?: CopyrightInformation; - canonical_url?: CanonicalURL; - canonical_website?: CanonicalWebsite; - website?: Website; - website_url?: WebsiteURL; - short_url?: Short_Url; - created_date?: CreatedDate; - last_updated_date?: LastUpdatedDate; - publish_date?: Publish_Date; - first_publish_date?: FirstPublishDate; - display_date?: Display_Date; - location?: LocationRelatedTrait; - geo?: Geo; - address?: Address; - editor_note?: Editor_Note; - status?: Status; - headlines?: Headlines; - subheadlines?: SubHeadlines; - description?: Description; - credits?: CreditTrait; - taxonomy?: Taxonomy; - promo_items?: PromoItems; - related_content?: Related_Content; - owner?: OwnerInformation; - planning?: SchedulingInformation; - workflow?: WorkflowInformation; - pitches?: Pitches; - revision?: Revision; - syndication?: Syndication; - source?: Source; - distributor?: Distributor; - tracking?: Tracking; - comments?: Comments; - label?: Label; - slug?: Slug; - content_restrictions?: ContentRestrictions; - additional_properties?: HasAdditionalProperties; - content_aliases?: AliasesTrait; - /** - * Runtime of the video in milliseconds. - */ - duration?: number; - /** - * A transcript of the contents of the video. - */ - transcript?: string; - /** - * A rating of the video, to be used for appropriate age/content warnings. - */ - rating?: string; - /** - * The type of video (e.g. clip, livestream, etc) - */ - video_type?: string; - /** - * The YouTube ID of the content, if (re)hosted on youtube.com - */ - youtube_content_id?: string; - /** - * The different streams this video can play in. - */ - streams?: AStreamOfVideo[]; - subtitles?: VideoSubtitleConfigurationSchema; - promo_image?: AnImage1; - /** - * An HTML snippet used to embed this video in another document. Used for oembed responses. - */ - embed_html?: string; - corrections?: Corrections; - websites?: WebsitesInput; -} -/** - * Latitidue and Longitude of the content - */ -export interface Geo { - latitude?: number; - longitude?: number; - [k: string]: unknown; -} -/** - * An Address following the convention of http://microformats.org/wiki/hcard - */ -export interface Address { - post_office_box?: string; - extended_address?: string; - street_address?: string; - locality?: string; - region?: string; - postal_code?: string; - country_name?: string; - additional_properties?: HasAdditionalProperties; -} -/** - * A grab-bag object for non-validatable data. - */ -export interface HasAdditionalProperties { - [k: string]: unknown; -} -/** - * The headline(s) or title for this content. The 'basic' key is required. - */ -export interface Headlines { - basic: string; - /** - * This interface was referenced by `Headlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `SubHeadlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `Description`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: string; -} -/** - * The sub-headline(s) for the content. - */ -export interface SubHeadlines { - basic: string; - /** - * This interface was referenced by `Headlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `SubHeadlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `Description`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: string; -} -/** - * The descriptions, or blurbs, for the content. - */ -export interface Description { - basic: string; - /** - * This interface was referenced by `Headlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `SubHeadlines`'s JSON-Schema definition - * via the `patternProperty` ".*". - * - * This interface was referenced by `Description`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: string; -} -/** - * A list of people and groups attributed to this content, keyed by type of contribution. In the Arc ecosystem, references in this list will be denormalized into author objects from the arc-author-service. - */ -export interface CreditTrait { - by?: By; - photos_by?: PhotosBy; - /** - * This interface was referenced by `CreditTrait`'s JSON-Schema definition - * via the `patternProperty` "^[a-zA-Z0-9_]*". - */ - [k: string]: (AnAuthorOfAPieceOfContent | RepresentationOfANormalizedElement)[] | undefined; -} -/** - * Models attribution to an individual or group for contribution towards some content item. In the Arc ecosystem, these are stored in the arc-author-service. - */ -export interface AnAuthorOfAPieceOfContent { - _id?: GloballyUniqueIDTrait; - /** - * Indicates that this is an author - */ - type: 'author'; - version?: DescribesTheANSVersionOfThisObject; - name: Name; - image?: AnImage; - /** - * A link to an author's landing page on the website, or a personal website. - */ - url?: string; - social_links?: SocialLinks; - slug?: Slug; - first_name?: FirstName; - middle_name?: MiddleName; - last_name?: LastName; - suffix?: Suffix; - byline?: Byline; - location?: Location; - division?: Division; - email?: EMail; - role?: Role; - expertise?: Expertise; - affiliation?: Affiliation; - languages?: Languages; - bio?: ShortBiography; - long_bio?: LongBiography; - books?: Books; - education?: Education; - awards?: Awards; - contributor?: Contributor; - org?: Org; - socialLinks?: SocialLinks1; - additional_properties?: HasAdditionalProperties; -} -/** - * Holds attributes of an ANS image component. In the Arc ecosystem, these are stored in Anglerfish. - */ -export interface AnImage { - type: 'image'; - _id?: GloballyUniqueIDTrait; - version: DescribesTheANSVersionOfThisObject; - subtype?: SubtypeTrait; - channels?: ChannelTrait; - alignment?: Alignment; - language?: DescribesLanguageForAnElement; - copyright?: CopyrightInformation; - canonical_url?: CanonicalURL; - short_url?: Short_Url; - created_date?: CreatedDate; - last_updated_date?: LastUpdatedDate; - publish_date?: Publish_Date; - first_publish_date?: FirstPublishDate; - display_date?: Display_Date; - location?: LocationRelatedTrait; - geo?: Geo; - address?: Address; - editor_note?: Editor_Note; - status?: Status; - headlines?: Headlines; - subheadlines?: SubHeadlines; - description?: Description; - credits?: CreditTrait; - taxonomy?: Taxonomy; - promo_items?: PromoItems; - related_content?: Related_Content; - owner?: OwnerInformation; - planning?: SchedulingInformation; - workflow?: WorkflowInformation; - pitches?: Pitches; - revision?: Revision; - syndication?: Syndication; - source?: Source; - distributor?: Distributor; - tracking?: Tracking; - comments?: Comments; - label?: Label; - slug?: Slug; - content_restrictions?: ContentRestrictions; - additional_properties?: HasAdditionalProperties; - /** - * Subtitle for the image. - */ - subtitle?: string; - /** - * Caption for the image. - */ - caption?: string; - /** - * URL for the image. - */ - url?: string; - /** - * Width for the image. - */ - width?: number; - /** - * Height for the image. - */ - height?: number; - /** - * True if the image can legally be licensed to others. - */ - licensable?: boolean; -} -/** - * Holds the collection of tags, categories, keywords, etc that describe content. - */ -export interface Taxonomy { - /** - * A list of keywords. In the Arc ecosystem, this list is populated by Clavis. - */ - keywords?: Keyword[]; - /** - * A list of named entities. In the Arc ecosystem, this list is populated by Clavis. - */ - named_entities?: NamedEntity[]; - /** - * A list of topics. In the Arc ecosystem, this list is populated by Clavis. - */ - topics?: Topic[]; - /** - * A list of auxiliaries. In the Arc ecosystem, this list is populated by Clavis. - */ - auxiliaries?: Auxiliary[]; - tags?: Tag[]; - /** - * Deprecated in 0.8.0. (See `primary_section` instead.) A primary site object or reference to one. In the Arc ecosystem, a reference here is denormalized into a site from the arc-site-service. - */ - primary_site?: - | Site - | (RepresentationOfANormalizedElement & { - referent?: { - type?: 'site'; - [k: string]: unknown; - }; - [k: string]: unknown; - }); - /** - * A primary section object or reference to one. In the Arc ecosystem, a reference here is denormalized into a site from the arc-site-service. - */ - primary_section?: - | Section - | (RepresentationOfANormalizedElement & { - referent?: { - type?: 'section'; - [k: string]: unknown; - }; - [k: string]: unknown; - }); - /** - * Deprecated in 0.8.0. (See `sections` instead.) A list of site objects or references to them. In the Arc ecosystem, references in this list are denormalized into sites from the arc-site-service. In a multi-site context, sites will be denormalized against an organization's default website only. - */ - sites?: ( - | Site - | (RepresentationOfANormalizedElement & { - referent?: { - type?: 'site'; - [k: string]: unknown; - }; - [k: string]: unknown; - }) - )[]; - /** - * A list of site objects or references to them. In the Arc ecosystem, references in this list are denormalized into sites from the arc-site-service. In a multi-site context, sites will be denormalized against an organization's default website only. - */ - sections?: ( - | Section - | (RepresentationOfANormalizedElement & { - referent?: { - type?: 'section'; - [k: string]: unknown; - }; - [k: string]: unknown; - }) - )[]; - /** - * A list of user-editable manually entered keywords for search purposes. In the Arc ecosystem, these can be generated and saved in source CMS systems, editors, etc. - */ - seo_keywords?: string[]; - /** - * A list of stock symbols of companies related to this content. In the Arc ecosystem, these can be generated and saved in source CMS systems, editors, etc. - */ - stock_symbols?: string[]; - /** - * A list of WebSked task IDs that this content was created or curated to satisfy. - * - * @maxItems 200 - */ - associated_tasks?: string[]; - additional_properties?: HasAdditionalProperties; -} -/** - * Models a keyword used in describing a piece of content. - */ -export interface Keyword { - /** - * The keyword used to describe a piece of content - */ - keyword: string; - /** - * An arbitrary weighting to give the keyword - */ - score: number; - /** - * The Part of Speech tag for this keyword. - */ - tag?: string; - /** - * An optional count of the frequency of the keyword as it appears in the content it describes - */ - frequency?: number; -} -/** - * Models a named entity (i.e. name of a person, place, or organization) used in a piece of content. - */ -export interface NamedEntity { - /** - * A unique identifier for the concept of the named entity. - */ - _id: string; - /** - * The actual string of text that was identified as a named entity. - */ - name: string; - /** - * A description of what the named entity is. E.g. 'organization', 'person', or 'location'. - */ - type: string; - score?: number; -} -/** - * Models a topic used in describing a piece of content. - */ -export interface Topic { - /** - * The unique identifier for this topic. - */ - _id: string; - /** - * The general name for this topic. - */ - name?: string; - /** - * An arbitrary weighting to give the topic - */ - score: number; - /** - * A short identifier for this topic. Usually used in cases where a long form id cannot work. - */ - uid: string; -} -/** - * Models a auxiliary used in targeting a piece of content. - */ -export interface Auxiliary { - /** - * The unique identifier for this auxiliary. - */ - _id: string; - /** - * The general name for this auxiliary. - */ - name?: string; - /** - * A short identifier for this auxiliary. Usually used in cases where a long form id cannot work. - */ - uid: string; -} -/** - * Models a keyword used in describing a piece of content. - */ -export interface Tag { - _id?: GloballyUniqueIDTrait; - /** - * The text of the tag as displayed to users. - */ - text: string; - /** - * A more detailed description of the tag. - */ - description?: string; - additional_properties?: HasAdditionalProperties; - slug?: Slug; -} -/** - * A hierarchical section or 'site' in a taxonomy. In the Arc ecosystem, these are stored in the arc-site-service. - */ -export interface Site { - type: 'site'; - _id?: GloballyUniqueIDTrait; - version: DescribesTheANSVersionOfThisObject; - additional_properties?: HasAdditionalProperties; - /** - * The name of this site - */ - name: string; - /** - * A short description or tagline about this site - */ - description?: string; - /** - * The url path to this site - */ - path?: string; - /** - * The id of this section's parent site, if any - */ - parent_id?: string; - /** - * Is this the primary site? - */ - primary?: boolean; -} -/** - * This represents a reference to external content that should be denormalized - */ -export interface RepresentationOfANormalizedElement { - type: 'reference'; - additional_properties?: HasAdditionalProperties; - _id?: GloballyUniqueIDTrait; - subtype?: SubtypeTrait; - channels?: ChannelTrait; - alignment?: Alignment; - referent: { - /** - * The ANS type that the provider should return. - */ - type?: string; - /** - * The type of interaction the provider expects. E.g., 'oembed' - */ - service?: string; - /** - * The id passed to the provider to retrieve an ANS document - */ - id: string; - /** - * A URL that can resolve the id into an ANS element - */ - provider?: string; - /** - * The website which the referenced id belongs to. Currently supported only for sections. - */ - website?: string; - /** - * An object for key-value pairs that should override the values of keys with the same name in the denormalized object - */ - referent_properties?: { - [k: string]: unknown; - }; - }; -} -/** - * A hierarchical section in a taxonomy. In the Arc ecosystem, these are stored in the arc-site-service. - */ -export interface Section { - type: 'section'; - _id?: GloballyUniqueIDTrait; - _website?: Website; - version: DescribesTheANSVersionOfThisObject; - additional_properties?: HasAdditionalProperties; - /** - * The name of this site - */ - name: string; - /** - * A short description or tagline about this site - */ - description?: string; - /** - * The url path to this site - */ - path?: string; - /** - * The id of this section's parent section in the default hierarchy, if any. - */ - parent_id?: string; - /** - * The id of this section's parent section in various commonly-used hierarchies, where available. - */ - parent?: { - default?: string; - [k: string]: unknown; - }; - /** - * Is this the primary site? - */ - primary?: boolean; -} -/** - * Lists of promotional content to use when highlighting the story. In the Arc ecosystem, references in these lists will be denormalized. - */ -export interface PromoItems { - basic?: AContentObject | RepresentationOfANormalizedElement; - /** - * This interface was referenced by `PromoItems`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: AContentObject | RepresentationOfANormalizedElement | undefined; -} -/** - * Holds common attributes of ANS Content objects. - */ -export interface AContentObject { - type: string; - _id?: GloballyUniqueIDTrait; - version: DescribesTheANSVersionOfThisObject; - subtype?: SubtypeTrait; - channels?: ChannelTrait; - alignment?: Alignment; - language?: DescribesLanguageForAnElement; - copyright?: CopyrightInformation; - canonical_url?: CanonicalURL; - short_url?: Short_Url; - created_date?: CreatedDate; - last_updated_date?: LastUpdatedDate; - publish_date?: Publish_Date; - first_publish_date?: FirstPublishDate; - display_date?: Display_Date; - location?: LocationRelatedTrait; - geo?: Geo; - address?: Address; - editor_note?: Editor_Note; - status?: Status; - headlines?: Headlines; - subheadlines?: SubHeadlines; - description?: Description; - credits?: CreditTrait; - taxonomy?: Taxonomy; - promo_items?: PromoItems; - related_content?: Related_Content; - owner?: OwnerInformation; - planning?: SchedulingInformation; - workflow?: WorkflowInformation; - pitches?: Pitches; - revision?: Revision; - syndication?: Syndication; - source?: Source; - distributor?: Distributor; - tracking?: Tracking; - comments?: Comments; - label?: Label; - slug?: Slug; - content_restrictions?: ContentRestrictions; - additional_properties?: HasAdditionalProperties; - content_aliases?: AliasesTrait; - [k: string]: unknown; -} -/** - * Lists of content items or references this story is related to, arbitrarily keyed. In the Arc ecosystem, references in this object will be denormalized into the fully-inflated content objects they represent. - */ -export interface Related_Content { - /** - * An attached redirect. In Arc, when this content item is fetched by url, content api will instead return this redirect object with appropriate headers. In all other cases, this content should be treated normally. - * - * @maxItems 1 - */ - redirect?: [] | [ARedirectObject]; - /** - * This interface was referenced by `Related_Content`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: [ARedirectObject] | (AContentObject | RepresentationOfANormalizedElement)[] | undefined; -} -/** - * A redirect to another story. - */ -export interface ARedirectObject { - type: 'redirect'; - _id?: GloballyUniqueIDTrait; - version: DescribesTheANSVersionOfThisObject; - owner?: OwnerInformation; - revision?: Revision; - canonical_url: CanonicalURL; - redirect_url: CanonicalURL; -} -/** - * Various unrelated fields that should be preserved for backwards-compatibility reasons. See also trait_source. - */ -export interface OwnerInformation { - /** - * The machine-readable unique identifier of the organization whose database this content is stored in. In Arc, this is equivalent to ARC_ORG_NAME. - */ - id?: string; - /** - * Deprecated in 0.8.0. See `distributor.name`. (Formerly: The human-readable name of original producer of content. Distinguishes between Wires, Staff and other sources.) - */ - name?: string; - /** - * True if this content is advertorial or native advertising. - */ - sponsored?: boolean; - [k: string]: unknown; -} -/** - * Trait that applies revision information to a document. In the Arc ecosystem, many of these fields are populated in stories by the Story API. - */ -export interface Revision { - /** - * The unique id of this revision. - */ - revision_id?: string; - /** - * The unique id of the revision that this revisions was branched from, or preceded it on the current branch. - */ - parent_id?: string; - /** - * The name of the branch this revision was created on. - */ - branch?: string; - /** - * A list of identifiers of editions that point to this revision. - */ - editions?: string[]; - /** - * The unique user id of the person who created this revision. - */ - user_id?: string; - /** - * Whether or not this revision's parent story is published, in any form or place - */ - published?: boolean; - additional_properties?: HasAdditionalProperties; -} -/** - * Trait that applies planning information to a document or resource. In the Arc ecosystem, this data is generated by WebSked. Newsroom use only. All these fields should be available and editable in WebSked. - */ -export interface SchedulingInformation { - additional_properties?: HasAdditionalProperties; - /** - * Date to be used for chronological sorting in WebSked. - */ - websked_sort_date?: string; - /** - * The delta between the story's planned publish date and actual first publish time, in minutes. - */ - deadline_miss?: number; - internal_note?: InternalNote; - budget_line?: BudgetLine; - /** - * Scheduling information. - */ - scheduling?: { - /** - * When the content is planned to be published. - */ - planned_publish_date?: string; - /** - * When the content was first published. - */ - scheduled_publish_date?: string; - /** - * Will this content have galleries? - */ - will_have_gallery?: boolean; - /** - * Will this content have graphics? - */ - will_have_graphic?: boolean; - /** - * Will this content have images? - */ - will_have_image?: boolean; - /** - * Will this content have videos? - */ - will_have_video?: boolean; - }; - /** - * Story length information. - */ - story_length?: { - /** - * The anticipated number of words in the story. - */ - word_count_planned?: number; - /** - * Current number of words. - */ - word_count_actual?: number; - /** - * The anticipated length of the story in inches. - */ - inch_count_planned?: number; - /** - * The current length of the story in inches. - */ - inch_count_actual?: number; - /** - * The anticipated length of the story in lines. - */ - line_count_planned?: number; - /** - * The current length of the story in lines. - */ - line_count_actual?: number; - }; -} -/** - * Trait that applies workflow information to a document or resource. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface WorkflowInformation { - additional_properties?: HasAdditionalProperties; - /** - * Code indicating the story's current workflow status. This number should match the values configured in WebSked. - */ - status_code?: number; - /** - * This note will be used for any task automatically generated via WebSked task triggers. - */ - note?: string; -} -/** - * Trait that represents a story's pitches. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface Pitches { - additional_properties?: HasAdditionalProperties; - /** - * A list of the story's pitches to a platform. - */ - platform?: PlatformPitch[]; - /** - * A list of the story's pitches to a publication. - */ - publication?: PublicationPitch[]; -} -/** - * Trait that represents a pitch to a platform. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface PlatformPitch { - additional_properties?: HasAdditionalProperties; - /** - * The path of the platform that this pitch targets. - */ - platform_path?: string; - creation_event?: PlatformPitchEvent; - latest_event?: PlatformPitchEvent; -} -/** - * Trait that represents an update event for a pitch to a platform. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface PlatformPitchEvent { - additional_properties?: HasAdditionalProperties; - /** - * The current status of the pitch. - */ - status?: string; - /** - * The time of this update. - */ - time?: string; - /** - * The ID of the user who made this update. - */ - user_id?: string; - /** - * Optional note associated with this update. - */ - note?: string; -} -/** - * Trait that represents a pitch to a publication. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface PublicationPitch { - additional_properties?: HasAdditionalProperties; - /** - * The ID of the publication that this pitch targets. - */ - publication_id?: string; - creation_event?: PublicationPitchEvent; - latest_event?: PublicationPitchEvent; -} -/** - * Trait that represents an update event for a pitch to a publication. In the Arc ecosystem, this data is generated by WebSked. - */ -export interface PublicationPitchEvent { - additional_properties?: HasAdditionalProperties; - /** - * The current status of the pitch. - */ - status?: string; - /** - * The time of this update. - */ - time?: string; - /** - * The ID of the user who made this update. - */ - user_id?: string; - /** - * Optional note associated with this update. - */ - note?: string; - /** - * The ID of the publication edition that this pitch targets. - */ - edition_id?: string; - /** - * The time of the publication edition that this pitch targets. - */ - edition_time?: string; -} -/** - * Key-boolean pair of syndication services where this article may go - */ -export interface Syndication { - /** - * Necessary for fulfilling contractual agreements with third party Globe and Mail clients - */ - external_distribution?: boolean; - /** - * Necessary so that we can filter out all articles that editorial has deemed should not be discoverable via search - */ - search?: boolean; - /** - * This interface was referenced by `Syndication`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: boolean | undefined; -} -/** - * Information about the original source and/or owner of this content - */ -export interface Source { - /** - * The id of this content in a foreign CMS. - */ - source_id?: string; - /** - * Deprecated in 0.8.0. See `distributor.category` and `distributor.subcategory`. (Formerly: The method used to enter this content. E.g. 'staff', 'wires'.) - */ - source_type?: string; - /** - * Deprecated in 0.8.0. See `distributor.name`. (Formerly: The human-readable name of the organization who first produced this content. E.g., 'Reuters'.) - */ - name?: string; - /** - * The software (CMS or editor) that was used to enter this content. E.g., 'wordpress', 'ellipsis'. - */ - system?: string; - /** - * A link to edit this content in its source CMS. - */ - edit_url?: string; - additional_properties?: HasAdditionalProperties; -} -/** - * Tracking information, probably implementation-dependent - */ -export interface Tracking { - [k: string]: unknown; -} -/** - * Comment configuration data - */ -export interface Comments { - /** - * How long (in days) after publish date until comments are closed. - */ - comments_period?: number; - /** - * If false, commenting is disabled on this content. - */ - allow_comments?: boolean; - /** - * If false, do not render comments on this content. - */ - display_comments?: boolean; - /** - * If true, comments must be moderator-approved before being displayed. - */ - moderation_required?: boolean; - additional_properties?: HasAdditionalProperties; - [k: string]: unknown; -} -/** - * What the Washington Post calls a Kicker - */ -export interface Label { - /** - * The default label object for this piece of content. - */ - basic?: { - /** - * The text of this label. - */ - text: string; - /** - * An optional destination url of this label. - */ - url?: string; - /** - * If false, this label should be hidden. - */ - display?: boolean; - additional_properties?: HasAdditionalProperties; - }; - /** - * Additional user-defined keyed label objects. - * - * This interface was referenced by `Label`'s JSON-Schema definition - * via the `patternProperty` "^[a-zA-Z0-9_]*$". - */ - [k: string]: - | { - /** - * The text of this label. - */ - text: string; - /** - * An optional destination url of this label. - */ - url?: string; - /** - * If false, this label should be hidden. - */ - display?: boolean; - additional_properties?: HasAdditionalProperties | undefined; - } - | undefined; -} -/** - * Trait that applies contains the content restrictions of an ANS object. - */ -export interface ContentRestrictions { - /** - * The content restriction code/level/flag associated with the ANS object - */ - content_code?: string; - [k: string]: unknown; -} -export interface Book { - book_title?: Title; - book_url?: URL; -} -export interface School { - school_name?: SchoolName; -} -/** - * Configuration for a piece of video content, over a stream. - */ -export interface AStreamOfVideo { - /** - * The height of the video. - */ - height?: number; - /** - * The width of the video. - */ - width?: number; - /** - * The size of the video, in bytes. - */ - filesize?: number; - /** - * The audio codec. - */ - audio_codec?: string; - /** - * The video codec. - */ - video_codec?: string; - /** - * The type of video (e.g. mp4). - */ - stream_type?: string; - /** - * Where to get the stream from. - */ - url?: string; - /** - * The bitrate of the video - */ - bitrate?: number; - /** - * The provider of the video. - */ - provider?: string; - [k: string]: unknown; -} -/** - * Data about different subtitle encodings and confidences of auto-transcribed content. - */ -export interface VideoSubtitleConfigurationSchema { - /** - * How confident the transcriber (human or automated) is of the accuracy of the subtitles. - */ - confidence?: number; - /** - * The locations of any subtitle transcriptions of the video. - */ - urls?: SubtitleUrl[]; - [k: string]: unknown; -} -export interface SubtitleUrl { - /** - * The format of the subtitles (e.g. SRT, DFXP, WEB_VTT, etc) - */ - format?: string; - /** - * The url of the subtitle stream. - */ - url?: string; - [k: string]: unknown; -} -/** - * Holds attributes of an ANS image component. In the Arc ecosystem, these are stored in Anglerfish. - */ -export interface AnImage1 { - type: 'image'; - _id?: GloballyUniqueIDTrait; - version: DescribesTheANSVersionOfThisObject; - subtype?: SubtypeTrait; - channels?: ChannelTrait; - alignment?: Alignment; - language?: DescribesLanguageForAnElement; - copyright?: CopyrightInformation; - canonical_url?: CanonicalURL; - short_url?: Short_Url; - created_date?: CreatedDate; - last_updated_date?: LastUpdatedDate; - publish_date?: Publish_Date; - first_publish_date?: FirstPublishDate; - display_date?: Display_Date; - location?: LocationRelatedTrait; - geo?: Geo; - address?: Address; - editor_note?: Editor_Note; - status?: Status; - headlines?: Headlines; - subheadlines?: SubHeadlines; - description?: Description; - credits?: CreditTrait; - taxonomy?: Taxonomy; - promo_items?: PromoItems; - related_content?: Related_Content; - owner?: OwnerInformation; - planning?: SchedulingInformation; - workflow?: WorkflowInformation; - pitches?: Pitches; - revision?: Revision; - syndication?: Syndication; - source?: Source; - distributor?: Distributor; - tracking?: Tracking; - comments?: Comments; - label?: Label; - slug?: Slug; - content_restrictions?: ContentRestrictions; - additional_properties?: HasAdditionalProperties; - /** - * Subtitle for the image. - */ - subtitle?: string; - /** - * Caption for the image. - */ - caption?: string; - /** - * URL for the image. - */ - url?: string; - /** - * Width for the image. - */ - width?: number; - /** - * Height for the image. - */ - height?: number; - /** - * True if the image can legally be licensed to others. - */ - licensable?: boolean; -} -/** - * Describes a change that has been made to the document for transparency, or describes inaccuracies or falsehoods that remain in the document. - */ -export interface Correction { - type: 'correction'; - _id?: GloballyUniqueIDTrait; - subtype?: SubtypeTrait; - channels?: ChannelTrait; - alignment?: Alignment; - additional_properties?: HasAdditionalProperties; - /** - * Type of correction. E.g., clarification, retraction. - */ - correction_type?: string; - /** - * The text of the correction. - */ - text: string; -} -/** - * Website-specific metadata for url generation for multi-site copies. These fields are not indexed in Content API. - */ -export interface WebsitesInput { - /** - * This interface was referenced by `WebsitesInput`'s JSON-Schema definition - * via the `patternProperty` "^[a-zA-Z0-9_]*". - */ - [k: string]: { - website_section?: RepresentationOfANormalizedElement | Section; - website_url?: WebsiteURL; - }; -} diff --git a/src/utils/arc/ans.ts b/src/utils/arc/ans.ts index fcff0a3..b31cb60 100644 --- a/src/utils/arc/ans.ts +++ b/src/utils/arc/ans.ts @@ -1,6 +1,8 @@ -import type { RepresentationOfANormalizedElement } from '../../types/story'; +import type { ANS } from '../../types'; -export const reference = (ref: RepresentationOfANormalizedElement['referent']): RepresentationOfANormalizedElement => { +export const reference = ( + ref: ANS.RepresentationOfANormalizedElement['referent'] +): ANS.RepresentationOfANormalizedElement => { return { _id: ref.id, type: 'reference' as const, diff --git a/src/utils/arc/content.ts b/src/utils/arc/content.ts index aaea8bb..af86d00 100644 --- a/src/utils/arc/content.ts +++ b/src/utils/arc/content.ts @@ -1,5 +1,5 @@ -import { ContentElement } from '../../content-elements'; -import type { ContentElementType } from '../../types/content-elements'; +import { ContentElement } from '../../content-elements/content-elements.js'; +import type { ContentElementType } from '../../content-elements/types.js'; const socialRegExps = { instagram: diff --git a/src/utils/arc/index.ts b/src/utils/arc/index.ts index b7e5f65..e399192 100644 --- a/src/utils/arc/index.ts +++ b/src/utils/arc/index.ts @@ -1,9 +1,11 @@ -import * as ANS from './ans'; -import * as ContentElements from './content'; -import * as Id from './id'; +import * as ANS from './ans.js'; +import * as ContentElements from './content.js'; +import * as Id from './id.js'; +import * as Section from './section.js'; export const ArcUtils = { Id, ANS, ContentElements, + Section, }; diff --git a/src/utils/arc/section.ts b/src/utils/arc/section.ts new file mode 100644 index 0000000..0f38bad --- /dev/null +++ b/src/utils/arc/section.ts @@ -0,0 +1,221 @@ +import assert from 'node:assert'; +import type { ArcAPIType } from '../../api'; +import type { Section, SectionReference, SetSectionPayload } from '../../types'; +import { reference } from './ans'; + +export type NavigationTreeNode = { + id: string; + children: NavigationTreeNode[]; + parent: NavigationTreeNode | null; + meta: T; +}; + +export type NavigationItem = { + id: string; + [key: `N${number}`]: string; +}; + +export const buildTree = (items: NavigationItem[]) => { + const tree: NavigationTreeNode[] = [ + { + id: '/', + children: [], + meta: new Proxy( + {}, + { + get: () => { + throw new Error('Root node meta is not accessible'); + }, + } + ), + parent: null, + } as any, + ]; + + // Track nodes at each level to maintain parent-child relationships + // stores last node at each level + const currLevelNodes: Record> = { + 0: tree[0], + }; + + for (const item of items) { + const node: NavigationTreeNode = { + id: item.id, + parent: null, + children: [], + meta: item as any, + }; + + // Determine the level of this node + const levelKey = Object.keys(item).find((key) => key.startsWith('N') && item[key as keyof NavigationItem]); + const level = Number(levelKey?.replace('N', '')) || 0; + if (!level) { + throw new Error(`Invalid level for section ${item.id}`); + } + + // This is a child node - attach to its parent + const parentLevel = level - 1; + const parentNode = currLevelNodes[parentLevel]; + + if (parentNode) { + node.parent = parentNode; + parentNode.children.push(node); + } else { + throw new Error(`Parent node not found for section ${item.id}`); + } + + // Set this as the current node for its level + currLevelNodes[level] = node; + } + + // return root nodes children + return tree[0].children; +}; + +export const flattenTree = (tree: NavigationTreeNode[]): NavigationTreeNode[] => { + const flatten: NavigationTreeNode[] = []; + + const traverse = (node: NavigationTreeNode) => { + flatten.push(node); + for (const child of node.children) { + traverse(child); + } + }; + + // traverse all root nodes and their children + for (const node of tree) { + traverse(node); + } + + return flatten; +}; + +export const buildAndFlattenTree = (items: NavigationItem[]) => flattenTree(buildTree(items)); + +export const groupByWebsites = (sections: Section[]) => { + return sections.reduce( + (acc, section) => { + const website = section._website!; + if (!acc[website]) acc[website] = []; + acc[website].push(section); + return acc; + }, + {} as Record + ); +}; + +export const references = (sections: Section[]) => { + return sections.map( + (s) => + reference({ + id: s._id, + website: s._website, + type: 'section', + }) as SectionReference + ); +}; + +export const isReference = (section: any): section is SectionReference => { + return section?.type === 'reference' && section?.referent?.type === 'section'; +}; + +export const removeDuplicates = (sections: T[]): T[] => { + const map = new Map(); + + sections.forEach((s) => { + if (isReference(s)) { + map.set(`${s.referent.id}${s.referent.website}`, s); + } else { + map.set(`${s._id}${s._website}`, s); + } + }); + + return [...map.values()]; +}; + +export class SectionsRepository { + public sectionsByWebsite: Record = {}; + public websitesAreLoaded = false; + + constructor(protected arc: ArcAPIType) {} + + async put(ans: SetSectionPayload) { + await this.arc.Site.putSection(ans); + const created = await this.arc.Site.getSection(ans._id, ans.website); + this.save(created); + } + + async loadWebsite(website: string) { + const sections: Section[] = []; + let next = true; + let offset = 0; + + while (next) { + const migrated = await this.arc.Site.getSections({ website, offset }).catch((_) => { + return { q_results: [] }; + }); + if (migrated.q_results.length) { + sections.push(...migrated.q_results); + offset += migrated.q_results.length; + } else { + next = false; + } + } + + return sections; + } + + async loadWebsites(websites: string[]) { + for (const website of websites) { + this.sectionsByWebsite[website] = await this.loadWebsite(website); + } + + this.websitesAreLoaded = true; + } + + save(section: Section) { + const website = section._website; + + assert.ok(website, 'Section must have a website'); + + this.sectionsByWebsite[website] = this.sectionsByWebsite[website] || []; + + if (!this.sectionsByWebsite[website].find((s) => s._id === section._id)) { + this.sectionsByWebsite[website].push(section); + } + } + + getById(id: string, website: string) { + this.ensureWebsitesLoaded(); + + const section = this.sectionsByWebsite[website]?.find((s) => s._id === id); + return section; + } + + getByWebsite(website: string) { + this.ensureWebsitesLoaded(); + + return this.sectionsByWebsite[website]; + } + + getParentSections(section: Section) { + this.ensureWebsitesLoaded(); + + const parents: Section[] = []; + let current = section; + + while (current.parent?.default && current.parent.default !== '/') { + const parent = this.getById(current.parent.default, section._website!); + if (!parent) break; + + parents.push(parent); + current = parent; + } + + return parents; + } + + protected ensureWebsitesLoaded() { + assert.ok(this.websitesAreLoaded, 'call .loadWebsites() first'); + } +} diff --git a/src/utils/cache.ts b/src/utils/cache.ts index ac11eb0..2eb7b6b 100644 --- a/src/utils/cache.ts +++ b/src/utils/cache.ts @@ -1,4 +1,4 @@ -import { Duration } from './duration'; +import { Duration } from './duration.js'; export type CacheItem = { data: Data; ttl: number; timer?: NodeJS.Timeout }; diff --git a/src/utils/decorator.ts b/src/utils/decorator.ts index c914806..02d99e7 100644 --- a/src/utils/decorator.ts +++ b/src/utils/decorator.ts @@ -1,4 +1,4 @@ -import type Cache from './cache'; +import type Cache from './cache.js'; export function Cached(cache: Cache) { return (_target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): void => { diff --git a/tsconfig.json b/tsconfig.json index 724b54d..f53c31b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,72 +1,18 @@ { "compilerOptions": { - "target": "ES2020" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */, - "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */, - "moduleResolution": "node", - "lib": ["ESNext"] /* Specify library files to be included in the compilation. */, - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */ - "declaration": true /* Generates corresponding '.d.ts' file. */, - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - "sourceMap": true /* Generates corresponding '.map' file. */, - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./dist" /* Redirect output structure to the directory. */, - "resolveJsonModule": true, - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - "downlevelIteration": true /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */, - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true /* Enable all strict type-checking options. */, - "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, - "strictNullChecks": true /* Enable strict null checks. */, - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - "noUnusedLocals": false /* Report errors on unused locals. */, - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - // "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */ - // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */ - // "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ - "skipLibCheck": true /* Skip type checking of declaration files. */, - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ + "target": "ES2020", + "module": "ES2022", + "lib": ["es2021"], + "declaration": true, + "emitDeclarationOnly": false, + "outDir": "dist", + "rootDir": "src", + "strict": true, + "moduleResolution": "bundler", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "skipLibCheck": true }, - "include": ["src/**/*.ts"], - "exclude": ["./node_modules", "dist", "./vite.config.ts"] + "include": ["src"], + "exclude": ["node_modules", "dist", "**/*.test.ts"] }