@proveanything/smartlinks 1.7.0 → 1.7.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/dist/api/tags.d.ts +160 -132
- package/dist/api/tags.js +206 -167
- package/dist/docs/API_SUMMARY.md +162 -143
- package/dist/docs/interactions.md +291 -0
- package/dist/docs/manifests.md +200 -0
- package/dist/docs/mpa.md +135 -0
- package/dist/docs/overview.md +372 -0
- package/dist/openapi.yaml +266 -145
- package/dist/types/appManifest.d.ts +7 -2
- package/dist/types/tags.d.ts +116 -113
- package/dist/types/tags.js +3 -2
- package/docs/API_SUMMARY.md +162 -143
- package/docs/interactions.md +291 -0
- package/docs/manifests.md +200 -0
- package/docs/mpa.md +135 -0
- package/docs/overview.md +372 -0
- package/openapi.yaml +266 -145
- package/package.json +1 -1
package/dist/types/tags.d.ts
CHANGED
|
@@ -1,37 +1,73 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tag Management Types
|
|
3
3
|
*
|
|
4
|
-
* Types for
|
|
5
|
-
*
|
|
4
|
+
* Types for the two-tier tag system:
|
|
5
|
+
* - Per-org shard (`tags` table) — full tag data, all collection-scoped queries
|
|
6
|
+
* - Shared shard (`tag_index` table) — tagId → collectionId routing only
|
|
6
7
|
*/
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* Full tag record, stored on the per-org shard.
|
|
10
|
+
* Returned by all collection-scoped endpoints.
|
|
9
11
|
*/
|
|
10
12
|
export interface Tag {
|
|
11
13
|
id: string;
|
|
12
14
|
orgId: string;
|
|
13
15
|
tagId: string;
|
|
14
16
|
collectionId: string;
|
|
15
|
-
productId
|
|
16
|
-
variantId
|
|
17
|
-
batchId
|
|
18
|
-
proofId
|
|
17
|
+
productId: string | null;
|
|
18
|
+
variantId: string | null;
|
|
19
|
+
batchId: string | null;
|
|
20
|
+
proofId: string | null;
|
|
19
21
|
/**
|
|
20
|
-
* Polymorphic
|
|
21
|
-
*
|
|
22
|
-
* Must always be paired with `refId`.
|
|
22
|
+
* Polymorphic ref type: `'app_record'`, `'app_case'`, `'app_thread'`, `'container'`, etc.
|
|
23
|
+
* Always paired with `refId`.
|
|
23
24
|
*/
|
|
24
|
-
refType
|
|
25
|
-
/** UUID of the referenced object.
|
|
26
|
-
refId
|
|
25
|
+
refType: string | null;
|
|
26
|
+
/** UUID of the referenced object. Always paired with `refType`. */
|
|
27
|
+
refId: string | null;
|
|
27
28
|
metadata: Record<string, any>;
|
|
28
29
|
createdAt: string;
|
|
29
30
|
updatedAt: string;
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
33
|
+
* Lightweight index entry returned by the global resolve endpoint only
|
|
34
|
+
* (`GET /public/tags/:tagId`).
|
|
35
|
+
*
|
|
36
|
+
* Use this when the collection is not yet known — it contains routing info
|
|
37
|
+
* only. Once `collectionId` is resolved, use the collection-scoped endpoints
|
|
38
|
+
* for full tag data.
|
|
39
|
+
*/
|
|
40
|
+
export interface TagIndexEntry {
|
|
41
|
+
tagId: string;
|
|
42
|
+
collectionId: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Deduplicated embedded objects attached to collection-scoped tag lookup
|
|
46
|
+
* responses. Which fields are populated depends on the `embed` parameter.
|
|
47
|
+
*
|
|
48
|
+
* Supported `embed` values: `'product'`, `'proof'`, `'container'`, `'ref'`
|
|
49
|
+
* (`embed=collection` is not supported on collection-scoped endpoints).
|
|
34
50
|
*/
|
|
51
|
+
export interface TagEmbedded {
|
|
52
|
+
/** `productId → Firestore product record` (when `embed` includes `'product'`) */
|
|
53
|
+
products?: Record<string, any>;
|
|
54
|
+
/**
|
|
55
|
+
* `proofId → proof record or virtual serial-number proof`
|
|
56
|
+
* (when `embed` includes `'proof'`)
|
|
57
|
+
*/
|
|
58
|
+
proofs?: Record<string, any>;
|
|
59
|
+
/**
|
|
60
|
+
* `containerId → Container row`
|
|
61
|
+
* (for tags where `refType === 'container'`, when `embed` includes `'container'`)
|
|
62
|
+
*/
|
|
63
|
+
containers?: Record<string, any>;
|
|
64
|
+
/**
|
|
65
|
+
* `refId → app_record | app_case | app_thread | container`
|
|
66
|
+
* (when `embed` includes `'ref'`)
|
|
67
|
+
*/
|
|
68
|
+
refs?: Record<string, any>;
|
|
69
|
+
}
|
|
70
|
+
/** Request body to create a single tag mapping. */
|
|
35
71
|
export interface CreateTagRequest {
|
|
36
72
|
tagId: string;
|
|
37
73
|
productId?: string;
|
|
@@ -39,41 +75,34 @@ export interface CreateTagRequest {
|
|
|
39
75
|
batchId?: string;
|
|
40
76
|
proofId?: string;
|
|
41
77
|
useSerialNumber?: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Polymorphic ref type linking this tag to any app object (e.g. `'app_record'`, `'container'`).
|
|
44
|
-
* Must be paired with `refId`. A tag can simultaneously have a product/proof AND a ref.
|
|
45
|
-
*/
|
|
46
78
|
refType?: string;
|
|
47
|
-
/** UUID of the referenced object. Must be paired with `refType`. */
|
|
48
79
|
refId?: string;
|
|
49
80
|
metadata?: Record<string, any>;
|
|
50
81
|
force?: boolean;
|
|
51
82
|
}
|
|
52
|
-
/**
|
|
53
|
-
|
|
54
|
-
|
|
83
|
+
/** Request body to batch-create tags. `force` applies to all entries in the batch. */
|
|
84
|
+
export interface BatchCreateTagRequest {
|
|
85
|
+
tags: Omit<CreateTagRequest, 'force'>[];
|
|
86
|
+
force?: boolean;
|
|
87
|
+
}
|
|
88
|
+
/** Partial update request — `metadata` is deep-merged with existing values. */
|
|
89
|
+
export interface UpdateTagRequest {
|
|
90
|
+
productId?: string;
|
|
91
|
+
variantId?: string;
|
|
92
|
+
batchId?: string;
|
|
93
|
+
proofId?: string;
|
|
94
|
+
/** Pass `null` to clear the polymorphic ref. Must be paired with `refId`. */
|
|
95
|
+
refType?: string | null;
|
|
96
|
+
/** Pass `null` to clear the polymorphic ref. Must be paired with `refType`. */
|
|
97
|
+
refId?: string | null;
|
|
98
|
+
metadata?: Record<string, any>;
|
|
99
|
+
}
|
|
100
|
+
/** Returned when creating a single tag (`wasUpdated: true` when force triggered an update). */
|
|
55
101
|
export interface CreateTagResponse extends Tag {
|
|
56
102
|
wasUpdated?: boolean;
|
|
57
103
|
}
|
|
58
|
-
/**
|
|
59
|
-
|
|
60
|
-
* By default, auto-generates serial numbers for all tags without explicit proofId.
|
|
61
|
-
*/
|
|
62
|
-
export interface CreateTagsBatchRequest {
|
|
63
|
-
tags: Array<{
|
|
64
|
-
tagId: string;
|
|
65
|
-
productId: string;
|
|
66
|
-
variantId?: string;
|
|
67
|
-
batchId?: string;
|
|
68
|
-
proofId?: string;
|
|
69
|
-
metadata?: Record<string, any>;
|
|
70
|
-
}>;
|
|
71
|
-
force?: boolean;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Response from batch creating tags.
|
|
75
|
-
*/
|
|
76
|
-
export interface CreateTagsBatchResponse {
|
|
104
|
+
/** Result of a batch tag creation. Partial success is possible. */
|
|
105
|
+
export interface BatchCreateResult {
|
|
77
106
|
summary: {
|
|
78
107
|
total: number;
|
|
79
108
|
created: number;
|
|
@@ -88,7 +117,6 @@ export interface CreateTagsBatchResponse {
|
|
|
88
117
|
tagId: string;
|
|
89
118
|
reason: string;
|
|
90
119
|
message: string;
|
|
91
|
-
existingTag?: Tag;
|
|
92
120
|
}>;
|
|
93
121
|
conflicts: Array<{
|
|
94
122
|
tagId: string;
|
|
@@ -98,119 +126,94 @@ export interface CreateTagsBatchResponse {
|
|
|
98
126
|
}>;
|
|
99
127
|
};
|
|
100
128
|
}
|
|
101
|
-
/**
|
|
102
|
-
* Request to update an existing tag mapping.
|
|
103
|
-
*/
|
|
104
|
-
export interface UpdateTagRequest {
|
|
105
|
-
productId?: string;
|
|
106
|
-
variantId?: string | null;
|
|
107
|
-
batchId?: string | null;
|
|
108
|
-
proofId?: string;
|
|
109
|
-
/**
|
|
110
|
-
* Polymorphic ref type. Must be paired with `refId`.
|
|
111
|
-
* Set both to `null` / omit to leave unchanged.
|
|
112
|
-
*/
|
|
113
|
-
refType?: string;
|
|
114
|
-
/** UUID of the referenced object. Must be paired with `refType`. */
|
|
115
|
-
refId?: string;
|
|
116
|
-
metadata?: Record<string, any>;
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Response from updating a tag.
|
|
120
|
-
*/
|
|
121
129
|
export interface UpdateTagResponse extends Tag {
|
|
122
130
|
}
|
|
123
|
-
/**
|
|
124
|
-
* Response from deleting a tag.
|
|
125
|
-
*/
|
|
126
131
|
export interface DeleteTagResponse {
|
|
127
132
|
success: boolean;
|
|
128
133
|
}
|
|
129
|
-
/**
|
|
130
|
-
* Response from getting a single tag.
|
|
131
|
-
*/
|
|
132
134
|
export interface GetTagResponse extends Tag {
|
|
133
135
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Request parameters for listing tags.
|
|
136
|
-
*/
|
|
137
136
|
export interface ListTagsRequest {
|
|
138
137
|
limit?: number;
|
|
139
138
|
offset?: number;
|
|
140
139
|
productId?: string;
|
|
141
140
|
variantId?: string;
|
|
142
141
|
batchId?: string;
|
|
143
|
-
/**
|
|
142
|
+
/** Filter by polymorphic ref type (e.g. `'container'`, `'app_record'`) */
|
|
144
143
|
refType?: string;
|
|
145
|
-
/**
|
|
144
|
+
/** Filter by polymorphic ref UUID */
|
|
146
145
|
refId?: string;
|
|
147
146
|
}
|
|
148
|
-
/**
|
|
149
|
-
* Response from listing tags.
|
|
150
|
-
*/
|
|
151
147
|
export interface ListTagsResponse {
|
|
152
148
|
tags: Tag[];
|
|
153
149
|
limit: number;
|
|
154
150
|
offset: number;
|
|
155
151
|
}
|
|
156
152
|
/**
|
|
157
|
-
* Request
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
embed?: string;
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* Response from public tag lookup with optional embedded data.
|
|
164
|
-
*/
|
|
165
|
-
export interface PublicGetTagResponse {
|
|
166
|
-
tag: Tag;
|
|
167
|
-
collection?: any;
|
|
168
|
-
product?: any;
|
|
169
|
-
proof?: any;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Request to lookup multiple tags in a single request.
|
|
153
|
+
* Request body / params for the collection-scoped batch lookup.
|
|
154
|
+
*
|
|
155
|
+
* `embed` — comma-separated: `'product'`, `'proof'`, `'container'`, `'ref'`
|
|
173
156
|
*/
|
|
174
|
-
export interface
|
|
157
|
+
export interface LookupTagsRequest {
|
|
175
158
|
tagIds: string[];
|
|
176
159
|
embed?: string;
|
|
177
160
|
}
|
|
178
161
|
/**
|
|
179
|
-
*
|
|
162
|
+
* Query-string variant of {@link LookupTagsRequest} for GET requests.
|
|
163
|
+
* `tagIds` is a comma-separated string.
|
|
180
164
|
*/
|
|
181
|
-
export interface
|
|
182
|
-
tags: Record<string, Tag>;
|
|
183
|
-
collections?: Record<string, any>;
|
|
184
|
-
products?: Record<string, any>;
|
|
185
|
-
proofs?: Record<string, any>;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Query parameters for public batch lookup (GET).
|
|
189
|
-
*/
|
|
190
|
-
export interface PublicBatchLookupQueryRequest {
|
|
165
|
+
export interface LookupTagsQueryRequest {
|
|
191
166
|
tagIds: string;
|
|
192
167
|
embed?: string;
|
|
193
168
|
}
|
|
194
169
|
/**
|
|
195
|
-
*
|
|
170
|
+
* POST body for the collection-scoped public by-ref lookup.
|
|
171
|
+
* `embed` — comma-separated: `'product'`, `'proof'`, `'container'`, `'ref'`
|
|
196
172
|
*/
|
|
197
|
-
export interface
|
|
173
|
+
export interface ByRefRequest {
|
|
174
|
+
refType: string;
|
|
175
|
+
refId: string;
|
|
176
|
+
embed?: string;
|
|
198
177
|
}
|
|
199
178
|
/**
|
|
200
|
-
* Query parameters for
|
|
201
|
-
* Finds all tags linked to a given app object across any collection.
|
|
179
|
+
* Query parameters for admin and public GET by-ref requests.
|
|
202
180
|
*/
|
|
203
181
|
export interface ReverseTagLookupParams {
|
|
204
|
-
/** Required — polymorphic ref type
|
|
182
|
+
/** Required — polymorphic ref type */
|
|
205
183
|
refType: string;
|
|
206
184
|
/** Required — UUID of the referenced object */
|
|
207
185
|
refId: string;
|
|
186
|
+
/** Optional embed string (public endpoint only) */
|
|
187
|
+
embed?: string;
|
|
208
188
|
}
|
|
209
189
|
/**
|
|
210
|
-
* Response from the
|
|
211
|
-
*
|
|
212
|
-
* which collection the object belongs to.
|
|
190
|
+
* Response from the collection-scoped single-tag public endpoint.
|
|
191
|
+
* `GET /public/collection/:collectionId/tags/:tagId?embed=product,proof,ref`
|
|
213
192
|
*/
|
|
193
|
+
export interface PublicGetTagResponse {
|
|
194
|
+
tag: Tag;
|
|
195
|
+
embedded: TagEmbedded;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Response from the collection-scoped batch lookup endpoints.
|
|
199
|
+
* `POST /public/collection/:collectionId/tags/lookup`
|
|
200
|
+
* `GET /public/collection/:collectionId/tags/lookup?tagIds=...`
|
|
201
|
+
*/
|
|
202
|
+
export interface TagLookupResponse {
|
|
203
|
+
count: number;
|
|
204
|
+
tags: Tag[];
|
|
205
|
+
embedded: TagEmbedded;
|
|
206
|
+
}
|
|
207
|
+
/** Response from the admin by-ref endpoint (no embed support on admin side). */
|
|
214
208
|
export interface ReverseTagLookupResponse {
|
|
215
209
|
tags: Tag[];
|
|
216
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Response from the public by-ref endpoints (supports `embed`).
|
|
213
|
+
* `GET /public/collection/:collectionId/tags/by-ref?refType=&refId=&embed=`
|
|
214
|
+
* `POST /public/collection/:collectionId/tags/by-ref`
|
|
215
|
+
*/
|
|
216
|
+
export interface ByRefResponse {
|
|
217
|
+
tags: Tag[];
|
|
218
|
+
embedded: TagEmbedded;
|
|
219
|
+
}
|
package/dist/types/tags.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tag Management Types
|
|
3
3
|
*
|
|
4
|
-
* Types for
|
|
5
|
-
*
|
|
4
|
+
* Types for the two-tier tag system:
|
|
5
|
+
* - Per-org shard (`tags` table) — full tag data, all collection-scoped queries
|
|
6
|
+
* - Shared shard (`tag_index` table) — tagId → collectionId routing only
|
|
6
7
|
*/
|
|
7
8
|
export {};
|