@surfiran/public-api-client 0.27.0 → 0.28.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Public API Client
2
2
 
3
- Zero-runtime-dependency TypeScript types and fetch client for SURFIRAN Public API V1. The checked-in package-local contract snapshot is OpenAPI `v0.17.0`.
3
+ Zero-runtime-dependency TypeScript types and fetch client for SURFIRAN Public API V1. The checked-in package-local contract snapshot is OpenAPI `v0.18.0`.
4
4
 
5
5
  Repository: `SURFIRAN/surfiran-public-api-client`
6
6
 
@@ -18,11 +18,11 @@ The repository split and production cutover are complete. This repository is the
18
18
 
19
19
  `contract/public-api-v1.yaml` is the package-local immutable snapshot used for generation. `contract/provenance.json` records its source identity, immutable source revision, checksums, and, for standalone releases, the exact API artifact identity.
20
20
 
21
- The checked-in `0.26.0` snapshot and provenance come from the `SURFIRAN/surfiran-crm-api` main-branch artifact `public-api-contract-c7ed3f7bf7930c540f07d8f6c47d47fba4f024ae-35233930079-1`. Published `0.20.0` and earlier keep their historical provenance, which may still reference the former monorepo owner or path. Do not rewrite an already published package version solely to rename historical provenance.
21
+ The checked-in `0.28.0` snapshot and provenance come from the `SURFIRAN/surfiran-crm-api` main-branch release `public-api-contract/56ba99f1008e85dd59b51d91be29ac23fa3a1051-36217113430-1`. Published `0.20.0` and earlier keep their historical provenance, which may still reference the former monorepo owner or path. Do not rewrite an already published package version solely to rename historical provenance.
22
22
 
23
- New client versions must consume an immutable reviewed contract artifact produced by a successful `SURFIRAN/surfiran-crm-api` main-branch CI run. The artifact is bound to the API source commit, GitHub Actions run identity, source ref/event, contract version, and checksum. Pull-request artifacts are verification evidence only and are not valid release inputs. This repository must never read another repository's private working tree at build time.
23
+ New client versions must consume the exact immutable GitHub Release assets produced from a successful `SURFIRAN/surfiran-crm-api` main-branch CI run. The release tag is `public-api-contract/<source SHA>-<run ID>-<attempt>` and contains only `public-api-v1.yaml` and `manifest.json`. Publication verifies the immutable release and both GitHub release attestations, the tag SHA, final successful source run, asset digests, manifest identity, and checked-in snapshot bytes. If any check is unavailable, publication stops. Pull-request artifacts are verification evidence only and are not valid release inputs. This repository must never read another repository's private working tree at build time.
24
24
 
25
- Generated client source is never hand-edited.
25
+ `src/generated/public-api-v1.ts` is generated from the checked-in snapshot; `src/client.ts` and `src/types.ts` are maintained in this repository against that reviewed contract. Never hand-edit generated source.
26
26
 
27
27
  ## Boundary
28
28
 
@@ -65,9 +65,9 @@ Generation is deterministic: stable ordering and formatting, LF newlines, no mac
65
65
 
66
66
  A new contract update must:
67
67
 
68
- 1. use the exact immutable artifact from a successful API run on `refs/heads/main` triggered by `push` or `workflow_dispatch`;
68
+ 1. use the exact immutable release assets from a successful API run on `refs/heads/main` triggered by `push` or `workflow_dispatch`;
69
69
  2. make a reviewed package version change before rewriting contract provenance;
70
- 3. run `sync:api-contract-artifact` with the exact API commit, run ID, and run attempt;
70
+ 3. verify/download the release assets, then run `sync:api-contract-artifact` with the exact API commit, run ID, and run attempt;
71
71
  4. update `contract/public-api-v1.yaml` and `contract/provenance.json` together;
72
72
  5. regenerate the client;
73
73
  6. pass artifact verification, package verification, reproducibility, tests, typecheck, and build;
@@ -83,7 +83,9 @@ Do not duplicate the endpoint list here; the pinned OpenAPI snapshot and generat
83
83
 
84
84
  ## Publication and rollback
85
85
 
86
- Publication is manual and repository-local through [public-api-client-publish.yml](.github/workflows/public-api-client-publish.yml). It runs on `main` only with explicit publication authorization and `publish_confirm=PUBLISH`. A future version must be bound to an exact reviewed API contract artifact, pass package/reproducibility checks and publication preflight, create release provenance, and provide an exact previous rollback version. Missing or unverifiable artifact provenance blocks publication. The workflow defines required inputs and the download/verification sequence.
86
+ Routine package CI runs on the non-production Linux `ci-worker` pool. Manual publication uses the dedicated trusted `package-publish` runner and never occupies `surfdmc-prod-deploy`; package and cross-repository artifact credentials do not move to Home or general CI workers.
87
+
88
+ Publication is manual and repository-local through [public-api-client-publish.yml](.github/workflows/public-api-client-publish.yml). It runs on `main` only with explicit publication authorization and `publish_confirm=PUBLISH`. A future version must be bound to an exact reviewed API contract release, pass package/reproducibility checks and publication preflight, create release provenance, and provide an exact previous rollback version. The workflow uses `PUBLIC_API_CONTRACT_READ_TOKEN` to read the private immutable API release and a separate `PUBLIC_API_CLIENT_RELEASE_SETTINGS_READ_TOKEN` with scoped Administration:read to confirm immutable Releases are enabled for this client repository. Before publishing to npmjs.org, it creates or exactly reuses an immutable client release `public-api-client/v<package version>` containing the packed tarball and provenance JSON. It marks the evidence release as non-latest and verifies its asset digests, source tag SHA, and GitHub release attestations. Retries must reproduce the same bytes, including the explicit generation timestamp. Missing or unverifiable release or publication evidence blocks npm publication; the workflow does not use Actions artifact storage for these gates.
87
89
 
88
90
  Published versions are immutable. Rollback means pinning consumers to the previous verified exact package version. Package publication never deploys a consumer, changes API runtime behavior, applies a database migration, or authorizes production data/configuration access.
89
91
 
@@ -92,6 +94,6 @@ Published versions are immutable. Rollback means pinning consumers to the previo
92
94
  - This README owns local setup, contract synchronization, CI, publication, and rollback guidance.
93
95
  - [AGENTS.md](AGENTS.md) owns agent operating instructions.
94
96
  - [Repository boundaries and documentation governance](https://github.com/SURFIRAN/surfiran-crm-api/blob/main/docs/architecture/REPOSITORY_BOUNDARIES.md) own shared architecture and current system state.
95
- - [Contract snapshot](contract/public-api-v1.yaml) and [provenance](contract/provenance.json) are immutable evidence for `0.26.0`, not current API ownership authorities.
97
+ - [Contract snapshot](contract/public-api-v1.yaml) and [provenance](contract/provenance.json) are immutable evidence for `0.28.0`, not current API ownership authorities.
96
98
 
97
99
  Update existing guidance instead of creating duplicate contract or publication authorities. Preserve the historical snapshot, provenance, and generated bytes until a reviewed new package version imports a verified API artifact.
package/dist/client.d.ts CHANGED
@@ -4,9 +4,7 @@ export type PublicApiClientOptions = {
4
4
  fetchImpl?: typeof fetch;
5
5
  requestId?: string;
6
6
  /**
7
- * Bounds every request issued by this client. Defaults to 10000ms, matching
8
- * the existing AbortController-based timeout precedent in
9
- * server/services/webhookDispatcher.ts.
7
+ * Bounds every request issued by this client. Defaults to 10000ms.
10
8
  */
11
9
  timeoutMs?: number;
12
10
  };
package/dist/client.js CHANGED
@@ -1,5 +1,20 @@
1
1
  const DEFAULT_TIMEOUT_MS = 10000;
2
- const trimTrailingSlash = (value) => value.replace(/\/+$/, '');
2
+ /**
3
+ * Trims trailing slashes without a regular expression.
4
+ *
5
+ * `/\/+$/` has a candidate start at every slash, so a base URL ending in a
6
+ * long run of them was quadratic to reject (CodeQL js/polynomial-redos). This
7
+ * is a published client library: the base URL is whatever a consumer passes,
8
+ * and a library has no say in that. Scanning backwards is linear and says the
9
+ * same thing.
10
+ */
11
+ const SLASH = 47;
12
+ const trimTrailingSlash = (value) => {
13
+ let end = value.length;
14
+ while (end > 0 && value.charCodeAt(end - 1) === SLASH)
15
+ end -= 1;
16
+ return value.slice(0, end);
17
+ };
3
18
  const isAbortError = (err) => err instanceof Error && err.name === 'AbortError';
4
19
  const toTimeoutResult = (status, requestId) => ({
5
20
  ok: false,
@@ -130,6 +145,8 @@ const toSearchResultsQueryString = (params) => {
130
145
  search.set('limit', String(params.limit));
131
146
  if (params.type)
132
147
  search.set('type', params.type);
148
+ if (params.locale)
149
+ search.set('locale', params.locale);
133
150
  return `?${search.toString()}`;
134
151
  };
135
152
  const toTravelKnowledgeQueryString = (params) => {
package/dist/types.d.ts CHANGED
@@ -1623,6 +1623,8 @@ export type GetPublicSearchResultsParams = {
1623
1623
  /** Maximum items per group. 1 through 25; defaults to 10 server-side. Group totals still report every match. */
1624
1624
  limit?: number;
1625
1625
  type?: 'tour' | 'destination';
1626
+ /** Published tour copy locale; omitted or en keeps the English results. */
1627
+ locale?: PublicContentLocale;
1626
1628
  };
1627
1629
  export type ListPublicTourCategoriesParams = {
1628
1630
  limit?: number;
package/dist/types.js CHANGED
@@ -1,3 +1,3 @@
1
- // TypeScript interfaces aligned with server/openapi/public-api-v1.yaml v0.10.0
1
+ // Hand-maintained public API types; generated contract types live in src/generated/public-api-v1.ts.
2
2
  // Zero runtime code. Types only.
3
3
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surfiran/public-api-client",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "description": "TypeScript types and client for SURFIRAN CRM Public API V1",
5
5
  "type": "module",
6
6
  "engines": {