@canonical/design-system 0.1.1 → 0.1.2
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/.github/PULL_REQUEST_TEMPLATE.md +13 -0
- package/.github/workflows/ci.yml +39 -0
- package/.mcp.json +1 -3
- package/biome.json +1 -1
- package/bun.lock +38 -35
- package/data/apps_launchpad/component/badge.ttl +2 -1
- package/data/apps_launchpad/component/button.ttl +2 -1
- package/data/apps_launchpad/component/combobox.ttl +2 -1
- package/data/apps_launchpad/component/text_input.ttl +2 -1
- package/data/apps_launchpad/component/tooltip.ttl +2 -1
- package/data/global/component/announcement.ttl +1 -1
- package/data/global/component/button.ttl +3 -1
- package/data/global/component/code_snippet.ttl +1 -1
- package/data/global/component/heading.ttl +3 -2
- package/data/global/component/tile.ttl +1 -1
- package/data/global/component/tooltip.ttl +38 -19
- package/data/global/pattern/dropdown_button.ttl +1 -1
- package/data/global/pattern/timeline.ttl +8 -4
- package/definitions/ontology.ttl +108 -161
- package/package.json +1 -1
- package/skills/anatomy-author/SKILL.md +5 -0
- package/skills/component-specifier/SKILL.md +5 -2
- package/skills/design-auditor/SKILL.md +5 -0
- package/source.json +7 -2
- package/src/cli.ts +33 -33
- package/src/collect/generateTurtle.tests.ts +181 -176
- package/src/collect/generateTurtle.ts +189 -138
- package/src/collect/index.ts +5 -2
- package/src/collect/scanAnnotations.tests.ts +116 -110
- package/src/collect/scanAnnotations.ts +35 -33
- package/src/collect/types.ts +34 -33
- package/src/collect/validateCollectConfig.tests.ts +135 -112
- package/src/collect/validateCollectConfig.ts +60 -54
- package/src/collect-implementations.ts +101 -88
- package/src/commands/extract.tests.ts +31 -32
- package/src/commands/extract.ts +29 -27
- package/src/commands/index.ts +1 -1
- package/src/commands/list.tests.ts +13 -14
- package/src/commands/list.ts +9 -9
- package/src/commands/transform.tests.ts +21 -21
- package/src/commands/transform.ts +118 -114
- package/src/config/types.ts +40 -40
- package/src/config/validateConfig.tests.ts +31 -31
- package/src/config/validateConfig.ts +9 -9
- package/src/constants.ts +7 -8
- package/src/graph/GraphStore.tests.ts +111 -111
- package/src/graph/GraphStore.ts +205 -189
- package/src/graph/PrefixMap.tests.ts +124 -122
- package/src/graph/PrefixMap.ts +77 -77
- package/src/graph/buildUri.tests.ts +116 -116
- package/src/graph/buildUri.ts +45 -45
- package/src/graph/index.ts +2 -2
- package/src/graph/types.ts +3 -3
- package/src/providers/CodaProvider.tests.ts +233 -233
- package/src/providers/CodaProvider.ts +145 -145
- package/src/providers/CodaProvider.types.generated.ts +12484 -12123
- package/src/providers/index.ts +13 -13
- package/src/serializers/JSONSerializer.tests.ts +64 -64
- package/src/serializers/JSONSerializer.ts +51 -51
- package/src/serializers/TTLSerializer.tests.ts +45 -45
- package/src/serializers/TTLSerializer.ts +64 -57
- package/src/serializers/index.ts +4 -1
- package/src/serializers/types.ts +3 -3
- package/src/transform/resolveReferences.tests.ts +47 -43
- package/src/transform/resolveReferences.ts +18 -18
- package/src/transform/resolveValue.tests.ts +55 -49
- package/src/transform/resolveValue.ts +48 -48
- package/src/transform/transform.tests.ts +90 -77
- package/src/transform/transform.ts +77 -77
- package/src/transform/transformRow.tests.ts +372 -356
- package/src/transform/transformRow.ts +222 -191
- package/src/transform/types.ts +4 -4
- package/tsconfig.json +2 -1
- package/.gemini/settings.json +0 -14
|
@@ -14,161 +14,161 @@ export type CodaCellValue = components["schemas"]["CellValue"];
|
|
|
14
14
|
|
|
15
15
|
// Simplified types for this provider's API
|
|
16
16
|
export interface TableMetadata {
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export interface ColumnMetadata {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
type: string;
|
|
25
|
+
format: components["schemas"]["ColumnFormat"];
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export interface TableRow {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
_codaId: string;
|
|
30
|
+
[key: string]: unknown;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Coda API client for fetching document tables and data
|
|
35
35
|
*/
|
|
36
36
|
export default class CodaProvider {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
37
|
+
private apiKey: string;
|
|
38
|
+
|
|
39
|
+
constructor() {
|
|
40
|
+
const apiKey = process.env.CODA_API_KEY;
|
|
41
|
+
if (!apiKey) {
|
|
42
|
+
throw new Error("CODA_API_KEY environment variable is required");
|
|
43
|
+
}
|
|
44
|
+
this.apiKey = apiKey;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
private get headers(): Record<string, string> {
|
|
48
|
+
return {
|
|
49
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
50
|
+
"Content-Type": "application/json",
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
private async fetchWithAuth<T>(url: string): Promise<T> {
|
|
55
|
+
const response = await fetch(url, {
|
|
56
|
+
method: "GET",
|
|
57
|
+
headers: this.headers,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
`Coda API error: ${response.status} ${response.statusText}`,
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return response.json() as Promise<T>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* List all tables in a document
|
|
71
|
+
*
|
|
72
|
+
* @see https://coda.io/developers/apis/v1#tag/Tables/operation/listTables
|
|
73
|
+
*/
|
|
74
|
+
async listTables(documentId: string): Promise<TableMetadata[]> {
|
|
75
|
+
const tables: TableMetadata[] = [];
|
|
76
|
+
let pageToken: string | undefined;
|
|
77
|
+
|
|
78
|
+
do {
|
|
79
|
+
const url = new URL(`${CODA_API_BASE}/docs/${documentId}/tables`);
|
|
80
|
+
if (pageToken) {
|
|
81
|
+
url.searchParams.set("pageToken", pageToken);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const response = await this.fetchWithAuth<CodaTableList>(url.toString());
|
|
85
|
+
|
|
86
|
+
for (const table of response.items) {
|
|
87
|
+
tables.push({
|
|
88
|
+
id: table.id,
|
|
89
|
+
name: table.name,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
pageToken = response.nextPageToken;
|
|
94
|
+
} while (pageToken);
|
|
95
|
+
|
|
96
|
+
return tables;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Fetch all rows from a table
|
|
101
|
+
*
|
|
102
|
+
* @see https://coda.io/developers/apis/v1#tag/Rows/operation/listRows
|
|
103
|
+
*/
|
|
104
|
+
async fetchTable(documentId: string, tableId: string): Promise<TableRow[]> {
|
|
105
|
+
const rows: TableRow[] = [];
|
|
106
|
+
let pageToken: string | undefined;
|
|
107
|
+
|
|
108
|
+
do {
|
|
109
|
+
const url = new URL(
|
|
110
|
+
`${CODA_API_BASE}/docs/${documentId}/tables/${tableId}/rows`,
|
|
111
|
+
);
|
|
112
|
+
url.searchParams.set("useColumnNames", "true");
|
|
113
|
+
if (pageToken) {
|
|
114
|
+
url.searchParams.set("pageToken", pageToken);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const response = await this.fetchWithAuth<CodaRowList>(url.toString());
|
|
118
|
+
|
|
119
|
+
for (const row of response.items) {
|
|
120
|
+
const normalizedRow: TableRow = { _codaId: row.id };
|
|
121
|
+
|
|
122
|
+
for (const [key, value] of Object.entries(row.values)) {
|
|
123
|
+
// Coda API prefixes column names with "c-" when using useColumnNames=true.
|
|
124
|
+
// Strip this prefix to get clean column names matching the display names.
|
|
125
|
+
const normalizedKey = key.startsWith("c-") ? key.slice(2) : key;
|
|
126
|
+
normalizedRow[normalizedKey] = value;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
rows.push(normalizedRow);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
pageToken = response.nextPageToken;
|
|
133
|
+
} while (pageToken);
|
|
134
|
+
|
|
135
|
+
return rows;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Fetch column metadata for a table
|
|
140
|
+
*
|
|
141
|
+
* @see https://coda.io/developers/apis/v1#tag/Columns/operation/listColumns
|
|
142
|
+
*/
|
|
143
|
+
async fetchTableColumns(
|
|
144
|
+
documentId: string,
|
|
145
|
+
tableId: string,
|
|
146
|
+
): Promise<ColumnMetadata[]> {
|
|
147
|
+
const columns: ColumnMetadata[] = [];
|
|
148
|
+
let pageToken: string | undefined;
|
|
149
|
+
|
|
150
|
+
do {
|
|
151
|
+
const url = new URL(
|
|
152
|
+
`${CODA_API_BASE}/docs/${documentId}/tables/${tableId}/columns`,
|
|
153
|
+
);
|
|
154
|
+
if (pageToken) {
|
|
155
|
+
url.searchParams.set("pageToken", pageToken);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const response = await this.fetchWithAuth<CodaColumnList>(url.toString());
|
|
159
|
+
|
|
160
|
+
for (const col of response.items) {
|
|
161
|
+
columns.push({
|
|
162
|
+
id: col.id,
|
|
163
|
+
name: col.name,
|
|
164
|
+
type: col.format.type,
|
|
165
|
+
format: col.format,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
pageToken = response.nextPageToken;
|
|
170
|
+
} while (pageToken);
|
|
171
|
+
|
|
172
|
+
return columns;
|
|
173
|
+
}
|
|
174
174
|
}
|