@rebasepro/server-core 0.6.1 → 0.7.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 (165) hide show
  1. package/package.json +14 -14
  2. package/src/api/errors.ts +16 -2
  3. package/src/api/graphql/graphql-schema-generator.ts +45 -10
  4. package/src/api/server.ts +10 -2
  5. package/src/api/types.ts +6 -0
  6. package/src/auth/adapter-middleware.ts +10 -2
  7. package/src/auth/admin-roles-route.ts +36 -0
  8. package/src/auth/admin-users-route.ts +302 -0
  9. package/src/auth/api-keys/api-key-middleware.ts +4 -3
  10. package/src/auth/api-keys/api-key-routes.ts +12 -2
  11. package/src/auth/api-keys/api-key-store.ts +83 -66
  12. package/src/auth/api-keys/api-key-types.ts +8 -0
  13. package/src/auth/apple-oauth.ts +2 -1
  14. package/src/auth/auth-hooks.ts +21 -0
  15. package/src/auth/bitbucket-oauth.ts +2 -1
  16. package/src/auth/builtin-auth-adapter.ts +28 -4
  17. package/src/auth/custom-auth-adapter.ts +2 -0
  18. package/src/auth/discord-oauth.ts +2 -1
  19. package/src/auth/facebook-oauth.ts +2 -1
  20. package/src/auth/github-oauth.ts +2 -1
  21. package/src/auth/gitlab-oauth.ts +2 -1
  22. package/src/auth/google-oauth.ts +8 -4
  23. package/src/auth/index.ts +2 -0
  24. package/src/auth/interfaces.ts +27 -0
  25. package/src/auth/linkedin-oauth.ts +2 -1
  26. package/src/auth/magic-link-routes.ts +167 -0
  27. package/src/auth/mfa-crypto.ts +91 -0
  28. package/src/auth/mfa-routes.ts +34 -10
  29. package/src/auth/microsoft-oauth.ts +2 -1
  30. package/src/auth/middleware.ts +10 -1
  31. package/src/auth/reset-password-admin.ts +17 -1
  32. package/src/auth/routes.ts +77 -8
  33. package/src/auth/session-routes.ts +15 -3
  34. package/src/auth/slack-oauth.ts +2 -1
  35. package/src/auth/spotify-oauth.ts +2 -1
  36. package/src/auth/twitter-oauth.ts +8 -1
  37. package/src/cron/cron-store.ts +25 -23
  38. package/src/email/index.ts +3 -2
  39. package/src/email/templates.ts +82 -0
  40. package/src/email/types.ts +16 -0
  41. package/src/init.ts +137 -5
  42. package/src/services/routed-realtime-service.ts +113 -0
  43. package/src/utils/dev-port.ts +13 -7
  44. package/test/auth-routes.test.ts +54 -4
  45. package/test/custom-auth-adapter.test.ts +20 -1
  46. package/test/env.test.ts +9 -19
  47. package/test/multi-datasource-routing.test.ts +113 -0
  48. package/test/routed-realtime-service.test.ts +86 -0
  49. package/test/transform-auth-response.test.ts +305 -0
  50. package/build-errors.txt +0 -52
  51. package/dist/api/ast-schema-editor.d.ts +0 -21
  52. package/dist/api/collections_for_test/callbacks_test_collection.d.ts +0 -2
  53. package/dist/api/errors.d.ts +0 -53
  54. package/dist/api/graphql/graphql-schema-generator.d.ts +0 -35
  55. package/dist/api/graphql/index.d.ts +0 -1
  56. package/dist/api/index.d.ts +0 -9
  57. package/dist/api/logs-routes.d.ts +0 -37
  58. package/dist/api/openapi-generator.d.ts +0 -16
  59. package/dist/api/rest/api-generator.d.ts +0 -88
  60. package/dist/api/rest/index.d.ts +0 -1
  61. package/dist/api/rest/query-parser.d.ts +0 -11
  62. package/dist/api/schema-editor-routes.d.ts +0 -3
  63. package/dist/api/server.d.ts +0 -40
  64. package/dist/api/types.d.ts +0 -98
  65. package/dist/auth/adapter-middleware.d.ts +0 -37
  66. package/dist/auth/admin-user-ops.d.ts +0 -79
  67. package/dist/auth/api-keys/api-key-middleware.d.ts +0 -39
  68. package/dist/auth/api-keys/api-key-permission-guard.d.ts +0 -32
  69. package/dist/auth/api-keys/api-key-routes.d.ts +0 -20
  70. package/dist/auth/api-keys/api-key-store.d.ts +0 -35
  71. package/dist/auth/api-keys/api-key-types.d.ts +0 -88
  72. package/dist/auth/api-keys/index.d.ts +0 -17
  73. package/dist/auth/apple-oauth.d.ts +0 -30
  74. package/dist/auth/auth-hooks.d.ts +0 -225
  75. package/dist/auth/bitbucket-oauth.d.ts +0 -11
  76. package/dist/auth/builtin-auth-adapter.d.ts +0 -49
  77. package/dist/auth/crypto-utils.d.ts +0 -16
  78. package/dist/auth/custom-auth-adapter.d.ts +0 -39
  79. package/dist/auth/discord-oauth.d.ts +0 -14
  80. package/dist/auth/facebook-oauth.d.ts +0 -14
  81. package/dist/auth/github-oauth.d.ts +0 -15
  82. package/dist/auth/gitlab-oauth.d.ts +0 -13
  83. package/dist/auth/google-oauth.d.ts +0 -47
  84. package/dist/auth/index.d.ts +0 -36
  85. package/dist/auth/interfaces.d.ts +0 -401
  86. package/dist/auth/jwt.d.ts +0 -55
  87. package/dist/auth/linkedin-oauth.d.ts +0 -18
  88. package/dist/auth/mfa-routes.d.ts +0 -6
  89. package/dist/auth/mfa.d.ts +0 -49
  90. package/dist/auth/microsoft-oauth.d.ts +0 -16
  91. package/dist/auth/middleware.d.ts +0 -106
  92. package/dist/auth/password.d.ts +0 -22
  93. package/dist/auth/rate-limiter.d.ts +0 -50
  94. package/dist/auth/reset-password-admin.d.ts +0 -29
  95. package/dist/auth/rls-scope.d.ts +0 -31
  96. package/dist/auth/routes.d.ts +0 -33
  97. package/dist/auth/session-routes.d.ts +0 -25
  98. package/dist/auth/slack-oauth.d.ts +0 -12
  99. package/dist/auth/spotify-oauth.d.ts +0 -12
  100. package/dist/auth/twitter-oauth.d.ts +0 -18
  101. package/dist/backend-CIxN4FVm.js +0 -15
  102. package/dist/backend-CIxN4FVm.js.map +0 -1
  103. package/dist/chunk-Dze3rakg.js +0 -42
  104. package/dist/collections/BackendCollectionRegistry.d.ts +0 -13
  105. package/dist/collections/loader.d.ts +0 -5
  106. package/dist/cron/cron-loader.d.ts +0 -17
  107. package/dist/cron/cron-routes.d.ts +0 -14
  108. package/dist/cron/cron-scheduler.d.ts +0 -106
  109. package/dist/cron/cron-store.d.ts +0 -32
  110. package/dist/cron/index.d.ts +0 -6
  111. package/dist/db/interfaces.d.ts +0 -18
  112. package/dist/dist-CZKP-Xz4.js +0 -832
  113. package/dist/dist-CZKP-Xz4.js.map +0 -1
  114. package/dist/email/index.d.ts +0 -6
  115. package/dist/email/smtp-email-service.d.ts +0 -25
  116. package/dist/email/templates.d.ts +0 -42
  117. package/dist/email/types.d.ts +0 -108
  118. package/dist/env.d.ts +0 -102
  119. package/dist/from-VbwD7xRf.js +0 -3849
  120. package/dist/from-VbwD7xRf.js.map +0 -1
  121. package/dist/functions/function-loader.d.ts +0 -17
  122. package/dist/functions/function-routes.d.ts +0 -10
  123. package/dist/functions/index.d.ts +0 -3
  124. package/dist/history/history-routes.d.ts +0 -23
  125. package/dist/history/index.d.ts +0 -1
  126. package/dist/index.d.ts +0 -33
  127. package/dist/index.es.js +0 -61731
  128. package/dist/index.es.js.map +0 -1
  129. package/dist/index.umd.js +0 -73221
  130. package/dist/index.umd.js.map +0 -1
  131. package/dist/init/docs.d.ts +0 -4
  132. package/dist/init/health.d.ts +0 -2
  133. package/dist/init/middlewares.d.ts +0 -10
  134. package/dist/init/shutdown.d.ts +0 -11
  135. package/dist/init/storage.d.ts +0 -5
  136. package/dist/init.d.ts +0 -258
  137. package/dist/jwt-DHcQRGC3.js +0 -4168
  138. package/dist/jwt-DHcQRGC3.js.map +0 -1
  139. package/dist/logger-BYU66ENZ.js +0 -94
  140. package/dist/logger-BYU66ENZ.js.map +0 -1
  141. package/dist/ms-BeBSuOXN.js +0 -125
  142. package/dist/ms-BeBSuOXN.js.map +0 -1
  143. package/dist/multipart-parser-CedBDOeC.js +0 -299
  144. package/dist/multipart-parser-CedBDOeC.js.map +0 -1
  145. package/dist/serve-spa.d.ts +0 -30
  146. package/dist/services/driver-registry.d.ts +0 -78
  147. package/dist/services/webhook-service.d.ts +0 -29
  148. package/dist/singleton.d.ts +0 -35
  149. package/dist/src-COaj0G3P.js +0 -1182
  150. package/dist/src-COaj0G3P.js.map +0 -1
  151. package/dist/storage/LocalStorageController.d.ts +0 -46
  152. package/dist/storage/S3StorageController.d.ts +0 -36
  153. package/dist/storage/image-transform.d.ts +0 -50
  154. package/dist/storage/index.d.ts +0 -28
  155. package/dist/storage/routes.d.ts +0 -38
  156. package/dist/storage/storage-registry.d.ts +0 -78
  157. package/dist/storage/tus-handler.d.ts +0 -51
  158. package/dist/storage/types.d.ts +0 -103
  159. package/dist/types/index.d.ts +0 -11
  160. package/dist/utils/dev-port.d.ts +0 -35
  161. package/dist/utils/logger.d.ts +0 -31
  162. package/dist/utils/logging.d.ts +0 -9
  163. package/dist/utils/request-id.d.ts +0 -4
  164. package/dist/utils/request-logger.d.ts +0 -19
  165. package/dist/utils/sql.d.ts +0 -27
@@ -1 +0,0 @@
1
- {"version":3,"file":"dist-CZKP-Xz4.js","names":["http","exports","net"],"sources":["../../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/common.js","../../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js","../../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js","../../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js","../../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/parse-proxy-response.js","../../../node_modules/.pnpm/https-proxy-agent@7.0.6/node_modules/https-proxy-agent/dist/index.js"],"sourcesContent":["\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '')\n\t\t\t.trim()\n\t\t\t.replace(/\\s+/g, ',')\n\t\t\t.split(',')\n\t\t\t.filter(Boolean);\n\n\t\tfor (const ns of split) {\n\t\t\tif (ns[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(ns.slice(1));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(ns);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the given string matches a namespace template, honoring\n\t * asterisks as wildcards.\n\t *\n\t * @param {String} search\n\t * @param {String} template\n\t * @return {Boolean}\n\t */\n\tfunction matchesTemplate(search, template) {\n\t\tlet searchIndex = 0;\n\t\tlet templateIndex = 0;\n\t\tlet starIndex = -1;\n\t\tlet matchIndex = 0;\n\n\t\twhile (searchIndex < search.length) {\n\t\t\tif (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {\n\t\t\t\t// Match character or proceed with wildcard\n\t\t\t\tif (template[templateIndex] === '*') {\n\t\t\t\t\tstarIndex = templateIndex;\n\t\t\t\t\tmatchIndex = searchIndex;\n\t\t\t\t\ttemplateIndex++; // Skip the '*'\n\t\t\t\t} else {\n\t\t\t\t\tsearchIndex++;\n\t\t\t\t\ttemplateIndex++;\n\t\t\t\t}\n\t\t\t} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition\n\t\t\t\t// Backtrack to the last '*' and try to match more characters\n\t\t\t\ttemplateIndex = starIndex + 1;\n\t\t\t\tmatchIndex++;\n\t\t\t\tsearchIndex = matchIndex;\n\t\t\t} else {\n\t\t\t\treturn false; // No match\n\t\t\t}\n\t\t}\n\n\t\t// Handle trailing '*' in template\n\t\twhile (templateIndex < template.length && template[templateIndex] === '*') {\n\t\t\ttemplateIndex++;\n\t\t}\n\n\t\treturn templateIndex === template.length;\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names,\n\t\t\t...createDebug.skips.map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tfor (const skip of createDebug.skips) {\n\t\t\tif (matchesTemplate(name, skip)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (const ns of createDebug.names) {\n\t\t\tif (matchesTemplate(name, ns)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n","/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\tlet m;\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t// eslint-disable-next-line no-return-assign\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)) && parseInt(m[1], 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.req = exports.json = exports.toBuffer = void 0;\nconst http = __importStar(require(\"http\"));\nconst https = __importStar(require(\"https\"));\nasync function toBuffer(stream) {\n let length = 0;\n const chunks = [];\n for await (const chunk of stream) {\n length += chunk.length;\n chunks.push(chunk);\n }\n return Buffer.concat(chunks, length);\n}\nexports.toBuffer = toBuffer;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nasync function json(stream) {\n const buf = await toBuffer(stream);\n const str = buf.toString('utf8');\n try {\n return JSON.parse(str);\n }\n catch (_err) {\n const err = _err;\n err.message += ` (input: ${str})`;\n throw err;\n }\n}\nexports.json = json;\nfunction req(url, opts = {}) {\n const href = typeof url === 'string' ? url : url.href;\n const req = (href.startsWith('https:') ? https : http).request(url, opts);\n const promise = new Promise((resolve, reject) => {\n req\n .once('response', resolve)\n .once('error', reject)\n .end();\n });\n req.then = promise.then.bind(promise);\n return req;\n}\nexports.req = req;\n//# sourceMappingURL=helpers.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Agent = void 0;\nconst net = __importStar(require(\"net\"));\nconst http = __importStar(require(\"http\"));\nconst https_1 = require(\"https\");\n__exportStar(require(\"./helpers\"), exports);\nconst INTERNAL = Symbol('AgentBaseInternalState');\nclass Agent extends http.Agent {\n constructor(opts) {\n super(opts);\n this[INTERNAL] = {};\n }\n /**\n * Determine whether this is an `http` or `https` request.\n */\n isSecureEndpoint(options) {\n if (options) {\n // First check the `secureEndpoint` property explicitly, since this\n // means that a parent `Agent` is \"passing through\" to this instance.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n if (typeof options.secureEndpoint === 'boolean') {\n return options.secureEndpoint;\n }\n // If no explicit `secure` endpoint, check if `protocol` property is\n // set. This will usually be the case since using a full string URL\n // or `URL` instance should be the most common usage.\n if (typeof options.protocol === 'string') {\n return options.protocol === 'https:';\n }\n }\n // Finally, if no `protocol` property was set, then fall back to\n // checking the stack trace of the current call stack, and try to\n // detect the \"https\" module.\n const { stack } = new Error();\n if (typeof stack !== 'string')\n return false;\n return stack\n .split('\\n')\n .some((l) => l.indexOf('(https.js:') !== -1 ||\n l.indexOf('node:https:') !== -1);\n }\n // In order to support async signatures in `connect()` and Node's native\n // connection pooling in `http.Agent`, the array of sockets for each origin\n // has to be updated synchronously. This is so the length of the array is\n // accurate when `addRequest()` is next called. We achieve this by creating a\n // fake socket and adding it to `sockets[origin]` and incrementing\n // `totalSocketCount`.\n incrementSockets(name) {\n // If `maxSockets` and `maxTotalSockets` are both Infinity then there is no\n // need to create a fake socket because Node.js native connection pooling\n // will never be invoked.\n if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {\n return null;\n }\n // All instances of `sockets` are expected TypeScript errors. The\n // alternative is to add it as a private property of this class but that\n // will break TypeScript subclassing.\n if (!this.sockets[name]) {\n // @ts-expect-error `sockets` is readonly in `@types/node`\n this.sockets[name] = [];\n }\n const fakeSocket = new net.Socket({ writable: false });\n this.sockets[name].push(fakeSocket);\n // @ts-expect-error `totalSocketCount` isn't defined in `@types/node`\n this.totalSocketCount++;\n return fakeSocket;\n }\n decrementSockets(name, socket) {\n if (!this.sockets[name] || socket === null) {\n return;\n }\n const sockets = this.sockets[name];\n const index = sockets.indexOf(socket);\n if (index !== -1) {\n sockets.splice(index, 1);\n // @ts-expect-error `totalSocketCount` isn't defined in `@types/node`\n this.totalSocketCount--;\n if (sockets.length === 0) {\n // @ts-expect-error `sockets` is readonly in `@types/node`\n delete this.sockets[name];\n }\n }\n }\n // In order to properly update the socket pool, we need to call `getName()` on\n // the core `https.Agent` if it is a secureEndpoint.\n getName(options) {\n const secureEndpoint = this.isSecureEndpoint(options);\n if (secureEndpoint) {\n // @ts-expect-error `getName()` isn't defined in `@types/node`\n return https_1.Agent.prototype.getName.call(this, options);\n }\n // @ts-expect-error `getName()` isn't defined in `@types/node`\n return super.getName(options);\n }\n createSocket(req, options, cb) {\n const connectOpts = {\n ...options,\n secureEndpoint: this.isSecureEndpoint(options),\n };\n const name = this.getName(connectOpts);\n const fakeSocket = this.incrementSockets(name);\n Promise.resolve()\n .then(() => this.connect(req, connectOpts))\n .then((socket) => {\n this.decrementSockets(name, fakeSocket);\n if (socket instanceof http.Agent) {\n try {\n // @ts-expect-error `addRequest()` isn't defined in `@types/node`\n return socket.addRequest(req, connectOpts);\n }\n catch (err) {\n return cb(err);\n }\n }\n this[INTERNAL].currentSocket = socket;\n // @ts-expect-error `createSocket()` isn't defined in `@types/node`\n super.createSocket(req, options, cb);\n }, (err) => {\n this.decrementSockets(name, fakeSocket);\n cb(err);\n });\n }\n createConnection() {\n const socket = this[INTERNAL].currentSocket;\n this[INTERNAL].currentSocket = undefined;\n if (!socket) {\n throw new Error('No socket was returned in the `connect()` function');\n }\n return socket;\n }\n get defaultPort() {\n return (this[INTERNAL].defaultPort ??\n (this.protocol === 'https:' ? 443 : 80));\n }\n set defaultPort(v) {\n if (this[INTERNAL]) {\n this[INTERNAL].defaultPort = v;\n }\n }\n get protocol() {\n return (this[INTERNAL].protocol ??\n (this.isSecureEndpoint() ? 'https:' : 'http:'));\n }\n set protocol(v) {\n if (this[INTERNAL]) {\n this[INTERNAL].protocol = v;\n }\n }\n}\nexports.Agent = Agent;\n//# sourceMappingURL=index.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.parseProxyResponse = void 0;\nconst debug_1 = __importDefault(require(\"debug\"));\nconst debug = (0, debug_1.default)('https-proxy-agent:parse-proxy-response');\nfunction parseProxyResponse(socket) {\n return new Promise((resolve, reject) => {\n // we need to buffer any HTTP traffic that happens with the proxy before we get\n // the CONNECT response, so that if the response is anything other than an \"200\"\n // response code, then we can re-play the \"data\" events on the socket once the\n // HTTP parser is hooked up...\n let buffersLength = 0;\n const buffers = [];\n function read() {\n const b = socket.read();\n if (b)\n ondata(b);\n else\n socket.once('readable', read);\n }\n function cleanup() {\n socket.removeListener('end', onend);\n socket.removeListener('error', onerror);\n socket.removeListener('readable', read);\n }\n function onend() {\n cleanup();\n debug('onend');\n reject(new Error('Proxy connection ended before receiving CONNECT response'));\n }\n function onerror(err) {\n cleanup();\n debug('onerror %o', err);\n reject(err);\n }\n function ondata(b) {\n buffers.push(b);\n buffersLength += b.length;\n const buffered = Buffer.concat(buffers, buffersLength);\n const endOfHeaders = buffered.indexOf('\\r\\n\\r\\n');\n if (endOfHeaders === -1) {\n // keep buffering\n debug('have not received end of HTTP headers yet...');\n read();\n return;\n }\n const headerParts = buffered\n .slice(0, endOfHeaders)\n .toString('ascii')\n .split('\\r\\n');\n const firstLine = headerParts.shift();\n if (!firstLine) {\n socket.destroy();\n return reject(new Error('No header received from proxy CONNECT response'));\n }\n const firstLineParts = firstLine.split(' ');\n const statusCode = +firstLineParts[1];\n const statusText = firstLineParts.slice(2).join(' ');\n const headers = {};\n for (const header of headerParts) {\n if (!header)\n continue;\n const firstColon = header.indexOf(':');\n if (firstColon === -1) {\n socket.destroy();\n return reject(new Error(`Invalid header from proxy CONNECT response: \"${header}\"`));\n }\n const key = header.slice(0, firstColon).toLowerCase();\n const value = header.slice(firstColon + 1).trimStart();\n const current = headers[key];\n if (typeof current === 'string') {\n headers[key] = [current, value];\n }\n else if (Array.isArray(current)) {\n current.push(value);\n }\n else {\n headers[key] = value;\n }\n }\n debug('got proxy server response: %o %o', firstLine, headers);\n cleanup();\n resolve({\n connect: {\n statusCode,\n statusText,\n headers,\n },\n buffered,\n });\n }\n socket.on('error', onerror);\n socket.on('end', onend);\n read();\n });\n}\nexports.parseProxyResponse = parseProxyResponse;\n//# sourceMappingURL=parse-proxy-response.js.map","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.HttpsProxyAgent = void 0;\nconst net = __importStar(require(\"net\"));\nconst tls = __importStar(require(\"tls\"));\nconst assert_1 = __importDefault(require(\"assert\"));\nconst debug_1 = __importDefault(require(\"debug\"));\nconst agent_base_1 = require(\"agent-base\");\nconst url_1 = require(\"url\");\nconst parse_proxy_response_1 = require(\"./parse-proxy-response\");\nconst debug = (0, debug_1.default)('https-proxy-agent');\nconst setServernameFromNonIpHost = (options) => {\n if (options.servername === undefined &&\n options.host &&\n !net.isIP(options.host)) {\n return {\n ...options,\n servername: options.host,\n };\n }\n return options;\n};\n/**\n * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to\n * the specified \"HTTP(s) proxy server\" in order to proxy HTTPS requests.\n *\n * Outgoing HTTP requests are first tunneled through the proxy server using the\n * `CONNECT` HTTP request method to establish a connection to the proxy server,\n * and then the proxy server connects to the destination target and issues the\n * HTTP request from the proxy server.\n *\n * `https:` requests have their socket connection upgraded to TLS once\n * the connection to the proxy server has been established.\n */\nclass HttpsProxyAgent extends agent_base_1.Agent {\n constructor(proxy, opts) {\n super(opts);\n this.options = { path: undefined };\n this.proxy = typeof proxy === 'string' ? new url_1.URL(proxy) : proxy;\n this.proxyHeaders = opts?.headers ?? {};\n debug('Creating new HttpsProxyAgent instance: %o', this.proxy.href);\n // Trim off the brackets from IPv6 addresses\n const host = (this.proxy.hostname || this.proxy.host).replace(/^\\[|\\]$/g, '');\n const port = this.proxy.port\n ? parseInt(this.proxy.port, 10)\n : this.proxy.protocol === 'https:'\n ? 443\n : 80;\n this.connectOpts = {\n // Attempt to negotiate http/1.1 for proxy servers that support http/2\n ALPNProtocols: ['http/1.1'],\n ...(opts ? omit(opts, 'headers') : null),\n host,\n port,\n };\n }\n /**\n * Called when the node-core HTTP client library is creating a\n * new HTTP request.\n */\n async connect(req, opts) {\n const { proxy } = this;\n if (!opts.host) {\n throw new TypeError('No \"host\" provided');\n }\n // Create a socket connection to the proxy server.\n let socket;\n if (proxy.protocol === 'https:') {\n debug('Creating `tls.Socket`: %o', this.connectOpts);\n socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));\n }\n else {\n debug('Creating `net.Socket`: %o', this.connectOpts);\n socket = net.connect(this.connectOpts);\n }\n const headers = typeof this.proxyHeaders === 'function'\n ? this.proxyHeaders()\n : { ...this.proxyHeaders };\n const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;\n let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\\r\\n`;\n // Inject the `Proxy-Authorization` header if necessary.\n if (proxy.username || proxy.password) {\n const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;\n headers['Proxy-Authorization'] = `Basic ${Buffer.from(auth).toString('base64')}`;\n }\n headers.Host = `${host}:${opts.port}`;\n if (!headers['Proxy-Connection']) {\n headers['Proxy-Connection'] = this.keepAlive\n ? 'Keep-Alive'\n : 'close';\n }\n for (const name of Object.keys(headers)) {\n payload += `${name}: ${headers[name]}\\r\\n`;\n }\n const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);\n socket.write(`${payload}\\r\\n`);\n const { connect, buffered } = await proxyResponsePromise;\n req.emit('proxyConnect', connect);\n this.emit('proxyConnect', connect, req);\n if (connect.statusCode === 200) {\n req.once('socket', resume);\n if (opts.secureEndpoint) {\n // The proxy is connecting to a TLS server, so upgrade\n // this socket connection to a TLS connection.\n debug('Upgrading socket connection to TLS');\n return tls.connect({\n ...omit(setServernameFromNonIpHost(opts), 'host', 'path', 'port'),\n socket,\n });\n }\n return socket;\n }\n // Some other status code that's not 200... need to re-play the HTTP\n // header \"data\" events onto the socket once the HTTP machinery is\n // attached so that the node core `http` can parse and handle the\n // error status code.\n // Close the original socket, and a new \"fake\" socket is returned\n // instead, so that the proxy doesn't get the HTTP request\n // written to it (which may contain `Authorization` headers or other\n // sensitive data).\n //\n // See: https://hackerone.com/reports/541502\n socket.destroy();\n const fakeSocket = new net.Socket({ writable: false });\n fakeSocket.readable = true;\n // Need to wait for the \"socket\" event to re-play the \"data\" events.\n req.once('socket', (s) => {\n debug('Replaying proxy buffer for failed request');\n (0, assert_1.default)(s.listenerCount('data') > 0);\n // Replay the \"buffered\" Buffer onto the fake `socket`, since at\n // this point the HTTP module machinery has been hooked up for\n // the user.\n s.push(buffered);\n s.push(null);\n });\n return fakeSocket;\n }\n}\nHttpsProxyAgent.protocols = ['http', 'https'];\nexports.HttpsProxyAgent = HttpsProxyAgent;\nfunction resume(socket) {\n socket.resume();\n}\nfunction omit(obj, ...keys) {\n const ret = {};\n let key;\n for (key in obj) {\n if (!keys.includes(key)) {\n ret[key] = obj[key];\n }\n }\n return ret;\n}\n//# sourceMappingURL=index.js.map"],"x_google_ignoreList":[0,1,2,3,4,5],"mappings":";;;;;;;;;;;CAMA,SAAS,MAAM,KAAK;EACnB,YAAY,QAAQ;EACpB,YAAY,UAAU;EACtB,YAAY,SAAS;EACrB,YAAY,UAAU;EACtB,YAAY,SAAS;EACrB,YAAY,UAAU;E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AAO,OAAO;CAClB;CACA,SAAS,KAAK,KAAK,GAAG,MAAM;EACxB,MAAM,MAAM,CAAC;EACb,IAAI;EACJ,KAAK,OAAO,KACR,IAAI,CAAC,KAAK,SAAS,GAAG,GAClB,IAAI,OAAO,IAAI;EAGvB,OAAO;CACX"}
@@ -1,6 +0,0 @@
1
- /**
2
- * Email module exports
3
- */
4
- export type { EmailService, EmailSendOptions, SMTPConfig, EmailConfig, PasswordResetTemplateFunction, EmailVerificationTemplateFunction, UserInvitationTemplateFunction, WelcomeEmailTemplateFunction } from "./types";
5
- export { SMTPEmailService, createEmailService } from "./smtp-email-service";
6
- export { getPasswordResetTemplate, getEmailVerificationTemplate, getUserInvitationTemplate, getWelcomeEmailTemplate } from "./templates";
@@ -1,25 +0,0 @@
1
- import { EmailService, EmailSendOptions, EmailConfig } from "./types";
2
- /**
3
- * SMTP Email Service implementation using Nodemailer
4
- */
5
- export declare class SMTPEmailService implements EmailService {
6
- private transporter;
7
- private config;
8
- constructor(config: EmailConfig);
9
- /**
10
- * Check if the email service is properly configured
11
- */
12
- isConfigured(): boolean;
13
- /**
14
- * Send an email using SMTP or custom send function
15
- */
16
- send(options: EmailSendOptions): Promise<void>;
17
- /**
18
- * Verify SMTP connection (useful for startup checks)
19
- */
20
- verifyConnection(): Promise<boolean>;
21
- }
22
- /**
23
- * Create an email service from configuration
24
- */
25
- export declare function createEmailService(config: EmailConfig): EmailService;
@@ -1,42 +0,0 @@
1
- /**
2
- * Default email templates for authentication emails
3
- */
4
- interface TemplateUser {
5
- email: string;
6
- displayName?: string | null;
7
- }
8
- /**
9
- * Default password reset email template
10
- */
11
- export declare function getPasswordResetTemplate(resetUrl: string, user: TemplateUser, appName?: string): {
12
- subject: string;
13
- html: string;
14
- text: string;
15
- };
16
- /**
17
- * Default email verification template
18
- */
19
- export declare function getEmailVerificationTemplate(verifyUrl: string, user: TemplateUser, appName?: string): {
20
- subject: string;
21
- html: string;
22
- text: string;
23
- };
24
- /**
25
- * Default user invitation email template
26
- * Sent when an admin creates a new user account
27
- */
28
- export declare function getUserInvitationTemplate(setPasswordUrl: string, user: TemplateUser, appName?: string): {
29
- subject: string;
30
- html: string;
31
- text: string;
32
- };
33
- /**
34
- * Default welcome email template
35
- * Sent automatically when a new user registers
36
- */
37
- export declare function getWelcomeEmailTemplate(user: TemplateUser, appName?: string, loginUrl?: string): {
38
- subject: string;
39
- html: string;
40
- text: string;
41
- };
42
- export {};
@@ -1,108 +0,0 @@
1
- /**
2
- * Email service types and interfaces.
3
- *
4
- * The canonical `EmailService` and `EmailSendOptions` live in `@rebasepro/types`
5
- * so they can be used on the `RebaseClient` interface without pulling in nodemailer.
6
- * This file re-exports them for backward compatibility and adds server-specific
7
- * config types (SMTP, template functions, etc.).
8
- */
9
- import type { EmailService, EmailSendOptions } from "@rebasepro/types";
10
- export type { EmailService, EmailSendOptions };
11
- /**
12
- * SMTP server configuration
13
- */
14
- export interface SMTPConfig {
15
- host: string;
16
- port: number;
17
- secure?: boolean;
18
- auth?: {
19
- user: string;
20
- pass: string;
21
- };
22
- name?: string;
23
- }
24
- /**
25
- * Template function for password reset emails
26
- */
27
- export type PasswordResetTemplateFunction = (resetUrl: string, user: {
28
- email: string;
29
- displayName?: string | null;
30
- }) => {
31
- subject: string;
32
- html: string;
33
- text?: string;
34
- };
35
- /**
36
- * Template function for email verification emails
37
- */
38
- export type EmailVerificationTemplateFunction = (verifyUrl: string, user: {
39
- email: string;
40
- displayName?: string | null;
41
- }) => {
42
- subject: string;
43
- html: string;
44
- text?: string;
45
- };
46
- /**
47
- * Template function for user invitation emails
48
- */
49
- export type UserInvitationTemplateFunction = (setPasswordUrl: string, user: {
50
- email: string;
51
- displayName?: string | null;
52
- }) => {
53
- subject: string;
54
- html: string;
55
- text?: string;
56
- };
57
- /**
58
- * Template function for welcome emails sent after registration
59
- */
60
- export type WelcomeEmailTemplateFunction = (user: {
61
- email: string;
62
- displayName?: string | null;
63
- }, appName: string) => {
64
- subject: string;
65
- html: string;
66
- text?: string;
67
- };
68
- /**
69
- * Complete email configuration
70
- */
71
- export interface EmailConfig {
72
- /**
73
- * From address for all emails (e.g., "noreply@example.com" or "MyApp <noreply@example.com>")
74
- */
75
- from: string;
76
- /**
77
- * SMTP configuration for sending emails via SMTP server
78
- */
79
- smtp?: SMTPConfig;
80
- /**
81
- * Alternative: custom function to send emails
82
- * Use this for custom email providers (AWS SES SDK, Resend, etc.)
83
- */
84
- sendEmail?: (options: EmailSendOptions) => Promise<void>;
85
- /**
86
- * Base URL for password reset links (e.g., "https://myapp.com")
87
- * The reset link will be: {baseUrl}/reset-password?token={token}
88
- */
89
- resetPasswordUrl?: string;
90
- /**
91
- * Base URL for email verification links (e.g., "https://myapp.com")
92
- * The verification link will be: {baseUrl}/verify-email?token={token}
93
- */
94
- verifyEmailUrl?: string;
95
- /**
96
- * Application name to use in email templates
97
- */
98
- appName?: string;
99
- /**
100
- * Custom email templates (optional - defaults are provided)
101
- */
102
- templates?: {
103
- passwordReset?: PasswordResetTemplateFunction;
104
- emailVerification?: EmailVerificationTemplateFunction;
105
- userInvitation?: UserInvitationTemplateFunction;
106
- welcomeEmail?: WelcomeEmailTemplateFunction;
107
- };
108
- }
package/dist/env.d.ts DELETED
@@ -1,102 +0,0 @@
1
- import { z } from "zod";
2
- /**
3
- * The full set of environment variables recognized by a Rebase backend.
4
- */
5
- declare const rebaseEnvSchema: z.ZodObject<{
6
- NODE_ENV: z.ZodDefault<z.ZodEnum<{
7
- production: "production";
8
- development: "development";
9
- test: "test";
10
- }>>;
11
- PORT: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<number, string>>;
12
- DATABASE_URL: z.ZodString;
13
- ADMIN_CONNECTION_STRING: z.ZodOptional<z.ZodString>;
14
- JWT_SECRET: z.ZodString;
15
- JWT_ACCESS_EXPIRES_IN: z.ZodDefault<z.ZodString>;
16
- JWT_REFRESH_EXPIRES_IN: z.ZodDefault<z.ZodString>;
17
- GOOGLE_CLIENT_ID: z.ZodOptional<z.ZodString>;
18
- GOOGLE_CLIENT_SECRET: z.ZodOptional<z.ZodString>;
19
- REBASE_SERVICE_KEY: z.ZodOptional<z.ZodString>;
20
- ALLOW_REGISTRATION: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
21
- "": "";
22
- true: "true";
23
- false: "false";
24
- }>>, z.ZodTransform<boolean, "" | "true" | "false">>;
25
- ALLOW_LOCALHOST_IN_PRODUCTION: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
26
- "": "";
27
- true: "true";
28
- false: "false";
29
- }>>, z.ZodTransform<boolean, "" | "true" | "false" | undefined>>;
30
- CORS_ORIGINS: z.ZodOptional<z.ZodString>;
31
- FRONTEND_URL: z.ZodOptional<z.ZodString>;
32
- DB_POOL_MAX: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<number, string>>;
33
- DB_POOL_IDLE_TIMEOUT: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<number, string>>;
34
- DB_POOL_CONNECT_TIMEOUT: z.ZodPipe<z.ZodDefault<z.ZodString>, z.ZodTransform<number, string>>;
35
- DATABASE_DIRECT_URL: z.ZodOptional<z.ZodString>;
36
- DATABASE_READ_URL: z.ZodOptional<z.ZodString>;
37
- FORCE_LOCAL_STORAGE: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
38
- "": "";
39
- true: "true";
40
- false: "false";
41
- }>>, z.ZodTransform<boolean, "" | "true" | "false" | undefined>>;
42
- STORAGE_TYPE: z.ZodDefault<z.ZodEnum<{
43
- local: "local";
44
- s3: "s3";
45
- }>>;
46
- STORAGE_PATH: z.ZodOptional<z.ZodString>;
47
- S3_BUCKET: z.ZodOptional<z.ZodString>;
48
- S3_REGION: z.ZodOptional<z.ZodString>;
49
- S3_ACCESS_KEY_ID: z.ZodOptional<z.ZodString>;
50
- S3_SECRET_ACCESS_KEY: z.ZodOptional<z.ZodString>;
51
- S3_ENDPOINT: z.ZodOptional<z.ZodString>;
52
- S3_FORCE_PATH_STYLE: z.ZodPipe<z.ZodOptional<z.ZodEnum<{
53
- "": "";
54
- true: "true";
55
- false: "false";
56
- }>>, z.ZodTransform<boolean, "" | "true" | "false" | undefined>>;
57
- }, z.core.$strip>;
58
- /** Inferred type of the validated environment. */
59
- export type RebaseEnv = z.infer<typeof rebaseEnvSchema>;
60
- /**
61
- * Load and validate the Rebase environment configuration from `process.env`.
62
- *
63
- * Call this **after** your `.env` file has been loaded (via `dotenv`, `--env-file`,
64
- * container injection, etc.). This function does not load `.env` files itself —
65
- * that is a deployment concern, not a framework concern.
66
- *
67
- * Behavior:
68
- * - Auto-generates ephemeral `JWT_SECRET` and `REBASE_SERVICE_KEY` in
69
- * non-production mode so developers can start without manual setup.
70
- * - Blocks auto-generated secrets in production.
71
- * - Returns a fully typed, validated env object.
72
- *
73
- * Use `extend` to add your own typed env variables on top of the base Rebase schema:
74
- *
75
- * @example
76
- * ```ts
77
- * import dotenv from "dotenv";
78
- * import { z } from "zod";
79
- * import { loadEnv } from "@rebasepro/server-core";
80
- *
81
- * dotenv.config({ path: "../../.env" });
82
- *
83
- * // Basic — just Rebase env vars:
84
- * export const env = loadEnv();
85
- *
86
- * // Extended — add your own typed vars:
87
- * export const env = loadEnv({
88
- * extend: z.object({
89
- * SMTP_HOST: z.string().optional(),
90
- * SMTP_PORT: z.string().default("587").transform(Number),
91
- * STRIPE_SECRET_KEY: z.string(),
92
- * })
93
- * });
94
- * // env.SMTP_HOST → string | undefined (fully typed)
95
- * // env.STRIPE_SECRET_KEY → string (validated, required)
96
- * ```
97
- */
98
- export declare function loadEnv(): RebaseEnv;
99
- export declare function loadEnv<E extends z.ZodObject<z.ZodRawShape>>(options: {
100
- extend: E;
101
- }): RebaseEnv & z.infer<E>;
102
- export {};