@metacensus/library-api-public 0.0.0-stage → 0.1.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/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, MetaCensus
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md CHANGED
@@ -1,3 +1,44 @@
1
- # Temporary Holding Version
1
+ # @metacensus/library-api-public
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ TypeScript for the MetaCensus public API contract — every request and response
4
+ under `/metacensus/public`, generated from the `.proto` sources that also
5
+ generate the Go side. What ships is the generated types, the route manifest,
6
+ `protobufPackage`, and `PublicClient`.
7
+
8
+ ```bash
9
+ npm install @metacensus/library-api-public
10
+ ```
11
+
12
+ ```ts
13
+ import { PublicClient, ApiError, type PartnerSubmission } from "@metacensus/library-api-public";
14
+
15
+ const client = new PublicClient({ baseUrl: "https://api.example.com" });
16
+ const receipt = await client.submitPartnerInterest({ name, email, interests, message, website: "" });
17
+ ```
18
+
19
+ Construct `PublicClient` with:
20
+
21
+ - `baseUrl` — the origin; the client adds `/metacensus/public` and the route.
22
+ - `fetch?` — a `fetch` to use instead of the global, for tests or instrumentation.
23
+ - `prefix?` — a path to use instead of `/metacensus/public`.
24
+
25
+ A non-2xx response throws `ApiError` (`method`, `url`, `status`, and the raw
26
+ `body` — parse it defensively, since a 404 or 405 comes from the router, not a
27
+ handler). Every scalar is required, which is what makes the Go side's
28
+ `EmitDefaultValues` and these types describe the same document.
29
+
30
+ `PartnerSubmission_Interest` is a string enum, so a checkbox list is generated
31
+ from the contract rather than mirrored by hand. `Unspecified` is the proto3 zero
32
+ value, not an offered choice, so filter it out:
33
+
34
+ ```ts
35
+ const choices = Object.values(PartnerSubmission_Interest).filter(
36
+ (i) => i !== PartnerSubmission_Interest.Unspecified,
37
+ );
38
+ ```
39
+
40
+ The wire format is JSON, not protobuf binary: field names are `lowerCamelCase`,
41
+ enum values are PascalCase, and all ids are strings.
42
+
43
+ Source, the derivation of every field, and the Go module:
44
+ <https://github.com/metacensus/library-api-public>
@@ -0,0 +1,7 @@
1
+ export * from "./src/metacensus/public/v1/careers.js";
2
+ export * from "./src/metacensus/public/v1/common.js";
3
+ export * from "./src/metacensus/public/v1/partner.js";
4
+ export * from "./src/route-manifest.js";
5
+ export * from "./src/client.js";
6
+ export { protobufPackage } from "./src/metacensus/public/v1/common.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAIA,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAGhC,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ // The MetaCensus public API contract (/metacensus/public): generated types,
2
+ // route manifest, and PublicClient. Everything under ./src is generated; a new
3
+ // .proto file needs a line here, which scripts/check-entry-points.mjs enforces.
4
+ export * from "./src/metacensus/public/v1/careers.js";
5
+ export * from "./src/metacensus/public/v1/common.js";
6
+ export * from "./src/metacensus/public/v1/partner.js";
7
+ export * from "./src/route-manifest.js";
8
+ export * from "./src/client.js";
9
+ // `export *` can't pick one file's `protobufPackage` over another's.
10
+ export { protobufPackage } from "./src/metacensus/public/v1/common.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,+EAA+E;AAC/E,gFAAgF;AAEhF,cAAc,uCAAuC,CAAC;AACtD,cAAc,sCAAsC,CAAC;AACrD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAEhC,qEAAqE;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { ApplicationReceipt, ApplicationSubmission, GetRoleRequest, ListRolesRequest, Role, RoleSummary } from "./metacensus/public/v1/careers.js";
2
+ import type { PartnerReceipt, PartnerSubmission } from "./metacensus/public/v1/partner.js";
3
+ export declare class ApiError extends Error {
4
+ readonly method: string;
5
+ readonly url: string;
6
+ readonly status: number;
7
+ readonly body: string;
8
+ constructor(method: string, url: string, status: number, body: string);
9
+ }
10
+ export interface PublicClientOptions {
11
+ readonly baseUrl: string;
12
+ readonly fetch?: typeof globalThis.fetch;
13
+ readonly prefix?: string;
14
+ }
15
+ export declare class PublicClient {
16
+ #private;
17
+ constructor(options: PublicClientOptions);
18
+ listRoles(req: ListRolesRequest): Promise<RoleSummary[]>;
19
+ getRole(req: GetRoleRequest): Promise<Role>;
20
+ submitApplication(req: ApplicationSubmission): Promise<ApplicationReceipt>;
21
+ submitPartnerInterest(req: PartnerSubmission): Promise<PartnerReceipt>;
22
+ }
23
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,cAAc,EAAE,gBAAgB,EAAE,IAAI,EAAY,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAClK,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAK3F,qBAAa,QAAS,SAAQ,KAAK;IAE/B,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IAJvB,YACW,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAItB;CACF;AAiBD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qBAAa,YAAY;;IAKvB,YAAY,OAAO,EAAE,mBAAmB,EAIvC;IAeD,SAAS,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAEvD;IAGD,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1C;IAGD,iBAAiB,CAAC,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAEzE;IAGD,qBAAqB,CAAC,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAErE;CACF"}
@@ -0,0 +1,71 @@
1
+ // Code generated by routegen. DO NOT EDIT.
2
+ import { prefix } from "./route-manifest.js";
3
+ // ApiError is any non-2xx response. body is the response text, unparsed: a 404
4
+ // or 405 comes from the router, not a handler, so parse it defensively.
5
+ export class ApiError extends Error {
6
+ method;
7
+ url;
8
+ status;
9
+ body;
10
+ constructor(method, url, status, body) {
11
+ super(`${method} ${url}: HTTP ${status}`);
12
+ this.method = method;
13
+ this.url = url;
14
+ this.status = status;
15
+ this.body = body;
16
+ this.name = "ApiError";
17
+ }
18
+ }
19
+ function param(v) {
20
+ return encodeURIComponent(String(v));
21
+ }
22
+ // The query string for a request's query fields, from "?"; a field at its zero
23
+ // value is left out, which the server reads as that same zero value.
24
+ function query(fields) {
25
+ const q = new URLSearchParams();
26
+ for (const [k, v] of Object.entries(fields)) {
27
+ if (v !== undefined && v !== "" && v !== 0 && v !== false)
28
+ q.set(k, String(v));
29
+ }
30
+ const s = q.toString();
31
+ return s === "" ? "" : "?" + s;
32
+ }
33
+ export class PublicClient {
34
+ #baseUrl;
35
+ #fetch;
36
+ #prefix;
37
+ constructor(options) {
38
+ this.#baseUrl = options.baseUrl;
39
+ this.#fetch = options.fetch ?? globalThis.fetch.bind(globalThis);
40
+ this.#prefix = options.prefix ?? prefix;
41
+ }
42
+ async #request(method, path, body) {
43
+ const url = this.#baseUrl + this.#prefix + path;
44
+ const headers = {};
45
+ if (body !== undefined)
46
+ headers["Content-Type"] = "application/json";
47
+ const res = await this.#fetch(url, { method, headers, body });
48
+ if (res.status < 200 || res.status >= 300) {
49
+ throw new ApiError(method, url, res.status, await res.text());
50
+ }
51
+ const text = await res.text();
52
+ return (text === "" ? {} : JSON.parse(text));
53
+ }
54
+ // CareersRoutes.ListRoles: GET /roles
55
+ listRoles(req) {
56
+ return this.#request("GET", "/roles").then((r) => r.items);
57
+ }
58
+ // CareersRoutes.GetRole: GET /roles/{id}
59
+ getRole(req) {
60
+ return this.#request("GET", `/roles/${param(req.id)}`);
61
+ }
62
+ // CareersRoutes.SubmitApplication: POST /applications
63
+ submitApplication(req) {
64
+ return this.#request("POST", "/applications", JSON.stringify(req));
65
+ }
66
+ // PartnerRoutes.SubmitPartnerInterest: POST /partner
67
+ submitPartnerInterest(req) {
68
+ return this.#request("POST", "/partner", JSON.stringify(req));
69
+ }
70
+ }
71
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,63 @@
1
+ export declare const protobufPackage = "metacensus.public.v1";
2
+ /** The open roles the careers pages list, and the application form under each. */
3
+ export interface ListRolesRequest {
4
+ }
5
+ export interface RoleList {
6
+ items: RoleSummary[];
7
+ }
8
+ /** A role as the list shows it. */
9
+ export interface RoleSummary {
10
+ /** Kebab-case, and the listing's file name. */
11
+ id: string;
12
+ title: string;
13
+ /** One line. */
14
+ summary: string;
15
+ }
16
+ export interface GetRoleRequest {
17
+ id: string;
18
+ }
19
+ /** One open role, whole. */
20
+ export interface Role {
21
+ id: string;
22
+ title: string;
23
+ summary: string;
24
+ /** Markdown. */
25
+ body: string;
26
+ }
27
+ /**
28
+ * One application form post. Fields are trimmed before they are checked; a
29
+ * 400 body names the first field at fault, in this order.
30
+ */
31
+ export interface ApplicationSubmission {
32
+ /** Required. The id of an open role. */
33
+ roleId: string;
34
+ /** Required. Whitespace-collapsed, then capped at 120 characters. */
35
+ name: string;
36
+ /**
37
+ * Required. Capped at 254 characters, and must contain an `@` with a dotted
38
+ * host after it.
39
+ */
40
+ email: string;
41
+ /** Required. Capped at 2000 characters. */
42
+ message: string;
43
+ /** Optional. An http(s) URL, capped at 1000 characters. */
44
+ link: string;
45
+ /**
46
+ * Honeypot. Must be empty; a filled one receives an ordinary receipt and is
47
+ * never delivered.
48
+ */
49
+ website: string;
50
+ }
51
+ /**
52
+ * The 202 answer. `submission_id` correlates with the service's logs; it isn't
53
+ * a fetchable handle.
54
+ */
55
+ export interface ApplicationReceipt {
56
+ /**
57
+ * Always true; required because contract.UnmarshalOptions rejects unknown
58
+ * fields.
59
+ */
60
+ ok: boolean;
61
+ submissionId: string;
62
+ }
63
+ //# sourceMappingURL=careers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"careers.d.ts","sourceRoot":"","sources":["../../../../../src/metacensus/public/v1/careers.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,yBAAyB,CAAC;AAEtD,kFAAkF;AAElF,MAAM,WAAW,gBAAgB;CAChC;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED,mCAAmC;AACnC,MAAM,WAAW,WAAW;IAC1B,+CAA+C;IAC/C,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,4BAA4B;AAC5B,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,EAAE,EAAE,OAAO,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,8 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.7.7
4
+ // protoc unknown
5
+ // source: metacensus/public/v1/careers.proto
6
+ /* eslint-disable */
7
+ export const protobufPackage = "metacensus.public.v1";
8
+ //# sourceMappingURL=careers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"careers.js","sourceRoot":"","sources":["../../../../../src/metacensus/public/v1/careers.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,6CAA6C;AAE7C,oBAAoB;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,sBAAsB,CAAC"}
@@ -0,0 +1,22 @@
1
+ export declare const protobufPackage = "metacensus.public.v1";
2
+ /**
3
+ * Shared types for the public surface. See README.md, "Errors".
4
+ *
5
+ * The statuses this surface answers with, which `google.api.http` cannot
6
+ * express and so live nowhere else. A submission is accepted with 200 from
7
+ * /partner and 202 from /applications. 400 and 403 share a sentence on
8
+ * purpose — which applies is not a caller's business — except that an
9
+ * application's 400 names the field at fault.
10
+ *
11
+ * 400 the submission was not valid, or the body was not JSON
12
+ * 403 the `Origin` was absent or not allowlisted
13
+ * 404 no open role has the id
14
+ * 413 the body exceeded 16 KiB
15
+ * 429 the per-client rate limit was exceeded; `Retry-After` carries seconds
16
+ * 502 the submission could not be relayed upstream
17
+ * 500 something else went wrong
18
+ *
19
+ * No messages yet: this is the one file the cross-file typing rule exempts, so
20
+ * a type shared across the surface's resources would go here.
21
+ */
22
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../../src/metacensus/public/v1/common.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,yBAAyB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;GAmBG"}
@@ -0,0 +1,28 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.7.7
4
+ // protoc unknown
5
+ // source: metacensus/public/v1/common.proto
6
+ /* eslint-disable */
7
+ export const protobufPackage = "metacensus.public.v1";
8
+ /**
9
+ * Shared types for the public surface. See README.md, "Errors".
10
+ *
11
+ * The statuses this surface answers with, which `google.api.http` cannot
12
+ * express and so live nowhere else. A submission is accepted with 200 from
13
+ * /partner and 202 from /applications. 400 and 403 share a sentence on
14
+ * purpose — which applies is not a caller's business — except that an
15
+ * application's 400 names the field at fault.
16
+ *
17
+ * 400 the submission was not valid, or the body was not JSON
18
+ * 403 the `Origin` was absent or not allowlisted
19
+ * 404 no open role has the id
20
+ * 413 the body exceeded 16 KiB
21
+ * 429 the per-client rate limit was exceeded; `Retry-After` carries seconds
22
+ * 502 the submission could not be relayed upstream
23
+ * 500 something else went wrong
24
+ *
25
+ * No messages yet: this is the one file the cross-file typing rule exempts, so
26
+ * a type shared across the surface's resources would go here.
27
+ */
28
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../../src/metacensus/public/v1/common.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,4CAA4C;AAE5C,oBAAoB;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;GAmBG"}
@@ -0,0 +1,54 @@
1
+ export declare const protobufPackage = "metacensus.public.v1";
2
+ /** The partner / express-interest form the marketing site posts to. */
3
+ /**
4
+ * One express-interest form post. The length caps below are enforced but not
5
+ * machine-readable — ts-proto drops field options, so protovalidate can't
6
+ * reach the client.
7
+ */
8
+ export interface PartnerSubmission {
9
+ /** Required. Whitespace-collapsed, then capped at 120 characters. */
10
+ name: string;
11
+ /**
12
+ * Required. Trimmed, capped at 254 characters, and must contain an `@`
13
+ * with a dotted host after it. Deliberately a shape check, not RFC 5322.
14
+ */
15
+ email: string;
16
+ /**
17
+ * May be empty. Duplicates are collapsed rather than rejected; an
18
+ * unrecognised value rejects the whole submission.
19
+ */
20
+ interests: PartnerSubmission_Interest[];
21
+ /** Optional. Trimmed, capped at 2000 characters. */
22
+ message: string;
23
+ /**
24
+ * Honeypot. Must be empty; a filled one receives an ordinary receipt and
25
+ * is never delivered.
26
+ */
27
+ website: string;
28
+ }
29
+ /**
30
+ * The set of checkboxes is a contract; display wording is not. Unspecified
31
+ * is the proto3 zero value, not an offered choice — filter it out when
32
+ * building a form.
33
+ */
34
+ export declare enum PartnerSubmission_Interest {
35
+ Unspecified = "Unspecified",
36
+ PartnerOrPilot = "PartnerOrPilot",
37
+ FundTheWork = "FundTheWork",
38
+ ContributeExpertise = "ContributeExpertise",
39
+ BringToMyField = "BringToMyField",
40
+ RequestEarlyAccess = "RequestEarlyAccess"
41
+ }
42
+ /**
43
+ * The 200 answer. `submission_id` correlates with the service's logs; it
44
+ * isn't a fetchable handle.
45
+ */
46
+ export interface PartnerReceipt {
47
+ /**
48
+ * Always true; required because contract.UnmarshalOptions rejects unknown
49
+ * fields.
50
+ */
51
+ ok: boolean;
52
+ submissionId: string;
53
+ }
54
+ //# sourceMappingURL=partner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partner.d.ts","sourceRoot":"","sources":["../../../../../src/metacensus/public/v1/partner.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe,yBAAyB,CAAC;AAEtD,uEAAuE;AAEvE;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,SAAS,EAAE,0BAA0B,EAAE,CAAC;IACxC,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,oBAAY,0BAA0B;IACpC,WAAW,gBAAgB;IAC3B,cAAc,mBAAmB;IACjC,WAAW,gBAAgB;IAC3B,mBAAmB,wBAAwB;IAC3C,cAAc,mBAAmB;IACjC,kBAAkB,uBAAuB;CAC1C;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,EAAE,EAAE,OAAO,CAAC;IACZ,YAAY,EAAE,MAAM,CAAC;CACtB"}
@@ -0,0 +1,22 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.7.7
4
+ // protoc unknown
5
+ // source: metacensus/public/v1/partner.proto
6
+ /* eslint-disable */
7
+ export const protobufPackage = "metacensus.public.v1";
8
+ /**
9
+ * The set of checkboxes is a contract; display wording is not. Unspecified
10
+ * is the proto3 zero value, not an offered choice — filter it out when
11
+ * building a form.
12
+ */
13
+ export var PartnerSubmission_Interest;
14
+ (function (PartnerSubmission_Interest) {
15
+ PartnerSubmission_Interest["Unspecified"] = "Unspecified";
16
+ PartnerSubmission_Interest["PartnerOrPilot"] = "PartnerOrPilot";
17
+ PartnerSubmission_Interest["FundTheWork"] = "FundTheWork";
18
+ PartnerSubmission_Interest["ContributeExpertise"] = "ContributeExpertise";
19
+ PartnerSubmission_Interest["BringToMyField"] = "BringToMyField";
20
+ PartnerSubmission_Interest["RequestEarlyAccess"] = "RequestEarlyAccess";
21
+ })(PartnerSubmission_Interest || (PartnerSubmission_Interest = {}));
22
+ //# sourceMappingURL=partner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"partner.js","sourceRoot":"","sources":["../../../../../src/metacensus/public/v1/partner.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,gCAAgC;AAChC,iCAAiC;AACjC,6CAA6C;AAE7C,oBAAoB;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,sBAAsB,CAAC;AA+BtD;;;;GAIG;AACH,MAAM,CAAN,IAAY,0BAOX;AAPD,WAAY,0BAA0B;IACpC,yDAA2B,CAAA;IAC3B,+DAAiC,CAAA;IACjC,yDAA2B,CAAA;IAC3B,yEAA2C,CAAA;IAC3C,+DAAiC,CAAA;IACjC,uEAAyC,CAAA;AAC3C,CAAC,EAPW,0BAA0B,KAA1B,0BAA0B,QAOrC"}
@@ -0,0 +1,14 @@
1
+ export declare const prefix = "/metacensus/public";
2
+ export interface Route {
3
+ readonly service: string;
4
+ readonly rpc: string;
5
+ readonly method: string;
6
+ readonly path: string;
7
+ readonly params: readonly string[];
8
+ readonly query: readonly string[];
9
+ readonly body: string;
10
+ readonly request: string;
11
+ readonly response: string;
12
+ }
13
+ export declare const routes: readonly Route[];
14
+ //# sourceMappingURL=route-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-manifest.d.ts","sourceRoot":"","sources":["../../src/route-manifest.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,MAAM,uBAAuB,CAAC;AAK3C,MAAM,WAAW,KAAK;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,eAAO,MAAM,MAAM,EAAE,SAAS,KAAK,EAKlC,CAAC"}
@@ -0,0 +1,14 @@
1
+ // Code generated by routegen. DO NOT EDIT.
2
+ // Every route of the MetaCensus public surface on one screen, generated from
3
+ // the google.api.http annotations on each service. See the repository README,
4
+ // "Routes".
5
+ // The path metacensus.public.v1 routes hang off. Join it with a route's
6
+ // `path` for the path a client requests.
7
+ export const prefix = "/metacensus/public";
8
+ export const routes = [
9
+ { service: "CareersRoutes", rpc: "ListRoles", method: "GET", path: "/roles", params: [], query: [], body: "", request: "ListRolesRequest", response: "RoleList" },
10
+ { service: "CareersRoutes", rpc: "GetRole", method: "GET", path: "/roles/{id}", params: ["id"], query: [], body: "", request: "GetRoleRequest", response: "Role" },
11
+ { service: "CareersRoutes", rpc: "SubmitApplication", method: "POST", path: "/applications", params: [], query: [], body: "*", request: "ApplicationSubmission", response: "ApplicationReceipt" },
12
+ { service: "PartnerRoutes", rpc: "SubmitPartnerInterest", method: "POST", path: "/partner", params: [], query: [], body: "*", request: "PartnerSubmission", response: "PartnerReceipt" },
13
+ ];
14
+ //# sourceMappingURL=route-manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route-manifest.js","sourceRoot":"","sources":["../../src/route-manifest.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAE3C,6EAA6E;AAC7E,8EAA8E;AAC9E,YAAY;AAEZ,wEAAwE;AACxE,yCAAyC;AACzC,MAAM,CAAC,MAAM,MAAM,GAAG,oBAAoB,CAAC;AAiB3C,MAAM,CAAC,MAAM,MAAM,GAAqB;IACtC,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,EAAE;IACjK,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,EAAE;IAClK,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,oBAAoB,EAAE;IACjM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,uBAAuB,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,gBAAgB,EAAE;CACzL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,48 @@
1
1
  {
2
2
  "name": "@metacensus/library-api-public",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "TypeScript for the MetaCensus public API contract (/metacensus/public): generated types, a route manifest, and a typed transport-agnostic PublicClient.",
5
+ "license": "BSD-3-Clause",
6
+ "type": "module",
7
+ "engines": {
8
+ "node": ">=26"
9
+ },
10
+ "sideEffects": false,
11
+ "main": "./dist/index.js",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ },
18
+ "./package.json": "./package.json"
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "README.md",
23
+ "LICENSE"
24
+ ],
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/metacensus/library-api-public.git",
28
+ "directory": "ts"
29
+ },
30
+ "homepage": "https://github.com/metacensus/library-api-public#readme",
31
+ "bugs": {
32
+ "url": "https://github.com/metacensus/library-api-public/issues"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "scripts": {
38
+ "build": "rm -rf dist && tsc -p tsconfig.build.json",
39
+ "check": "tsc --noEmit && node scripts/check-entry-points.mjs",
40
+ "test": "npm run build && node --test \"test/**/*.test.mjs\"",
41
+ "prepack": "npm run build"
42
+ },
43
+ "dependencies": {},
44
+ "devDependencies": {
45
+ "ts-proto": "2.7.7",
46
+ "typescript": "7.0.2"
47
+ }
48
+ }