diff --git a/.gitignore b/.gitignore index 7b785c0..1c32a56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,8 @@ \.idea/ + +accounts-line/package-lock.json + +line-config-ui/package-lock.json + +line-oauth/package-lock.json diff --git a/accounts-line/.versions b/accounts-line/.versions index 64af08d..0d5a8ad 100644 --- a/accounts-line/.versions +++ b/accounts-line/.versions @@ -1,58 +1,60 @@ -accounts-base@1.9.0 -accounts-oauth@1.2.0 -allow-deny@1.1.0 -babel-compiler@7.6.1 -babel-runtime@1.5.0 +accounts-base@2.2.6 +accounts-oauth@1.4.2 +allow-deny@1.1.1 +babel-compiler@7.10.1 +babel-runtime@1.5.1 base64@1.0.12 binary-heap@1.0.11 boilerplate-generator@1.7.1 -callback-hook@1.3.0 -check@1.3.1 -ddp@1.4.0 -ddp-client@2.4.0 +callback-hook@1.4.0 +check@1.3.2 +ddp@1.4.1 +ddp-client@2.6.1 ddp-common@1.4.0 -ddp-rate-limiter@1.0.9 -ddp-server@2.3.2 -diff-sequence@1.1.1 -dynamic-import@0.6.0 -ecmascript@0.15.1 -ecmascript-runtime@0.7.0 -ecmascript-runtime-client@0.11.0 -ecmascript-runtime-server@0.10.0 -ejson@1.1.1 -fetch@0.1.1 -geojson-utils@1.0.10 -id-map@1.1.0 +ddp-rate-limiter@1.1.1 +ddp-server@2.6.0 +diff-sequence@1.1.2 +dynamic-import@0.7.2 +ecmascript@0.16.4 +ecmascript-runtime@0.8.0 +ecmascript-runtime-client@0.12.1 +ecmascript-runtime-server@0.11.0 +ejson@1.1.3 +fetch@0.1.2 +geojson-utils@1.0.11 +id-map@1.1.1 inter-process-messaging@0.1.1 localstorage@1.2.0 -logging@1.2.0 -meteor@1.9.3 -minimongo@1.6.2 -modern-browsers@0.1.5 -modules@0.16.0 -modules-runtime@0.12.0 -mongo@1.11.0 -mongo-decimal@0.1.2 +logging@1.3.1 +meteor@1.10.3 +minimongo@1.9.1 +modern-browsers@0.1.9 +modules@0.19.0 +modules-runtime@0.13.1 +mongo@1.16.3 +mongo-decimal@0.1.3 mongo-dev-server@1.1.0 -mongo-id@1.0.7 -npm-mongo@3.9.0 -oauth@1.3.2 -oauth2@1.3.0 +mongo-id@1.0.8 +npm-mongo@4.12.1 +oauth@2.1.3 +oauth2@1.3.2 ordered-dict@1.1.0 -promise@0.11.2 -random@1.2.0 +promise@0.12.2 +random@1.2.1 rate-limit@1.0.9 -react-fast-refresh@0.1.0 -reactive-var@1.0.11 +react-fast-refresh@0.2.3 +reactive-var@1.0.12 reload@1.3.1 retry@1.1.0 -routepolicy@1.1.0 -service-configuration@1.0.11 -socket-stream-client@0.3.1 -storyteller:accounts-line@1.2.3 +routepolicy@1.1.1 +service-configuration@1.3.1 +socket-stream-client@0.5.0 +storyteller:accounts-line@1.3.0 storyteller:line-oauth@1.2.2 -tracker@1.2.0 -underscore@1.0.10 -url@1.3.1 -webapp@1.10.1 -webapp-hashing@1.1.0 +tracker@1.2.1 +typescript@4.6.4 +underscore@1.0.11 +url@1.3.2 +webapp@1.13.2 +webapp-hashing@1.1.1 +zodern:types@1.0.9 diff --git a/accounts-line/definitions.d.ts b/accounts-line/definitions.d.ts new file mode 100644 index 0000000..4651adc --- /dev/null +++ b/accounts-line/definitions.d.ts @@ -0,0 +1,10 @@ +declare module 'storyteller:accounts-line' {} + +declare module 'meteor/meteor' { + namespace Meteor { + function loginWithLine( + options?: Meteor.LoginWithExternalServiceOptions, + callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void, + ): void; + } +} diff --git a/accounts-line/line.ts b/accounts-line/line.ts index b45a1a0..9f23f3f 100755 --- a/accounts-line/line.ts +++ b/accounts-line/line.ts @@ -5,6 +5,7 @@ import { Line } from 'meteor/storyteller:line-oauth'; Accounts.oauth.registerService('line'); if (Meteor.isClient) { + // TODO export this function, so that you can access it outside of the Meteor object? const loginWithLine = (options, callback) => { // support a callback without options if (!callback && typeof options === 'function') { diff --git a/accounts-line/main.ts b/accounts-line/main.ts deleted file mode 100644 index fbbaa56..0000000 --- a/accounts-line/main.ts +++ /dev/null @@ -1,2 +0,0 @@ -import './line' -import './notice' diff --git a/accounts-line/package-types.json b/accounts-line/package-types.json index f7aa7ea..7838991 100644 --- a/accounts-line/package-types.json +++ b/accounts-line/package-types.json @@ -1,3 +1,3 @@ { - "typesEntry": "main.ts" + "typesEntry": "definitions.d.ts" } diff --git a/accounts-line/package.js b/accounts-line/package.js index 047284f..6f8721f 100755 --- a/accounts-line/package.js +++ b/accounts-line/package.js @@ -8,7 +8,7 @@ Package.describe({ Package.onUse(api => { api.versionsFrom('2.3'); api.use(['ecmascript', 'typescript']); - api.use('zodern:types') + api.use('zodern:types@1.0.9') api.use('accounts-base', ['client', 'server']); // Export Accounts (etc) to packages using this one. api.imply('accounts-base', ['client', 'server']); diff --git a/jsconfig.json b/jsconfig.json index 783186c..23a628b 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -2,6 +2,7 @@ "compilerOptions": { "checkJs": true, "allowJs": true, + "lib": ["es2015"], "jsx": "react", "baseUrl": ".", "paths": { @@ -19,4 +20,4 @@ "node_modules", ".meteor" ] -} \ No newline at end of file +} diff --git a/line-config-ui/.versions b/line-config-ui/.versions index f957c96..a98c4c3 100644 --- a/line-config-ui/.versions +++ b/line-config-ui/.versions @@ -1,40 +1,41 @@ -babel-compiler@7.6.1 -babel-runtime@1.5.0 +babel-compiler@7.10.1 +babel-runtime@1.5.1 base64@1.0.12 -blaze@2.5.0 +blaze@2.6.0 blaze-tools@1.1.0 caching-compiler@1.2.2 caching-html-compiler@1.2.0 -check@1.3.1 -diff-sequence@1.1.1 -dynamic-import@0.6.0 -ecmascript@0.15.1 -ecmascript-runtime@0.7.0 -ecmascript-runtime-client@0.11.0 -ecmascript-runtime-server@0.10.0 -ejson@1.1.1 -fetch@0.1.1 +check@1.3.2 +diff-sequence@1.1.2 +dynamic-import@0.7.2 +ecmascript@0.16.4 +ecmascript-runtime@0.8.0 +ecmascript-runtime-client@0.12.1 +ecmascript-runtime-server@0.11.0 +ejson@1.1.3 +fetch@0.1.2 html-tools@1.1.0 -htmljs@1.1.0 -id-map@1.1.0 +htmljs@1.1.1 inter-process-messaging@0.1.1 -meteor@1.9.3 -modern-browsers@0.1.5 -modules@0.16.0 -modules-runtime@0.12.0 -mongo-id@1.0.7 +meteor@1.10.3 +modern-browsers@0.1.9 +modules@0.19.0 +modules-runtime@0.13.1 +mongo-id@1.0.8 observe-sequence@1.0.16 ordered-dict@1.1.0 -promise@0.11.2 -random@1.2.0 -react-fast-refresh@0.1.0 -reactive-var@1.0.11 -spacebars@1.2.0 +promise@0.12.2 +random@1.2.1 +react-fast-refresh@0.2.3 +reactive-var@1.0.12 +spacebars@1.3.0 spacebars-compiler@1.2.0 -storyteller:line-config-ui@1.1.2 -templating@1.4.1 +storyteller:line-config-ui@1.2.0 +templating@1.4.2 templating-compiler@1.4.1 -templating-runtime@1.5.0 +templating-runtime@1.6.0 templating-tools@1.2.0 -tracker@1.2.0 -underscore@1.0.10 +tracker@1.2.1 +typescript@4.6.4 +underscore@1.0.11 +zodern:types@1.0.9 diff --git a/line-config-ui/CHANGELOG.md b/line-config-ui/CHANGELOG.md index 02ed3db..2c62cee 100755 --- a/line-config-ui/CHANGELOG.md +++ b/line-config-ui/CHANGELOG.md @@ -3,6 +3,7 @@ * Typescript * `zodern:types` added * Fix helper names +* Updated templating to v1.4.2 ## 1.1.2 - 2021-06-24 * Update dependencies diff --git a/line-config-ui/definitions.d.ts b/line-config-ui/definitions.d.ts new file mode 100644 index 0000000..e69de29 diff --git a/line-config-ui/main.ts b/line-config-ui/main.ts deleted file mode 100644 index 6a8f4fe..0000000 --- a/line-config-ui/main.ts +++ /dev/null @@ -1 +0,0 @@ -import './line_configure' diff --git a/line-config-ui/package-types.json b/line-config-ui/package-types.json index f7aa7ea..7838991 100644 --- a/line-config-ui/package-types.json +++ b/line-config-ui/package-types.json @@ -1,3 +1,3 @@ { - "typesEntry": "main.ts" + "typesEntry": "definitions.d.ts" } diff --git a/line-config-ui/package.js b/line-config-ui/package.js index 331b731..c80afba 100755 --- a/line-config-ui/package.js +++ b/line-config-ui/package.js @@ -7,9 +7,9 @@ Package.describe({ Package.onUse(api => { api.versionsFrom('2.3'); - api.use('zodern:types', 'server') + api.use('zodern:types@1.0.9', 'server') api.use(['ecmascript', 'typescript'], 'client'); - api.use('templating', 'client'); + api.use('templating@1.4.2', 'client'); api.addFiles('line_login_button.css', 'client'); api.addFiles(['line_configure.html', 'line_configure.ts'], 'client'); diff --git a/line-oauth/.versions b/line-oauth/.versions index 877bbb4..c07e3fb 100644 --- a/line-oauth/.versions +++ b/line-oauth/.versions @@ -1,56 +1,58 @@ -accounts-base@2.2.4 +accounts-base@2.2.6 allow-deny@1.1.1 -babel-compiler@7.9.0 +babel-compiler@7.10.1 babel-runtime@1.5.1 base64@1.0.12 binary-heap@1.0.11 boilerplate-generator@1.7.1 callback-hook@1.4.0 -check@1.3.1 -ddp@1.4.0 -ddp-client@2.5.0 +check@1.3.2 +ddp@1.4.1 +ddp-client@2.6.1 ddp-common@1.4.0 -ddp-rate-limiter@1.1.0 -ddp-server@2.5.0 -diff-sequence@1.1.1 +ddp-rate-limiter@1.1.1 +ddp-server@2.6.0 +diff-sequence@1.1.2 dynamic-import@0.7.2 -ecmascript@0.16.2 +ecmascript@0.16.4 ecmascript-runtime@0.8.0 ecmascript-runtime-client@0.12.1 ecmascript-runtime-server@0.11.0 -ejson@1.1.2 -fetch@0.1.1 -geojson-utils@1.0.10 +ejson@1.1.3 +fetch@0.1.2 +geojson-utils@1.0.11 id-map@1.1.1 inter-process-messaging@0.1.1 localstorage@1.2.0 logging@1.3.1 -meteor@1.10.0 -minimongo@1.8.0 -modern-browsers@0.1.8 -modules@0.18.0 -modules-runtime@0.13.0 -mongo@1.15.0 +meteor@1.10.3 +minimongo@1.9.1 +modern-browsers@0.1.9 +modules@0.19.0 +modules-runtime@0.13.1 +mongo@1.16.3 mongo-decimal@0.1.3 mongo-dev-server@1.1.0 mongo-id@1.0.8 -npm-mongo@4.3.1 -oauth@2.1.2 -oauth2@1.3.1 +npm-mongo@4.12.1 +oauth@2.1.3 +oauth2@1.3.2 ordered-dict@1.1.0 -promise@0.12.0 -random@1.2.0 +promise@0.12.2 +random@1.2.1 rate-limit@1.0.9 react-fast-refresh@0.2.3 -reactive-var@1.0.11 +reactive-var@1.0.12 reload@1.3.1 retry@1.1.0 routepolicy@1.1.1 -service-configuration@1.3.0 +service-configuration@1.3.1 socket-stream-client@0.5.0 -storyteller:line-oauth@1.2.3 -tracker@1.2.0 -underscore@1.0.10 +storyteller:line-oauth@1.3.0 +tracker@1.2.1 +typescript@4.6.4 +underscore@1.0.11 url@1.3.2 -webapp@1.13.1 -webapp-hashing@1.1.0 +webapp@1.13.2 +webapp-hashing@1.1.1 +zodern:types@1.0.9 diff --git a/line-oauth/definition.d.ts b/line-oauth/definition.d.ts new file mode 100644 index 0000000..3c86a3d --- /dev/null +++ b/line-oauth/definition.d.ts @@ -0,0 +1,7 @@ +declare module 'storyteller:line-oauth' {} + +declare global { + interface Line { + retrieveCredential(credentialToken: string, credentialSecret: string): void + } +} diff --git a/line-oauth/line_server.ts b/line-oauth/line_server.ts index 52b02b3..b812487 100644 --- a/line-oauth/line_server.ts +++ b/line-oauth/line_server.ts @@ -1,4 +1,5 @@ import { Meteor } from 'meteor/meteor'; +import { fetch, URLSearchParams } from 'meteor/fetch'; import { ServiceConfiguration } from 'meteor/service-configuration'; import { OAuth } from 'meteor/oauth' const jsonwebtoken = Npm.require('jsonwebtoken'); @@ -28,7 +29,7 @@ OAuth.registerService('line', 2, null, async (query) => { return data; }); -const getAccessToken = async (query, callback) => { +const getAccessToken = async (query) => { const config = ServiceConfiguration.configurations.findOne({ service: 'line' }); if (!config) throw new ServiceConfiguration.ConfigError(); let request; @@ -59,7 +60,7 @@ const getAccessToken = async (query, callback) => { // if the response was a json object with an error attribute throw new Error(`Failed to complete OAuth handshake with LINE. ${response.error_description}`); } else { - callback(undefined, response); + return response } }; diff --git a/line-oauth/main.ts b/line-oauth/main.ts deleted file mode 100644 index 5e7cbe2..0000000 --- a/line-oauth/main.ts +++ /dev/null @@ -1,2 +0,0 @@ -import './line_server' -import './line_client' diff --git a/line-oauth/package-types.json b/line-oauth/package-types.json index f7aa7ea..69c3dd5 100644 --- a/line-oauth/package-types.json +++ b/line-oauth/package-types.json @@ -1,3 +1,3 @@ { - "typesEntry": "main.ts" + "typesEntry": "definition.d.ts" } diff --git a/line-oauth/package.js b/line-oauth/package.js index 1e81bc1..fef3abc 100755 --- a/line-oauth/package.js +++ b/line-oauth/package.js @@ -10,8 +10,8 @@ Npm.depends({ }); Package.onUse(api => { - api.versionsFrom(['2.9']); - api.use('zodern:types', 'server') + api.versionsFrom(['2.9.0']); + api.use('zodern:types@1.0.9', 'server') api.use(['ecmascript', 'typescript'], ['client', 'server']); api.use('oauth2', ['client', 'server']); api.use('oauth', ['client', 'server']);