Merge branch 'release-2.8.1' into feat-generate-in-cli

This commit is contained in:
Gabriel Grubba
2022-11-07 10:20:24 -03:00
97 changed files with 2364 additions and 96 deletions

View File

@@ -0,0 +1,326 @@
import { Mongo } from 'meteor/mongo';
import { Meteor } from 'meteor/meteor';
export interface URLS {
resetPassword: (token: string) => string;
verifyEmail: (token: string) => string;
enrollAccount: (token: string) => string;
}
export interface EmailFields {
from?: ((user: Meteor.User) => string) | undefined;
subject?: ((user: Meteor.User) => string) | undefined;
text?: ((user: Meteor.User, url: string) => string) | undefined;
html?: ((user: Meteor.User, url: string) => string) | undefined;
}
export namespace Accounts {
var urls: URLS;
function user(options?: {
fields?: Mongo.FieldSpecifier | undefined;
}): Meteor.User | null;
function userId(): string | null;
function createUser(
options: {
username?: string | undefined;
email?: string | undefined;
password?: string | undefined;
profile?: Object | undefined;
},
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
): string;
function config(options: {
sendVerificationEmail?: boolean | undefined;
forbidClientAccountCreation?: boolean | undefined;
restrictCreationByEmailDomain?: string | Function | undefined;
loginExpirationInDays?: number | undefined;
oauthSecretKey?: string | undefined;
passwordResetTokenExpirationInDays?: number | undefined;
passwordEnrollTokenExpirationInDays?: number | undefined;
ambiguousErrorMessages?: boolean | undefined;
defaultFieldSelector?: { [key: string]: 0 | 1 } | undefined;
}): void;
function onLogin(
func: Function
): {
stop: () => void;
};
function onLoginFailure(
func: Function
): {
stop: () => void;
};
function loginServicesConfigured(): boolean;
function onPageLoadLogin(func: Function): void;
}
export namespace Accounts {
function changePassword(
oldPassword: string,
newPassword: string,
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
): void;
function forgotPassword(
options: { email?: string | undefined },
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
): void;
function resetPassword(
token: string,
newPassword: string,
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
): void;
function verifyEmail(
token: string,
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
): void;
function onEmailVerificationLink(callback: Function): void;
function onEnrollmentLink(callback: Function): void;
function onResetPasswordLink(callback: Function): void;
function loggingIn(): boolean;
function loggingOut(): boolean;
function logout(
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
): void;
function logoutOtherClients(
callback?: (error?: Error | Meteor.Error | Meteor.TypedError) => void
): void;
var ui: {
config(options: {
requestPermissions?: Object | undefined;
requestOfflineToken?: Object | undefined;
forceApprovalPrompt?: Object | undefined;
passwordSignupFields?: string | undefined;
}): void;
};
}
export interface Header {
[id: string]: string;
}
export interface EmailTemplates {
from: string;
siteName: string;
headers?: Header | undefined;
resetPassword: EmailFields;
enrollAccount: EmailFields;
verifyEmail: EmailFields;
}
export namespace Accounts {
var emailTemplates: EmailTemplates;
function addEmail(userId: string, newEmail: string, verified?: boolean): void;
function removeEmail(userId: string, email: string): void;
function onCreateUser(
func: (options: { profile?: {} | undefined }, user: Meteor.User) => void
): void;
function findUserByEmail(
email: string,
options?: { fields?: Mongo.FieldSpecifier | undefined }
): Meteor.User | null | undefined;
function findUserByUsername(
username: string,
options?: { fields?: Mongo.FieldSpecifier | undefined }
): Meteor.User | null | undefined;
function sendEnrollmentEmail(
userId: string,
email?: string,
extraTokenData?: Record<string, unknown>,
extraParams?: Record<string, unknown>
): void;
function sendResetPasswordEmail(
userId: string,
email?: string,
extraTokenData?: Record<string, unknown>,
extraParams?: Record<string, unknown>
): void;
function sendVerificationEmail(
userId: string,
email?: string,
extraTokenData?: Record<string, unknown>,
extraParams?: Record<string, unknown>
): void;
function setUsername(userId: string, newUsername: string): void;
function setPassword(
userId: string,
newPassword: string,
options?: { logout?: Object | undefined }
): void;
function validateNewUser(func: Function): boolean;
function validateLoginAttempt(
func: Function
): {
stop: () => void;
};
function _hashPassword(
password: string
): { digest: string; algorithm: string };
interface IValidateLoginAttemptCbOpts {
type: string;
allowed: boolean;
error: Meteor.Error;
user: Meteor.User;
connection: Meteor.Connection;
methodName: string;
methodArguments: any[];
}
}
export namespace Accounts {
function onLogout(func: Function): void;
}
export namespace Accounts {
function onLogout(
func: (options: {
user: Meteor.User;
connection: Meteor.Connection;
}) => void
): void;
}
export namespace Accounts {
interface LoginMethodOptions {
/**
* The method to call (default 'login')
*/
methodName?: string | undefined;
/**
* The arguments for the method
*/
methodArguments?: any[] | undefined;
/**
* If provided, will be called with the result of the
* method. If it throws, the client will not be logged in (and
* its error will be passed to the callback).
*/
validateResult?: Function | undefined;
/**
* Will be called with no arguments once the user is fully
* logged in, or with the error on error.
*/
userCallback?: ((err?: any) => void) | undefined;
}
/**
*
* Call a login method on the server.
*
* A login method is a method which on success calls `this.setUserId(id)` and
* `Accounts._setLoginToken` on the server and returns an object with fields
* 'id' (containing the user id), 'token' (containing a resume token), and
* optionally `tokenExpires`.
*
* This function takes care of:
* - Updating the Meteor.loggingIn() reactive data source
* - Calling the method in 'wait' mode
* - On success, saving the resume token to localStorage
* - On success, calling Accounts.connection.setUserId()
* - Setting up an onReconnect handler which logs in with
* the resume token
*
* Options:
* - methodName: The method to call (default 'login')
* - methodArguments: The arguments for the method
* - validateResult: If provided, will be called with the result of the
* method. If it throws, the client will not be logged in (and
* its error will be passed to the callback).
* - userCallback: Will be called with no arguments once the user is fully
* logged in, or with the error on error.
*
* */
function callLoginMethod(options: LoginMethodOptions): void;
/**
*
* The main entry point for auth packages to hook in to login.
*
* A login handler is a login method which can return `undefined` to
* indicate that the login request is not handled by this handler.
*
* @param name {String} Optional. The service name, used by default
* if a specific service name isn't returned in the result.
*
* @param handler {Function} A function that receives an options object
* (as passed as an argument to the `login` method) and returns one of:
* - `undefined`, meaning don't handle;
* - a login method result object
**/
function registerLoginHandler(
name: string,
handler: (options: any) => undefined | Object
): void;
type Password =
| string
| {
digest: string;
algorithm: 'sha-256';
};
/**
*
* Check whether the provided password matches the bcrypt'ed password in
* the database user record. `password` can be a string (in which case
* it will be run through SHA256 before bcrypt) or an object with
* properties `digest` and `algorithm` (in which case we bcrypt
* `password.digest`).
*/
function _checkPassword(
user: Meteor.User,
password: Password
): { userId: string; error?: any };
}
export namespace Accounts {
type StampedLoginToken = {
token: string;
when: Date;
};
type HashedStampedLoginToken = {
hashedToken: string;
when: Date;
};
function _generateStampedLoginToken(): StampedLoginToken;
function _hashStampedToken(token: StampedLoginToken): HashedStampedLoginToken;
function _insertHashedLoginToken<T>(
userId: string,
token: HashedStampedLoginToken,
query?: Mongo.Selector<T> | Mongo.ObjectID | string
): void;
function _hashLoginToken(token: string): string;
}

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "accounts-base.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: 'A user account system',
version: '2.2.4',
version: '2.2.5-beta.1',
});
Package.onUse(api => {
@@ -48,6 +48,8 @@ Package.onUse(api => {
// modules that import the accounts-base package.
api.mainModule('server_main.js', 'server');
api.mainModule('client_main.js', 'client');
api.addAssets('accounts-base.d.ts', 'server');
});
Package.onTest(api => {

View File

@@ -0,0 +1,38 @@
export namespace BrowserPolicy {
var framing: {
disallow(): void;
restrictToOrigin(origin: string): void;
allowAll(): void;
};
var content: {
allowEval(): void;
allowInlineStyles(): void;
allowInlineScripts(): void;
allowSameOriginForAll(): void;
allowDataUrlForAll(): void;
allowOriginForAll(origin: string): void;
allowImageOrigin(origin: string): void;
allowMediaOrigin(origin: string): void;
allowFontOrigin(origin: string): void;
allowStyleOrigin(origin: string): void;
allowScriptOrigin(origin: string): void;
allowFrameOrigin(origin: string): void;
allowFrameAncestorsOrigin(origin: string): void;
allowContentTypeSniffing(): void;
allowAllContentOrigin(): void;
allowAllContentDataUrl(): void;
allowAllContentSameOrigin(): void;
allowConnectOrigin(origin: string): void;
allowObjectOrigin(origin: string): void;
disallowAll(): void;
disallowInlineStyles(): void;
disallowEval(): void;
disallowInlineScripts(): void;
disallowFont(): void;
disallowObject(): void;
disallowAllContent(): void;
disallowConnect(): void;
};
}

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "browser-policy-common.d.ts"
}

View File

@@ -1,10 +1,11 @@
Package.describe({
summary: "Common code for browser-policy packages",
version: "1.0.11"
version: "1.0.11-beta.1"
});
Package.onUse(function (api) {
api.use('webapp', 'server');
api.addFiles('browser-policy-common.js', 'server');
api.export('BrowserPolicy', 'server');
api.addAssets('browser-policy-common.d.ts', 'server');
});

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Restrict which websites can frame your app",
version: '1.1.1-beta.0'
version: '1.1.1-beta.1'
});
Package.onUse(function (api) {

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Configure security policies enforced by the browser",
version: '1.1.1-beta.0'
version: '1.1.1-beta.1'
});
Package.onUse(function (api) {

92
packages/check/check.d.ts vendored Normal file
View File

@@ -0,0 +1,92 @@
/**
* The namespace for all Match types and methods.
*/
export namespace Match {
interface Matcher<T> {
_meteorCheckMatcherBrand: void;
}
// prettier-ignore
export type Pattern =
typeof String |
typeof Number |
typeof Boolean |
typeof Object |
typeof Function |
(new (...args: any[]) => any) |
undefined | null | string | number | boolean |
[Pattern] |
{[key: string]: Pattern} |
Matcher<any>;
// prettier-ignore
export type PatternMatch<T extends Pattern> =
T extends Matcher<infer U> ? U :
T extends typeof String ? string :
T extends typeof Number ? number :
T extends typeof Boolean ? boolean :
T extends typeof Object ? object :
T extends typeof Function ? Function :
T extends undefined | null | string | number | boolean ? T :
T extends new (...args: any[]) => infer U ? U :
T extends [Pattern] ? PatternMatch<T[0]>[] :
T extends {[key: string]: Pattern} ? {[K in keyof T]: PatternMatch<T[K]>} :
unknown;
/** Matches any value. */
var Any: Matcher<any>;
/** Matches a signed 32-bit integer. Doesnt match `Infinity`, `-Infinity`, or `NaN`. */
var Integer: Matcher<number>;
/**
* Matches either `undefined`, `null`, or pattern. If used in an object, matches only if the key is not set as opposed to the value being set to `undefined` or `null`. This set of conditions
* was chosen because `undefined` arguments to Meteor Methods are converted to `null` when sent over the wire.
*/
function Maybe<T extends Pattern>(
pattern: T
): Matcher<PatternMatch<T> | undefined | null>;
/** Behaves like `Match.Maybe` except it doesnt accept `null`. If used in an object, the behavior is identical to `Match.Maybe`. */
function Optional<T extends Pattern>(
pattern: T
): Matcher<PatternMatch<T> | undefined>;
/** Matches an Object with the given keys; the value may also have other keys with arbitrary values. */
function ObjectIncluding<T extends { [key: string]: Pattern }>(
dico: T
): Matcher<PatternMatch<T>>;
/** Matches any value that matches at least one of the provided patterns. */
function OneOf<T extends Pattern[]>(
...patterns: T
): Matcher<PatternMatch<T[number]>>;
/**
* Calls the function condition with the value as the argument. If condition returns true, this matches. If condition throws a `Match.Error` or returns false, this fails. If condition throws
* any other error, that error is thrown from the call to `check` or `Match.test`.
*/
function Where<T>(condition: (val: any) => val is T): Matcher<T>;
function Where(condition: (val: any) => boolean): Matcher<any>;
/**
* Returns true if the value matches the pattern.
* @param value The value to check
* @param pattern The pattern to match `value` against
*/
function test<T extends Pattern>(
value: any,
pattern: T
): value is PatternMatch<T>;
}
/**
* Check that a value matches a pattern.
* If the value does not match the pattern, throw a `Match.Error`.
*
* Particularly useful to assert that arguments to a function have the right
* types and structure.
* @param value The value to check
* @param pattern The pattern to match `value` against
*/
export declare function check<T extends Match.Pattern>(
value: any,
pattern: T
): asserts value is Match.PatternMatch<T>;

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "check.d.ts"
}

View File

@@ -1,12 +1,14 @@
Package.describe({
summary: 'Check whether a value matches a pattern',
version: '1.3.1',
version: '1.3.2-beta.1',
});
Package.onUse(api => {
api.use('ecmascript');
api.use('ejson');
api.addAssets('check.d.ts', 'server');
api.mainModule('match.js');
api.export('check');

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Meteor's latency-compensated distributed data client",
version: '2.6.1-beta.0',
version: '2.6.1-beta.1',
documentation: null
});

View File

@@ -0,0 +1,17 @@
export namespace DDPRateLimiter {
interface Matcher {
type?: string | ((type: string) => boolean) | undefined;
name?: string | ((name: string) => boolean) | undefined;
userId?: string | ((userId: string) => boolean) | undefined;
connectionId?: string | ((connectionId: string) => boolean) | undefined;
clientAddress?: string | ((clientAddress: string) => boolean) | undefined;
}
function addRule(
matcher: Matcher,
numRequests: number,
timeInterval: number
): string;
function removeRule(ruleId: string): boolean;
}

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "ddp-rate-limiter.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
name: 'ddp-rate-limiter',
version: '1.1.0',
version: '1.1.0-beta.1',
// Brief, one-line summary of the package.
summary: 'The DDPRateLimiter allows users to add rate limits to DDP' +
' methods and subscriptions.',
@@ -14,6 +14,7 @@ Package.describe({
Package.onUse(function(api) {
api.use('rate-limit', 'server');
api.use('ecmascript');
api.addAssets('ddp-rate-limiter.d.ts', 'server');
api.export('DDPRateLimiter', 'server');
api.mainModule('ddp-rate-limiter.js', 'server');
});

65
packages/ddp/ddp.d.ts vendored Normal file
View File

@@ -0,0 +1,65 @@
import { Meteor } from 'meteor/meteor';
export namespace DDP {
interface DDPStatic {
subscribe(name: string, ...rest: any[]): Meteor.SubscriptionHandle;
call(method: string, ...parameters: any[]): any;
apply(method: string, ...parameters: any[]): any;
methods(IMeteorMethodsDictionary: any): any;
status(): DDPStatus;
reconnect(): void;
disconnect(): void;
onReconnect(): void;
}
function _allSubscriptionsReady(): boolean;
type Status = 'connected' | 'connecting' | 'failed' | 'waiting' | 'offline';
interface DDPStatus {
connected: boolean;
status: Status;
retryCount: number;
retryTime?: number | undefined;
reason?: string | undefined;
}
function connect(url: string): DDPStatic;
}
export namespace DDPCommon {
interface MethodInvocationOptions {
userId: string | null;
setUserId?: ((newUserId: string) => void) | undefined;
isSimulation: boolean;
connection: Meteor.Connection;
randomSeed: string;
}
/** The state for a single invocation of a method, referenced by this inside a method definition. */
interface MethodInvocation {
new (options: MethodInvocationOptions): MethodInvocation;
/**
* Call inside a method invocation. Allow subsequent method from this client to begin running in a new fiber.
*/
unblock(): void;
/**
* Set the logged in user.
* @param userId The value that should be returned by `userId` on this connection.
*/
setUserId(userId: string | null): void;
/**
* The id of the user that made this method call, or `null` if no user was logged in.
*/
userId: string | null;
/**
* Access inside a method invocation. Boolean value, true if this invocation is a stub.
*/
isSimulation: boolean;
/**
* Access inside a method invocation. The [connection](#meteor_onconnection) that this method was received on. `null` if the method is not associated with a connection, eg. a server
* initiated method call. Calls to methods made from a server method which was in turn initiated from the client share the same `connection`.
*/
connection: Meteor.Connection;
}
}

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "ddp.d.ts"
}

View File

@@ -1,12 +1,14 @@
Package.describe({
summary: "Meteor's latency-compensated distributed data framework",
version: '1.4.0'
version: '1.4.0-beta.1'
});
Package.onUse(function (api) {
api.use(['ddp-client'], ['client', 'server']);
api.use(['ddp-server'], 'server');
api.addAssets('ddp.d.ts', 'server');
api.export('DDP');
api.export('DDPServer', 'server');

View File

@@ -5,7 +5,7 @@ base64@1.0.12
binary-heap@1.0.11
boilerplate-generator@1.7.1
callback-hook@1.3.0
check@1.3.1
check@1.3.2-beta.1
ddp@1.4.0
ddp-client@2.4.1
ddp-common@1.4.0
@@ -36,14 +36,14 @@ mongo-id@1.0.8
npm-mongo@3.9.0
ordered-dict@1.1.0
promise@0.11.2
random@1.2.0
random@1.2.1-beta.1
react-fast-refresh@0.1.1
reload@1.3.1
retry@1.1.0
routepolicy@1.1.0
socket-stream-client@0.3.3
tinytest@1.1.0
tracker@1.2.0
underscore@1.0.10
tracker@1.2.1-beta.1
underscore@1.0.11-beta.1
webapp@1.10.1
webapp-hashing@1.1.0

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "An implementation of a diff algorithm on arrays and objects.",
version: '1.1.2-beta.0',
version: '1.1.2-beta.1',
documentation: null
});

View File

@@ -1,6 +1,6 @@
Package.describe({
name: 'ecmascript',
version: '0.16.3-beta.0',
version: '0.16.3-beta.1',
summary: 'Compiler plugin that supports ES2015+ in all .js files',
documentation: 'README.md',
});

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: 'Extended and Extensible JSON library',
version: '1.1.3-beta.0'
version: '1.1.3-beta.1'
});
Package.onUse(function onUse(api) {

44
packages/email/email.d.ts vendored Normal file
View File

@@ -0,0 +1,44 @@
export namespace Email {
interface EmailOptions {
from?: string | undefined;
to?: string | string[] | undefined;
cc?: string | string[] | undefined;
bcc?: string | string[] | undefined;
replyTo?: string | string[] | undefined;
subject?: string | undefined;
text?: string | undefined;
html?: string | undefined;
headers?: Object | undefined;
attachments?: Object[] | undefined;
mailComposer?: MailComposer | undefined;
}
interface CustomEmailOptions extends EmailOptions {
packageSettings?: unknown;
}
function send(options: EmailOptions): void;
function hookSend(fn: (options: EmailOptions) => boolean): void;
function customTransport(fn: (options: CustomEmailOptions) => void): void;
}
export interface MailComposerOptions {
escapeSMTP: boolean;
encoding: string;
charset: string;
keepBcc: boolean;
forceEmbeddedImages: boolean;
}
export declare var MailComposer: MailComposerStatic;
export interface MailComposerStatic {
new (options: MailComposerOptions): MailComposer;
}
export interface MailComposer {
addHeader(name: string, value: string): void;
setMessageOption(from: string, to: string, body: string, html: string): void;
streamMessage(): void;
pipe(stream: any /** fs.WriteStream **/): void;
}

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "email.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: 'Send email messages',
version: '2.2.1',
version: '2.2.1-beta.1',
});
Npm.depends({
@@ -10,6 +10,7 @@ Npm.depends({
Package.onUse(function(api) {
api.use(['ecmascript', 'logging', 'callback-hook'], 'server');
api.addAssets('email.d.ts', 'server');
api.mainModule('email.js', 'server');
api.export(['Email', 'EmailInternals'], 'server');
api.export('EmailTest', 'server', { testOnly: true });

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Facebook OAuth flow",
version: '1.11.1-beta.0'
version: '1.11.1-beta.1'
});
Package.onUse(api => {

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Display internal app statistics",
version: '1.0.1-beta.0'
version: '1.0.1-beta.1'
});
Package.onUse(function (api) {

View File

@@ -1,6 +1,6 @@
Package.describe({
name: "fetch",
version: '0.1.2-beta.0',
version: '0.1.2-beta.1',
summary: "Isomorphic modern/legacy/Node polyfill for WHATWG fetch()",
documentation: "README.md"
});

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: 'GeoJSON utility functions (from https://github.com/maxogden/geojson-js-utils)',
version: '1.0.11-beta.0'
version: '1.0.11-beta.1'
});
Package.onUse(function (api) {

View File

@@ -0,0 +1,14 @@
export interface Module {
readonly hot?: {
accept(): void;
decline(): void;
dispose(callback: (data: object) => void): void;
data: object | null;
onRequire<T>(callbacks: {
before?(requiredModule: Module, parentId: string): T;
after?(requiredModule: Module, data: T): void;
}): void;
};
}
export declare var module: NodeJS.Module;

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "hot-module-replacement.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
name: 'hot-module-replacement',
version: '0.5.1',
version: '0.5.1-beta.1',
summary: 'Update code in development without reloading the page',
documentation: 'README.md',
debugOnly: true,
@@ -11,6 +11,8 @@ Package.onUse(function(api) {
api.use('meteor');
api.use('hot-code-push', { unordered: true });
api.addAssets('hot-module-replacement.d.ts', 'server');
// Provides polyfills needed by Meteor.absoluteUrl in legacy browsers
api.use('ecmascript-runtime-client', { weak: true });

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: 'The Meteor command-line tool',
version: '2.8.1-beta.0',
version: '2.8.1-beta.1',
});
Package.includeTool();

504
packages/meteor/meteor.d.ts vendored Normal file
View File

@@ -0,0 +1,504 @@
import { Mongo } from 'meteor/mongo';
import { EJSONable, EJSONableProperty } from 'meteor/ejson';
import { Blaze } from 'meteor/blaze';
import { DDP } from 'meteor/ddp';
export type global_Error = Error;
export namespace Meteor {
/** Global props **/
/** True if running in client environment. */
var isClient: boolean;
/** True if running in a Cordova mobile environment. */
var isCordova: boolean;
/** True if running in server environment. */
var isServer: boolean;
/** True if running in production environment. */
var isProduction: boolean;
/**
* `Meteor.release` is a string containing the name of the release with which the project was built (for example, `"1.2.3"`). It is `undefined` if the project was built using a git checkout
* of Meteor.
*/
var release: string;
/** Global props **/
/** Settings **/
interface Settings {
public: { [id: string]: any };
[id: string]: any;
}
/**
* `Meteor.settings` contains deployment-specific configuration options. You can initialize settings by passing the `--settings` option (which takes the name of a file containing JSON data)
* to `meteor run` or `meteor deploy`. When running your server directly (e.g. from a bundle), you instead specify settings by putting the JSON directly into the `METEOR_SETTINGS` environment
* variable. If the settings object contains a key named `public`, then `Meteor.settings.public` will be available on the client as well as the server. All other properties of
* `Meteor.settings` are only defined on the server. You can rely on `Meteor.settings` and `Meteor.settings.public` being defined objects (not undefined) on both client and server even if
* there are no settings specified. Changes to `Meteor.settings.public` at runtime will be picked up by new client connections.
*/
var settings: Settings;
/** Settings **/
/** User **/
interface UserEmail {
address: string;
verified: boolean;
}
/**
* UserProfile is left intentionally underspecified here, to allow you
* to override it in your application (but keep in mind that the default
* Meteor configuration allows users to write directly to their user
* record's profile field)
*/
interface UserProfile {}
interface User {
_id: string;
username?: string | undefined;
emails?: UserEmail[] | undefined;
createdAt?: Date | undefined;
profile?: UserProfile;
services?: any;
}
function user(options?: {
fields?: Mongo.FieldSpecifier | undefined;
}): User | null;
function userId(): string | null;
var users: Mongo.Collection<User>;
/** User **/
/** Error **/
/**
* This class represents a symbolic error thrown by a method.
*/
var Error: ErrorStatic;
interface ErrorStatic {
/**
* @param error A string code uniquely identifying this kind of error.
* This string should be used by callers of the method to determine the
* appropriate action to take, instead of attempting to parse the reason
* or details fields. For example:
*
* ```
* // on the server, pick a code unique to this error
* // the reason field should be a useful debug message
* throw new Meteor.Error("logged-out",
* "The user must be logged in to post a comment.");
*
* // on the client
* Meteor.call("methodName", function (error) {
* // identify the error
* if (error && error.error === "logged-out") {
* // show a nice error message
* Session.set("errorMessage", "Please log in to post a comment.");
* }
* });
* ```
*
* For legacy reasons, some built-in Meteor functions such as `check` throw
* errors with a number in this field.
*
* @param reason Optional. A short human-readable summary of the
* error, like 'Not Found'.
* @param details Optional. Additional information about the error,
* like a textual stack trace.
*/
new (error: string | number, reason?: string, details?: string): Error;
}
interface Error extends global_Error {
error: string | number;
reason?: string | undefined;
details?: string | undefined;
}
var TypedError: TypedErrorStatic;
interface TypedErrorStatic {
new (message: string, errorType: string): TypedError;
}
interface TypedError extends global_Error {
message: string;
errorType: string;
}
/** Error **/
/** Method **/
interface MethodThisType {
/** Access inside a method invocation. Boolean value, true if this invocation is a stub. */
isSimulation: boolean;
/** The id of the user that made this method call, or `null` if no user was logged in. */
userId: string | null;
/**
* Access inside a method invocation. The connection that this method was received on. `null` if the method is not associated with a connection, eg. a server initiated method call. Calls
* to methods made from a server method which was in turn initiated from the client share the same `connection`. */
connection: Connection | null;
/**
* Set the logged in user.
* @param userId The value that should be returned by `userId` on this connection.
*/
setUserId(userId: string | null): void;
/** Call inside a method invocation. Allow subsequent method from this client to begin running in a new fiber. */
unblock(): void;
}
/**
* Defines functions that can be invoked over the network by clients.
* @param methods Dictionary whose keys are method names and values are functions.
*/
function methods(methods: {
[key: string]: (this: MethodThisType, ...args: any[]) => any;
}): void;
/**
* Invokes a method passing any number of arguments.
* @param name Name of method to invoke
* @param args Optional method arguments
*/
function call(name: string, ...args: any[]): any;
function apply<
Result extends
| EJSONable
| EJSONable[]
| EJSONableProperty
| EJSONableProperty[]
>(
name: string,
args: ReadonlyArray<EJSONable | EJSONableProperty>,
options?: {
wait?: boolean | undefined;
onResultReceived?:
| ((
error: global_Error | Meteor.Error | undefined,
result?: Result
) => void)
| undefined;
/**
* (Client only) if true, don't send this method again on reload, simply call the callback an error with the error code 'invocation-failed'.
*/
noRetry?: boolean | undefined;
returnStubValue?: boolean | undefined;
throwStubExceptions?: boolean | undefined;
},
asyncCallback?: (
error: global_Error | Meteor.Error | undefined,
result?: Result
) => void
): any;
/** Method **/
/** Url **/
/**
* Generate an absolute URL pointing to the application. The server reads from the `ROOT_URL` environment variable to determine where it is running. This is taken care of automatically for
* apps deployed to Galaxy, but must be provided when using `meteor build`.
*/
var absoluteUrl: {
/**
* @param path A path to append to the root URL. Do not include a leading "`/`".
*/
(path?: string, options?: absoluteUrlOptions): string;
defaultOptions: absoluteUrlOptions;
};
interface absoluteUrlOptions {
/** Create an HTTPS URL. */
secure?: boolean | undefined;
/** Replace localhost with 127.0.0.1. Useful for services that don't recognize localhost as a domain name. */
replaceLocalhost?: boolean | undefined;
/** Override the default ROOT_URL from the server environment. For example: "`http://foo.example.com`" */
rootUrl?: string | undefined;
}
/** Url **/
/** Timeout **/
/**
* Call a function repeatedly, with a time delay between calls.
* @param func The function to run
* @param delay Number of milliseconds to wait between each function call.
*/
function setInterval(func: Function, delay: number): number;
/**
* Call a function in the future after waiting for a specified delay.
* @param func The function to run
* @param delay Number of milliseconds to wait before calling function
*/
function setTimeout(func: Function, delay: number): number;
/**
* Cancel a repeating function call scheduled by `Meteor.setInterval`.
* @param id The handle returned by `Meteor.setInterval`
*/
function clearInterval(id: number): void;
/**
* Cancel a function call scheduled by `Meteor.setTimeout`.
* @param id The handle returned by `Meteor.setTimeout`
*/
function clearTimeout(id: number): void;
/**
* Defer execution of a function to run asynchronously in the background (similar to `Meteor.setTimeout(func, 0)`.
* @param func The function to run
*/
function defer(func: Function): void;
/** Timeout **/
/** utils **/
/**
* Run code when a client or a server starts.
* @param func A function to run on startup.
*/
function startup(func: Function): void;
/**
* Wrap a function that takes a callback function as its final parameter.
* The signature of the callback of the wrapped function should be `function(error, result){}`.
* On the server, the wrapped function can be used either synchronously (without passing a callback) or asynchronously
* (when a callback is passed). On the client, a callback is always required; errors will be logged if there is no callback.
* If a callback is provided, the environment captured when the original function was called will be restored in the callback.
* The parameters of the wrapped function must not contain any optional parameters or be undefined, as the callback function is expected to be the final, non-undefined parameter.
* @param func A function that takes a callback as its final parameter
* @param context Optional `this` object against which the original function will be invoked
*/
function wrapAsync(func: Function, context?: Object): any;
function bindEnvironment<TFunc extends Function>(func: TFunc): TFunc;
class EnvironmentVariable<T> {
readonly slot: number;
constructor();
get(): T;
getOrNullIfOutsideFiber(): T | null;
withValue<U>(value: T, fn: () => U): U;
}
/** utils **/
/** Pub/Sub **/
interface SubscriptionHandle {
/** Cancel the subscription. This will typically result in the server directing the client to remove the subscriptions data from the clients cache. */
stop(): void;
/** True if the server has marked the subscription as ready. A reactive data source. */
ready(): boolean;
}
interface LiveQueryHandle {
stop(): void;
}
/** Pub/Sub **/
}
export namespace Meteor {
/** Login **/
interface LoginWithExternalServiceOptions {
requestPermissions?: ReadonlyArray<string> | undefined;
requestOfflineToken?: Boolean | undefined;
forceApprovalPrompt?: Boolean | undefined;
loginUrlParameters?: Object | undefined;
redirectUrl?: string | undefined;
loginHint?: string | undefined;
loginStyle?: string | undefined;
}
function loginWithMeteorDeveloperAccount(
options?: Meteor.LoginWithExternalServiceOptions,
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
function loginWithFacebook(
options?: Meteor.LoginWithExternalServiceOptions,
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
function loginWithGithub(
options?: Meteor.LoginWithExternalServiceOptions,
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
function loginWithGoogle(
options?: Meteor.LoginWithExternalServiceOptions,
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
function loginWithMeetup(
options?: Meteor.LoginWithExternalServiceOptions,
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
function loginWithTwitter(
options?: Meteor.LoginWithExternalServiceOptions,
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
function loginWithWeibo(
options?: Meteor.LoginWithExternalServiceOptions,
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
function loginWith<ExternalService>(
options?: {
requestPermissions?: ReadonlyArray<string> | undefined;
requestOfflineToken?: boolean | undefined;
loginUrlParameters?: Object | undefined;
userEmail?: string | undefined;
loginStyle?: string | undefined;
redirectUrl?: string | undefined;
},
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
function loginWithPassword(
user: Object | string,
password: string,
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
function loginWithToken(
token: string,
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
function loggingIn(): boolean;
function loggingOut(): boolean;
function logout(
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
function logoutOtherClients(
callback?: (error?: global_Error | Meteor.Error | Meteor.TypedError) => void
): void;
/** Login **/
/** Event **/
interface Event {
type: string;
target: HTMLElement;
currentTarget: HTMLElement;
which: number;
stopPropagation(): void;
stopImmediatePropagation(): void;
preventDefault(): void;
isPropagationStopped(): boolean;
isImmediatePropagationStopped(): boolean;
isDefaultPrevented(): boolean;
}
interface EventHandlerFunction extends Function {
(event?: Meteor.Event, templateInstance?: Blaze.TemplateInstance): void;
}
interface EventMap {
[id: string]: Meteor.EventHandlerFunction;
}
/** Event **/
/** Connection **/
function reconnect(): void;
function disconnect(): void;
/** Connection **/
/** Status **/
function status(): DDP.DDPStatus;
/** Status **/
/** Pub/Sub **/
/**
* Subscribe to a record set. Returns a handle that provides
* `stop()` and `ready()` methods.
* @param name Name of the subscription. Matches the name of the
* server's `publish()` call.
* @param args Optional arguments passed to publisher
* function on server.
* @param callbacks Optional. May include `onStop`
* and `onReady` callbacks. If there is an error, it is passed as an
* argument to `onStop`. If a function is passed instead of an object, it
* is interpreted as an `onReady` callback.
*/
function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
/** Pub/Sub **/
}
export namespace Meteor {
/** Connection **/
interface Connection {
id: string;
close: () => void;
onClose: (callback: () => void) => void;
clientAddress: string;
httpHeaders: Object;
}
function onConnection(callback: (connection: Connection) => void): void;
/** Connection **/
/**
* Publish a record set.
* @param name If String, name of the record set. If Object, publications Dictionary of publish functions by name. If `null`, the set has no name, and the record set is automatically sent to
* all connected clients.
* @param func Function called on the server each time a client subscribes. Inside the function, `this` is the publish handler object, described below. If the client passed arguments to
* `subscribe`, the function is called with the same arguments.
*/
function publish(
name: string | null,
func: (this: Subscription, ...args: any[]) => void,
options?: { is_auto: boolean }
): void;
function _debug(...args: any[]): void;
}
export interface Subscription {
/**
* Call inside the publish function. Informs the subscriber that a document has been added to the record set.
* @param collection The name of the collection that contains the new document.
* @param id The new document's ID.
* @param fields The fields in the new document. If `_id` is present it is ignored.
*/
added(collection: string, id: string, fields: Object): void;
/**
* Call inside the publish function. Informs the subscriber that a document in the record set has been modified.
* @param collection The name of the collection that contains the changed document.
* @param id The changed document's ID.
* @param fields The fields in the document that have changed, together with their new values. If a field is not present in `fields` it was left unchanged; if it is present in `fields` and
* has a value of `undefined` it was removed from the document. If `_id` is present it is ignored.
*/
changed(collection: string, id: string, fields: Object): void;
/** Access inside the publish function. The incoming connection for this subscription. */
connection: Meteor.Connection;
/**
* Call inside the publish function. Stops this client's subscription, triggering a call on the client to the `onStop` callback passed to `Meteor.subscribe`, if any. If `error` is not a
* `Meteor.Error`, it will be sanitized.
* @param error The error to pass to the client.
*/
error(error: Error): void;
/**
* Call inside the publish function. Registers a callback function to run when the subscription is stopped.
* @param func The callback function
*/
onStop(func: Function): void;
/**
* Call inside the publish function. Informs the subscriber that an initial, complete snapshot of the record set has been sent. This will trigger a call on the client to the `onReady`
* callback passed to `Meteor.subscribe`, if any.
*/
ready(): void;
/**
* Call inside the publish function. Informs the subscriber that a document has been removed from the record set.
* @param collection The name of the collection that the document has been removed from.
* @param id The ID of the document that has been removed.
*/
removed(collection: string, id: string): void;
/**
* Access inside the publish function. The incoming connection for this subscription.
*/
stop(): void;
/**
* Call inside the publish function. Allows subsequent methods or subscriptions for the client of this subscription
* to begin running without waiting for the publishing to become ready.
*/
unblock(): void;
/** Access inside the publish function. The id of the logged-in user, or `null` if no user is logged in. */
userId: string | null;
}
export namespace Meteor {
/** Global props **/
/** True if running in development environment. */
var isDevelopment: boolean;
var isTest: boolean;
var isAppTest: boolean;
/** Global props **/
}

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "meteor.d.ts"
}

View File

@@ -2,7 +2,7 @@
Package.describe({
summary: "Core Meteor environment",
version: '1.10.1'
version: '1.10.1-beta.1'
});
Package.registerBuildPlugin({
@@ -54,6 +54,8 @@ Package.onUse(function (api) {
// People expect process.exit() to not swallow console output.
// On Windows, it sometimes does, so we fix it for all apps and packages
api.addFiles('flush-buffers-on-exit-in-windows.js', 'server');
api.addAssets('meteor.d.ts', 'server');
});
Package.onTest(function (api) {

4
packages/modern-browsers/modern.d.ts vendored Normal file
View File

@@ -0,0 +1,4 @@
export declare function setMinimumBrowserVersions(
versions: Record<string, number | number[]>,
source: string
): void;

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "modern.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
name: 'modern-browsers',
version: '0.1.8',
version: '0.1.8-beta.1',
summary:
'API for defining the boundary between modern and legacy ' +
'JavaScript clients',
@@ -10,6 +10,7 @@ Package.describe({
Package.onUse(function(api) {
api.use('modules');
api.mainModule('modern.js', 'server');
api.addAssets('modern.d.ts', 'server');
});
Package.onTest(function(api) {

View File

@@ -1,6 +1,6 @@
Package.describe({
name: 'modules-runtime-hot',
version: '0.14.1-beta.0',
version: '0.14.1-beta.1',
summary: 'Patches modules-runtime to support Hot Module Replacement',
git: 'https://github.com/benjamn/install',
documentation: 'README.md',

View File

@@ -1,6 +1,6 @@
Package.describe({
name: "modules-runtime",
version: '0.13.2-beta.0',
version: '0.13.2-beta.1',
summary: "CommonJS module system",
git: "https://github.com/benjamn/install",
documentation: "README.md"

598
packages/mongo/mongo.d.ts vendored Normal file
View File

@@ -0,0 +1,598 @@
import * as MongoNpmModule from 'mongodb';
import {
Collection as MongoCollection,
CreateIndexesOptions,
Db as MongoDb,
Hint,
IndexSpecification,
MongoClient,
} from 'mongodb';
import { Meteor } from 'meteor/meteor';
// Based on https://github.com/microsoft/TypeScript/issues/28791#issuecomment-443520161
export type UnionOmit<T, K extends keyof any> = T extends T
? Pick<T, Exclude<keyof T, K>>
: never;
export namespace Mongo {
// prettier-ignore
type BsonType = 1 | "double" |
2 | "string" |
3 | "object" |
4 | "array" |
5 | "binData" |
6 | "undefined" |
7 | "objectId" |
8 | "bool" |
9 | "date" |
10 | "null" |
11 | "regex" |
12 | "dbPointer" |
13 | "javascript" |
14 | "symbol" |
15 | "javascriptWithScope" |
16 | "int" |
17 | "timestamp" |
18 | "long" |
19 | "decimal" |
-1 | "minKey" |
127 | "maxKey" | "number";
type FieldExpression<T> = {
$eq?: T | undefined;
$gt?: T | undefined;
$gte?: T | undefined;
$lt?: T | undefined;
$lte?: T | undefined;
$in?: T[] | undefined;
$nin?: T[] | undefined;
$ne?: T | undefined;
$exists?: boolean | undefined;
$type?: BsonType[] | BsonType | undefined;
$not?: FieldExpression<T> | undefined;
$expr?: FieldExpression<T> | undefined;
$jsonSchema?: any;
$mod?: number[] | undefined;
$regex?: RegExp | string | undefined;
$options?: string | undefined;
$text?:
| {
$search: string;
$language?: string | undefined;
$caseSensitive?: boolean | undefined;
$diacriticSensitive?: boolean | undefined;
}
| undefined;
$where?: string | Function | undefined;
$geoIntersects?: any;
$geoWithin?: any;
$near?: any;
$nearSphere?: any;
$all?: T[] | undefined;
$elemMatch?: T extends {} ? Query<T> : FieldExpression<T> | undefined;
$size?: number | undefined;
$bitsAllClear?: any;
$bitsAllSet?: any;
$bitsAnyClear?: any;
$bitsAnySet?: any;
$comment?: string | undefined;
};
type Flatten<T> = T extends any[] ? T[0] : T;
type Query<T> = {
[P in keyof T]?: Flatten<T[P]> | RegExp | FieldExpression<Flatten<T[P]>>;
} & {
$or?: Query<T>[] | undefined;
$and?: Query<T>[] | undefined;
$nor?: Query<T>[] | undefined;
} & Dictionary<any>;
type QueryWithModifiers<T> = {
$query: Query<T>;
$comment?: string | undefined;
$explain?: any;
$hint?: Hint;
$maxScan?: any;
$max?: any;
$maxTimeMS?: any;
$min?: any;
$orderby?: any;
$returnKey?: any;
$showDiskLoc?: any;
$natural?: any;
};
type Selector<T> = Query<T> | QueryWithModifiers<T>;
type Dictionary<T> = { [key: string]: T };
type PartialMapTo<T, M> = Partial<Record<keyof T, M>>;
type OnlyArrays<T> = T extends any[] ? T : never;
type OnlyElementsOfArrays<T> = T extends any[] ? Partial<T[0]> : never;
type ElementsOf<T> = {
[P in keyof T]?: OnlyElementsOfArrays<T[P]>;
};
type PushModifier<T> = {
[P in keyof T]?:
| OnlyElementsOfArrays<T[P]>
| {
$each?: T[P] | undefined;
$position?: number | undefined;
$slice?: number | undefined;
$sort?: 1 | -1 | Dictionary<number> | undefined;
};
};
type ArraysOrEach<T> = {
[P in keyof T]?: OnlyElementsOfArrays<T[P]> | { $each: T[P] };
};
type CurrentDateModifier = { $type: 'timestamp' | 'date' } | true;
type Modifier<T> =
| T
| {
$currentDate?:
| (Partial<Record<keyof T, CurrentDateModifier>> &
Dictionary<CurrentDateModifier>)
| undefined;
$inc?: (PartialMapTo<T, number> & Dictionary<number>) | undefined;
$min?:
| (PartialMapTo<T, Date | number> & Dictionary<Date | number>)
| undefined;
$max?:
| (PartialMapTo<T, Date | number> & Dictionary<Date | number>)
| undefined;
$mul?: (PartialMapTo<T, number> & Dictionary<number>) | undefined;
$rename?: (PartialMapTo<T, string> & Dictionary<string>) | undefined;
$set?: (Partial<T> & Dictionary<any>) | undefined;
$setOnInsert?: (Partial<T> & Dictionary<any>) | undefined;
$unset?:
| (PartialMapTo<T, string | boolean | 1 | 0> & Dictionary<any>)
| undefined;
$addToSet?: (ArraysOrEach<T> & Dictionary<any>) | undefined;
$push?: (PushModifier<T> & Dictionary<any>) | undefined;
$pull?: (ElementsOf<T> & Dictionary<any>) | undefined;
$pullAll?: (Partial<T> & Dictionary<any>) | undefined;
$pop?: (PartialMapTo<T, 1 | -1> & Dictionary<1 | -1>) | undefined;
};
type OptionalId<TSchema> = UnionOmit<TSchema, '_id'> & { _id?: any };
interface SortSpecifier {}
interface FieldSpecifier {
[id: string]: Number;
}
type Transform<T> = ((doc: T) => any) | null | undefined;
type Options<T> = {
/** Sort order (default: natural order) */
sort?: SortSpecifier | undefined;
/** Number of results to skip at the beginning */
skip?: number | undefined;
/** Maximum number of results to return */
limit?: number | undefined;
/** Dictionary of fields to return or exclude. */
fields?: FieldSpecifier | undefined;
/** (Server only) Overrides MongoDB's default index selection and query optimization process. Specify an index to force its use, either by its name or index specification. */
hint?: Hint | undefined;
/** (Client only) Default `true`; pass `false` to disable reactivity */
reactive?: boolean | undefined;
/** Overrides `transform` on the [`Collection`](#collections) for this cursor. Pass `null` to disable transformation. */
transform?: Transform<T> | undefined;
};
type DispatchTransform<Transform, T, U> = Transform extends (
...args: any
) => any
? ReturnType<Transform>
: Transform extends null
? T
: U;
var Collection: CollectionStatic;
interface CollectionStatic {
/**
* Constructor for a Collection
* @param name The name of the collection. If null, creates an unmanaged (unsynchronized) local collection.
*/
new <T extends MongoNpmModule.Document, U = T>(
name: string | null,
options?: {
/**
* The server connection that will manage this collection. Uses the default connection if not specified. Pass the return value of calling `DDP.connect` to specify a different
* server. Pass `null` to specify no connection. Unmanaged (`name` is null) collections cannot specify a connection.
*/
connection?: Object | null | undefined;
/** The method of generating the `_id` fields of new documents in this collection. Possible values:
* - **`'STRING'`**: random strings
* - **`'MONGO'`**: random [`Mongo.ObjectID`](#mongo_object_id) values
*
* The default id generation technique is `'STRING'`.
*/
idGeneration?: string | undefined;
/**
* An optional transformation function. Documents will be passed through this function before being returned from `fetch` or `findOne`, and before being passed to callbacks of
* `observe`, `map`, `forEach`, `allow`, and `deny`. Transforms are *not* applied for the callbacks of `observeChanges` or to cursors returned from publish functions.
*/
transform?: (doc: T) => U;
/** Set to `false` to skip setting up the mutation methods that enable insert/update/remove from client code. Default `true`. */
defineMutationMethods?: boolean | undefined;
}
): Collection<T, U>;
}
interface Collection<T extends MongoNpmModule.Document, U = T> {
allow<Fn extends Transform<T> = undefined>(options: {
insert?:
| ((userId: string, doc: DispatchTransform<Fn, T, U>) => boolean)
| undefined;
update?:
| ((
userId: string,
doc: DispatchTransform<Fn, T, U>,
fieldNames: string[],
modifier: any
) => boolean)
| undefined;
remove?:
| ((userId: string, doc: DispatchTransform<Fn, T, U>) => boolean)
| undefined;
fetch?: string[] | undefined;
transform?: Fn | undefined;
}): boolean;
createCappedCollectionAsync(
byteSize?: number,
maxDocuments?: number
): Promise<void>;
createIndex(
indexSpec: IndexSpecification,
options?: CreateIndexesOptions
): void;
createIndexAsync(
indexSpec: IndexSpecification,
options?: CreateIndexesOptions
): Promise<void>;
deny<Fn extends Transform<T> = undefined>(options: {
insert?:
| ((userId: string, doc: DispatchTransform<Fn, T, U>) => boolean)
| undefined;
update?:
| ((
userId: string,
doc: DispatchTransform<Fn, T, U>,
fieldNames: string[],
modifier: any
) => boolean)
| undefined;
remove?:
| ((userId: string, doc: DispatchTransform<Fn, T, U>) => boolean)
| undefined;
fetch?: string[] | undefined;
transform?: Fn | undefined;
}): boolean;
dropCollectionAsync(): Promise<void>;
dropIndexAsync(indexName: string): void;
/**
* Find the documents in a collection that match the selector.
* @param selector A query describing the documents to find
*/
find(selector?: Selector<T> | ObjectID | string): Cursor<T, U>;
/**
* Find the documents in a collection that match the selector.
* @param selector A query describing the documents to find
*/
find<O extends Options<T>>(
selector?: Selector<T> | ObjectID | string,
options?: O
): Cursor<T, DispatchTransform<O['transform'], T, U>>;
/**
* Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found.
* @param selector A query describing the documents to find
*/
findOne(selector?: Selector<T> | ObjectID | string): U | undefined;
/**
* Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found.
* @param selector A query describing the documents to find
*/
findOne<O extends Omit<Options<T>, 'limit'>>(
selector?: Selector<T> | ObjectID | string,
options?: O
): DispatchTransform<O['transform'], T, U> | undefined;
/**
* Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found.
* @param selector A query describing the documents to find
*/
findOneAsync(
selector?: Selector<T> | ObjectID | string
): Promise<U | undefined>;
/**
* Finds the first document that matches the selector, as ordered by sort and skip options. Returns `undefined` if no matching document is found.
* @param selector A query describing the documents to find
*/
findOneAsync<O extends Omit<Options<T>, 'limit'>>(
selector?: Selector<T> | ObjectID | string,
options?: O
): Promise<DispatchTransform<O['transform'], T, U> | undefined>;
/**
* Insert a document in the collection. Returns its unique _id.
* @param doc The document to insert. May not yet have an _id attribute, in which case Meteor will generate one for you.
* @param callback If present, called with an error object as the first argument and, if no error, the _id as the second.
*/
insert(doc: OptionalId<T>, callback?: Function): string;
/**
* Insert a document in the collection. Returns its unique _id.
* @param doc The document to insert. May not yet have an _id attribute, in which case Meteor will generate one for you.
* @param callback If present, called with an error object as the first argument and, if no error, the _id as the second.
*/
insertAsync(doc: OptionalId<T>, callback?: Function): Promise<string>;
/**
* Returns the [`Collection`](http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html) object corresponding to this collection from the
* [npm `mongodb` driver module](https://www.npmjs.com/package/mongodb) which is wrapped by `Mongo.Collection`.
*/
rawCollection(): MongoCollection<T>;
/**
* Returns the [`Db`](http://mongodb.github.io/node-mongodb-native/3.0/api/Db.html) object corresponding to this collection's database connection from the
* [npm `mongodb` driver module](https://www.npmjs.com/package/mongodb) which is wrapped by `Mongo.Collection`.
*/
rawDatabase(): MongoDb;
/**
* Remove documents from the collection
* @param selector Specifies which documents to remove
* @param callback If present, called with an error object as its argument.
*/
remove(
selector: Selector<T> | ObjectID | string,
callback?: Function
): number;
/**
* Remove documents from the collection
* @param selector Specifies which documents to remove
* @param callback If present, called with an error object as its argument.
*/
removeAsync(
selector: Selector<T> | ObjectID | string,
callback?: Function
): Promise<number>;
/**
* Modify one or more documents in the collection. Returns the number of matched documents.
* @param selector Specifies which documents to modify
* @param modifier Specifies how to modify the documents
* @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second.
*/
update(
selector: Selector<T> | ObjectID | string,
modifier: Modifier<T>,
options?: {
/** True to modify all matching documents; false to only modify one of the matching documents (the default). */
multi?: boolean | undefined;
/** True to insert a document if no matching documents are found. */
upsert?: boolean | undefined;
/**
* Used in combination with MongoDB [filtered positional operator](https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/) to specify which elements to
* modify in an array field.
*/
arrayFilters?: { [identifier: string]: any }[] | undefined;
},
callback?: Function
): number;
/**
* Modify one or more documents in the collection. Returns the number of matched documents.
* @param selector Specifies which documents to modify
* @param modifier Specifies how to modify the documents
* @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second.
*/
updateAsync(
selector: Selector<T> | ObjectID | string,
modifier: Modifier<T>,
options?: {
/** True to modify all matching documents; false to only modify one of the matching documents (the default). */
multi?: boolean | undefined;
/** True to insert a document if no matching documents are found. */
upsert?: boolean | undefined;
/**
* Used in combination with MongoDB [filtered positional operator](https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/) to specify which elements to
* modify in an array field.
*/
arrayFilters?: { [identifier: string]: any }[] | undefined;
},
callback?: Function
): Promise<number>;
/**
* Modify one or more documents in the collection, or insert one if no matching documents were found. Returns an object with keys `numberAffected` (the number of documents modified) and
* `insertedId` (the unique _id of the document that was inserted, if any).
* @param selector Specifies which documents to modify
* @param modifier Specifies how to modify the documents
* @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second.
*/
upsert(
selector: Selector<T> | ObjectID | string,
modifier: Modifier<T>,
options?: {
/** True to modify all matching documents; false to only modify one of the matching documents (the default). */
multi?: boolean | undefined;
},
callback?: Function
): {
numberAffected?: number | undefined;
insertedId?: string | undefined;
};
/**
* Modify one or more documents in the collection, or insert one if no matching documents were found. Returns an object with keys `numberAffected` (the number of documents modified) and
* `insertedId` (the unique _id of the document that was inserted, if any).
* @param selector Specifies which documents to modify
* @param modifier Specifies how to modify the documents
* @param callback If present, called with an error object as the first argument and, if no error, the number of affected documents as the second.
*/
upsertAsync(
selector: Selector<T> | ObjectID | string,
modifier: Modifier<T>,
options?: {
/** True to modify all matching documents; false to only modify one of the matching documents (the default). */
multi?: boolean | undefined;
},
callback?: Function
): Promise<{
numberAffected?: number | undefined;
insertedId?: string | undefined;
}>;
_createCappedCollection(byteSize?: number, maxDocuments?: number): void;
/** @deprecated */
_ensureIndex(
indexSpec: IndexSpecification,
options?: CreateIndexesOptions
): void;
_dropCollection(): Promise<void>;
_dropIndex(indexName: string): void;
}
var Cursor: CursorStatic;
interface CursorStatic {
/**
* To create a cursor, use find. To access the documents in a cursor, use forEach, map, or fetch.
*/
new <T, U = T>(): Cursor<T, U>;
}
interface ObserveCallbacks<T> {
added?(document: T): void;
addedAt?(document: T, atIndex: number, before: T | null): void;
changed?(newDocument: T, oldDocument: T): void;
changedAt?(newDocument: T, oldDocument: T, indexAt: number): void;
removed?(oldDocument: T): void;
removedAt?(oldDocument: T, atIndex: number): void;
movedTo?(
document: T,
fromIndex: number,
toIndex: number,
before: T | null
): void;
}
interface ObserveChangesCallbacks<T> {
added?(id: string, fields: Partial<T>): void;
addedBefore?(id: string, fields: Partial<T>, before: T | null): void;
changed?(id: string, fields: Partial<T>): void;
movedBefore?(id: string, before: T | null): void;
removed?(id: string): void;
}
interface Cursor<T, U = T> {
/**
* Returns the number of documents that match a query.
* @param applySkipLimit If set to `false`, the value returned will reflect the total number of matching documents, ignoring any value supplied for limit. (Default: true)
*/
count(applySkipLimit?: boolean): number;
/**
* Returns the number of documents that match a query.
* @param applySkipLimit If set to `false`, the value returned will reflect the total number of matching documents, ignoring any value supplied for limit. (Default: true)
*/
countAsync(applySkipLimit?: boolean): Promise<number>;
/**
* Return all matching documents as an Array.
*/
fetch(): Array<U>;
/**
* Return all matching documents as an Array.
*/
fetchAsync(): Promise<Array<U>>;
/**
* Call `callback` once for each matching document, sequentially and
* synchronously.
* @param callback Function to call. It will be called with three arguments: the document, a 0-based index, and <em>cursor</em> itself.
* @param thisArg An object which will be the value of `this` inside `callback`.
*/
forEach(
callback: (doc: U, index: number, cursor: Cursor<T, U>) => void,
thisArg?: any
): void;
/**
* Call `callback` once for each matching document, sequentially and
* synchronously.
* @param callback Function to call. It will be called with three arguments: the document, a 0-based index, and <em>cursor</em> itself.
* @param thisArg An object which will be the value of `this` inside `callback`.
*/
forEachAsync(
callback: (doc: U, index: number, cursor: Cursor<T, U>) => void,
thisArg?: any
): Promise<void>;
/**
* Map callback over all matching documents. Returns an Array.
* @param callback Function to call. It will be called with three arguments: the document, a 0-based index, and <em>cursor</em> itself.
* @param thisArg An object which will be the value of `this` inside `callback`.
*/
map<M>(
callback: (doc: U, index: number, cursor: Cursor<T, U>) => M,
thisArg?: any
): Array<M>;
/**
* Map callback over all matching documents. Returns an Array.
* @param callback Function to call. It will be called with three arguments: the document, a 0-based index, and <em>cursor</em> itself.
* @param thisArg An object which will be the value of `this` inside `callback`.
*/
mapAsync<M>(
callback: (doc: U, index: number, cursor: Cursor<T, U>) => M,
thisArg?: any
): Promise<Array<M>>;
/**
* Watch a query. Receive callbacks as the result set changes.
* @param callbacks Functions to call to deliver the result set as it changes
*/
observe(callbacks: ObserveCallbacks<U>): Meteor.LiveQueryHandle;
/**
* Watch a query. Receive callbacks as the result set changes. Only the differences between the old and new documents are passed to the callbacks.
* @param callbacks Functions to call to deliver the result set as it changes
*/
observeChanges(
callbacks: ObserveChangesCallbacks<T>,
options?: { nonMutatingCallbacks?: boolean | undefined }
): Meteor.LiveQueryHandle;
[Symbol.iterator](): Iterator<T, never, never>;
[Symbol.asyncIterator](): AsyncIterator<T, never, never>;
}
var ObjectID: ObjectIDStatic;
interface ObjectIDStatic {
/**
* Create a Mongo-style `ObjectID`. If you don't specify a `hexString`, the `ObjectID` will generated randomly (not using MongoDB's ID construction rules).
* @param hexString The 24-character hexadecimal contents of the ObjectID to create
*/
new (hexString?: string): ObjectID;
}
interface ObjectID {
toHexString(): string;
equals(otherID: ObjectID): boolean;
}
function setConnectionOptions(options: any): void;
}
export namespace Mongo {
interface AllowDenyOptions {
insert?: ((userId: string, doc: any) => boolean) | undefined;
update?:
| ((
userId: string,
doc: any,
fieldNames: string[],
modifier: any
) => boolean)
| undefined;
remove?: ((userId: string, doc: any) => boolean) | undefined;
fetch?: string[] | undefined;
transform?: Function | null | undefined;
}
}
export declare module MongoInternals {
interface MongoConnection {
db: MongoDb;
client: MongoClient;
}
function defaultRemoteCollectionDriver(): {
mongo: MongoConnection;
};
var NpmModules: {
mongodb: {
version: string;
module: typeof MongoNpmModule;
};
};
}

View File

@@ -9,7 +9,7 @@
Package.describe({
summary: "Adaptor for using MongoDB and Minimongo over DDP",
version: '1.16.1-beta.0'
version: '1.16.1-beta.1'
});
Npm.depends({
@@ -82,6 +82,7 @@ Package.onUse(function (api) {
api.addFiles('remote_collection_driver.js', 'server');
api.addFiles('collection.js', ['client', 'server']);
api.addFiles('connection_options.js', 'server');
api.addAssets('mongo.d.ts', 'server');
});
Package.onTest(function (api) {

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "mongo.d.ts"
}

View File

@@ -7,7 +7,7 @@ blaze@2.3.4
boilerplate-generator@1.7.1
caching-compiler@1.2.2
callback-hook@1.3.1
check@1.3.1
check@1.3.2-beta.1
ddp@1.4.0
ddp-client@2.5.0
ddp-common@1.4.0
@@ -40,16 +40,16 @@ npm-mongo@3.9.0
observe-sequence@1.0.19
ordered-dict@1.1.0
promise@0.12.0
random@1.2.0
random@1.2.1-beta.1
react-fast-refresh@0.1.1
reactive-var@1.0.11
reactive-var@1.0.12-beta.1
reload@1.3.1
retry@1.1.0
routepolicy@1.1.1
socket-stream-client@0.4.0
test-helpers@1.2.0
tinytest@1.1.1
tracker@1.2.0
underscore@1.0.10
tracker@1.2.1-beta.1
underscore@1.0.11-beta.1
webapp@1.11.1
webapp-hashing@1.1.0

View File

@@ -3,7 +3,7 @@
Package.describe({
summary: "Wrapper around the mongo npm package",
version: '4.11.0-beta.0',
version: '4.11.0-beta.1',
documentation: null
});

View File

@@ -1,6 +1,6 @@
Package.describe({
name: "promise",
version: "0.12.0",
version: "0.12.0-beta.1",
summary: "ECMAScript 2015 Promise polyfill with Fiber support",
git: "https://github.com/meteor/promise",
documentation: "README.md"
@@ -20,6 +20,7 @@ Package.onUse(function(api) {
api.mainModule("client.js", "client");
api.mainModule("server.js", "server");
api.export("Promise");
api.addAssets("promise.d.ts", ["client", "server"]);
});
Package.onTest(function(api) {

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "promise.d.ts"
}

23
packages/promise/promise.d.ts vendored Normal file
View File

@@ -0,0 +1,23 @@
export declare class Promise<T> extends globalThis.Promise<T> {
static async<
Fn extends (this: This, ...args: Args) => any,
This,
Args extends any[]
>(
fn: Fn,
allowReuseOfCurrentFiber?: boolean
): (this: This, ...args: Args) => Promise<ReturnType<Fn>>;
static asyncApply<
Fn extends (this: This, ...args: Args) => any,
This,
Args extends any[]
>(
fn: Fn,
context: This,
args: Args,
allowReuseOfCurrentFiber?: boolean
): Promise<ReturnType<Fn>>;
static await<T>(value: PromiseLike<T>): T;
static awaitAll<T>(values: Iterable<T | PromiseLike<T>>): T[];
await(): T;
}

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "random.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: 'Random number generator and utilities',
version: '1.2.0',
version: '1.2.1-beta.1',
});
Package.onUse(function (api) {
@@ -8,6 +8,7 @@ Package.onUse(function (api) {
api.export('Random');
api.mainModule('main_client.js', 'client');
api.mainModule('main_server.js', 'server');
api.addAssets('random.d.ts', 'server');
});
Package.onTest(function (api) {

13
packages/random/random.d.ts vendored Normal file
View File

@@ -0,0 +1,13 @@
export namespace Random {
function id(numberOfChars?: number): string;
function secret(numberOfChars?: number): string;
function fraction(): number;
// @param numberOfDigits, @returns a random hex string of the given length
function hexString(numberOfDigits: number): string;
// @param array, @return a random element in array
function choice<T>(array: T[]): T | undefined;
// @param str, @return a random char in str
function choice(str: string): string;
}

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "reactive-dict.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Reactive dictionary",
version: '1.3.0'
version: '1.3.0-beta.1'
});
Package.onUse(function (api) {
@@ -9,6 +9,7 @@ Package.onUse(function (api) {
api.use(['mongo', 'reload'], { weak: true });
api.mainModule('migration.js');
api.export('ReactiveDict');
api.addAssets('reactive-dict.d.ts', 'server');
});
Package.onTest(function (api) {

View File

@@ -0,0 +1,94 @@
import { EJSONable } from 'meteor/ejson';
export declare class ReactiveDict<O = EJSONable> {
/**
* Constructor for a ReactiveDict, which represents a reactive dictionary of key/value pairs.
* @param name When a name is passed, preserves contents across Hot Code Pushes
* @param initialValue The default values for the dictionary
*/
constructor(name?: string, initialValue?: Partial<O>);
/**
* Set a value for a key if it hasn't been set before.
* Otherwise works exactly the same as `ReactiveDict.set`.
* @param key The key to set, eg, `selectedItem`
* @param value The new value for `key`
*/
setDefault<P extends keyof O>(key: P, value?: O[P]): void;
/**
* Set a value for a key if it hasn't been set before.
* Otherwise works exactly the same as `ReactiveDict.set`.
*/
setDefault(object: Partial<O>): void;
/**
* Set a value for a key in the ReactiveDict. Notify any listeners
* that the value has changed (eg: redraw templates, and rerun any
* `Tracker.autorun` computations, that called
* `ReactiveDict.get` on this `key`.)
* @param key The key to set, eg, `selectedItem`
* @param value The new value for `key`
*/
set<P extends keyof O>(key: P, value?: O[P]): void;
/**
* Set a value for a key in the ReactiveDict. Notify any listeners
* that the value has changed (eg: redraw templates, and rerun any
* `Tracker.autorun` computations, that called
* `ReactiveDict.get` on this `key`.)
*/
set(object: Partial<O>): void;
/**
* Get the value assiciated with a key. If inside a reactive
* computation, invalidate the computation the next time the
* value associated with this key is changed by `ReactiveDict.set`.
* This returns a clone of the value, so if it's an object or an array,
* mutating the returned value has no effect on the value stored in the
* ReactiveDict.
* @param key The key of the element to return
*/
get<P extends keyof O>(key: P): O[P] | undefined;
/**
* Test if the stored entry for a key is equal to a value. If inside a
* reactive computation, invalidate the computation the next
* time the variable changes to or from the value.
* @param key The name of the session variable to test
* @param value The value to
* test against
*/
equals<P extends keyof O>(
key: P,
value: string | number | boolean | undefined | null
): boolean;
/**
* Get all key-value pairs as a plain object. If inside a reactive
* computation, invalidate the computation the next time the
* value associated with any key is changed by `ReactiveDict.set`.
* This returns a clone of each value, so if it's an object or an array,
* mutating the returned value has no effect on the value stored in the
* ReactiveDict.
*/
all(): Partial<O>;
/**
* remove all key-value pairs from the ReactiveDict. Notify any
* listeners that the value has changed (eg: redraw templates, and rerun any
* `Tracker.autorun` computations, that called
* `ReactiveDict.get` on this `key`.)
*/
clear(): void;
/**
* remove a key-value pair from the ReactiveDict. Notify any listeners
* that the value has changed (eg: redraw templates, and rerun any
* `Tracker.autorun` computations, that called
* `ReactiveDict.get` on this `key`.)
* @param key The key to delete, eg, `selectedItem`
* @return did remove
*/
delete<P extends keyof O>(key: P): boolean;
/**
* Clear all values from the reactiveDict and prevent it from being
* migrated on a Hot Code Pushes. Notify any listeners
* that the value has changed (eg: redraw templates, and rerun any
* `Tracker.autorun` computations, that called
* `ReactiveDict.get` on this `key`.)
*/
destroy(): void;
}

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "reactive-var.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Reactive variable",
version: '1.0.11'
version: '1.0.12-beta.1'
});
Package.onUse(function (api) {
@@ -9,4 +9,5 @@ Package.onUse(function (api) {
api.use('tracker');
api.addFiles('reactive-var.js');
api.addAssets('reactive-var.d.ts', 'server');
});

25
packages/reactive-var/reactive-var.d.ts vendored Normal file
View File

@@ -0,0 +1,25 @@
export declare var ReactiveVar: ReactiveVarStatic;
export interface ReactiveVarStatic {
/**
* Constructor for a ReactiveVar, which represents a single reactive variable.
* @param initialValue The initial value to set. `equalsFunc` is ignored when setting the initial value.
* @param equalsFunc A function of two arguments, called on the old value and the new value whenever the ReactiveVar is set. If it returns true, no set is performed. If omitted, the default
* `equalsFunc` returns true if its arguments are `===` and are of type number, boolean, string, undefined, or null.
*/
new <T>(
initialValue: T,
equalsFunc?: (oldValue: T, newValue: T) => boolean
): ReactiveVar<T>;
}
export interface ReactiveVar<T> {
/**
* Returns the current value of the ReactiveVar, establishing a reactive dependency.
*/
get(): T;
/**
* Sets the current value of the ReactiveVar, invalidating the Computations that called `get` if `newValue` is different from the old value.
*/
set(newValue: T): void;
}

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "server-render.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
name: "server-render",
version: "0.4.0",
version: "0.4.0-beta.1",
summary: "Generic support for server-side rendering in Meteor apps",
documentation: "README.md"
});
@@ -17,6 +17,7 @@ Package.onUse(function(api) {
api.use("webapp");
api.mainModule("client.js", "client", { lazy: true });
api.mainModule("server.js", "server");
api.addAssets('server-render.d.ts', 'server');
});
Package.onTest(function(api) {

View File

@@ -0,0 +1,36 @@
import * as http from 'http';
// NodeJS.ReadableStream only works on server.
// HTMLElement only works on client.
export type Content = string | Content[] | NodeJS.ReadableStream | HTMLElement;
export interface ClientSink {
// Client and server. Only client
appendToHead(html: Content): void;
appendToBody(html: Content): void;
appendToElementById(id: string, html: Content): void;
renderIntoElementById(id: string, html: Content): void;
redirect(location: string, code?: number): void;
// Server-only, but error-raising stubs provided to client:
setStatusCode(code: number): void;
setHeader(key: string, value: number | string | string[]): void;
getHeaders(): http.IncomingHttpHeaders;
getCookies(): { [key: string]: string };
}
export interface ServerSink extends ClientSink {
// Server-only:
request: http.IncomingMessage;
arch: string;
head: string;
body: string;
htmlById: { [key: string]: string };
maybeMadeChanges: boolean;
}
export type Sink = ClientSink | ServerSink;
export type Callback = (sink: Sink) => Promise<any> | any;
export function onPageLoad<T extends Callback>(callback: T): T;

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "service-configuration.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: 'Manage the configuration for third-party services',
version: '1.3.0',
version: '1.3.0-beta.1',
});
Package.onUse(function(api) {
@@ -10,4 +10,5 @@ Package.onUse(function(api) {
api.export('ServiceConfiguration');
api.addFiles('service_configuration_common.js', ['client', 'server']);
api.addFiles('service_configuration_server.js', 'server');
api.addAssets('service-configuration.d.ts', 'server');
});

View File

@@ -0,0 +1,10 @@
import { Mongo } from 'meteor/mongo';
export interface Configuration {
appId: string;
secret: string;
}
export declare var ServiceConfiguration: {
configurations: Mongo.Collection<Configuration>;
};

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "session.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Session variable",
version: '1.2.0'
version: '1.2.1-beta.1'
});
Package.onUse(function (api) {
@@ -13,6 +13,7 @@ Package.onUse(function (api) {
api.export('Session', 'client');
api.mainModule('session.js', 'client');
api.addAssets('session.d.ts', 'server');
});
Package.onTest(function (api) {

41
packages/session/session.d.ts vendored Normal file
View File

@@ -0,0 +1,41 @@
import { EJSONable } from 'meteor/ejson';
export namespace Session {
/**
* Test if a session variable is equal to a value. If inside a
* reactive computation, invalidate the computation the next
* time the variable changes to or from the value.
* @param key The name of the session variable to test
* @param value The value to test against
*/
function equals(key: string, value: string | number | boolean | any): boolean;
/**
* Get the value of a session variable. If inside a reactive
* computation, invalidate the computation the next time the
* value of the variable is changed by `Session.set`. This
* returns a clone of the session value, so if it's an object or an array,
* mutating the returned value has no effect on the value stored in the
* session.
* @param key The name of the session variable to return
*/
function get(key: string): any;
/**
* Set a variable in the session. Notify any listeners that the value
* has changed (eg: redraw templates, and rerun any
* `Tracker.autorun` computations, that called
* `Session.get` on this `key`.)
* @param key The key to set, eg, `selectedItem`
* @param value The new value for `key`
*/
function set(key: string, value: EJSONable | any): void;
/**
* Set a variable in the session if it hasn't been set before.
* Otherwise works exactly the same as `Session.set`.
* @param key The key to set, eg, `selectedItem`
* @param value The new value for `key`
*/
function setDefault(key: string, value: EJSONable | any): void;
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Run tests interactively in the browser",
version: '1.3.1-beta.0',
version: '1.3.1-beta.1',
documentation: null
});

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "tracker.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Dependency tracker to allow reactive callbacks",
version: "1.2.0"
version: "1.2.1-beta.1"
});
Package.onUse(function (api) {
@@ -8,6 +8,7 @@ Package.onUse(function (api) {
api.addFiles("tracker.js");
api.export("Tracker");
api.export("Deps");
api.addAssets("tracker.d.ts", ["client", "server"]);
});
Package.onTest(function (api) {

128
packages/tracker/tracker.d.ts vendored Normal file
View File

@@ -0,0 +1,128 @@
/**
* The namespace for Tracker-related methods.
*/
export namespace Tracker {
function Computation(): void;
/**
* A Computation object represents code that is repeatedly rerun
* in response to
* reactive data changes. Computations don't have return values; they just
* perform actions, such as rerendering a template on the screen. Computations
* are created using Tracker.autorun. Use stop to prevent further rerunning of a
* computation.
*/
interface Computation {
/**
* True during the initial run of the computation at the time `Tracker.autorun` is called, and false on subsequent reruns and at other times.
*/
firstRun: boolean;
/**
* Invalidates this computation so that it will be rerun.
*/
invalidate(): void;
/**
* True if this computation has been invalidated (and not yet rerun), or if it has been stopped.
*/
invalidated: boolean;
/**
* Registers `callback` to run when this computation is next invalidated, or runs it immediately if the computation is already invalidated. The callback is run exactly once and not upon
* future invalidations unless `onInvalidate` is called again after the computation becomes valid again.
* @param callback Function to be called on invalidation. Receives one argument, the computation that was invalidated.
*/
onInvalidate(callback: Function): void;
/**
* Registers `callback` to run when this computation is stopped, or runs it immediately if the computation is already stopped. The callback is run after any `onInvalidate` callbacks.
* @param callback Function to be called on stop. Receives one argument, the computation that was stopped.
*/
onStop(callback: Function): void;
/**
* Prevents this computation from rerunning.
*/
stop(): void;
/**
* True if this computation has been stopped.
*/
stopped: boolean;
}
/**
* The current computation, or `null` if there isn't one. The current computation is the `Tracker.Computation` object created by the innermost active call to
* `Tracker.autorun`, and it's the computation that gains dependencies when reactive data sources are accessed.
*/
var currentComputation: Computation;
var Dependency: DependencyStatic;
/**
* A Dependency represents an atomic unit of reactive data that a
* computation might depend on. Reactive data sources such as Session or
* Minimongo internally create different Dependency objects for different
* pieces of data, each of which may be depended on by multiple computations.
* When the data changes, the computations are invalidated.
*/
interface DependencyStatic {
new (): Dependency;
}
interface Dependency {
/**
* Invalidate all dependent computations immediately and remove them as dependents.
*/
changed(): void;
/**
* Declares that the current computation (or `fromComputation` if given) depends on `dependency`. The computation will be invalidated the next time `dependency` changes.
* If there is no current computation and `depend()` is called with no arguments, it does nothing and returns false.
* Returns true if the computation is a new dependent of `dependency` rather than an existing one.
* @param fromComputation An optional computation declared to depend on `dependency` instead of the current computation.
*/
depend(fromComputation?: Computation): boolean;
/**
* True if this Dependency has one or more dependent Computations, which would be invalidated if this Dependency were to change.
*/
hasDependents(): boolean;
}
/**
* True if there is a current computation, meaning that dependencies on reactive data sources will be tracked and potentially cause the current computation to be rerun.
*/
var active: boolean;
/**
* Schedules a function to be called during the next flush, or later in the current flush if one is in progress, after all invalidated computations have been rerun. The function will be run
* once and not on subsequent flushes unless `afterFlush` is called again.
* @param callback A function to call at flush time.
*/
function afterFlush(callback: Function): void;
/**
* Run a function now and rerun it later whenever its dependencies
* change. Returns a Computation object that can be used to stop or observe the
* rerunning.
* @param runFunc The function to run. It receives one argument: the Computation object that will be returned.
*/
function autorun(
runFunc: (computation: Computation) => void,
options?: {
/**
* The function to run when an error
* happens in the Computation. The only argument it receives is the Error
* thrown. Defaults to the error being logged to the console.
*/
onError?: Function | undefined;
}
): Computation;
/**
* Process all reactive updates immediately and ensure that all invalidated computations are rerun.
*/
function flush(): void;
/**
* Run a function without tracking dependencies.
* @param func A function to call immediately.
*/
function nonreactive<T>(func: () => T): T;
/**
* Registers a new `onInvalidate` callback on the current computation (which must exist), to be called immediately when the current computation is invalidated or stopped.
* @param callback A callback function that will be invoked as `func(c)`, where `c` is the computation on which the callback is registered.
*/
function onInvalidate(callback: Function): void;
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Twitter OAuth flow",
version: '1.3.1-beta.0'
version: '1.3.1-beta.1'
});
Package.onUse(function(api) {

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "underscore.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Collection of small helpers: _.map, _.each, ...",
version: '1.0.10'
version: '1.0.11-beta.1'
});
Package.onUse(function (api) {
@@ -27,6 +27,8 @@ Package.onUse(function (api) {
// numeric length field whose constructor === Object are still treated as
// objects, not as arrays. Search for looksLikeArray.
api.addFiles(['pre.js', 'underscore.js', 'post.js']);
api.addAssets('underscore.d.ts', 'server');
});

2
packages/underscore/underscore.d.ts vendored Normal file
View File

@@ -0,0 +1,2 @@
import * as _ from 'underscore';
export { _ };

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: "Used internally by WebApp. Knows how to hash programs from manifests.",
version: '1.1.1-beta.0'
version: '1.1.1-beta.1'
});
Package.onUse(function(api) {

View File

@@ -0,0 +1,3 @@
{
"typesEntry": "webapp.d.ts"
}

View File

@@ -1,6 +1,6 @@
Package.describe({
summary: 'Serves a Meteor app over HTTP',
version: '1.13.1',
version: '1.13.1-beta.1',
});
Npm.depends({
@@ -57,6 +57,7 @@ Package.onUse(function(api) {
api.export('WebApp', 'client');
api.mainModule('webapp_cordova.js', 'web.cordova');
api.addAssets('webapp.d.ts', 'server');
});
Package.onTest(function(api) {

87
packages/webapp/webapp.d.ts vendored Normal file
View File

@@ -0,0 +1,87 @@
import * as http from 'http';
import * as connect from 'connect';
export interface StaticFiles {
[key: string]: {
content?: string | undefined;
absolutePath: string;
cacheable: boolean;
hash: string;
sourceMapUrl?: string | undefined;
type: string;
};
}
export declare module WebApp {
var defaultArch: string;
var clientPrograms: {
[key: string]: {
format: string;
manifest: any;
version: string;
cordovaCompatibilityVersions?: any;
PUBLIC_SETTINGS: any;
};
};
var connectHandlers: connect.Server;
var rawConnectHandlers: connect.Server;
var httpServer: http.Server;
var connectApp: connect.Server;
function suppressConnectErrors(): void;
function onListening(callback: Function): void;
type RuntimeConfigHookCallback = (options: {
arch: 'web.browser' | 'web.browser.legacy' | 'web.cordova';
request: http.IncomingMessage;
encodedCurrentConfig: string;
updated: boolean;
}) => string | undefined | null | false;
function addRuntimeConfigHook(callback: RuntimeConfigHookCallback): void;
function decodeRuntimeConfig(rtimeConfigString: string): unknown;
function encodeRuntimeConfig(rtimeConfig: unknown): string;
}
export declare module WebAppInternals {
var NpmModules: {
[key: string]: {
version: string;
module: any;
};
};
function identifyBrowser(
userAgentString: string
): {
name: string;
major: string;
minor: string;
patch: string;
};
function registerBoilerplateDataCallback(
key: string,
callback: Function
): Function;
function generateBoilerplateInstance(
arch: string,
manifest: any,
additionalOptions: any
): any;
function staticFilesMiddleware(
staticFiles: StaticFiles,
req: http.IncomingMessage,
res: http.ServerResponse,
next: Function
): void;
function parsePort(port: string): number;
function reloadClientPrograms(): void;
function generateBoilerplate(): void;
var staticFiles: StaticFiles;
function inlineScriptsAllowed(): boolean;
function setInlineScriptsAllowed(inlineScriptsAllowed: boolean): void;
function setBundledJsCssUrlRewriteHook(hookFn: (url: string) => string): void;
function setBundledJsCssPrefix(bundledJsCssPrefix: string): void;
function addStaticJs(): void;
function getBoilerplate(request: http.IncomingMessage, arch: string): string;
var additionalStaticJs: any;
}

View File

@@ -1,6 +1,6 @@
{
"track": "METEOR",
"version": "2.8.1-beta.0",
"version": "2.8.1-beta.1",
"recommended": false,
"official": false,
"description": "Meteor experimental release"

View File

@@ -7,6 +7,7 @@
const semver = require('semver');
const fs = require('fs');
const { exec } = require("child_process");
const { readdir } = require("fs/promises");
const runCommand = async (command) => {
return new Promise((resolve, reject) => {
@@ -45,12 +46,23 @@ async function getFile(path) {
}
const getDirectories = async source =>
(await readdir(source, { withFileTypes: true }))
.filter(dirent => dirent.isDirectory())
.map(dirent => dirent.name);
async function main() {
/**
* @type {string[]}
*/
let args = process.argv.slice(2);
if (args[0].startsWith('@all')) {
const [_, type] = args[0].split('.');
const allPackages = await getDirectories('../../../packages');
args = allPackages.map((packageName) => `${ packageName }.${ type }`);
}
if (args[0].startsWith('@auto')) {
const [_, type] = args[0].split('.');
// List of packages that for some reason are not in the diff.
@@ -60,6 +72,10 @@ async function main() {
// ddp-common
const p = await getPackages();
console.log('****************')
console.log('Will be updating the following packages:');
console.dir(p)
console.log('****************')
const packages = p.concat(`packages/meteor-tool.${ type }`);
args = packages
.split('/')
@@ -88,8 +104,13 @@ async function main() {
// version: '1.2.3' <--- this is the line we want, we assure that it has a version in the previous if
//});
const [_, versionValue] = line.split(':');
const currentVersion = versionValue.trim().replace(',', '');
const semverVersion = semver.coerce(currentVersion);
if (!versionValue) continue;
const currentVersion = versionValue
.trim()
.replace(',', '')
.replace(/'/g, '')
.replace(/"/g, '');
/**
*
@@ -98,14 +119,14 @@ async function main() {
*/
function incrementNewVersion(release) {
if (release.includes('beta') || release.includes('rc')) {
return semver.inc(semverVersion, 'prerelease', release);
return semver.inc(currentVersion, 'prerelease', release);
}
return semver.inc(semverVersion, release);
return semver.inc(currentVersion, release);
}
const newVersion = incrementNewVersion(release);
console.log(`Updating ${ name } from ${ currentVersion } to ${ newVersion }`);
const newCode = code.replace(currentVersion, "'" + newVersion + "'");
const newCode = code.replace(currentVersion, `${ newVersion }`);
await fs.promises.writeFile(filePath, newCode);
}
}

View File

@@ -57,8 +57,8 @@ standard-minifier-css@1.4.1
standard-minifier-js@2.3.2
static-html@1.2.2
templating-tools@1.1.2
tracker@1.2.0
underscore@1.0.10
tracker@1.2.1-beta.1
underscore@1.0.11-beta.1
url@1.2.0
webapp@1.5.0
webapp-hashing@1.0.9

View File

@@ -7,7 +7,7 @@ boilerplate-generator@1.6.0
caching-compiler@1.2.1
caching-html-compiler@1.1.3
callback-hook@1.1.0
check@1.3.1
check@1.3.2-beta.1
ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
@@ -47,8 +47,8 @@ standard-minifier-js@2.4.1
static-html@1.2.2
templating-tools@1.1.2
test-package@0.0.1
tracker@1.2.0
tracker@1.2.1-beta.1
typescript@3.5.2-beta182.17
underscore@1.0.10
underscore@1.0.11-beta.1
webapp@1.7.4
webapp-hashing@1.0.9

View File

@@ -7,7 +7,7 @@ boilerplate-generator@1.6.0
caching-compiler@1.2.1
caching-html-compiler@1.1.3
callback-hook@1.1.0
check@1.3.1
check@1.3.2-beta.1
ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
@@ -49,7 +49,7 @@ standard-minifier-css@1.5.3
standard-minifier-js@2.4.1
static-html@1.2.2
templating-tools@1.1.2
tracker@1.2.0
underscore@1.0.10
tracker@1.2.1-beta.1
underscore@1.0.11-beta.1
webapp@1.7.4
webapp-hashing@1.0.9

View File

@@ -7,7 +7,7 @@ boilerplate-generator@1.6.0
caching-compiler@1.2.1
caching-html-compiler@1.1.3
callback-hook@1.1.0
check@1.3.1
check@1.3.2-beta.1
ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
@@ -49,7 +49,7 @@ standard-minifier-css@1.5.3
standard-minifier-js@2.4.1
static-html@1.2.2
templating-tools@1.1.2
tracker@1.2.0
underscore@1.0.10
tracker@1.2.1-beta.1
underscore@1.0.11-beta.1
webapp@1.7.4
webapp-hashing@1.0.9

View File

@@ -7,7 +7,7 @@ boilerplate-generator@1.6.0
caching-compiler@1.2.1
caching-html-compiler@1.1.3
callback-hook@1.2.0
check@1.3.1
check@1.3.2-beta.1
custom-minifier@0.0.1
ddp@1.4.0
ddp-client@2.3.3
@@ -45,7 +45,7 @@ socket-stream-client@0.2.2
spacebars-compiler@1.1.3
static-html@1.2.2
templating-tools@1.1.2
tracker@1.2.0
underscore@1.0.10
tracker@1.2.1-beta.1
underscore@1.0.11-beta.1
webapp@1.7.5
webapp-hashing@1.0.9

View File

@@ -8,8 +8,8 @@ meteor-base@1.4.0 # Packages every Meteor app needs to have
mobile-experience@1.1.0 # Packages for a great mobile UX
mongo@1.9.0 # The database Meteor supports right now
blaze-html-templates@1.0.4 # Compile .html files into Meteor Blaze views
reactive-var@1.0.11 # Reactive variable for tracker
tracker@1.2.0 # Meteor's client-side reactive programming library
reactive-var@1.0.12-beta.1 # Reactive variable for tracker
tracker@1.2.1-beta.1 # Meteor's client-side reactive programming library
standard-minifier-css@1.6.0 # CSS minifier run for production mode
standard-minifier-js@2.6.0 # JS minifier run for production mode
@@ -23,6 +23,6 @@ dynamic-import@0.5.1
lazy-test-package
helper-package
user:colon-name
underscore@1.0.10
underscore@1.0.11-beta.1
fetch@0.1.1
jquery

View File

@@ -12,7 +12,7 @@ boilerplate-generator@1.7.0
caching-compiler@1.2.1
caching-html-compiler@1.1.3
callback-hook@1.3.0
check@1.3.1
check@1.3.2-beta.1
coffeescript@2.4.1
coffeescript-compiler@2.4.1
ddp@1.4.0
@@ -60,8 +60,8 @@ npm-mongo@3.7.0
observe-sequence@1.0.16
ordered-dict@1.1.0
promise@0.11.2
random@1.2.0
reactive-var@1.0.11
random@1.2.1-beta.1
reactive-var@1.0.12-beta.1
reload@1.3.0
retry@1.1.0
routepolicy@1.1.0
@@ -75,9 +75,9 @@ templating@1.3.2
templating-compiler@1.3.3
templating-runtime@1.3.2
templating-tools@1.1.2
tracker@1.2.0
tracker@1.2.1-beta.1
ui@1.0.13
underscore@1.0.10
underscore@1.0.11-beta.1
user:colon-name@0.0.1
webapp@1.9.0
webapp-hashing@1.0.9

View File

@@ -7,7 +7,7 @@
meteor-base@1.5.1 # Packages every Meteor app needs to have
mobile-experience@1.1.0 # Packages for a great mobile UX
mongo@1.13.0 # The database Meteor supports right now
reactive-var@1.0.11 # Reactive variable for tracker
reactive-var@1.0.12-beta.1 # Reactive variable for tracker
standard-minifier-css@1.7.4 # CSS minifier run for production mode
standard-minifier-js@2.7.0 # JS minifier run for production mode

View File

@@ -10,7 +10,7 @@ boilerplate-generator@1.7.1
caching-compiler@1.2.2
caching-html-compiler@1.2.1
callback-hook@1.4.0
check@1.3.1
check@1.3.2-beta.1
ddp@1.4.0
ddp-client@2.5.0
ddp-common@1.4.0
@@ -56,10 +56,10 @@ mongo-id@1.0.8
npm-mongo@3.9.1
ordered-dict@1.1.0
promise@0.12.0
random@1.2.0
random@1.2.1-beta.1
react-fast-refresh@0.1.1
react-meteor-data@2.3.3
reactive-var@1.0.11
reactive-var@1.0.12-beta.1
reload@1.3.1
retry@1.1.0
routepolicy@1.1.1
@@ -70,9 +70,9 @@ standard-minifier-css@1.7.4
standard-minifier-js@2.7.1
static-html@1.3.2
templating-tools@1.2.1
tracker@1.2.0
tracker@1.2.1-beta.1
typescript@4.3.5
underscore@1.0.10
underscore@1.0.11-beta.1
url@1.3.2
webapp@1.12.0
webapp-hashing@1.1.0

View File

@@ -33,7 +33,7 @@ standard-minifier-css@1.5.2
standard-minifier-js@2.4.0
static-html@1.2.2
templating-tools@1.1.2
tracker@1.2.0
underscore@1.0.10
tracker@1.2.1-beta.1
underscore@1.0.11-beta.1
webapp@1.7.3-beta181.16
webapp-hashing@1.0.9

View File

@@ -33,7 +33,7 @@ standard-minifier-css@1.4.1
standard-minifier-js@2.4.0-rc171.6
static-html@1.2.2
templating-tools@1.1.2
tracker@1.2.0
underscore@1.0.10
tracker@1.2.1-beta.1
underscore@1.0.11-beta.1
webapp@1.7.0-rc171.6
webapp-hashing@1.0.9

View File

@@ -33,7 +33,7 @@ standard-minifier-css@1.4.1
standard-minifier-js@2.4.0-rc171.6
static-html@1.2.2
templating-tools@1.1.2
tracker@1.2.0
underscore@1.0.10
tracker@1.2.1-beta.1
underscore@1.0.11-beta.1
webapp@1.7.0-rc171.6
webapp-hashing@1.0.9

View File

@@ -47,7 +47,7 @@ npm-mongo@2.2.30
ordered-dict@1.0.9
promise@0.9.0
random@1.0.10
reactive-var@1.0.11
reactive-var@1.0.12-beta.1
reload@1.1.11
retry@1.0.9
routepolicy@1.0.12
@@ -58,7 +58,7 @@ standard-minifier-js@2.1.1
static-html@1.2.2
templating-tools@1.1.2
tracker@1.1.3
underscore@1.0.10
underscore@1.0.11-beta.1
url@1.1.0
webapp@1.3.19
webapp-hashing@1.0.9

View File

@@ -8,9 +8,9 @@ meteor-base@1.4.0 # Packages every Meteor app needs to have
mobile-experience@1.1.0 # Packages for a great mobile UX
mongo@1.9.0 # The database Meteor supports right now
blaze-html-templates # Compile .html files into Meteor Blaze views
session@1.2.0 # Client-side reactive dictionary for your app
session@1.2.1-beta.1 # Client-side reactive dictionary for your app
jquery # Helpful client-side library
tracker@1.2.0 # Meteor's client-side reactive programming library
tracker@1.2.1-beta.1 # Meteor's client-side reactive programming library
es5-shim@4.8.0 # ECMAScript 5 compatibility for older browsers.
ecmascript@0.14.2 # Enable ECMAScript2015+ syntax in app code
@@ -23,7 +23,7 @@ client-only-ecmascript
modules-test-plugin
shell-server@0.5.0
dynamic-import@0.5.1
underscore@1.0.10
underscore@1.0.11-beta.1
import-local-json-module
akryum:vue-component
dummy-compiler

View File

@@ -6,7 +6,7 @@ base64@1.0.11
binary-heap@1.0.11
boilerplate-generator@1.6.0
callback-hook@1.1.0
check@1.3.1
check@1.3.2-beta.1
ddp@1.4.0
ddp-client@2.3.3
ddp-common@1.4.0
@@ -49,7 +49,7 @@ shell-server@0.4.0
socket-stream-client@0.2.2
standard-minifier-css@1.5.2
standard-minifier-js@2.4.0
tracker@1.2.0
underscore@1.0.10
tracker@1.2.1-beta.1
underscore@1.0.11-beta.1
webapp@1.7.2
webapp-hashing@1.0.9

View File

@@ -47,7 +47,7 @@ npm-mongo@2.2.33
ordered-dict@1.0.9
promise@0.10.0
random@1.0.10
reactive-var@1.0.11
reactive-var@1.0.12-beta.1
reload@1.1.11
retry@1.0.9
routepolicy@1.0.12
@@ -58,7 +58,7 @@ standard-minifier-js@2.2.1
static-html@1.2.2
templating-tools@1.1.2
tracker@1.1.3
underscore@1.0.10
underscore@1.0.11-beta.1
url@1.1.0
webapp@1.4.0
webapp-hashing@1.0.9