@proveanything/smartlinks 2.0.55 → 2.0.56
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/realtime.d.ts +31 -88
- package/dist/api/realtime.js +239 -93
- package/dist/docs/API_SUMMARY.md +66 -3
- package/dist/docs/overview.md +2 -2
- package/dist/docs/realtime.md +118 -765
- package/dist/http.js +3 -0
- package/dist/openapi.yaml +105 -2
- package/dist/types/appManifest.d.ts +11 -0
- package/dist/types/realtime.d.ts +44 -0
- package/docs/API_SUMMARY.md +66 -3
- package/docs/overview.md +2 -2
- package/docs/realtime.md +118 -765
- package/openapi.yaml +105 -2
- package/package.json +1 -1
- package/scripts/doctor.mjs +25 -0
package/openapi.yaml
CHANGED
|
@@ -123,7 +123,7 @@ paths:
|
|
|
123
123
|
get:
|
|
124
124
|
tags:
|
|
125
125
|
- realtime
|
|
126
|
-
summary:
|
|
126
|
+
summary: (subscribe only).
|
|
127
127
|
operationId: realtime_getAdminToken
|
|
128
128
|
security:
|
|
129
129
|
- bearerAuth: []
|
|
@@ -13960,7 +13960,7 @@ paths:
|
|
|
13960
13960
|
get:
|
|
13961
13961
|
tags:
|
|
13962
13962
|
- realtime
|
|
13963
|
-
summary:
|
|
13963
|
+
summary: "`collection:{collectionId}:*` (subscribe; publish only for the collection's admins)."
|
|
13964
13964
|
operationId: realtime_getPublicToken
|
|
13965
13965
|
security: []
|
|
13966
13966
|
parameters:
|
|
@@ -14018,6 +14018,33 @@ paths:
|
|
|
14018
14018
|
description: Unauthorized
|
|
14019
14019
|
404:
|
|
14020
14020
|
description: Not found
|
|
14021
|
+
/public/realtime/publish:
|
|
14022
|
+
post:
|
|
14023
|
+
tags:
|
|
14024
|
+
- realtime
|
|
14025
|
+
summary: "One of your app's declared channels (manifest `realtime.channels`)."
|
|
14026
|
+
operationId: realtime_channel
|
|
14027
|
+
security: []
|
|
14028
|
+
responses:
|
|
14029
|
+
200:
|
|
14030
|
+
description: Success
|
|
14031
|
+
content:
|
|
14032
|
+
application/json:
|
|
14033
|
+
schema:
|
|
14034
|
+
type: object
|
|
14035
|
+
additionalProperties: true
|
|
14036
|
+
400:
|
|
14037
|
+
description: Bad request
|
|
14038
|
+
401:
|
|
14039
|
+
description: Unauthorized
|
|
14040
|
+
404:
|
|
14041
|
+
description: Not found
|
|
14042
|
+
requestBody:
|
|
14043
|
+
required: true
|
|
14044
|
+
content:
|
|
14045
|
+
application/json:
|
|
14046
|
+
schema:
|
|
14047
|
+
$ref: "#/components/schemas/RealtimeScope"
|
|
14021
14048
|
/public/tags/{tagId}:
|
|
14022
14049
|
get:
|
|
14023
14050
|
tags:
|
|
@@ -19618,6 +19645,9 @@ components:
|
|
|
19618
19645
|
$ref: "#/components/schemas/AppManifestExecutor"
|
|
19619
19646
|
functions:
|
|
19620
19647
|
$ref: "#/components/schemas/AppManifestFunctions"
|
|
19648
|
+
realtime:
|
|
19649
|
+
type: object
|
|
19650
|
+
additionalProperties: true
|
|
19621
19651
|
data:
|
|
19622
19652
|
$ref: "#/components/schemas/AppDataDeclaration"
|
|
19623
19653
|
headless:
|
|
@@ -29830,6 +29860,79 @@ components:
|
|
|
29830
29860
|
- nonce
|
|
29831
29861
|
- mac
|
|
29832
29862
|
- clientId
|
|
29863
|
+
RealtimeScope:
|
|
29864
|
+
type: object
|
|
29865
|
+
properties:
|
|
29866
|
+
collectionId:
|
|
29867
|
+
type: string
|
|
29868
|
+
appId:
|
|
29869
|
+
type: string
|
|
29870
|
+
required:
|
|
29871
|
+
- collectionId
|
|
29872
|
+
RealtimeMessage:
|
|
29873
|
+
type: object
|
|
29874
|
+
properties:
|
|
29875
|
+
channel:
|
|
29876
|
+
type: string
|
|
29877
|
+
event:
|
|
29878
|
+
type: string
|
|
29879
|
+
data: {}
|
|
29880
|
+
at:
|
|
29881
|
+
type: number
|
|
29882
|
+
required:
|
|
29883
|
+
- channel
|
|
29884
|
+
- event
|
|
29885
|
+
- data
|
|
29886
|
+
RealtimeChangeEvent:
|
|
29887
|
+
type: object
|
|
29888
|
+
properties:
|
|
29889
|
+
type:
|
|
29890
|
+
type: string
|
|
29891
|
+
id:
|
|
29892
|
+
type: string
|
|
29893
|
+
appId:
|
|
29894
|
+
type: string
|
|
29895
|
+
recordType:
|
|
29896
|
+
type: string
|
|
29897
|
+
productId:
|
|
29898
|
+
type: string
|
|
29899
|
+
proofId:
|
|
29900
|
+
type: string
|
|
29901
|
+
status:
|
|
29902
|
+
type: string
|
|
29903
|
+
at:
|
|
29904
|
+
type: number
|
|
29905
|
+
required:
|
|
29906
|
+
- type
|
|
29907
|
+
- at
|
|
29908
|
+
RealtimeChangeFilter:
|
|
29909
|
+
type: object
|
|
29910
|
+
properties:
|
|
29911
|
+
type:
|
|
29912
|
+
type: string
|
|
29913
|
+
id:
|
|
29914
|
+
type: string
|
|
29915
|
+
appId:
|
|
29916
|
+
type: string
|
|
29917
|
+
recordType:
|
|
29918
|
+
type: string
|
|
29919
|
+
productId:
|
|
29920
|
+
type: string
|
|
29921
|
+
proofId:
|
|
29922
|
+
type: string
|
|
29923
|
+
RealtimeChannelDeclaration:
|
|
29924
|
+
type: object
|
|
29925
|
+
properties:
|
|
29926
|
+
name:
|
|
29927
|
+
type: string
|
|
29928
|
+
subscribe:
|
|
29929
|
+
type: object
|
|
29930
|
+
additionalProperties: true
|
|
29931
|
+
publish:
|
|
29932
|
+
type: object
|
|
29933
|
+
additionalProperties: true
|
|
29934
|
+
required:
|
|
29935
|
+
- name
|
|
29833
29936
|
RealtimeChannelPattern:
|
|
29834
29937
|
type: string
|
|
29835
29938
|
ResearchFetchRequest:
|
package/package.json
CHANGED
package/scripts/doctor.mjs
CHANGED
|
@@ -313,6 +313,31 @@ if (meta.respectsHostTheme) {
|
|
|
313
313
|
if (embeds && !handRolled.length && !blocked.size) console.log(`${GREEN}✓${RESET} embedded widgets ${DIM}— ${embeds} via the host's EmbeddedWidget${RESET}`);
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
// ---- realtime: SL.realtime, never a provider library or key in the app ---------------------------
|
|
317
|
+
// SmartLinks Realtime (docs/realtime.md) hands out the stream and checks every publish; an app that talks
|
|
318
|
+
// to the provider directly bypasses the channel rules (and a provider key in a bundle is a key for all).
|
|
319
|
+
{
|
|
320
|
+
const EXT = /\.(tsx|ts|jsx|js)$/;
|
|
321
|
+
const SKIP = new Set(['node_modules', 'dist', '.git', 'public']);
|
|
322
|
+
const hitsRt = [];
|
|
323
|
+
(function walkRt(dir) {
|
|
324
|
+
let entries = [];
|
|
325
|
+
try { entries = readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
326
|
+
for (const e of entries) {
|
|
327
|
+
if (e.isDirectory()) { if (!SKIP.has(e.name)) walkRt(join(dir, e.name)); }
|
|
328
|
+
else if (EXT.test(e.name)) {
|
|
329
|
+
const f = join(dir, e.name);
|
|
330
|
+
const text = readFileSync(f, 'utf8');
|
|
331
|
+
if (/from\s+['"]ably(\/[^'"]*)?['"]|require\(\s*['"]ably['"]\s*\)|ABLY_(API_)?KEY/.test(text)) hitsRt.push(f.startsWith(appDir) ? f.slice(appDir.length + 1) : f);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
})(existsSync(join(appDir, 'src')) ? join(appDir, 'src') : appDir);
|
|
335
|
+
if (hitsRt.length) {
|
|
336
|
+
console.log(`${YELLOW}⚠${RESET} realtime — talks to the realtime provider directly in ${hitsRt.slice(0, 3).join(', ')}`);
|
|
337
|
+
warnings.push(`${hitsRt.join(', ')} use${hitsRt.length === 1 ? 's' : ''} the realtime provider (Ably) directly. Use SL.realtime instead — declare channels in the manifest (realtime.channels) and use realtime.channel() / onChange() (docs/realtime.md); never put a provider key in an app.`);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
|
|
316
341
|
// ---- package.json scripts point at files that exist ------------------------------------------
|
|
317
342
|
// An upgrade that copies a script LINE but not the script FILE breaks every build at that step
|
|
318
343
|
// (e.g. `postbuild: node scripts/smartlinks-deploy.mjs` with no scripts/smartlinks-deploy.mjs).
|