@arcblock/did-connect-service 4.0.6 → 4.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.
Files changed (97) hide show
  1. package/dist/_generated/asset-bytes.d.ts +3 -0
  2. package/dist/_generated/asset-bytes.d.ts.map +1 -0
  3. package/dist/_generated/asset-bytes.js +2 -0
  4. package/dist/_generated/asset-bytes.js.map +1 -0
  5. package/dist/_generated/asset-manifest.d.ts +3 -0
  6. package/dist/_generated/asset-manifest.d.ts.map +1 -0
  7. package/dist/_generated/asset-manifest.js +12 -0
  8. package/dist/_generated/asset-manifest.js.map +1 -0
  9. package/dist/asset-registry.d.ts +38 -0
  10. package/dist/asset-registry.d.ts.map +1 -0
  11. package/dist/asset-registry.js +73 -0
  12. package/dist/asset-registry.js.map +1 -0
  13. package/dist/assets/admin-core.c0b5af61.js +1393 -0
  14. package/dist/assets/admin-extra.7ca9c16b.js +2529 -0
  15. package/dist/assets/admin.c26bb17a.css +2219 -0
  16. package/dist/assets/design.99dc4ddc.css +97 -0
  17. package/dist/assets/did-address.7df30f28.js +51 -0
  18. package/dist/assets/header.94d9e46b.js +136 -0
  19. package/dist/assets/login.7b12c6dc.css +662 -0
  20. package/dist/assets/login.d3f05790.js +720 -0
  21. package/dist/assets/qr.c0d203ca.js +3 -0
  22. package/dist/blocklet-service.d.ts +7 -32
  23. package/dist/blocklet-service.d.ts.map +1 -1
  24. package/dist/blocklet-service.js +43 -37
  25. package/dist/blocklet-service.js.map +1 -1
  26. package/dist/env-config.d.ts +86 -0
  27. package/dist/env-config.d.ts.map +1 -0
  28. package/dist/env-config.js +33 -0
  29. package/dist/env-config.js.map +1 -0
  30. package/dist/handlers/auth-handler.d.ts +1 -1
  31. package/dist/handlers/auth-handler.d.ts.map +1 -1
  32. package/dist/handlers/auth-handler.js +11 -11
  33. package/dist/handlers/auth-handler.js.map +1 -1
  34. package/dist/handlers/branding-handler.d.ts.map +1 -1
  35. package/dist/handlers/branding-handler.js +3 -2
  36. package/dist/handlers/branding-handler.js.map +1 -1
  37. package/dist/index.d.ts +1 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/og/generator.d.ts.map +1 -1
  42. package/dist/og/generator.js +8 -2
  43. package/dist/og/generator.js.map +1 -1
  44. package/dist/og/index.d.ts +2 -0
  45. package/dist/og/index.d.ts.map +1 -1
  46. package/dist/og/index.js +1 -0
  47. package/dist/og/index.js.map +1 -1
  48. package/dist/og/node-config.d.ts +23 -0
  49. package/dist/og/node-config.d.ts.map +1 -0
  50. package/dist/og/node-config.js +22 -0
  51. package/dist/og/node-config.js.map +1 -0
  52. package/dist/og/types.d.ts +10 -5
  53. package/dist/og/types.d.ts.map +1 -1
  54. package/dist/og/types.js.map +1 -1
  55. package/dist/pages/admin/index.d.ts.map +1 -1
  56. package/dist/pages/admin/index.js +25 -41
  57. package/dist/pages/admin/index.js.map +1 -1
  58. package/dist/pages/admin/tab-access.d.ts +1 -1
  59. package/dist/pages/admin/tab-access.d.ts.map +1 -1
  60. package/dist/pages/admin/tab-access.js +5 -2
  61. package/dist/pages/admin/tab-access.js.map +1 -1
  62. package/dist/pages/admin/tab-appearance.d.ts +1 -1
  63. package/dist/pages/admin/tab-appearance.d.ts.map +1 -1
  64. package/dist/pages/admin/tab-appearance.js +4 -2
  65. package/dist/pages/admin/tab-appearance.js.map +1 -1
  66. package/dist/pages/admin/tab-branding.d.ts.map +1 -1
  67. package/dist/pages/admin/tab-branding.js +4 -2
  68. package/dist/pages/admin/tab-branding.js.map +1 -1
  69. package/dist/pages/admin/tab-profile-accounts.d.ts.map +1 -1
  70. package/dist/pages/admin/tab-profile-accounts.js +4 -2
  71. package/dist/pages/admin/tab-profile-accounts.js.map +1 -1
  72. package/dist/pages/admin/tab-settings.d.ts.map +1 -1
  73. package/dist/pages/admin/tab-settings.js +4 -2
  74. package/dist/pages/admin/tab-settings.js.map +1 -1
  75. package/dist/pages/admin-instances-page.d.ts.map +1 -1
  76. package/dist/pages/admin-instances-page.js +4 -6
  77. package/dist/pages/admin-instances-page.js.map +1 -1
  78. package/dist/pages/error-page.d.ts.map +1 -1
  79. package/dist/pages/error-page.js +3 -2
  80. package/dist/pages/error-page.js.map +1 -1
  81. package/dist/pages/gen-access-key-page.d.ts.map +1 -1
  82. package/dist/pages/gen-access-key-page.js +3 -4
  83. package/dist/pages/gen-access-key-page.js.map +1 -1
  84. package/dist/pages/homepage.d.ts.map +1 -1
  85. package/dist/pages/homepage.js +4 -3
  86. package/dist/pages/homepage.js.map +1 -1
  87. package/dist/pages/invite-page.d.ts.map +1 -1
  88. package/dist/pages/invite-page.js +4 -4
  89. package/dist/pages/invite-page.js.map +1 -1
  90. package/dist/pages/login-page.d.ts.map +1 -1
  91. package/dist/pages/login-page.js +3 -4
  92. package/dist/pages/login-page.js.map +1 -1
  93. package/package.json +6 -4
  94. package/dist/identity/csrf.d.ts +0 -17
  95. package/dist/identity/csrf.d.ts.map +0 -1
  96. package/dist/identity/csrf.js +0 -56
  97. package/dist/identity/csrf.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-bytes.js","sourceRoot":"","sources":["../../src/_generated/asset-bytes.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,6DAA6D;AAC7D,MAAM,KAAK,GAA2B,EAAE,CAAC;AACzC,eAAe,KAAK,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const manifest: Record<string, string>;
2
+ export default manifest;
3
+ //# sourceMappingURL=asset-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-manifest.d.ts","sourceRoot":"","sources":["../../src/_generated/asset-manifest.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,12 @@
1
+ // AUTO-GENERATED by build-assets.mjs — do not edit
2
+ export default {
3
+ "login.js": "login.d3f05790.js",
4
+ "qr.js": "qr.c0d203ca.js",
5
+ "did-address.js": "did-address.7df30f28.js",
6
+ "header.js": "header.94d9e46b.js",
7
+ "login.css": "login.7b12c6dc.css",
8
+ "design.css": "design.99dc4ddc.css",
9
+ "admin.css": "admin.c26bb17a.css",
10
+ "admin-core.js": "admin-core.c0b5af61.js",
11
+ "admin-extra.js": "admin-extra.7ca9c16b.js"
12
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-manifest.js","sourceRoot":"","sources":["../../src/_generated/asset-manifest.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,+EAA+E;AAC/E,MAAM,QAAQ,GAA2B,EAAE,CAAC;AAC5C,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Static browser-asset registry — content-hashed URLs + optional self-serve.
3
+ *
4
+ * In ALL runtimes the rendered HTML references assets by URL ({@link assetUrl}),
5
+ * so the browser caches them (`immutable`) instead of re-receiving inlined copies
6
+ * on every page load. Two byte-serving modes, selected at *build time*:
7
+ *
8
+ * - default — **self-serve**: connect-service serves the bytes itself from
9
+ * `_generated/asset-bytes.js` via {@link serveAsset}. Zero host config; used
10
+ * by the Node runtime and any host without a static-asset layer.
11
+ *
12
+ * - external — **host-serve**: the host serves the bytes (e.g. Cloudflare's
13
+ * `[assets]` binding, before the worker runs). The host build does two things:
14
+ * 1. `define __CONNECT_EXTERNAL_ASSETS__ = true` → {@link serveAsset} no-ops.
15
+ * 2. stub `_generated/asset-bytes.js` → `export default {}` in its bundler.
16
+ * Step 2 is what actually removes the heavy asset strings from the worker
17
+ * bundle — esbuild will NOT dead-code-eliminate the bytes module on its own
18
+ * (the import symbol is still syntactically referenced), so the host must
19
+ * stub it. All externalizable bytes funnel through this single module, so
20
+ * stubbing one file drops them all.
21
+ */
22
+ export declare const EXTERNAL_ASSETS: boolean;
23
+ /** Public mount path for connect-service assets (under the fixed service prefix). */
24
+ export declare const ASSET_BASE_PATH = "/.well-known/service/assets";
25
+ /**
26
+ * Resolve a logical asset key (e.g. "login.js") to its content-hashed public URL
27
+ * (e.g. "/.well-known/service/assets/login.a1b2c3d4.js"). Falls back to the key
28
+ * itself if the manifest has no entry (keeps dev/un-built paths working).
29
+ */
30
+ export declare function assetUrl(key: string, base?: string): string;
31
+ /**
32
+ * Self-serve an asset by its public path. Returns null when the request is not
33
+ * an asset request, when the asset is unknown, or when running in external mode
34
+ * (host serves the bytes). The dynamic import below is unreachable in external
35
+ * mode and is dropped from the bundle by dead-code elimination.
36
+ */
37
+ export declare function serveAsset(request: Request, base?: string): Promise<Response | null>;
38
+ //# sourceMappingURL=asset-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-registry.d.ts","sourceRoot":"","sources":["../src/asset-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAOH,eAAO,MAAM,eAAe,EAAE,OAC8D,CAAC;AAE7F,qFAAqF;AACrF,eAAO,MAAM,eAAe,gCAAgC,CAAC;AAI7D;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,MAAwB,GAAG,MAAM,CAE5E;AAOD;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,GAAE,MAAwB,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAwB3G"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Static browser-asset registry — content-hashed URLs + optional self-serve.
3
+ *
4
+ * In ALL runtimes the rendered HTML references assets by URL ({@link assetUrl}),
5
+ * so the browser caches them (`immutable`) instead of re-receiving inlined copies
6
+ * on every page load. Two byte-serving modes, selected at *build time*:
7
+ *
8
+ * - default — **self-serve**: connect-service serves the bytes itself from
9
+ * `_generated/asset-bytes.js` via {@link serveAsset}. Zero host config; used
10
+ * by the Node runtime and any host without a static-asset layer.
11
+ *
12
+ * - external — **host-serve**: the host serves the bytes (e.g. Cloudflare's
13
+ * `[assets]` binding, before the worker runs). The host build does two things:
14
+ * 1. `define __CONNECT_EXTERNAL_ASSETS__ = true` → {@link serveAsset} no-ops.
15
+ * 2. stub `_generated/asset-bytes.js` → `export default {}` in its bundler.
16
+ * Step 2 is what actually removes the heavy asset strings from the worker
17
+ * bundle — esbuild will NOT dead-code-eliminate the bytes module on its own
18
+ * (the import symbol is still syntactically referenced), so the host must
19
+ * stub it. All externalizable bytes funnel through this single module, so
20
+ * stubbing one file drops them all.
21
+ */
22
+ import manifest from "./_generated/asset-manifest.js";
23
+ export const EXTERNAL_ASSETS = typeof __CONNECT_EXTERNAL_ASSETS__ !== "undefined" && __CONNECT_EXTERNAL_ASSETS__ === true;
24
+ /** Public mount path for connect-service assets (under the fixed service prefix). */
25
+ export const ASSET_BASE_PATH = "/.well-known/service/assets";
26
+ const ASSET_MANIFEST = manifest;
27
+ /**
28
+ * Resolve a logical asset key (e.g. "login.js") to its content-hashed public URL
29
+ * (e.g. "/.well-known/service/assets/login.a1b2c3d4.js"). Falls back to the key
30
+ * itself if the manifest has no entry (keeps dev/un-built paths working).
31
+ */
32
+ export function assetUrl(key, base = ASSET_BASE_PATH) {
33
+ return `${base}/${ASSET_MANIFEST[key] ?? key}`;
34
+ }
35
+ const CONTENT_TYPE = {
36
+ js: "text/javascript; charset=utf-8",
37
+ css: "text/css; charset=utf-8",
38
+ };
39
+ /**
40
+ * Self-serve an asset by its public path. Returns null when the request is not
41
+ * an asset request, when the asset is unknown, or when running in external mode
42
+ * (host serves the bytes). The dynamic import below is unreachable in external
43
+ * mode and is dropped from the bundle by dead-code elimination.
44
+ */
45
+ export async function serveAsset(request, base = ASSET_BASE_PATH) {
46
+ // Self-serve only. In external mode (`__CONNECT_EXTERNAL_ASSETS__` define) this
47
+ // block becomes `if (false) { … }` and never runs. NOTE: esbuild still emits the
48
+ // dynamic `import("./_generated/asset-bytes.js")` as a (lazy) chunk even from dead
49
+ // code, so the host build must additionally stub asset-bytes.js to drop the bytes
50
+ // from the worker (see the Cloudflare build's connect-assets-stub plugin).
51
+ if (!EXTERNAL_ASSETS) {
52
+ if (request.method !== "GET")
53
+ return null;
54
+ const { pathname } = new URL(request.url);
55
+ const prefix = `${base}/`;
56
+ if (!pathname.startsWith(prefix))
57
+ return null;
58
+ const file = pathname.slice(prefix.length);
59
+ const bytes = (await import("./_generated/asset-bytes.js")).default;
60
+ const body = bytes[file];
61
+ if (body === undefined)
62
+ return null;
63
+ const ext = file.split(".").pop() ?? "";
64
+ return new Response(body, {
65
+ headers: {
66
+ "Content-Type": CONTENT_TYPE[ext] ?? "application/octet-stream",
67
+ "Cache-Control": "public, max-age=31536000, immutable",
68
+ },
69
+ });
70
+ }
71
+ return null;
72
+ }
73
+ //# sourceMappingURL=asset-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-registry.js","sourceRoot":"","sources":["../src/asset-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,QAAQ,MAAM,gCAAgC,CAAC;AAKtD,MAAM,CAAC,MAAM,eAAe,GAC1B,OAAO,2BAA2B,KAAK,WAAW,IAAI,2BAA2B,KAAK,IAAI,CAAC;AAE7F,qFAAqF;AACrF,MAAM,CAAC,MAAM,eAAe,GAAG,6BAA6B,CAAC;AAE7D,MAAM,cAAc,GAAG,QAAkC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW,EAAE,OAAe,eAAe;IAClE,OAAO,GAAG,IAAI,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;AACjD,CAAC;AAED,MAAM,YAAY,GAA2B;IAC3C,EAAE,EAAE,gCAAgC;IACpC,GAAG,EAAE,yBAAyB;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAAgB,EAAE,OAAe,eAAe;IAC/E,gFAAgF;IAChF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