@pantheon-systems/css-client 0.18.2 → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/content.js +4 -0
- package/dist/endpoints/documents.js +3 -0
- package/dist/index.d.ts +1 -1
- package/dist/sdk-version.d.ts +1 -1
- package/dist/sdk-version.js +1 -1
- package/dist/types/index.d.ts +24 -0
- package/package.json +1 -1
package/dist/content.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { P1ApiError } from './errors.js';
|
|
2
2
|
import { resolveBaseUrl } from './constants.js';
|
|
3
|
+
import { requirePathParams } from './utils.js';
|
|
3
4
|
function trimTrailingSlashes(value) {
|
|
4
5
|
let end = value.length;
|
|
5
6
|
while (end > 0 && value[end - 1] === '/')
|
|
@@ -24,6 +25,7 @@ export class P1ContentClient {
|
|
|
24
25
|
this.branchId = config.branchId;
|
|
25
26
|
}
|
|
26
27
|
async getPage(documentPath) {
|
|
28
|
+
requirePathParams({ siteId: this.siteId }, 'content.getPage');
|
|
27
29
|
const cleanPath = documentPath === '/' ? '' : trimLeadingSlashes(documentPath);
|
|
28
30
|
const pathSegment = cleanPath ? `/${cleanPath}` : '';
|
|
29
31
|
let url = `${this.baseUrl}/api/sites/${this.siteId}/content${pathSegment}`;
|
|
@@ -43,6 +45,7 @@ export class P1ContentClient {
|
|
|
43
45
|
return response.json();
|
|
44
46
|
}
|
|
45
47
|
async getRedirect(path) {
|
|
48
|
+
requirePathParams({ siteId: this.siteId }, 'content.getRedirect');
|
|
46
49
|
const cleanPath = path === '/' ? '' : trimLeadingSlashes(path);
|
|
47
50
|
const pathSegment = cleanPath ? `/${cleanPath}` : '';
|
|
48
51
|
const url = `${this.baseUrl}/api/sites/${this.siteId}/content-redirects${pathSegment}`;
|
|
@@ -59,6 +62,7 @@ export class P1ContentClient {
|
|
|
59
62
|
return response.json();
|
|
60
63
|
}
|
|
61
64
|
async getPagePaths() {
|
|
65
|
+
requirePathParams({ siteId: this.siteId }, 'content.getPagePaths');
|
|
62
66
|
let url = `${this.baseUrl}/api/sites/${this.siteId}/content-pages`;
|
|
63
67
|
if (this.branchId) {
|
|
64
68
|
url += `?branch=${this.branchId}`;
|
|
@@ -26,6 +26,9 @@ export class DocumentsEndpoint {
|
|
|
26
26
|
if (options?.pathPrefix !== undefined) {
|
|
27
27
|
params.set('pathPrefix', options.pathPrefix);
|
|
28
28
|
}
|
|
29
|
+
if (options?.include && options.include.length > 0) {
|
|
30
|
+
params.set('include', options.include.join(','));
|
|
31
|
+
}
|
|
29
32
|
const query = params.toString();
|
|
30
33
|
const path = query
|
|
31
34
|
? `/api/sites/${siteId}/branches/${branchId}/documents?${query}`
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
export { P1Client } from './client.js';
|
|
7
7
|
export type { P1ClientConfig } from './client.js';
|
|
8
8
|
export { PRODUCTION_BASE_URL } from './constants.js';
|
|
9
|
-
export type { Site, Branch, BranchStatus, Document, DocumentVersion, DocumentVersionSource, Checkpoint, CheckpointType, CheckpointStatus, CheckpointDocument, WorkflowSettings, PuckData, PuckComponentData, PuckRootData, Principal, PaginationOptions, CreateBranchParams, CreateDocumentParams, CreateDocumentVersionParams, CreateCheckpointParams, PublishDocumentResult, ListDocumentsOptions, ActorState, ActorRole, ActorPresence, DocumentPresenceSummary, BranchPresenceSummary, BranchPresence, SitePresence, AgentPresenceLocation, AgentGlobalPresence, AgentStatus, AgentSettings, RegisteredAgent, CreateAgentParams, UpdateAgentParams, ListAgentsOptions, AgentTrigger, AgentEditDenialReason, AgentEditContext, AgentEditPermission, AgentEditSession, AgentEditCompleteResult, AgentEditAbortResult, AgentStopResult, UpdateFocusRegionsResponse, PublishResult, ConflictResolutionStrategy, MergeRequestStatus, DocumentConflictType, DocumentConflict, ConflictDetails, MergeabilityResult, DocumentDiff, MergePreview, MergeExecuteParams, MergeExecuteResult, MergeRequest, CreateMergeRequestParams, UpdateMergeRequestParams, ListMergeRequestsOptions, ExecuteMergeRequestOptions, Template, TemplateSummary, TemplateMetadata, TemplateContentItem, TemplateRootProps, CreateTemplateParams, UpdateTemplateParams, MigrationJob, MigrationConflict, MigrationPreview, MigrationPreviewDocument, TriggerMigrationParams, Datasource, QuerySortField, Query, QueryResultItem, QueryResultsMeta, QueryResults, QueryResultsParams, LocalePolicy, SiteLocales, SiteSettings, SiteSettingsResult, TranslationMode, LocalizationRelation, CreateTranslationParams, CreateTranslationResult, TranslationVariant, ListTranslationsResult, PropAuthority, AuthorityOverridesMap, AuthorityOverridesResult, ChangeClassification, ChangeSummaryEntry, ChangeSummary, UpstreamResolutions, UpstreamResolutionTarget, SiteMemberRole, AgentSiteRole, SiteMemberUser, SiteMemberAgent, SiteMembers, MergeJob, MergeJobStatus, } from './types/index.js';
|
|
9
|
+
export type { Site, Branch, BranchStatus, Document, DocumentRouteSummary, DocumentVersion, DocumentVersionSource, Checkpoint, CheckpointType, CheckpointStatus, CheckpointDocument, WorkflowSettings, PuckData, PuckComponentData, PuckRootData, Principal, PaginationOptions, CreateBranchParams, CreateDocumentParams, CreateDocumentVersionParams, CreateCheckpointParams, PublishDocumentResult, ListDocumentsOptions, ActorState, ActorRole, ActorPresence, DocumentPresenceSummary, BranchPresenceSummary, BranchPresence, SitePresence, AgentPresenceLocation, AgentGlobalPresence, AgentStatus, AgentSettings, RegisteredAgent, CreateAgentParams, UpdateAgentParams, ListAgentsOptions, AgentTrigger, AgentEditDenialReason, AgentEditContext, AgentEditPermission, AgentEditSession, AgentEditCompleteResult, AgentEditAbortResult, AgentStopResult, UpdateFocusRegionsResponse, PublishResult, ConflictResolutionStrategy, MergeRequestStatus, DocumentConflictType, DocumentConflict, ConflictDetails, MergeabilityResult, DocumentDiff, MergePreview, MergeExecuteParams, MergeExecuteResult, MergeRequest, CreateMergeRequestParams, UpdateMergeRequestParams, ListMergeRequestsOptions, ExecuteMergeRequestOptions, Template, TemplateSummary, TemplateMetadata, TemplateContentItem, TemplateRootProps, CreateTemplateParams, UpdateTemplateParams, MigrationJob, MigrationConflict, MigrationPreview, MigrationPreviewDocument, TriggerMigrationParams, Datasource, QuerySortField, Query, QueryResultItem, QueryResultsMeta, QueryResults, QueryResultsParams, LocalePolicy, SiteLocales, SiteSettings, SiteSettingsResult, TranslationMode, LocalizationRelation, CreateTranslationParams, CreateTranslationResult, TranslationVariant, ListTranslationsResult, PropAuthority, AuthorityOverridesMap, AuthorityOverridesResult, ChangeClassification, ChangeSummaryEntry, ChangeSummary, UpstreamResolutions, UpstreamResolutionTarget, SiteMemberRole, AgentSiteRole, SiteMemberUser, SiteMemberAgent, SiteMembers, MergeJob, MergeJobStatus, } from './types/index.js';
|
|
10
10
|
export type * from './types/threads/index.js';
|
|
11
11
|
export type { RegistryComponent, RegistryComponentList } from './endpoints/registry.js';
|
|
12
12
|
export { isAgentProposal, isAgentWorking } from './types/threads/index.js';
|
package/dist/sdk-version.d.ts
CHANGED
package/dist/sdk-version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const SDK_NAME = 'css-client';
|
|
2
|
-
export const SDK_VERSION = '0.
|
|
2
|
+
export const SDK_VERSION = '0.19.0';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -75,6 +75,21 @@ export interface Branch {
|
|
|
75
75
|
createdAt: string;
|
|
76
76
|
updatedAt: string;
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* A brief description of what a document holds, returned on a branch document
|
|
80
|
+
* listing when requested with `include: ['routeSummary']`.
|
|
81
|
+
*/
|
|
82
|
+
export interface DocumentRouteSummary {
|
|
83
|
+
/**
|
|
84
|
+
* `patch` is a page override entry, `page` is a full page, and `other` is any
|
|
85
|
+
* other content.
|
|
86
|
+
*/
|
|
87
|
+
shape: 'patch' | 'page' | 'other';
|
|
88
|
+
/** The path a `patch` overrides. Present only when `shape` is `patch`. */
|
|
89
|
+
basePath?: string;
|
|
90
|
+
/** The number of operations in a `patch`. Present only when `shape` is `patch`. */
|
|
91
|
+
operationCount?: number;
|
|
92
|
+
}
|
|
78
93
|
/**
|
|
79
94
|
* A document (page) within a site.
|
|
80
95
|
*/
|
|
@@ -98,6 +113,13 @@ export interface Document {
|
|
|
98
113
|
* only on a branch document listing; absent elsewhere (get-by-id, get-by-path).
|
|
99
114
|
*/
|
|
100
115
|
snapshotTitle?: string;
|
|
116
|
+
/**
|
|
117
|
+
* A summary of what the document holds, or `null` when it has no readable
|
|
118
|
+
* version on the branch or that version has empty content. Present only on a
|
|
119
|
+
* branch document listing that requested `include: ['routeSummary']`; servers
|
|
120
|
+
* that predate the option omit it.
|
|
121
|
+
*/
|
|
122
|
+
routeSummary?: DocumentRouteSummary | null;
|
|
101
123
|
/** Template this document is bound to (nullable for blank pages) */
|
|
102
124
|
templateId?: string | null;
|
|
103
125
|
/** Version of the template this document was created from or migrated to */
|
|
@@ -480,6 +502,8 @@ export interface PublishDocumentResult {
|
|
|
480
502
|
*/
|
|
481
503
|
export interface ListDocumentsOptions extends PaginationOptions {
|
|
482
504
|
pathPrefix?: string;
|
|
505
|
+
/** Extra data to return with each document. `routeSummary` adds `Document.routeSummary`. */
|
|
506
|
+
include?: 'routeSummary'[];
|
|
483
507
|
}
|
|
484
508
|
/**
|
|
485
509
|
* Actor state in a document session.
|